Bug 41071

Summary: Registers not correctly populated / selected when changing branches
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Staff interfaceAssignee: Nick Clemens (kidclamp) <nick>
Status: Pushed to main --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: trivial    
Priority: P5 - low CC: gmcharlt, jonathan.druart, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Crowdfunding goal: 0
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Bug Depends on: 38664    
Bug Blocks:    
Attachments: Bug 41071: Fix missing space in cash register classes
Bug 41071: Fix missing space in cash register classes
Bug 41071: Fix missing space in cash register classes

Description Nick Clemens (kidclamp) 2025-10-22 13:46:54 UTC
To recreate:
1 - Enable UseCashRegisters system preference
2 - Create three registers for three different branches
3 - Make each register the default
4 - Click on username in top right
5 - Select 'Set library and cash register'
6 - Choose on of the three branches
7 - Note the dropdown does not populate with the default
8 - Note no registers can be selected
Comment 1 Nick Clemens (kidclamp) 2025-10-22 13:51:20 UTC
Created attachment 188296 [details] [review]
Bug 41071: Fix missing space in cash register classes

It seems we dropped a space somewhere so the class for default registers had become:
   "{Branchcode}default" instead of "{Branchcode} default"
This broke the JS for selecting

To test:
1 - Enable UseCashRegisters system preference
2 - Create three registers for three different branches
3 - Make each register the default
4 - Click on username in top right
5 - Select 'Set library and cash register'
6 - Choose on of the three branches
7 - Note the dropdown does not populate with the default
8 - Note no registers can be selected
9 - Apply patch
10 - Reload the page
11 - Change libraries and verify all works as expected

Current status: Needs Signoff
Comment 2 Nick Clemens (kidclamp) 2025-10-22 13:52:42 UTC
This is tricky - tidy removes the spaces, I had to commit the patch with --no-verify
Comment 3 Nick Clemens (kidclamp) 2025-10-22 13:54:52 UTC
Created attachment 188297 [details] [review]
Bug 41071: Fix missing space in cash register classes

It seems we dropped a space somewhere so the class for default registers had become:
   "{Branchcode}default" instead of "{Branchcode} default"
This broke the JS for selecting

To test:
1 - Enable UseCashRegisters system preference
2 - Create three registers for three different branches
3 - Make each register the default
4 - Click on username in top right
5 - Select 'Set library and cash register'
6 - Choose on of the three branches
7 - Note the dropdown does not populate with the default
8 - Note no registers can be selected
9 - Apply patch
10 - Reload the page
11 - Change libraries and verify all works as expected
Comment 4 Nick Clemens (kidclamp) 2025-10-22 13:55:27 UTC
I changed to adding the space in TT, it's kind of ugly, but maybe better? Moving to QA as trivial and to get attention
Comment 5 Jonathan Druart 2025-10-23 08:47:47 UTC
(In reply to Nick Clemens (kidclamp) from comment #4)
> I changed to adding the space in TT, it's kind of ugly, but maybe better?
> Moving to QA as trivial and to get attention

This is the correct way to force a space now.
Comment 6 Jonathan Druart 2025-10-23 08:49:33 UTC
There is one thing: if you go to the form and there is a default, it's not selected automatically. I guess it is not regression from bug 38664 and it was an existing bug.
Comment 7 Jonathan Druart 2025-10-23 08:49:51 UTC
Created attachment 188308 [details] [review]
Bug 41071: Fix missing space in cash register classes

It seems we dropped a space somewhere so the class for default registers had become:
   "{Branchcode}default" instead of "{Branchcode} default"
This broke the JS for selecting

To test:
1 - Enable UseCashRegisters system preference
2 - Create three registers for three different branches
3 - Make each register the default
4 - Click on username in top right
5 - Select 'Set library and cash register'
6 - Choose on of the three branches
7 - Note the dropdown does not populate with the default
8 - Note no registers can be selected
9 - Apply patch
10 - Reload the page
11 - Change libraries and verify all works as expected

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Lucas Gass (lukeg) 2025-10-24 13:59:15 UTC
Nice work everyone!

Pushed to main for 25.11