Bugzilla – Attachment 76450 Details for
Bug 19617
Allow 'writeoff of selected'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19617: Allow 'writeoff of selected'
Bug-19617-Allow-writeoff-of-selected.patch (text/plain), 8.40 KB, created by
Kyle M Hall (khall)
on 2018-06-26 14:37:27 UTC
(
hide
)
Description:
Bug 19617: Allow 'writeoff of selected'
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-06-26 14:37:27 UTC
Size:
8.40 KB
patch
obsolete
>From 1dc96109ef03936f9226a37f8935baedf572c6f9 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Mon, 30 Apr 2018 12:47:26 -0400 >Subject: [PATCH] Bug 19617: Allow 'writeoff of selected' > >This patch adds a writeoff equivilent to 'Pay selected' > >Test Plan: >1) Apply this patch >2) Find a patron with fines >3) On the "Pay fines" tab, select one or more fines and use the > "Write off selected" button. >4) Note the fine amount you used was written off for those fines. > >Signed-off-by: Kyle M Hall <kyle@bywatetsolutions.com> > >Signed-off-by: Martha Fuerst <mfuerst@hmcpl.org> >--- > .../intranet-tmpl/prog/en/modules/members/pay.tt | 1 + > .../prog/en/modules/members/paycollect.tt | 26 +++++++++++++++---- > members/pay.pl | 30 ++++++++++++---------- > members/paycollect.pl | 3 +++ > 4 files changed, 42 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index 80abac023e..c234c23eec 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -121,6 +121,7 @@ > <input type="submit" id="paycollect" name="paycollect" value="Pay amount" class="submit" /> > [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall" id="woall" value="Write off all" class="submit" />[% END %] > <input type="submit" id="payselected" name="payselected" value="Pay selected" class="submit" /> >+<input type="submit" id="writeoff-selected" name="writeoff_selected" value="Write off selected" class="submit" /> > <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a> > </fieldset> > </form> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >index fb42d4317a..cead73e2f2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -12,7 +12,7 @@ > <body id="pat_paycollect" class="pat"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'patron-search.inc' %] >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Pay fines for [% patron.firstname %] [% patron.surname %]</a> › [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div> >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Pay fines for [% patron.firstname %] [% patron.surname %]</a> › [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %][% IF type == 'write off' %]Write off an amount toward selected fines[% ELSE %]Pay an amount toward selected fines[% END %][% ELSE %]Pay an amount toward all fines[% END %][% END %]</div> > > <div id="doc3" class="yui-t2"> > >@@ -158,16 +158,30 @@ > <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" /> > <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" /> > <input type="hidden" name="total" id="total" value="[% total %]" /> >+ <input type="hidden" name="type" value="[% type %]" /> > > <fieldset class="rows"> >- [% IF ( selected_accts ) %]<legend>Pay an amount toward selected fines</legend>[% ELSE %]<legend>Pay an amount toward all fines</legend>[% END %] >+ [% IF ( selected_accts ) %] >+ [% IF type == 'writeoff' %] >+ <legend>Write off an amount toward selected fines</legend> >+ [% ELSE %] >+ <legend>Pay an amount toward selected fines</legend> >+ [% END %] >+ [% ELSE %] >+ <legend>Pay an amount toward all fines</legend> >+ [% END %] >+ > <ol> > <li> > <span class="label">Total amount outstanding: </span> > <span class="debit">[% total | format('%.2f') %]</span> > </li> > <li> >- <label for="paid">Collect from patron: </label> >+ [% IF type == 'writeoff' %] >+ <label for="paid">Writeoff amount: </label> >+ [% ELSE %] >+ <label for="paid">Collect from patron: </label> >+ [% END %] > <!-- default to paying all --> > <input name="paid" id="paid" value="[% total | format('%.2f') %]" /> > </li> >@@ -189,8 +203,10 @@ > </li> > </ol> > </fieldset> >- <div class="action"><input type="submit" name="submitbutton" value="Confirm" /> >- <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div> >+ <div class="action"> >+ <input type="submit" name="submitbutton" value="Confirm" /> >+ <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a> >+ </div> > </form> > [% END %] > </div></div> >diff --git a/members/pay.pl b/members/pay.pl >index 53a8f37794..fe6ae585d1 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -74,24 +74,23 @@ $user ||= q{}; > > our $branch = C4::Context->userenv->{'branch'}; > >-my $writeoff_item = $input->param('confirm_writeoff'); >-my $paycollect = $input->param('paycollect'); >-if ($paycollect) { >+if ( $input->param('paycollect') ) { > print $input->redirect( > "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"); > } >-my $payselected = $input->param('payselected'); >-if ($payselected) { >- payselected(@names); >+elsif ( $input->param('payselected') ) { >+ payselected({ params => \@names }); > } >- >-my $writeoff_all = $input->param('woall'); # writeoff all fines >-if ($writeoff_all) { >+elsif ( $input->param('writeoff_selected') ) { >+ payselected({ params => \@names, type => 'writeoff' }); >+} >+elsif ( $input->param('woall') ) { > writeoff_all(@names); >-} elsif ($writeoff_item) { >+} >+elsif ( $input->param('confirm_writeoff') ) { > my $accountlines_id = $input->param('accountlines_id'); >- my $amount = $input->param('amountwrittenoff'); >- my $payment_note = $input->param("payment_note"); >+ my $amount = $input->param('amountwrittenoff'); >+ my $payment_note = $input->param("payment_note"); > > my $accountline = Koha::Account::Lines->find( $accountlines_id ); > >@@ -252,7 +251,11 @@ sub borrower_add_additional_fields { > } > > sub payselected { >- my @params = @_; >+ my $parameters = shift; >+ >+ my @params = @{ $parameters->{params} }; >+ my $type = $parameters->{type} || 'payment'; >+ > my $amt = 0; > my @lines_to_pay; > foreach (@params) { >@@ -267,6 +270,7 @@ sub payselected { > my $notes = '¬es=' . join("%0A", map { scalar $input->param("payment_note_$_") } @lines_to_pay ); > my $redirect = > "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber" >+ . "&type=$type" > . $amt > . $sel > . $notes; >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 0f98a9d3f1..220a27ed53 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -69,6 +69,7 @@ my $select_lines = $input->param('selected'); > my $select = $input->param('selected_accts'); > my $payment_note = uri_unescape scalar $input->param('payment_note'); > my $payment_type = scalar $input->param('payment_type'); >+my $type = scalar $input->param('type') || 'payment', > my $accountlines_id; > > if ( $individual || $writeoff ) { >@@ -153,6 +154,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > } > )->pay( > { >+ type => $type, > amount => $total_paid, > lines => \@lines, > note => $note, >@@ -187,6 +189,7 @@ if ( $input->param('error_over') ) { > } > > $template->param( >+ type => $type, > borrowernumber => $borrowernumber, # some templates require global > patron => $patron, > total => $total_due, >-- >2.15.2 (Apple Git-101.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 19617
:
74941
|
75702
|
76450
|
76638
|
76639