mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix: preserve order of invoices in bulk print
This commit is contained in:
@@ -44,8 +44,13 @@ module Admin
|
||||
html: render(partial: "spree/admin/orders/bulk/invoice_modal")
|
||||
).broadcast
|
||||
|
||||
# Preserve order of bulk_ids.
|
||||
# The ids are supplied in the sequence of the orders screen and may be
|
||||
# sorted, for example by last name of the customer.
|
||||
visible_order_ids = params[:bulk_ids].map(&:to_i) & visible_orders.pluck(:id)
|
||||
|
||||
BulkInvoiceJob.perform_later(
|
||||
visible_orders.pluck(:id),
|
||||
visible_order_ids,
|
||||
"tmp/invoices/#{Time.zone.now.to_i}-#{SecureRandom.hex(2)}.pdf",
|
||||
channel: SessionChannel.for_request(request),
|
||||
current_user_id: current_user.id
|
||||
|
||||
@@ -710,7 +710,6 @@ describe '
|
||||
order4.name.gsub(/.* /, ""), order5.name.gsub(/.* /, "")].sort
|
||||
}
|
||||
before do
|
||||
pending("#12340")
|
||||
page.find('a', text: "NAME").click # orders alphabetically (asc)
|
||||
sleep(0.5) # waits for column sorting
|
||||
page.find('#selectAll').click
|
||||
@@ -723,7 +722,6 @@ describe '
|
||||
order4.name.gsub(/.* /, ""), order5.name.gsub(/.* /, "")].sort.reverse
|
||||
}
|
||||
before do
|
||||
pending("#12340")
|
||||
page.find('a', text: "NAME").click # orders alphabetically (asc)
|
||||
sleep(0.5) # waits for column sorting
|
||||
page.find('a', text: "NAME").click # orders alphabetically (desc)
|
||||
|
||||
Reference in New Issue
Block a user