Bugzilla – Attachment 193257 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: Add new 'PAYOUT' notice template
55fe1d2.patch (text/plain), 8.77 KB, created by
Martin Renvoize (ashimema)
on 2026-02-16 15:32:12 UTC
(
hide
)
Description:
Bug 37671: Add new 'PAYOUT' notice template
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-16 15:32:12 UTC
Size:
8.77 KB
patch
obsolete
>From 55fe1d2a07f905b473ae08a5d9724fa12291b89f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 2 Feb 2026 17:22:24 +0000 >Subject: [PATCH] Bug 37671: Add new 'PAYOUT' notice template > >When a refund is processed through Point of Sale, the system creates: >1. A credit account line (the refund) >2. A debit account line (the payout) > >The receipt printing logic currently only accounts for RECEIPTs against >credits. > >This patch adds a new 'PAYOUT' template for dealing with the negative >debits that make up a payout so we can construct a proper receipt for >this action. >--- > .../data/mysql/atomicupdate/bug_37671.pl | 105 ++++++++++++++++++ > .../mysql/en/mandatory/sample_notices.yml | 94 +++++++++++++++- > 2 files changed, 198 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_37671.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_37671.pl b/installer/data/mysql/atomicupdate/bug_37671.pl >new file mode 100644 >index 00000000000..a2b4d5ea71d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_37671.pl >@@ -0,0 +1,105 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "37671", >+ description => "Add PAYOUT notice template for POS refund receipts", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Add new PAYOUT letter template for POS >+ $dbh->do( >+ q{ >+ INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type, lang, updated_on) >+ VALUES ( >+ 'pos', 'PAYOUT', '', 'Point of sale payout receipt', 1, 'Payout receipt', >+ '[% USE KohaDates %] >+[% USE Branches %] >+[% USE Price %] >+[% USE AuthorisedValues %] >+[% PROCESS "accounts.inc" %] >+<table> >+[% IF ( LibraryName ) %] >+ <tr> >+ <th colspan="2" class="centerednames"> >+ <h3>[% LibraryName | html %]</h3> >+ </th> >+ </tr> >+[% END %] >+ <tr> >+ <th colspan="2" class="centerednames"> >+ <h2>[% Branches.GetName( debit.branchcode ) | html %]</h2> >+ </th> >+ </tr> >+<tr> >+ <th colspan="2" class="centerednames"> >+ <h3>[% debit.date | $KohaDates %]</h3> >+</tr> >+<tr> >+ <td>Transaction ID: </td> >+ <td>[% debit.accountlines_id %]</td> >+</tr> >+<tr> >+ <td>Operator ID: </td> >+ <td>[% debit.manager_id %]</td> >+</tr> >+<tr> >+ <td>Payout type: </td> >+ <td>[% AuthorisedValues.GetByCode( "PAYMENT_TYPE", debit.payment_type ) | html %]</td> >+</tr> >+ <tr></tr> >+ <tr> >+ <th colspan="2" class="centerednames"> >+ <h2><u>Refund Payout Receipt</u></h2> >+ </th> >+ </tr> >+ <tr></tr> >+ [% IF debit.patron %] >+ <tr> >+ <th colspan="2"> >+ Paid to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %]<br> >+ Card number: [% debit.patron.cardnumber | html %] >+ </th> >+ </tr> >+ <tr></tr> >+ [% END %] >+ <tr> >+ <th colspan="2">Refund details</th> >+ </tr> >+ <tr> >+ <th>Item / Original charge</th> >+ <th>Refund amount</th> >+ </tr> >+ >+ [% FOREACH credit IN debit.credits %] >+ [% FOREACH offset IN credit.credit_offsets %] >+ [% IF offset.debit && offset.debit.debit_type_code != 'PAYOUT' %] >+ <tr> >+ <td> >+ [% PROCESS account_type_description account=offset.debit %] >+ [% IF offset.debit.description %] - [% offset.debit.description | html %][% END %] >+ [% IF offset.debit.itemnumber %]<br><i>[% offset.debit.item.biblio.title | html %]</i>[% END %] >+ <br>Original charge: [% offset.debit.amount | $Price %] >+ </td> >+ <td>[% credit.amount * -1 | $Price %]</td> >+ </tr> >+ [% END %] >+ [% END %] >+ [% END %] >+ >+<tfoot> >+ <tr class="highlight"> >+ <td>Total payout: </td> >+ <td>[% debit.amount | $Price %]</td> >+ </tr> >+</tfoot> >+</table>', >+ 'print', 'default', NOW() >+ ) >+ } >+ ); >+ >+ say_success( $out, "Added new PAYOUT letter template for POS refunds" ); >+ }, >+}; >diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml >index 69ff86f532b..938fbd2d249 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.yml >+++ b/installer/data/mysql/en/mandatory/sample_notices.yml >@@ -1808,6 +1808,7 @@ tables: > - "[% USE KohaDates %]" > - "[% USE Branches %]" > - "[% USE Price %]" >+ - "[% USE AuthorisedValues %]" > - "[% PROCESS \"accounts.inc\" %]" > - "<table>" > - "[% IF ( LibraryName ) %]" >@@ -1836,7 +1837,7 @@ tables: > - "</tr>" > - "<tr>" > - " <td>Payment type: </td>" >- - " <td>[% credit.payment_type %]</td>" >+ - " <td>[% AuthorisedValues.GetByCode( 'PAYMENT_TYPE', credit.payment_type ) | html %]</td>" > - "</tr>" > - " <tr></tr>" > - " <tr>" >@@ -1949,6 +1950,97 @@ tables: > - " </tfoot>" > - "</table>" > >+ - module: pos >+ code: PAYOUT >+ branchcode: "" >+ name: "Point of sale payout receipt" >+ is_html: 1 >+ title: "Payout receipt" >+ message_transport_type: print >+ lang: default >+ content: >+ - "[% USE KohaDates %]" >+ - "[% USE Branches %]" >+ - "[% USE Price %]" >+ - "[% USE AuthorisedValues %]" >+ - "[% PROCESS \"accounts.inc\" %]" >+ - "<table>" >+ - "[% IF ( LibraryName ) %]" >+ - " <tr>" >+ - " <th colspan=\"2\" class=\"centerednames\">" >+ - " <h3>[% LibraryName | html %]</h3>" >+ - " </th>" >+ - " </tr>" >+ - "[% END %]" >+ - " <tr>" >+ - " <th colspan=\"2\" class=\"centerednames\">" >+ - " <h2>[% Branches.GetName( debit.branchcode ) | html %]</h2>" >+ - " </th>" >+ - " </tr>" >+ - "<tr>" >+ - " <th colspan=\"2\" class=\"centerednames\">" >+ - " <h3>[% debit.date | $KohaDates %]</h3>" >+ - "</tr>" >+ - "<tr>" >+ - " <td>Transaction ID: </td>" >+ - " <td>[% debit.accountlines_id %]</td>" >+ - "</tr>" >+ - "<tr>" >+ - " <td>Operator ID: </td>" >+ - " <td>[% debit.manager_id %]</td>" >+ - "</tr>" >+ - "<tr>" >+ - " <td>Payout type: </td>" >+ - " <td>[% AuthorisedValues.GetByCode( \"PAYMENT_TYPE\", debit.payment_type ) | html %]</td>" >+ - "</tr>" >+ - " <tr></tr>" >+ - " <tr>" >+ - " <th colspan=\"2\" class=\"centerednames\">" >+ - " <h2><u>Refund Payout Receipt</u></h2>" >+ - " </th>" >+ - " </tr>" >+ - " <tr></tr>" >+ - " [% IF debit.patron %]" >+ - " <tr>" >+ - " <th colspan=\"2\">" >+ - " Paid to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %]<br>" >+ - " Card number: [% debit.patron.cardnumber | html %]" >+ - " </th>" >+ - " </tr>" >+ - " <tr></tr>" >+ - " [% END %]" >+ - " <tr>" >+ - " <th colspan=\"2\">Refund details</th>" >+ - " </tr>" >+ - " <tr>" >+ - " <th>Item / Original charge</th>" >+ - " <th>Refund amount</th>" >+ - " </tr>" >+ - "" >+ - " [% FOREACH credit IN debit.credits %]" >+ - " [% FOREACH offset IN credit.credit_offsets %]" >+ - " [% IF offset.debit && offset.debit.debit_type_code != 'PAYOUT' %]" >+ - " <tr>" >+ - " <td>" >+ - " [% PROCESS account_type_description account=offset.debit %]" >+ - " [% IF offset.debit.description %] - [% offset.debit.description | html %][% END %]" >+ - " [% IF offset.debit.itemnumber %]<br><i>[% offset.debit.item.biblio.title | html %]</i>[% END %]" >+ - " <br>Original charge: [% offset.debit.amount | $Price %]" >+ - " </td>" >+ - " <td>[% credit.amount * -1 | $Price %]</td>" >+ - " </tr>" >+ - " [% END %]" >+ - " [% END %]" >+ - " [% END %]" >+ - "" >+ - "<tfoot>" >+ - " <tr class=\"highlight\">" >+ - " <td>Total payout: </td>" >+ - " <td>[% debit.amount | $Price %]</td>" >+ - " </tr>" >+ - "</tfoot>" >+ - "</table>" >+ > - module: reserves > code: CANCEL_HOLD_ON_LOST > branchcode: "" >-- >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