Bugzilla – Attachment 95326 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: (follow-up) Handle deleted items
Bug-22393-follow-up-Handle-deleted-items.patch (text/plain), 3.29 KB, created by
Martin Renvoize (ashimema)
on 2019-11-12 14:40:10 UTC
(
hide
)
Description:
Bug 22393: (follow-up) Handle deleted items
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-11-12 14:40:10 UTC
Size:
3.29 KB
patch
obsolete
>From 1c82c600682f92c235e75d1d792fbec9cd194df7 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: (follow-up) Handle deleted items > >--- > members/maninvoice.pl | 53 ++++++++++++++++++++++++++++--------------- > 1 file changed, 35 insertions(+), 18 deletions(-) > >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 6681da4016..05fe86ced7 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -91,35 +91,51 @@ if ($add) { > my $note = $input->param('note'); > my $debit_type = $input->param('type'); > >- # If LOST try to match barcode to Item and then try to match Item + Borrower to an Issue. >+ # If barcode is passed, attempt to find the associated item > my $failed; > my $item_id; >+ my $issue_id; > my $barcode = $input->param('barcode'); > if ($barcode) { >+ my $old_item_id; > my $item = Koha::Items->find( { barcode => $barcode } ); > if ($item) { > $item_id = $item->itemnumber; > } > else { >- $template->param( error => 'itemnumber' ); >- $failed = 1; >+ my $old_itemnumber = $dbh->selectrow_array( >+ "SELECT itemnumber FROM deleted_items WHERE barcode=?", >+ undef, $barcode ); >+ unless ($old_itemnumber) { >+ $template->param( error => 'itemnumber' ); >+ $failed = 1; >+ } >+ } >+ >+ my $issue_id; >+ if ( $debit_type eq 'LOST' && ( $item_id || $old_itemnumber ) ) { >+ my $itemnumber = $item_id // $old_itemnumber; >+ my $checkouts = Koha::Checkouts->search( >+ { >+ itemnumber => $itemnumber, >+ borrowernumber => $borrowernumber >+ } >+ ); >+ my $checkout = >+ $checkouts->count >+ ? $checkouts->next >+ : Koha::Old::Checkouts->search( >+ { >+ itemnumber => $itemnumber, >+ borrowernumber => $borrowernumber >+ }, >+ { order_by => { -desc => 'returndate' }, rows => 1 } >+ )->next; >+ $issue_id = $checkout ? $checkout->issue_id : undef; > } >- } >- 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) { >+ if ( !$failed ) { > try { > $patron->account->add_debit( > { >@@ -148,7 +164,8 @@ if ($add) { > my $error = $_; > if ( ref($error) eq 'Koha::Exceptions::Object::FKConstraint' ) { > $template->param( error => $error->broken_fk ); >- } else { >+ } >+ else { > $template->param( error => '1' ); > } > } >-- >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