Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Invoices] Bulk printing of invoices not reflecting sort applied in Orders screen #12340

Closed
BethanOFN opened this issue Apr 4, 2024 · 1 comment · Fixed by #12357
Closed
Assignees
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.

Comments

@BethanOFN
Copy link

Description

A user contacted support as they use the Bulk Actions - Print Invoices tool as packing slips for their orders. Since Tuesday 4th April, the user noticed an issue with the generated PDF where sorting applied to Orders was not being reflected in the PDF file. The user usually sorts the Orders page by name alphabetically, then clicks Print Invoices, and the generated PDF is also sorted alphabetically. Since Tuesday, the generated PDF is sorted differently (see Possible Fix below). The user is a hub which had 88 orders over 130 pages in their latest order cycle, so sorting the printed PDF manually is not practical.

Expected Behavior

Generated PDFs should reflect sorting applied on the Orders screen, in the same way that filters (e.g. order cycle/name) are reflected in the generated PDF.

Actual Behaviour

Generated PDF is sorted in one way, irrespective of sorting applied on Orders screen. Sorting by date or name does not change the generated PDF.

Steps to Reproduce

  1. User selects enterprise (ID: 202005), order cycle (id: 215923) sorts the Orders screen by clicking a column heading e.g. name column
Screenshot 2024-04-04 at 15 58 22 2. User sets view to '100 per page' to include all orders in outputted PDF. 3. User clicks 'select all' checkbox, then bulk actions, print invoices. 4. Generated PDF is sorted by name alphabetically.

Animated Gif/Screenshot

First order in list when sorted alphabetically:
Screenshot 2024-04-04 at 15 58 22

First order in generated PDF:
Screenshot 2024-04-04 at 16 20 53

Workaround

I've tried adding dummy company name/legal address into enterprise settings, which didn't work.
I've also tested with other enterprises and seen the same issue, as well as using the date range filter vs. the order cycle filter.
I've also tested on new admin and seen the same issue.
Same issue when viewing 15 per page.

Severity

bug-s2: a non-critical feature is broken, no workaround

Your Environment

  • Version used:
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

The sorting of orders in the PDF appears to be via the id field within spree_orders. Running this query on UK prod:
select * from spree_orders where distributor_id=202005 and order_cycle_id=215923 and state='complete' order by id asc
Returns the orders in the same order they appear in the PDF.
PDF:
Screenshot 2024-04-04 at 16 20 53
SQL query:
Screenshot 2024-04-04 at 16 48 49

@RachL RachL added the bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround. label Apr 5, 2024
filipefurtad0 added a commit to filipefurtad0/openfoodnetwork that referenced this issue Apr 5, 2024
mkllnk added a commit that referenced this issue Apr 9, 2024
@mkllnk mkllnk self-assigned this Apr 9, 2024
@mkllnk
Copy link
Member

mkllnk commented Apr 9, 2024

I used Filipe's automated spec and did a git bisect. I found 6e9089a breaking this feature. That was in release https://github.com/openfoodfoundation/openfoodnetwork/releases/tag/v4.4.35 deployed two weeks ago, 25 March 2024.

@mkllnk mkllnk assigned mkllnk and unassigned mkllnk Apr 9, 2024
sergioosouzaa pushed a commit to sergioosouzaa/openfoodnetwork that referenced this issue Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s2 The bug is affecting any of the non-critical features described in S1 and there is no workaround.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants