Bugzilla – Attachment 192846 Details for
Bug 37671
Can't print receipt for refund from cash register transaction history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37671: Fix POS receipt printing for refunds
c37733d.patch (text/plain), 2.69 KB, created by
Martin Renvoize (ashimema)
on 2026-02-10 07:37:25 UTC
(
hide
)
Description:
Bug 37671: Fix POS receipt printing for refunds
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-10 07:37:25 UTC
Size:
2.69 KB
patch
obsolete
>From c37733db42d1ab6c4df8a1eafd91ef1a89e7be07 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 2 Feb 2026 15:59:16 +0000 >Subject: [PATCH] Bug 37671: Fix POS receipt printing for refunds > >The receipt printing logic was failing because it always expected a credit >but the "Print receipt" button was passing the payout debit line ID. > >This fix: >- Updates pos/printreceipt.pl to use previously added PAYOUT template based > on account line type >- Uses RECEIPT template for credits, PAYOUT template for PAYOUT debits >- Throws proper error for unsupported transaction types > >Test plan: >1. Make a purchase through Point of Sale >2. Go to transaction history for the register used >3. Issue a refund for the purchase >4. Click "Print receipt" button for the refund >5. Verify receipt prints correctly with payout details >--- > pos/printreceipt.pl | 22 ++++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > >diff --git a/pos/printreceipt.pl b/pos/printreceipt.pl >index 321e3db6040..e24ad26692b 100755 >--- a/pos/printreceipt.pl >+++ b/pos/printreceipt.pl >@@ -36,8 +36,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > ); > > my $payment_id = $input->param('accountlines_id'); >-my $payment = Koha::Account::Lines->find($payment_id); >-my $patron = $payment->patron; >+my $accountline = Koha::Account::Lines->find($payment_id); >+my $patron = $accountline->patron; > > my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in"; > output_and_exit_if_error( >@@ -51,14 +51,28 @@ output_and_exit_if_error( > ) if $patron; # Payment could have been anonymous > > my $lang = $patron ? $patron->lang : $template->lang; >+# Determine template and table based on account line type >+my ($letter_code, $table_key, $table_id); >+if ($accountline->is_credit) { >+ $letter_code = 'RECEIPT'; >+ $table_key = 'credits'; >+ $table_id = $accountline->accountlines_id; >+} elsif ($accountline->is_debit && $accountline->debit_type_code eq 'PAYOUT') { >+ $letter_code = 'PAYOUT'; >+ $table_key = 'debits'; >+ $table_id = $accountline->accountlines_id; >+} else { >+ die "Account line " . $payment_id . " is not a credit or supported payout transaction"; >+} >+ > my $letter = C4::Letters::GetPreparedLetter( > module => 'pos', >- letter_code => 'RECEIPT', >+ letter_code => $letter_code, > branchcode => C4::Context::mybranch, > message_transport_type => 'print', > lang => $lang, > tables => { >- credits => $payment_id, >+ $table_key => $table_id, > borrowers => $patron ? $patron->borrowernumber : undef > }, > substitute => { >-- >2.53.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 37671
:
192335
|
192336
|
192845
|
192846
|
193257
|
193258
|
193259