Bugzilla – Attachment 98027 Details for
Bug 23355
Add a 'cashup' process to accounts
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.62 KB, created by
Martin Renvoize (ashimema)
on 2020-01-28 13:54:03 UTC
(
hide
)
Description:
Bug 24082: Add refund action to relevant lines
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-01-28 13:54:03 UTC
Size:
8.62 KB
patch
obsolete
>From ee612c3ae11817cf9b89e9a08f8b9259b7ac4960 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 > >https://bugs.koha-community.org/show_bug.cgi?id=23355 >--- > .../prog/en/modules/pos/register.tt | 72 ++++++++++++++++++- > pos/register.pl | 34 +++++++++ > 2 files changed, 105 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..0f1715c7b6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% USE Koha %] > [% USE KohaDates %] >+[% USE AuthorisedValues %] > [% USE Price %] > [% SET footerjs = 1 %] > [% PROCESS 'accounts.inc' %] >@@ -97,7 +98,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 +154,57 @@ > </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.description | 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></span> >+ </li> >+ <li> >+ <label class="required" for="amount">Returned to patron: </label> >+ <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required"> >+ <span class="required">Required</span> >+ </li> >+ [% SET payment_types = [] %] >+ [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] >+ [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %] >+ [% payment_types.push(pt) %] >+ [% END %] >+ <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> >+ </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 +229,18 @@ > } > })); > >+ $("#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); >+ $("#returned").attr({ "value": amount, "max": amount }); >+ $("#returned, #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 23355
:
92941
|
92942
|
92943
|
92944
|
92945
|
92946
|
92947
|
92948
|
92949
|
92950
|
92951
|
92952
|
92953
|
97031
|
97032
|
97033
|
97034
|
97035
|
97036
|
97037
|
97038
|
97039
|
97040
|
97041
|
97043
|
97044
|
97045
|
97046
|
97047
|
97048
|
97049
|
97050
|
97051
|
97052
|
97053
|
97054
|
97077
|
97078
|
97079
|
97080
|
97081
|
97082
|
97083
|
97084
|
97085
|
97086
|
97087
|
97088
|
97089
|
97706
|
97707
|
97708
|
97709
|
97710
|
97711
|
97712
|
97713
|
97714
|
97715
|
97716
|
97784
|
97785
|
97786
|
97787
|
97788
|
97789
|
97790
|
97791
|
97792
|
97793
|
97794
|
97816
|
97817
|
97818
|
97819
|
97820
|
97821
|
97822
|
97823
|
98026
|
98027
|
98028
|
98835
|
98836
|
98837
|
98838
|
98839
|
98840
|
98841
|
98842
|
100009
|
100010
|
100011
|
100012
|
100013
|
100014
|
100015
|
100016
|
100017
|
100018
|
100019
|
100020
|
100021
|
100030
|
100090
|
101685