Bugzilla – Attachment 95308 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: simplify?
Bug-22393-simplify.patch (text/plain), 4.47 KB, created by
Jonathan Druart
on 2019-11-12 13:47:59 UTC
(
hide
)
Description:
Bug 22393: simplify?
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-11-12 13:47:59 UTC
Size:
4.47 KB
patch
obsolete
>From 852a7b0235e7626606981acade80b3db8d667568 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 12 Nov 2019 14:47:44 +0100 >Subject: [PATCH] Bug 22393: simplify? > >--- > members/maninvoice.pl | 93 +++++++++++++++++++++++++-------------------------- > 1 file changed, 45 insertions(+), 48 deletions(-) > >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 7299eb8575..01289310c2 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -97,59 +97,56 @@ if ($add) { > my $barcode = $input->param('barcode'); > if ($barcode) { > my $item = Koha::Items->find( { barcode => $barcode } ); >- if ($item) { >- $item_id = $item->itemnumber; >- } >- else { >+ unless ( $item ) { > $template->param( error => 'itemnumber' ); > $failed = 1; >- } >- } >- my $issue_id; >- if ( $debit_type eq 'LOST' && $item_id ) { >- my $checkouts = Koha::Checkouts->search( >- { itemnumber => $item_id, borrowernumber => $borrowernumber } ); >- my $checkout = >- $checkouts->count >- ? $checkouts->next >- : Koha::Old::Checkouts->search( >- { itemnumber => $item_id, borrowernumber => $borrowernumber }, >- { order_by => { -desc => 'returndate' }, rows => 1 } >- )->next; >- $issue_id = $checkout ? $checkout->issue_id : undef; >- } >+ } else { >+ $item_id = $item->itemnumber; >+ my $issue_id; >+ if ( $debit_type eq 'LOST' && $item_id ) { >+ my $checkouts = Koha::Checkouts->search( >+ { itemnumber => $item_id, borrowernumber => $borrowernumber } ); >+ my $checkout = >+ $checkouts->count >+ ? $checkouts->next >+ : Koha::Old::Checkouts->search( >+ { itemnumber => $item_id, borrowernumber => $borrowernumber }, >+ { order_by => { -desc => 'returndate' }, rows => 1 } >+ )->next; >+ $issue_id = $checkout ? $checkout->issue_id : undef; >+ } > >- unless ($failed) { >- try { >- $patron->account->add_debit( >- { >- amount => $amount, >- description => $desc, >- note => $note, >- user_id => $logged_in_user->borrowernumber, >- interface => 'intranet', >- library_id => $library_id, >- type => $debit_type, >- item_id => $item_id, >- issue_id => $issue_id >+ try { >+ $patron->account->add_debit( >+ { >+ amount => $amount, >+ description => $desc, >+ note => $note, >+ user_id => $logged_in_user->borrowernumber, >+ interface => 'intranet', >+ library_id => $library_id, >+ type => $debit_type, >+ item_id => $item_id, >+ issue_id => $issue_id >+ } >+ ); >+ >+ if ( C4::Context->preference('AccountAutoReconcile') ) { >+ $patron->account->reconcile_balance; > } >- ); >- >- if ( C4::Context->preference('AccountAutoReconcile') ) { >- $patron->account->reconcile_balance; >+ >+ print $input->redirect( >+ "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber" >+ ); >+ exit; > } >- >- print $input->redirect( >- "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber" >- ); >- exit; >- } >- catch { >- my $error = $_; >- if ( ref($error) eq 'Koha::Exceptions::Object::FKConstraint' ) { >- $template->param( error => $error->broken_fk ); >- } else { >- $template->param( error => '1' ); >+ catch { >+ my $error = $_; >+ if ( ref($error) eq 'Koha::Exceptions::Object::FKConstraint' ) { >+ $template->param( error => $error->broken_fk ); >+ } else { >+ $template->param( error => '1' ); >+ } > } > } > } >-- >2.11.0
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