X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=acqui%2Fparcel.pl;h=5c73d97c081e36529730c6b1a63b333fbc3fae4b;hb=f59484df2246c0ee11c5d44f2dca762908864fe8;hp=fbd376f24ed9d6eff7cfd521d4845b59a6240d3e;hpb=703b97f22d62ac7d25981a0449196fbe5b90aec1;p=koha.git diff --git a/acqui/parcel.pl b/acqui/parcel.pl index fbd376f24e..5c73d97c08 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -28,7 +28,7 @@ parcel.pl =head1 DESCRIPTION This script shows all orders receipt or pending for a given supplier. -It allows to write an order as 'received' when he arrives. +It allows to write an order as 'received' when it arrives. =head1 CGI PARAMETERS @@ -241,17 +241,11 @@ unless( defined $invoice->{closedate} ) { my $biblio = Koha::Biblios->find( $biblionumber ); my $countbiblio = CountBiblioInOrders($biblionumber); my $ordernumber = $line{'ordernumber'}; - my @subscriptions = GetSubscriptionsId ($biblionumber); + my $cnt_subscriptions = $biblio->subscriptions->count; my $itemcount = $biblio->items->count; my $holds_count = $biblio->holds->count; my @items = GetItemnumbersFromOrder( $ordernumber ); - my $itemholds; - foreach my $item (@items){ - my $nb = GetItemHolds($biblionumber, $item); - if ($nb){ - $itemholds += $nb; - } - } + my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0; my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); $line{suggestionid} = $suggestion->{suggestionid}; @@ -259,13 +253,13 @@ 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_count); + $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 scalar @subscriptions >= 1; - $line{subscriptions} = scalar @subscriptions; + $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;