From 6d0ae35c80d63b858f692a14d10f184a8a48071c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sun, 11 Jan 2026 17:46:57 +0000 Subject: [PATCH] Bug 41592: Refactor patron account page to use shared refund modal This patch refactors the patron account page (boraccount.tt) to use the new shared refund modal component created in the previous commit, removing duplicate code and providing a consistent refund experience across both the Point of Sale and patron account pages. Changes: - Replace inline refund modal with shared refund_modal.inc component - Update modal population JavaScript to work with new modal structure: * Parse amount and amountoutstanding as floats for proper formatting * Populate transaction details fields (description, original charge, amount paid) * Hide payment method and original register rows (not applicable in this context) * Update form field IDs to match new modal structure - Fix focus to use #refund_amount instead of deprecated #returned field - Update cash register validation to use #refund_registerid_select - Add html_helpers.inc for proper formatting support The shared modal intelligently adapts to different contexts, showing only relevant information based on available data. For patron account refunds, payment method and original register information are hidden since debits can be paid by multiple credits with different payment methods. Test plan: 1. Apply patch and rebuild: yarn build 2. Navigate to a patron's account page with paid charges 3. Click "Issue refund" on a debit that has been partially or fully paid 4. Verify refund modal displays: - Transaction description (properly formatted) - Original charge amount (properly formatted with currency) - Amount paid (properly formatted) - No payment method row (hidden in this context) - No original register row (hidden in this context) 5. Enter a refund amount and complete the refund 6. Verify the refund is processed successfully 7. Verify cash register validation works when UseCashRegisters is enabled --- .../prog/en/modules/members/boraccount.tt | 104 ++---------------- members/boraccount.pl | 2 +- 2 files changed, 10 insertions(+), 96 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index f185f68adad..b5e05496091 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -8,6 +8,7 @@ [% USE Price %] [% USE Registers %] [% PROCESS 'i18n.inc' %] +[% PROCESS 'html_helpers.inc' %] [% SET footerjs = 1 %] [% SET registers = Registers.all( filters => { current_branch => 1 } ) %] @@ -239,6 +240,7 @@ data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price on_editing => 1 %]" data-amountoutstanding="[% account.amountoutstanding | $Price on_editing => 1 %]" + data-payment-type="[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', account.credits.single.payment_type ) | html %]" data-member="[% account.borrowernumber | html %]" > Issue refund @@ -345,66 +347,7 @@ - - - +[% INCLUDE 'modals/refund_modal.inc' refund_form_action = '/cgi-bin/koha/members/boraccount.pl' patron = patron registers = registers %]