Bug 40753 - DT's SaveState not working on the orders table
Summary: DT's SaveState not working on the orders table
Status: Needs documenting
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:
: 39933 (view as bug list)
Depends on: 33484
Blocks: 40982
  Show dependency treegraph
 
Reported: 2025-09-04 10:49 UTC by Jonathan Druart
Modified: 2025-10-17 13:35 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Crowdfunding goal: 0
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,25.05.04
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
Comment 7 Paul Derscheid 2025-09-20 08:59:44 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 8 Jonathan Druart 2025-10-09 14:31:06 UTC
*** Bug 39933 has been marked as a duplicate of this bug. ***
Comment 9 Fridolin Somers 2025-10-16 05:52:04 UTC
Does not apply easy on 24.11.x which uses : KohaTable("orders",

Could you create a patch for 24.11.x ?
Comment 10 Jonathan Druart 2025-10-16 07:22:43 UTC
(In reply to Fridolin Somers from comment #9)
> Does not apply easy on 24.11.x which uses : KohaTable("orders",
> 
> Could you create a patch for 24.11.x ?

No possible without the other changes related to kohaTable (bug 26553 and friends).
Comment 11 Fridolin Somers 2025-10-17 13:35:39 UTC
OK thanks.

Not backported to 24.11.x