Bugzilla – Attachment 85516 Details for
Bug 22393
Remove last remaining manualinvoice use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22393: Update members/manivoice to use add_debit
Bug-22393-Update-membersmanivoice-to-use-adddebit.patch (text/plain), 2.82 KB, created by
Martin Renvoize (ashimema)
on 2019-02-22 11:13:59 UTC
(
hide
)
Description:
Bug 22393: Update members/manivoice to use add_debit
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-02-22 11:13:59 UTC
Size:
2.82 KB
patch
obsolete
>From 119a850e1bb4c68b524936327104cda7b7d9463d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 17 Dec 2018 07:25:25 +0000 >Subject: [PATCH] Bug 22393: Update members/manivoice to use add_debit > >https://bugs.koha-community.org/show_bug.cgi?id=21756 >--- > members/maninvoice.pl | 38 +++++++++++++++++++++++++------------- > 1 file changed, 25 insertions(+), 13 deletions(-) > >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 2d22666bd5..52a8791d9d 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -38,6 +38,8 @@ use Koha::Patrons; > > use Koha::Patron::Categories; > >+use Try::Tiny; >+ > my $input=new CGI; > my $flagsrequired = { borrowers => 'edit_borrowers' }; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -78,23 +80,33 @@ if ($add){ > my $amount=$input->param('amount'); > my $type=$input->param('type'); > my $note = $input->param('note'); >- my $error = manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note ); >- if ($error) { >- if ( $error =~ /FOREIGN KEY/ && $error =~ /itemnumber/ ) { >- $template->param( 'ITEMNUMBER' => 1 ); >- } >- $template->param( csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }) ); >- $template->param( 'ERROR' => $error ); >- output_html_with_http_headers $input, $cookie, $template->output; >- } else { >+ my $account = $patron->account; >+ try { >+ $account->add_debit( >+ { >+ amount => $amount, >+ item_id => $itemnum, >+ description => $desc, >+ type => $type, >+ note => $note >+ } >+ ); > > if ( C4::Context->preference('AccountAutoReconcile') ) { >- $patron->account->reconcile_balance; >+ $account->reconcile_balance; > } >- >- print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); >- exit; > } >+ catch { >+ if ( $_->isa('Koha::Exceptions::Object::FKConstraint') && $_->error =~ /FOREIGN KEY/ && $_->error =~ /itemnumber/ ) { >+ $template->param( 'ITEMNUMBER' => 1 ) if ($_->broken_fk eq 'itemnumber'); >+ $template->param( 'ERROR' => $_->message ); >+ } >+ $template->param( csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }) ); >+ output_html_with_http_headers $input, $cookie, $template->output; >+ } >+ >+ print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); >+ exit; > } > } else { > >-- >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 22393
:
85516
|
95298
|
95303
|
95308
|
95309
|
95325
|
95326
|
98662
|
98663
|
103336
|
103382
|
103897
|
103898
|
106773
|
108330
|
108331
|
108332