X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=acqui%2Fparcel.pl;h=32498ea1a35b536ee73c451444079f6cfe340d63;hb=2f07f7b48eab65f8dbd84f50993e388aff907594;hp=65be1051235da9c9dc5ee6c3b1fa86cec51a3841;hpb=6475f83189f2565173a8deb6b1afd363b84a7607;p=koha.git diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 65be105123..32498ea1a3 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -68,6 +68,7 @@ use C4::Suggestions; use C4::Reserves qw/GetReservesFromBiblionumber/; use Koha::Acquisition::Bookseller; +use Koha::Biblios; use Koha::DateUtils; use JSON; @@ -235,11 +236,12 @@ unless( defined $invoice->{closedate} ) { $line{booksellerid} = $booksellerid; my $biblionumber = $line{'biblionumber'}; + my $biblio = Koha::Biblios->find( $biblionumber ); my $countbiblio = CountBiblioInOrders($biblionumber); my $ordernumber = $line{'ordernumber'}; my @subscriptions = GetSubscriptionsId ($biblionumber); my $itemcount = GetItemsCount($biblionumber); - my $holds = GetHolds ($biblionumber); + my $holds_count = $biblio->holds->count; my @items = GetItemnumbersFromOrder( $ordernumber ); my $itemholds; foreach my $item (@items){ @@ -255,17 +257,17 @@ unless( defined $invoice->{closedate} ) { $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 && !(@subscriptions) && !($holds); + $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; - $line{left_holds} = ($holds >= 1) ? 1 : 0; + $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; - $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; + $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;