Bugzilla – Attachment 59213 Details for
Bug 17894
Remove and Replace WriteOffFee
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17894 - Remove and replace WriteOffFee
Bug-17894---Remove-and-replace-WriteOffFee.patch (text/plain), 6.81 KB, created by
Jonathan Druart
on 2017-01-19 09:12:56 UTC
(
hide
)
Description:
Bug 17894 - Remove and replace WriteOffFee
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-19 09:12:56 UTC
Size:
6.81 KB
patch
obsolete
>From a6b2b7540386ba3008f34eb85bf1d0fef10583e0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 12 Jan 2017 18:45:40 +0000 >Subject: [PATCH] Bug 17894 - Remove and replace WriteOffFee > >WriteOffFee is the last of the "payment" subroutines that need to be >merged into Koha::Account::pay ( as a writeoff is really just type of >payment ). > >Test Plan: >1) Apply this patch >2) Verify the writeoff, and writeoff all buttons still work > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Accounts.pm | 57 +++++++++++------------------------------------ > members/pay.pl | 46 ++++++++++++++++++++++++-------------- > t/db_dependent/Accounts.t | 1 - > 3 files changed, 42 insertions(+), 62 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 17f7e69..3942c39 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -33,20 +33,19 @@ use Data::Dumper qw(Dumper); > use vars qw(@ISA @EXPORT); > > BEGIN { >- require Exporter; >- @ISA = qw(Exporter); >- @EXPORT = qw( >- &manualinvoice >- &getnextacctno >- &getcharges >- &ModNote >- &getcredits >- &getrefunds >- &chargelostitem >- &ReversePayment >- &WriteOffFee >- &purge_zero_balance_fees >- ); >+ require Exporter; >+ @ISA = qw(Exporter); >+ @EXPORT = qw( >+ &manualinvoice >+ &getnextacctno >+ &getcharges >+ &ModNote >+ &getcredits >+ &getrefunds >+ &chargelostitem >+ &ReversePayment >+ &purge_zero_balance_fees >+ ); > } > > =head1 NAME >@@ -350,36 +349,6 @@ sub ReversePayment { > > } > >-=head2 WriteOffFee >- >- WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note ); >- >-Write off a fine for a patron. >-C<$borrowernumber> is the patron's borrower number. >-C<$accountline_id> is the accountline_id of the fee to write off. >-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, $accountlines_id, $itemnum, $accounttype, $amount, $branch, $payment_note ) = @_; >- >- my $line = Koha::Account::Lines->find($accountlines_id); >- return Koha::Account->new( { patron_id => $borrowernumber } )->pay( >- { >- amount => $amount, >- lines => [$line], >- type => 'writeoff', >- note => $payment_note, >- library_id => $branch, >- } >- ); >-} >- > =head2 purge_zero_balance_fees > > purge_zero_balance_fees( $days ); >diff --git a/members/pay.pl b/members/pay.pl >index bfca78b..7e008d4 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -88,11 +88,18 @@ if ($writeoff_all) { > writeoff_all(@names); > } elsif ($writeoff_item) { > my $accountlines_id = $input->param('accountlines_id'); >- my $itemno = $input->param('itemnumber'); >- my $account_type = $input->param('accounttype'); > my $amount = $input->param('amountoutstanding'); > my $payment_note = $input->param("payment_note"); >- WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $account_type, $amount, $branch, $payment_note ); >+ >+ Koha::Account->new( { patron_id => $borrowernumber } )->pay( >+ { >+ amount => $amount, >+ lines => [Koha::Account::Lines->find($accountlines_id)], >+ type => 'writeoff', >+ note => $payment_note, >+ library_id => $branch, >+ } >+ ); > } > > for (@names) { >@@ -153,7 +160,7 @@ sub add_accounts_to_template { > sub get_for_redirect { > my ( $name, $name_in, $money ) = @_; > my $s = q{&} . $name . q{=}; >- my $value = $input->param($name_in); >+ my $value = uri_escape_utf8( $input->param($name_in) ); > if ( !defined $value ) { > $value = ( $money == 1 ) ? 0 : q{}; > } >@@ -175,8 +182,8 @@ sub redirect_to_paycollect { > $redirect .= get_for_redirect( 'amount', "amount$line_no", 1 ); > $redirect .= > get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); >- $redirect .= uri_escape_utf8( get_for_redirect( 'description', "description$line_no", 0 ) ); >- $redirect .= uri_escape_utf8( get_for_redirect( 'title', "title$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 ); >@@ -190,23 +197,28 @@ sub redirect_to_paycollect { > sub writeoff_all { > my @params = @_; > my @wo_lines = grep { /^accountlines_id\d+$/ } @params; >+ >+ my $borrowernumber = $input->param('borrowernumber'); >+ > for (@wo_lines) { > if (/(\d+)/) { >- my $value = $1; >- my $accounttype = $input->param("accounttype$value"); >- >- # my $borrowernum = $input->param("borrowernumber$value"); >- my $itemno = $input->param("itemnumber$value"); >- my $amount = $input->param("amountoutstanding$value"); >+ my $value = $1; >+ my $amount = $input->param("amountoutstanding$value"); > my $accountlines_id = $input->param("accountlines_id$value"); >- my $payment_note = $input->param("payment_note_$value"); >- WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $accounttype, $amount, $branch, $payment_note ); >+ my $payment_note = $input->param("payment_note_$value"); >+ Koha::Account->new( { patron_id => $borrowernumber } )->pay( >+ { >+ amount => $amount, >+ lines => [ Koha::Account::Lines->find($accountlines_id) ], >+ type => 'writeoff', >+ note => $payment_note, >+ library_id => $branch, >+ } >+ ); > } > } > >- $borrowernumber = $input->param('borrowernumber'); >- print $input->redirect( >- "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); >+ print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); > return; > } > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index d1cc6db..505ce2f 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -45,7 +45,6 @@ can_ok( 'C4::Accounts', > getcredits > getrefunds > ReversePayment >- WriteOffFee > purge_zero_balance_fees ) > ); > >-- >2.9.3
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 17894
:
58883
|
58884
|
58885
|
58908
|
58909
|
58910
|
59211
|
59212
| 59213