Lines 68-73
use C4::Suggestions;
Link Here
|
68 |
use C4::Reserves qw/GetReservesFromBiblionumber/; |
68 |
use C4::Reserves qw/GetReservesFromBiblionumber/; |
69 |
|
69 |
|
70 |
use Koha::Acquisition::Bookseller; |
70 |
use Koha::Acquisition::Bookseller; |
|
|
71 |
use Koha::Biblios; |
71 |
use Koha::DateUtils; |
72 |
use Koha::DateUtils; |
72 |
|
73 |
|
73 |
use JSON; |
74 |
use JSON; |
Lines 239-249
unless( defined $invoice->{closedate} ) {
Link Here
|
239 |
$line{booksellerid} = $booksellerid; |
240 |
$line{booksellerid} = $booksellerid; |
240 |
|
241 |
|
241 |
my $biblionumber = $line{'biblionumber'}; |
242 |
my $biblionumber = $line{'biblionumber'}; |
|
|
243 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
242 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
244 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
243 |
my $ordernumber = $line{'ordernumber'}; |
245 |
my $ordernumber = $line{'ordernumber'}; |
244 |
my @subscriptions = GetSubscriptionsId ($biblionumber); |
246 |
my @subscriptions = GetSubscriptionsId ($biblionumber); |
245 |
my $itemcount = GetItemsCount($biblionumber); |
247 |
my $itemcount = GetItemsCount($biblionumber); |
246 |
my $holds = GetHolds ($biblionumber); |
248 |
my $holds_count = $biblio->holds->count; |
247 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
249 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
248 |
my $itemholds; |
250 |
my $itemholds; |
249 |
foreach my $item (@items){ |
251 |
foreach my $item (@items){ |
Lines 259-275
unless( defined $invoice->{closedate} ) {
Link Here
|
259 |
$line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; |
261 |
$line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; |
260 |
|
262 |
|
261 |
# 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 |
263 |
# 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 |
262 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds); |
264 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds_count); |
263 |
$line{items} = ($itemcount) - (scalar @items); |
265 |
$line{items} = ($itemcount) - (scalar @items); |
264 |
$line{left_item} = 1 if $line{items} >= 1; |
266 |
$line{left_item} = 1 if $line{items} >= 1; |
265 |
$line{left_biblio} = 1 if $countbiblio > 1; |
267 |
$line{left_biblio} = 1 if $countbiblio > 1; |
266 |
$line{biblios} = $countbiblio - 1; |
268 |
$line{biblios} = $countbiblio - 1; |
267 |
$line{left_subscription} = 1 if scalar @subscriptions >= 1; |
269 |
$line{left_subscription} = 1 if scalar @subscriptions >= 1; |
268 |
$line{subscriptions} = scalar @subscriptions; |
270 |
$line{subscriptions} = scalar @subscriptions; |
269 |
$line{left_holds} = ($holds >= 1) ? 1 : 0; |
271 |
$line{left_holds} = ($holds_count >= 1) ? 1 : 0; |
270 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
272 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
271 |
$line{holds} = $holds; |
273 |
$line{holds} = $holds_count; |
272 |
$line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; |
274 |
$line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; |
273 |
|
275 |
|
274 |
my $budget_name = GetBudgetName( $line{budget_id} ); |
276 |
my $budget_name = GetBudgetName( $line{budget_id} ); |
275 |
$line{budget_name} = $budget_name; |
277 |
$line{budget_name} = $budget_name; |
276 |
- |
|
|