Bugzilla – Attachment 85423 Details for
Bug 21756
Deprecate C4::Accounts::manualinvoice (use Koha::Account->add_debit instead)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21756: Update members/manivoice to use add_debit
Bug-21756-Update-membersmanivoice-to-use-adddebit.patch (text/plain), 2.78 KB, created by
Martin Renvoize (ashimema)
on 2019-02-21 08:49:58 UTC
(
hide
)
Description:
Bug 21756: Update members/manivoice to use add_debit
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-02-21 08:49:58 UTC
Size:
2.78 KB
patch
obsolete
>From c5822d14e03d4423274e44ef39cf17b9b99e1c23 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 21756: Update members/manivoice to use add_debit > >https://bugs.koha-community.org/show_bug.cgi?id=21756 >--- > members/maninvoice.pl | 36 ++++++++++++++++++++++++------------ > 1 file changed, 24 insertions(+), 12 deletions(-) > >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 2d22666bd5..d5e24497ff 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 { >+ try { >+ my $account = $patron->account; >+ my $invoice = $account->add_debit( >+ { >+ amount => $amount, >+ item_id => $itemnum, >+ description => $desc, >+ type => $type, >+ note => $note >+ } >+ ); > > if ( C4::Context->preference('AccountAutoReconcile') ) { > $patron->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 21756
:
83257
|
83258
|
83259
|
83260
|
83261
|
83262
|
83263
|
83264
|
83265
|
83266
|
83267
|
83268
|
83269
|
83270
|
83271
|
84729
|
84730
|
84731
|
84732
|
84733
|
85320
|
85321
|
85322
|
85323
|
85324
|
85325
|
85326
|
85327
|
85350
|
85420
|
85421
|
85422
|
85423
|
85424
|
85425
|
85426
|
85427
|
85428
|
85429
|
85430
|
85505
|
85506
|
85507
|
85508
|
85509
|
85510
|
85511
|
85512
|
85513
|
85514
|
85515
|
85638
|
85639
|
85640
|
85641
|
85642
|
85643
|
85644
|
85645
|
85646
|
85647
|
85648
|
85654
|
85655
|
85656
|
85657
|
85658
|
85659
|
85660
|
85661
|
85662
|
85663
|
85664
|
85665
|
86265
|
86266
|
86267
|
86268
|
86269
|
86270
|
86271
|
86272
|
86273
|
86274
|
86275
|
86276
|
86441
|
86442
|
86443
|
86444
|
86445
|
86446
|
86447
|
86448
|
86449
|
86450
|
86451
|
86452