Fix: preserve order of invoices in bulk print

This commit is contained in:
Maikel Linke
2024-04-10 14:51:55 +10:00
parent 1d8b942acd
commit 16c877f7cb
2 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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)