Bug 41229 - Cash registers are not fully reset on library change
Summary: Cash registers are not fully reset on library change
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 40445
  Show dependency treegraph
 
Reported: 2025-11-10 13:43 UTC by Martin Renvoize (ashimema)
Modified: 2025-11-10 14:16 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41229: Fix desk and register session persistence on library change (4.39 KB, patch)
2025-11-10 13:44 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2025-11-10 13:43:19 UTC
When changing library in circ/set-library.pl, desk and register values are not being properly cleared from the session. This caused stale desk/register data from the previous library to persist, resulting in:
    - Incorrect cashup displays showing wrong library's register
    - Point of Sale defaulting to registers from different libraries
    - Session state inconsistent with visual UI
Comment 1 Martin Renvoize (ashimema) 2025-11-10 13:44:42 UTC
Created attachment 189409 [details] [review]
Bug 41229: Fix desk and register session persistence on library change

When changing library in circ/set-library.pl, desk and register values
were not being properly cleared from the session. This caused stale
desk/register data from the previous library to persist, resulting in:
- Incorrect cashup displays showing wrong library's register
- POS defaulting to registers from different libraries
- Session state inconsistent with visual UI

Three issues fixed:
1. Template: Changed register "None" option ID from "set-library-noregister"
   to "noregister" to match JavaScript expectations (consistent with desk handling)
2. Desk logic: Changed condition to use defined() and explicitly clear session
   when "No desk" is selected
3. Register logic: Added session clearing when "No register" is selected and
   fixed condition to handle empty initial state

Test plan:
1. Select Library A with Register 5
2. Change to Library B without selecting a register
3. Verify register is cleared from session (check POS page)
4. Repeat for desk selection
5. Verify explicit "-- None --" selection clears session values