Bugzilla – Attachment 191255 Details for
Bug 41592
Add an enhanced workflow for refunds against anonymous transactions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41592: Refactor register page to use shared refund modal
5cd6181.patch (text/plain), 9.84 KB, created by
Martin Renvoize (ashimema)
on 2026-01-12 13:13:49 UTC
(
hide
)
Description:
Bug 41592: Refactor register page to use shared refund modal
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-01-12 13:13:49 UTC
Size:
9.84 KB
patch
obsolete
>From 5cd61816aebb350862563af7e8cb37225af74473 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 12 Jan 2026 12:18:33 +0000 >Subject: [PATCH] Bug 41592: Refactor register page to use shared refund modal > >This patch refactors the register report page (register.tt) to use the >new shared refund modal component created in previous commits, removing >duplicate code and providing a consistent refund experience across both >the Point of Sale and register 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 register page with some paid charges >3. Click "Issue refund" on a debit that has been paid >4. Verify refund modal displays: > - Transaction description (properly formatted) > - Original charge amount (properly formatted with currency) > - Amount paid (properly formatted) > - No original register row (hidden in this context) >5. Enter a refund amount and complete the refund >6. Verify the refund is processed successfully >--- > .../prog/en/modules/pos/register.tt | 71 +++---------------- > 1 file changed, 10 insertions(+), 61 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >index 2f459442ef0..95207c8831a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -4,6 +4,8 @@ > [% USE KohaDates %] > [% USE AuthorisedValues %] > [% USE Price %] >+[% USE Registers %] >+[% SET registers = Registers.all( filters => { current_branch => 1 } ) %] > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] > [% PROCESS 'accounts.inc' %] >@@ -150,6 +152,7 @@ > data-accountline="[% credit.debit.accountlines_id | html %]" > data-amount="[% credit.debit.amount | $Price %]" > data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" >+ data-payment-type="[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %]" > data-member="[% credit.debit.borrowernumber | html %]" > ><i class="fa-solid fa-money-bill-1"></i> Issue refund</button > > >@@ -163,6 +166,7 @@ > data-accountline="[% credit.debit.accountlines_id | html %]" > data-amount="[% credit.debit.amount | $Price %]" > data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" >+ data-payment-type="[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %]" > data-member="[% credit.debit.borrowernumber | html %]" > ><i class="fa-solid fa-money-bill-1"></i> Issue refund</button > > >@@ -285,6 +289,7 @@ > data-accountline="[% credit.debit.accountlines_id | html %]" > data-amount="[% credit.debit.amount | $Price %]" > data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" >+ data-payment-type="[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %]" > data-member="[% credit.debit.borrowernumber | html %]" > ><i class="fa-solid fa-money-bill-1"></i> Issue refund</button > > >@@ -298,6 +303,7 @@ > data-accountline="[% credit.debit.accountlines_id | html %]" > data-amount="[% credit.debit.amount | $Price %]" > data-amountoutstanding="[% credit.debit.amountoutstanding | $Price %]" >+ data-payment-type="[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', accountline.payment_type ) | html %]" > data-member="[% credit.debit.borrowernumber | html %]" > ><i class="fa-solid fa-money-bill-1"></i> Issue refund</button > > >@@ -397,48 +403,7 @@ > </div> > <!-- /#confirmCashupModal --> > >-<!-- Issue refund modal --> >-<div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel"> >- <form id="refund_form" method="post" enctype="multipart/form-data" class="validated"> >- [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="accountline_id" value="" id="refundline" /> >- <div class="modal-dialog"> >- <div class="modal-content"> >- <div class="modal-header"> >- <h1 class="modal-title" id="issueRefundLabel">Issue refund from <em>[% register.description | html %]</em></h1> >- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> >- </div> >- <div class="modal-body"> >- <fieldset class="rows"> >- <ol> >- <li> <span id="item" class="label">Item: </span><span></span> </li> >- <li> <span id="paid" class="label">Amount paid: </span><span></span> </li> >- <li> >- <label class="required" for="amount">Returned to patron: </label> >- <input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" id="returned" name="amount" required="required" /> >- <span class="required">Required</span> >- </li> >- [% INCLUDE 'transaction_types.inc' type="refund" %] >- </ol> >- </fieldset> >- <!-- /.rows --> >- </div> >- <!-- /.modal-body --> >- <div class="modal-footer"> >- <input type="hidden" name="registerid" value="[% register.id | html %]" /> >- <input type="hidden" name="op" value="cud-refund" /> >- <button type="submit" class="btn btn-default" id="pos_refund_confirm">Confirm</button> >- <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button> >- </div> >- <!-- /.modal-footer --> >- </div> >- <!-- /.modal-content --> >- </div> >- <!-- /.modal-dialog --> >- </form> >- <!-- /#refund_form --> >-</div> >-<!-- /#issueRefundModal --> >+[% INCLUDE 'modals/refund_modal.inc' refund_form_action = '/cgi-bin/koha/pos/register.pl' register_id = register.id registers = registers %] > > [% INCLUDE 'modals/cashup_summary.inc' %] > >@@ -448,6 +413,7 @@ > [% INCLUDE 'js-date-format.inc' %] > [% Asset.js("js/cashup_modal.js") | $raw %] > [% Asset.js("js/modal_printer.js") | $raw %] >+ [% Asset.js("js/refund_modal.js") | $raw %] > [% INCLUDE 'calendar.inc' %] > <script> > var sales_table = $("#sales").kohaTable({ >@@ -499,25 +465,8 @@ > } > }); > >- $("#issueRefundModal").on("shown.bs.modal", function(e){ >- var button = $(e.relatedTarget); >- var item = button.data('item'); >- $("#item + span").replaceWith(item); >- var accountline = button.data('accountline'); >- $('#refundline').val(accountline); >- var amount = button.data('amount'); >- var amountoutstanding = button.data('amountoutstanding') || 0; >- var paid = amount - amountoutstanding; >- $("#paid + span").text(paid.format_price()); >- $("#returned").attr({ "value": paid.format_price(), "max": paid }); >- var member = button.data('member'); >- if ( member === '' ) { >- $("#refund_type option[value='AC']").remove(); >- } else if ( $("#refund_type option[value='AC']").length == 0 ) { >- $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>'); >- } >- $("#returned, #refund_type").focus(); >- }); >+ // Initialize refund modal >+ initRefundModal(); > > $("body").on('click', ".printReceipt", function() { > var accountlines_id = $(this).data('accountline'); >-- >2.52.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41592
:
191252
|
191253
|
191254
| 191255