Koha-clms/pos
Martin Renvoize 2025731e52
Bug 38728: (follow-up) Fix cashup modal triggering after POST/REDIRECT/GET implementation
The upstream implementation of POST/REDIRECT/GET pattern for cashup operations
introduced a regression where the cashup modal would no longer auto-trigger
after successful cashup submission. The original approach passed cashup_id as
a query parameter in the redirect, but the template variable was not being
populated from the URL parameter, causing the JavaScript to receive an empty
value.

This follow-up implements a more modern and reliable solution using URL hash
fragments instead of query parameters:

1. Changed redirect URLs to use hash fragments (e.g., #cashup-123)
2. Updated JavaScript to detect and parse hash fragments on page load
3. Auto-triggers the cashup modal when hash is present
4. Cleans up the URL using history.replaceState() after modal opens

Benefits:
- Maintains proper POST/REDIRECT/GET pattern
- Hash fragments don't trigger server requests or require server-side handling
- More reliable than template variable approach
- Follows modern web development patterns
- Works consistently across both register.pl and registers.pl pages

Test plan:
1. Navigate to POS register page (pos/register.pl)
2. Perform a cashup operation
3. Verify the cashup summary modal automatically appears after redirect
4. Verify the URL is clean (no hash fragment visible)
5. Repeat for registers summary page (pos/registers.pl)
6. Perform individual register cashup
7. Verify modal auto-triggers correctly

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-01-22 09:25:59 -07:00
..
pay.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
printreceipt.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
register.pl Bug 38728: (follow-up) Fix cashup modal triggering after POST/REDIRECT/GET implementation 2026-01-22 09:25:59 -07:00
registers.pl Bug 38728: (follow-up) Fix cashup modal triggering after POST/REDIRECT/GET implementation 2026-01-22 09:25:59 -07:00