Bug 40753 - DT's SaveState not working on the orders table
Summary: DT's SaveState not working on the orders table
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 33484
Blocks:
  Show dependency treegraph
 
Reported: 2025-09-04 10:49 UTC by Jonathan Druart
Modified: 2025-09-05 21:20 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the basket order table so that when you close (or reopen) a basket, the columns shown remain the same as the table configuration. Before this fix, if you closed a basket and then reopened it, the table settings columns hidden by default were ignored and all the possible columns were shown.
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 40753: Fix DT's SaveState on the orders table (11.14 KB, patch)
2025-09-04 10:58 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40753: Fix DT's SaveState on the orders table (11.18 KB, patch)
2025-09-04 23:02 UTC, David Nind
Details | Diff | Splinter Review
Bug 40753: Fix DT's SaveState on the orders table (11.24 KB, patch)
2025-09-05 16:17 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-09-04 10:49:20 UTC

    
Comment 1 Jonathan Druart 2025-09-04 10:58:44 UTC
Created attachment 186140 [details] [review]
Bug 40753: Fix DT's SaveState on the orders table

We build the the orders table depending on some conditions (sysprefs or if the
basket is closed/opened).
DataTables cannot correctly restore the state because the number of columns
stored in localStorage is different than the one we have one the table.

Test plan:
Open and close a basket
Confirm that the table is correctly displayed (no extra columns)
Comment 2 Jonathan Druart 2025-09-04 11:00:51 UTC
Initially reported on bug 39930 comment 1
Comment 3 David Nind 2025-09-04 23:02:50 UTC
Created attachment 186184 [details] [review]
Bug 40753: Fix DT's SaveState on the orders table

We build the the orders table depending on some conditions (sysprefs or if the
basket is closed/opened).
DataTables cannot correctly restore the state because the number of columns
stored in localStorage is different than the one we have one the table.

Test plan:
Open and close a basket
Confirm that the table is correctly displayed (no extra columns)

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-09-04 23:15:10 UTC
Testing notes (using KTD):

1. Add an item to a basket:
   1.1 Go to Acquisitions > Search vendors > Search
   1.2 Click My Vendor in the results (name column)
   1.3 Under the 'Baskets' column, click the link
   1.4 Select 'My Basket'
   1.5 Add an item to the basket
2. Note that these columns are displayed (these should match the columns displayed by default for the table configuration):
   . No.
   . Order
   . RRP tax exc.
   . Actual cost tax exc.
   . Budgeted cost tax exc.
   . Budgeted cost tax inc.
   . Replacement price
   . Qty.
   . Total tax exc. (USD)
   . GST %
   . GST
   . Fund
   . Estimated delivery date
   . Invoice
   . Place hold
3. Close the basket (Result = you go back to the list of baskets for the vendor).
4. Click the basket you just closed.
5. The table now shows all columns, including those hidden by default in the table configuration.
6. Apply the patch.
7. Reset everything (reset_all).
8. Repeat steps 1-4.
9. The columns now shown should be the same (and should reflect the default columns configured, and not show the hidden by default columns).

Note: When saving changes to the table configuration, unless you untick 'Save configuration state on page change' and tick 'Save search state on page change', the changes are only shown after you log out and log back in again.

Before the patch, the columns hidden by default in the table configuration were incorrectly shown when the basket was closed.
Comment 5 Nick Clemens (kidclamp) 2025-09-05 16:17:38 UTC
Created attachment 186239 [details] [review]
Bug 40753: Fix DT's SaveState on the orders table

We build the the orders table depending on some conditions (sysprefs or if the
basket is closed/opened).
DataTables cannot correctly restore the state because the number of columns
stored in localStorage is different than the one we have one the table.

Test plan:
Open and close a basket
Confirm that the table is correctly displayed (no extra columns)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Lucas Gass (lukeg) 2025-09-05 21:20:00 UTC
Nice work everyone!

Pushed to main for 25.11