https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40445
--- Comment #120 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 193133 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193133&action=edit Bug 40445: Refactor cashup modals to eliminate duplication This patch refactors the cashup modal implementation across register.tt and registers.tt pages to eliminate significant code duplication by following Koha's conventions for shared modal templates and JavaScript. Changes: 1. Created shared modal templates: - includes/modals/trigger_cashup.inc: Shared trigger cashup modal - includes/modals/confirm_cashup.inc: Shared confirm cashup modal with reconciliation support 2. Created shared JavaScript module: - js/modals/cashup_modals.js: Initialization functions for both modals with configuration-driven behavior 3. Updated backend scripts: - pos/register.pl: Added redirect_to parameter support for flexible redirects, fixed regex to accept negative cashup amounts - pos/registers.pl: Added authorized value and system preference parameters for consistent functionality 4. Updated template files: - pos/register.tt: Replaced inline modals and JavaScript with shared includes (~165 lines removed) - pos/registers.tt: Replaced inline modals and JavaScript with shared includes (~150 lines removed) Benefits: - Eliminates ~355 lines of duplicated code - Single source of truth for cashup modal logic - Consistent functionality across both pages - Flexible redirect behavior (stay on registers page or go to individual register page) - Proper support for negative cashup amounts (float deficits) - Follows established Koha patterns for shared modals Test plan: 1. Apply patch and run: yarn build 2. Test cashup workflows on register.tt: - Start cashup and complete with reconciliation - Quick cashup - Test with positive and negative amounts 3. Test cashup workflows on registers.tt: - Individual register cashup (should redirect back to registers) - Verify authorized value dropdown appears if configured - Test required note validation if enabled 4. Verify reconciliation calculations work correctly 5. Test cross-page workflow: start cashup in registers.tt, complete in register.tt Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: Jackie Usher <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
