Bugzilla – Attachment 98663 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.92 KB, created by
Martin Renvoize
on 2020-02-10 15:13:39 UTC
(
hide
)
Description:
Bug 22393: (follow-up) Handle deleted items
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2020-02-10 15:13:39 UTC
Size:
3.92 KB
patch
obsolete
>From 5cfe4c4fe858a1f6c48d76300f967aacca4eb94a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 10 Feb 2020 15:11:54 +0000 >Subject: [PATCH] Bug 22393: (follow-up) Handle deleted items > >This patch adds fallback handling to looking items in the old items >table if they're not found in the items table. >--- > members/maninvoice.pl | 57 ++++++++++++++++++++++++++----------------- > 1 file changed, 35 insertions(+), 22 deletions(-) > >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 665bcbbf73..8e03b36214 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -84,16 +84,17 @@ if ($add) { > } > ); > >- # Note: If the logged in user is not allowed to see this patron an invoice can be forced >- # Here we are trusting librarians not to hack the system >+# Note: If the logged in user is not allowed to see this patron an invoice can be forced >+# Here we are trusting librarians not to hack the system > my $desc = $input->param('desc'); > my $amount = $input->param('amount'); > 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 $item = Koha::Items->find( { barcode => $barcode } ); >@@ -101,22 +102,35 @@ if ($add) { > $item_id = $item->itemnumber; > } > else { >- $template->param( error => 'itemnumber' ); >- $failed = 1; >+ $item = Koha::Old::Items->find( { barcode => $barcode } ); >+ if ($item) { >+ $item_id = $item->itemnumber; >+ } >+ else { >+ $template->param( error => 'itemnumber' ); >+ $failed = 1; >+ } >+ } >+ >+ 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; > } >- } >- 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) { >@@ -139,16 +153,15 @@ if ($add) { > $patron->account->reconcile_balance; > } > >- print $input->redirect( >- "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber" >- ); >+ 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 { >+ } >+ 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