Bugzilla – Attachment 67070 Details for
Bug 19293
Internal server error when receiving shipment with order with deleted biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19293: Prevent error when receiving shipment with order with deleted biblio
Bug-19293-Prevent-error-when-receiving-shipment-wi.patch (text/plain), 6.49 KB, created by
Aleisha Amohia
on 2017-09-12 05:18:05 UTC
(
hide
)
Description:
Bug 19293: Prevent error when receiving shipment with order with deleted biblio
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-09-12 05:18:05 UTC
Size:
6.49 KB
patch
obsolete
>From 9640e5b29e20d0cc9d573e061a01b544a3bc4e6f Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 12 Sep 2017 05:15:36 +0000 >Subject: [PATCH] Bug 19293: Prevent error when receiving shipment with order > with deleted biblio > >This patch checks if the biblio exists when receiving a shipment, and >will skip the order if the biblio does not exist. > >To test: >1) Find or create a basket >2) Add TWO items to it >3) Find the record for one item in a separate tab, delete the record >4) Notice the order in the basket for that item now says 'deleted bibliographic >record' >5) close the basket and receive the shipment >6) After entering an invoice number and clicking next, you'll see the >error: >Can't call method "subscriptions" on an undefined value at >/home/vagrant/kohaclone/acqui/parcel.pl line 245. >7) Apply the patch and go back to the basket to receive the shipment >8) Put in an invoice number and click next >9) This should now work as expected, skipping the deleted biblio, and >the other item should show as ready to receive > >Sponsored-by: Catalyst IT >--- > acqui/parcel.pl | 88 +++++++++++++++++++++++++++++---------------------------- > 1 file changed, 45 insertions(+), 43 deletions(-) > >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 5c73d97..15c04ea 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -225,50 +225,52 @@ unless( defined $invoice->{closedate} ) { > for (my $i = 0 ; $i < $countpendings ; $i++) { > my $order = $pendingorders->[$i]; > >- if ( $bookseller->invoiceincgst ) { >- $order->{ecost} = $order->{ecost_tax_included}; >- } else { >- $order->{ecost} = $order->{ecost_tax_excluded}; >+ unless( !defined $order->{biblionumber} ){ # if this biblio has been deleted and the orderline hasn't been cancelled >+ if ( $bookseller->invoiceincgst ) { >+ $order->{ecost} = $order->{ecost_tax_included}; >+ } else { >+ $order->{ecost} = $order->{ecost_tax_excluded}; >+ } >+ $order->{total} = $order->{ecost} * $order->{quantity}; >+ >+ my %line = %$order; >+ >+ $line{invoice} = $invoice; >+ $line{booksellerid} = $booksellerid; >+ >+ my $biblionumber = $line{'biblionumber'}; >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $countbiblio = CountBiblioInOrders($biblionumber); >+ my $ordernumber = $line{'ordernumber'}; >+ my $cnt_subscriptions = $biblio->subscriptions->count; >+ my $itemcount = $biblio->items->count; >+ my $holds_count = $biblio->holds->count; >+ my @items = GetItemnumbersFromOrder( $ordernumber ); >+ my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0; >+ >+ my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); >+ $line{suggestionid} = $suggestion->{suggestionid}; >+ $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; >+ $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; >+ >+ # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680 >+ $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($cnt_subscriptions) && !($holds_count); >+ $line{items} = ($itemcount) - (scalar @items); >+ $line{left_item} = 1 if $line{items} >= 1; >+ $line{left_biblio} = 1 if $countbiblio > 1; >+ $line{biblios} = $countbiblio - 1; >+ $line{left_subscription} = 1 if $cnt_subscriptions; >+ $line{subscriptions} = $cnt_subscriptions; >+ $line{left_holds} = ($holds_count >= 1) ? 1 : 0; >+ $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); >+ $line{holds} = $holds_count; >+ $line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; >+ >+ my $budget_name = GetBudgetName( $line{budget_id} ); >+ $line{budget_name} = $budget_name; >+ >+ push @loop_orders, \%line; > } >- $order->{total} = $order->{ecost} * $order->{quantity}; >- >- my %line = %$order; >- >- $line{invoice} = $invoice; >- $line{booksellerid} = $booksellerid; >- >- my $biblionumber = $line{'biblionumber'}; >- my $biblio = Koha::Biblios->find( $biblionumber ); >- my $countbiblio = CountBiblioInOrders($biblionumber); >- my $ordernumber = $line{'ordernumber'}; >- my $cnt_subscriptions = $biblio->subscriptions->count; >- my $itemcount = $biblio->items->count; >- my $holds_count = $biblio->holds->count; >- my @items = GetItemnumbersFromOrder( $ordernumber ); >- my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0; >- >- my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); >- $line{suggestionid} = $suggestion->{suggestionid}; >- $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; >- $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; >- >- # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680 >- $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($cnt_subscriptions) && !($holds_count); >- $line{items} = ($itemcount) - (scalar @items); >- $line{left_item} = 1 if $line{items} >= 1; >- $line{left_biblio} = 1 if $countbiblio > 1; >- $line{biblios} = $countbiblio - 1; >- $line{left_subscription} = 1 if $cnt_subscriptions; >- $line{subscriptions} = $cnt_subscriptions; >- $line{left_holds} = ($holds_count >= 1) ? 1 : 0; >- $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); >- $line{holds} = $holds_count; >- $line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; >- >- my $budget_name = GetBudgetName( $line{budget_id} ); >- $line{budget_name} = $budget_name; >- >- push @loop_orders, \%line; > } > > $template->param( >-- >2.1.4
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 19293
:
67070
|
67127
|
67624
|
67625
|
67839