Bugzilla – Attachment 9129 Details for
Bug 6413
Notes in Fines doing wonky things
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6413 Added ability to add a note when paying or writing off a fine Code will also respect notes when using the "Writeoff All" button but WILL NOT when using either the "Pay Amount" or "Pay Selected" buttons Fixed uri encoding of arguments
Bug-6413-Added-ability-to-add-a-note-when-paying-o.patch (text/plain), 10.94 KB, created by
Chris Cormack
on 2012-04-11 21:10:30 UTC
(
hide
)
Description:
Bug 6413 Added ability to add a note when paying or writing off a fine Code will also respect notes when using the "Writeoff All" button but WILL NOT when using either the "Pay Amount" or "Pay Selected" buttons Fixed uri encoding of arguments
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-04-11 21:10:30 UTC
Size:
10.94 KB
patch
obsolete
>From 44442c63b30a1fee431f95ff5206365e17bc531b Mon Sep 17 00:00:00 2001 >From: Chris Hall <chrish@catalyst.net.nz> >Date: Thu, 26 Jan 2012 16:04:53 +1300 >Subject: [PATCH] Bug 6413 Added ability to add a note when paying or writing > off a fine Code will also respect notes when using the > "Writeoff All" button but WILL NOT when using either the > "Pay Amount" or "Pay Selected" buttons Fixed uri encoding > of arguments > >--- > C4/Accounts.pm | 32 +++++++++++-------- > .../intranet-tmpl/prog/en/modules/members/pay.tt | 4 ++- > .../prog/en/modules/members/paycollect.tt | 2 + > members/pay.pl | 9 ++++-- > members/paycollect.pl | 7 +++- > 5 files changed, 34 insertions(+), 20 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index b7aef01..5c88383 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -165,7 +165,7 @@ sub makepayment { > #here we update both the accountoffsets and the account lines > #updated to check, if they are paying off a lost item, we return the item > # from their card, and put a note on the item record >- my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; >+ my ( $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; > my $dbh = C4::Context->dbh; > my $manager_id = 0; > $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; >@@ -205,14 +205,15 @@ sub makepayment { > > # create new line > my $payment = 0 - $amount; >+ $payment_note //= ""; > > my $ins = > $dbh->prepare( > "INSERT >- INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id) >- VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?)" >+ INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) >+ VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?)" > ); >- $ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id); >+ $ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); > $ins->finish; > } > >@@ -732,12 +733,13 @@ sub recordpayment_selectaccts { > # makepayment needs to be fixed to handle partials till then this separate subroutine > # fills in > sub makepartialpayment { >- my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; >+ my ( $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; > my $manager_id = 0; > $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; > if (!$amount || $amount < 0) { > return; > } >+ $payment_note //= ""; > my $dbh = C4::Context->dbh; > > my $nextaccntno = getnextacctno($borrowernumber); >@@ -753,20 +755,20 @@ sub makepartialpayment { > > # create new line > my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' >- . 'description, accounttype, amountoutstanding, itemnumber, manager_id) ' >- . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?)'; >+ . 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' >+ . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; > > $dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, >- "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id); >+ "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); > > UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); > > return; > } > >-=head2 WriteOff >+=head2 WriteOffFee > >- WriteOff( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch ); >+ WriteOffFee( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch, $payment_note ); > > Write off a fine for a patron. > C<$borrowernumber> is the patron's borrower number. >@@ -775,11 +777,13 @@ C<$itemnum> is the itemnumber of of item whose fine is being written off. > C<$accounttype> is the account type of the fine being written off. > C<$amount> is a floating-point number, giving the amount that is being written off. > C<$branch> is the branchcode of the library where the writeoff occurred. >+C<$payment_note> is the note to attach to this payment > > =cut > > sub WriteOffFee { >- my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch ) = @_; >+ my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount, $branch, $payment_note ) = @_; >+ $payment_note //= ""; > $branch ||= C4::Context->userenv->{branch}; > my $manager_id = 0; > $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; >@@ -799,12 +803,12 @@ sub WriteOffFee { > > $query =" > INSERT INTO accountlines >- ( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id ) >- VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ? ) >+ ( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id, note ) >+ VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ?, ? ) > "; > $sth = $dbh->prepare( $query ); > my $acct = getnextacctno($borrowernumber); >- $sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id ); >+ $sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id, $payment_note ); > > UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber ); > >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 591f92e..f93c983 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -47,7 +47,8 @@ > <th>Fines & charges</th> > <th>Sel</th> > <th>Description</th> >- <th>Account type</th> >+ <th>Payment note</th> >+ <th>Account ype</th> > <th>Notify id</th> > <th>Level</th> > <th>Amount</th> >@@ -86,6 +87,7 @@ > [% END %] > </td> > <td>[% line.description %] [% line.title |html_entity %]</td> >+ <td><input type="text" name="payment_note_[% line.accountno %]"></input></td> > <td>[% line.accounttype %]</td> > <td>[% line.notify_id %]</td> > <td>[% line.notify_level %]</td> >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 d5102cc..e58a9bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -106,6 +106,7 @@ function moneyFormat(textObj) { > > <fieldset class="rows"> > <legend>Pay an individual fine</legend> >+ <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" /> > <table> > <thead><tr> > <th>Description</th> >@@ -158,6 +159,7 @@ function moneyFormat(textObj) { > <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" /> > <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" /> > <input type="hidden" name="title" id="title" value="[% title %]" /> >+ <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" /> > <table> > <thead><tr> > <th>Description</th> >diff --git a/members/pay.pl b/members/pay.pl >index 8f5233c..f49d1f6 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -29,6 +29,7 @@ > use strict; > use warnings; > >+use URI::Escape; > use C4::Context; > use C4::Auth; > use C4::Output; >@@ -87,7 +88,8 @@ if ($writeoff_all) { > my $itemno = $input->param('itemnumber'); > my $account_type = $input->param('accounttype'); > my $amount = $input->param('amountoutstanding'); >- WriteOffFee( $borrowernumber, $accountno, $itemno, $account_type, $amount, $branch ); >+ my $payment_note = $input->param("payment_note"); >+ WriteOffFee( $borrowernumber, $accountno, $itemno, $account_type, $amount, $branch, $payment_note ); > } > > for (@names) { >@@ -162,11 +164,11 @@ sub redirect_to_paycollect { > $redirect .= > get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); > $redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 ); >- $redirect .= get_for_redirect( 'description', "description$line_no", 0 ); > $redirect .= get_for_redirect( 'title', "title$line_no", 0 ); > $redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); > $redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); > $redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 ); >+ $redirect .= q{&} . 'payment_note' . q{=} . uri_escape $input->param("payment_note_$line_no"); > $redirect .= '&remote_user='; > $redirect .= $user; > return print $input->redirect($redirect); >@@ -184,7 +186,8 @@ sub writeoff_all { > my $itemno = $input->param("itemnumber$value"); > my $amount = $input->param("amountoutstanding$value"); > my $accountno = $input->param("accountno$value"); >- WriteOffFee( $borrowernumber, $accountno, $itemno, $accounttype, $amount, $branch ); >+ my $payment_note = $input->param("payment_note_$value"); >+ WriteOffFee( $borrowernumber, $accountno, $itemno, $accounttype, $amount, $branch, $payment_note ); > } > } > >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 7dfb622..3d25e69 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -19,6 +19,7 @@ > > use strict; > use warnings; >+use URI::Escape; > use C4::Context; > use C4::Auth; > use C4::Output; >@@ -55,6 +56,7 @@ my $individual = $input->param('pay_individual'); > my $writeoff = $input->param('writeoff_individual'); > my $select_lines = $input->param('selected'); > my $select = $input->param('selected_accts'); >+my $payment_note = uri_unescape $input->param('payment_note'); > my $accountno; > > if ( $individual || $writeoff ) { >@@ -83,6 +85,7 @@ if ( $individual || $writeoff ) { > description => $description, > notify_id => $notify_id, > notify_level => $notify_level, >+ payment_note => $payment_note, > ); > } elsif ($select_lines) { > $total_due = $input->param('amt'); >@@ -102,10 +105,10 @@ if ( $total_paid and $total_paid ne '0.00' ) { > if ($individual) { > if ( $total_paid == $total_due ) { > makepayment( $borrowernumber, $accountno, $total_paid, $user, >- $branch ); >+ $branch, $payment_note ); > } else { > makepartialpayment( $borrowernumber, $accountno, $total_paid, >- $user, $branch ); >+ $user, $branch, $payment_note ); > } > print $input->redirect( > "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber"); >-- >1.7.5.4
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 6413
:
7333
|
7496
|
9107
|
9129
|
9144
|
9220
|
9221
|
9374
|
12658
|
12661
|
12668
|
12669
|
14832
|
14833
|
14834
|
14840
|
14846
|
14895
|
14896
|
14899
|
14900
|
15232
|
15233
|
15234
|
16486
|
16487
|
16488
|
16489
|
18035