Bugzilla – Attachment 97827 Details for
Bug 24082
Add a 'refund' option to anonymous payments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24082: Add refund action to relevant lines
Bug-24082-Add-refund-action-to-relevant-lines.patch (text/plain), 8.81 KB, created by
Martin Renvoize (ashimema)
on 2020-01-23 16:21:57 UTC
(
hide
)
Description:
Bug 24082: Add refund action to relevant lines
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-23 16:21:57 UTC
Size:
8.81 KB
patch
obsolete
>From ec21ab1ea727c52f105add1e56cf4d9de9bb4b79 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 23 Jan 2020 16:03:06 +0000 >Subject: [PATCH] Bug 24082: Add refund action to relevant lines > >--- > .../prog/en/modules/pos/register.tt | 77 ++++++++++++++++++- > pos/register.pl | 34 ++++++++ > 2 files changed, 110 insertions(+), 1 deletion(-) > >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 dc3685e9f2..7970ef7965 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -97,7 +97,13 @@ > [% credit.debit.amount | $Price %] > </td> > <td></td> >- <td></td> >+ <td> >+ [% IF CAN_user_cash_management_anonymous_refund && !(credit.debit.status == 'REFUNDED' ) %] >+ <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-quantity="[% credit.debit.note | html %]"><i class="fa fa-money"></i> Issue refund</button> >+ [% ELSIF CAN_user_updatecharges_refund && !(credit.debit.status == 'REFUNDED') && credit.debit.borrowernumber %] >+ <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=credit.debit -%]" data-accountline="[% credit.debit.accountlines_id | html %]" data-amount="[% credit.debit.amount | $Price %]" data-quantity="[% credit.debit.note | html %]"><i class="fa fa-money"></i> Issue refund</button> >+ [% END %] >+ </td> > </tr> > [% END %] > [% END %] >@@ -147,6 +153,60 @@ > </div> > </div><!-- /.row --> > >+ <!-- 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"> >+ <input type="hidden" name="accountline" value="" id="refundline"> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ <h4 class="modal-title" id="issueRefundLabel">Issue refund from <em>[% register.name | html %]</em></h4> >+ </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>[% refund.amount | $Price %]</span> >+ </li> >+ <li> >+ <label class="required" for="amount">Returned to patron: </label> >+ <input type="number" step="0.01" max="[% refund.amount | $Price %]" id="amount" name="amount" value="[% refund.amount | $Price %]" required="required"> >+ <span class="required">Required</span> >+ </li> >+ <li> >+ <label class="required" for="quantity">Quantity: </label> >+ <input type="text" id="quantity" name="quantity" value="[% refund.quantity | html %]" required="required"> >+ <span class="required">Required</span> >+ </li> >+ [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] >+ [% IF payment_types %] >+ <li> >+ <label for="transaction_type">Transaction type: </label> >+ <select name="transaction_type" id="transaction_type"> >+ [% FOREACH pt IN payment_types %] >+ <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option> >+ [% END %] >+ </select> >+ </li> >+ [% END %] >+ </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="refund"> >+ <button type="submit" class="btn btn-default">Confirm</button> >+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> >+ </div> <!-- /.modal-footer --> >+ </div> <!-- /.modal-content --> >+ </div> <!-- /.modal-dialog --> >+ </form> <!-- /#refund_form --> >+ </div> <!-- /#issueRefundModal --> >+ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] >@@ -171,6 +231,21 @@ > } > })); > >+ $("#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'); >+ $("#paid + span").replaceWith(amount); >+ $("#amount").val(amount); >+ $("#amount").attr("max", amount); >+ var quantity = button.data('quantity'); >+ $("#quantity").val(quantity); >+ $("#amount, #quantity, #transaction_type").focus(); >+ }); >+ > $(".printReceipt").click(function() { > var accountlines_id = $(this).data('accountline'); > var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=' + accountlines_id, '_blank'); >diff --git a/pos/register.pl b/pos/register.pl >index a7fde86ce2..382aeab44c 100755 >--- a/pos/register.pl >+++ b/pos/register.pl >@@ -39,6 +39,7 @@ my ( $template, $loggedinuser, $cookie, $user_flags ) = get_template_and_user( > } > ); > my $logged_in_user = Koha::Patrons->find($loggedinuser) or die "Not logged in"; >+my $schema = Koha::Database->new->schema; > > my $library_id = C4::Context->userenv->{'branch'}; > my $registerid = $input->param('registerid'); >@@ -79,6 +80,39 @@ else { > } > ); > } >+ elsif ( $op eq 'refund' ) { >+ my $amount = $input->param('amount'); >+ my $quantity = $input->param('quantity'); >+ my $accountline_id = $input->param('accountline'); >+ my $transaction_type = $input->param('transaction_type'); >+ >+ my $accountline = Koha::Account::Lines->find($accountline_id); >+ $schema->txn_do( >+ sub { >+ >+ my $refund = $accountline->reduce( >+ { >+ reduction_type => 'Refund', >+ branch => $library_id, >+ staff_id => $logged_in_user->id, >+ interface => 'intranet', >+ amount => $amount >+ } >+ ); >+ my $payout = $refund->payout( >+ { >+ payout_type => $transaction_type, >+ branch => $library_id, >+ staff_id => $logged_in_user->id, >+ cash_register => $cash_register->id, >+ interface => 'intranet', >+ amount => $amount >+ } >+ ); >+ >+ } >+ ); >+ } > } > > output_html_with_http_headers( $input, $cookie, $template->output ); >-- >2.20.1
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 24082
:
97042
|
97826
|
97827
|
97828
|
98849
|
98850
|
98851
|
98854
|
98855
|
98856
|
99983
|
99984
|
99985
|
99991
|
99992
|
99993
|
99995
|
99996
|
99997
|
100031
|
100032
|
100033
|
100070
|
100071
|
100072
|
100073