Lines 473-499
sub get_order_infos {
Link Here
|
473 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
473 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
474 |
my $countbiblio = $biblio->active_orders->count; |
474 |
my $countbiblio = $biblio->active_orders->count; |
475 |
|
475 |
|
476 |
my $ordernumber = $order->{'ordernumber'}; |
476 |
my $ordernumber = $order->{'ordernumber'}; |
477 |
my $cnt_subscriptions = $biblio->subscriptions->count; |
477 |
my $cnt_subscriptions = $biblio->subscriptions->count; |
478 |
my $itemcount = $biblio->items->count; |
478 |
my $itemcount = $biblio->items->count; |
479 |
my $holds_count = $biblio->holds->count; |
479 |
my $holds_count = $biblio->holds->count; |
480 |
my $order = Koha::Acquisition::Orders->find($ordernumber); # FIXME We should certainly do that at the beginning of this sub |
480 |
my $order = Koha::Acquisition::Orders->find($ordernumber); # FIXME We should certainly do that at the beginning of this sub |
481 |
my $items = $order->items; |
481 |
my $items = $order->items; |
|
|
482 |
my $invoice = $order->invoice; |
483 |
|
482 |
my $itemholds = $biblio->holds->search({ itemnumber => { -in => [ $items->get_column('itemnumber') ] } })->count; |
484 |
my $itemholds = $biblio->holds->search({ itemnumber => { -in => [ $items->get_column('itemnumber') ] } })->count; |
483 |
|
485 |
|
484 |
# 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 |
486 |
# 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 |
485 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == $items->count && !($cnt_subscriptions) && !($holds_count); |
487 |
$line{can_del_bib} = 1 |
486 |
$line{items} = $itemcount - $items->count; |
488 |
if $countbiblio <= 1 && $itemcount == $items->count && !($cnt_subscriptions) && !($holds_count); |
487 |
$line{left_item} = 1 if $line{items} >= 1; |
489 |
$line{items} = $itemcount - $items->count; |
488 |
$line{left_biblio} = 1 if $countbiblio > 1; |
490 |
$line{left_item} = 1 if $line{items} >= 1; |
489 |
$line{biblios} = $countbiblio - 1; |
491 |
$line{left_biblio} = 1 if $countbiblio > 1; |
490 |
$line{left_subscription} = 1 if $cnt_subscriptions; |
492 |
$line{biblios} = $countbiblio - 1; |
491 |
$line{subscriptions} = $cnt_subscriptions; |
493 |
$line{left_subscription} = 1 if $cnt_subscriptions; |
492 |
($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0; |
494 |
$line{subscriptions} = $cnt_subscriptions; |
493 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
495 |
( $holds_count >= 1 ) ? $line{left_holds} = 1 : $line{left_holds} = 0; |
494 |
$line{holds} = $holds_count; |
496 |
$line{left_holds_on_order} = 1 if $line{left_holds} == 1 && ( $line{items} == 0 || $itemholds ); |
495 |
$line{holds_on_order} = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order}; |
497 |
$line{holds} = $holds_count; |
496 |
$line{order_object} = $order; |
498 |
$line{holds_on_order} = $itemholds ? $itemholds : $holds_count if $line{left_holds_on_order}; |
|
|
499 |
$line{order_object} = $order; |
500 |
$line{invoice_object} = $invoice; |
501 |
|
497 |
} |
502 |
} |
498 |
|
503 |
|
499 |
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); |
504 |
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); |