Bugzilla – Attachment 62570 Details for
Bug 18467
Error calling count on undefined bib in basket.pl if order cancelled and record deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18467: Handle orders with deleted biblio when viewing a basket
Bug-18467-Handle-orders-with-deleted-biblio-when-v.patch (text/plain), 4.08 KB, created by
Alex Buckley
on 2017-04-22 13:09:01 UTC
(
hide
)
Description:
Bug 18467: Handle orders with deleted biblio when viewing a basket
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-04-22 13:09:01 UTC
Size:
4.08 KB
patch
obsolete
>From 1a94849f7878de5111c79eb894225c044b772f5a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Apr 2017 13:05:47 -0300 >Subject: [PATCH] Bug 18467: Handle orders with deleted biblio when viewing a > basket > >If the bibliographic record of an order has been removed, $order->{bibionumber} >is undefined. We need to handle this specific case correctly. > >To test: >1 - Create a basket >2 - Order a bib >3 - Cancel order and delete record >4 - You cannot view basket >5 - Apply patch >6 - View basket >7 - There should not be an error >r calling count on undefined bib in basket.pl if order cancelled and >record deleted >--- > acqui/basket.pl | 44 +++++++++++++++++++++++--------------------- > 1 file changed, 23 insertions(+), 21 deletions(-) > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index e556be2..55aca4c 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -463,27 +463,29 @@ sub get_order_infos { > } > > my $biblionumber = $order->{'biblionumber'}; >- my $biblio = Koha::Biblios->find( $biblionumber ); >- my $countbiblio = CountBiblioInOrders($biblionumber); >- my $ordernumber = $order->{'ordernumber'}; >- my @subscriptions = GetSubscriptionsId ($biblionumber); >- 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; >- >- # 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 && !(@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 scalar @subscriptions >= 1; >- $line{subscriptions} = scalar @subscriptions; >- ($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 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}; >+ if ( $biblionumber ) { # The biblio still exists >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $countbiblio = CountBiblioInOrders($biblionumber); >+ my $ordernumber = $order->{'ordernumber'}; >+ my @subscriptions = GetSubscriptionsId ($biblionumber); >+ my $itemcount = $biblio->items->count; >+ my $holds_count = $biblio->holds->count; >+ my @items = GetItemnumbersFromOrder( $ordernumber ); >+ my $itemholds = $biblio->holds->search({ itemnumber => { -in => \@items } })->count; >+ >+ # 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 && !(@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 scalar @subscriptions >= 1; >+ $line{subscriptions} = scalar @subscriptions; >+ ($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 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 $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); >-- >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 18467
:
62511
|
62514
|
62537
|
62570
|
62571
|
62654