Bug 41360

Summary: Transport cost matrix assumes all transfers are disabled upon first use
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: System AdministrationAssignee: Kyle M Hall (khall) <kyle>
Status: Pushed to main --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: david, gmcharlt, kyle, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This adds three new toolbar buttons to make batch modifications to the transport cost matrix table easier (when UseTransportCostMatrix is enabeld): * Enable all cells * Disable empty cells * Populate empty cells, with selectable values from 0 to 100
Version(s) released in:
26.05.00
Circulation function:
Attachments: Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix
Post-patch editor
Pre-patch editor
Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix
Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix

Description Nick Clemens (kidclamp) 2025-12-02 20:11:17 UTC
On a system not using transport cost matrix enable the preference 
UseTransportCostMatrix

(if your test system has a matrix setup, back it up then DELETE FROM transport_cost;)

 and then go to Administration->Transport Cost Matrix

(almost) All squares are red
Click on one, enable and enter a cost
Save

In the DB:
SELECT * FROM transport_cost;

Note that all transfers are now forbidden.

It should be possible to set the matrix without defaulting to no transfers allowed
Comment 1 Kyle M Hall (khall) 2025-12-03 15:55:31 UTC
Created attachment 190121 [details] [review]
Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix

We can add a toolbar of buttons to
A) batch enable all cells
B) batch populate empty cells with a value
C) batch disable empty cells

Test plan:
1) Apply this patch
2) Visit the TCM editor
3) Try out the 3 new buttons, verify they behave correctly
Comment 2 David Nind 2025-12-03 23:05:53 UTC
I've not used the transport cost matrix before, so am reluctant to sign off - it appears to work as expected: the new actions work, I can add values, and can also edit individually.

One thing I noted is that there is the text above the table saying "Red cells signify no transfer allowed.", which is still correct. 

However, the transfer for the same library (for example, Centerville to Centerville) is either white or grey, where previously it was red.
Comment 3 David Nind 2025-12-03 23:09:39 UTC
Testing notes (using KTD):

1. Enable the UseTransportCostMatrix system preference.

2. Go to Administration > Patrons and circulation > Transport cost matrix.
Comment 4 Kyle M Hall (khall) 2025-12-05 12:16:55 UTC
Created attachment 190204 [details]
Post-patch editor
Comment 5 Kyle M Hall (khall) 2025-12-05 12:17:30 UTC
Created attachment 190205 [details]
Pre-patch editor
Comment 6 Kyle M Hall (khall) 2025-12-05 12:18:12 UTC
(In reply to David Nind from comment #2)
> I've not used the transport cost matrix before, so am reluctant to sign off
> - it appears to work as expected: the new actions work, I can add values,
> and can also edit individually.
> 
> One thing I noted is that there is the text above the table saying "Red
> cells signify no transfer allowed.", which is still correct. 
> 
> However, the transfer for the same library (for example, Centerville to
> Centerville) is either white or grey, where previously it was red.

I'm not sure I'm seeing what you are seeing. Can you have a look at the two screenshots I've added and let me know if I'm looking in the wrong place?

Thanks!
Comment 7 David Nind 2025-12-05 22:58:07 UTC
Created attachment 190259 [details] [review]
Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix

We can add a toolbar of buttons to
A) batch enable all cells
B) batch populate empty cells with a value
C) batch disable empty cells

Test plan:
1) Apply this patch
2) Visit the TCM editor
3) Try out the 3 new buttons, verify they behave correctly

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-12-05 22:59:30 UTC
(In reply to Kyle M Hall (khall) from comment #6)
> (In reply to David Nind from comment #2)
> > I've not used the transport cost matrix before, so am reluctant to sign off
> > - it appears to work as expected: the new actions work, I can add values,
> > and can also edit individually.
> > 
> > One thing I noted is that there is the text above the table saying "Red
> > cells signify no transfer allowed.", which is still correct. 
> > 
> > However, the transfer for the same library (for example, Centerville to
> > Centerville) is either white or grey, where previously it was red.
> 
> I'm not sure I'm seeing what you are seeing. Can you have a look at the two
> screenshots I've added and let me know if I'm looking in the wrong place?
> 
> Thanks!

I'm not sure now what I was thinking/seeing - I don't see it now, so must have been imaging it! Apologies for creating extra work 8-(...
Comment 9 Marcel de Rooy 2026-02-20 10:30:37 UTC
Created attachment 193514 [details] [review]
Bug 41360: Add toolbar of buttons for batch modifications to transport cost matrix

We can add a toolbar of buttons to
A) batch enable all cells
B) batch populate empty cells with a value
C) batch disable empty cells

Test plan:
1) Apply this patch
2) Visit the TCM editor
3) Try out the 3 new buttons, verify they behave correctly

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 10 Lucas Gass (lukeg) 2026-02-26 16:06:43 UTC
Nice work everyone!

Pushed to main for 26.05