Lines 134-143
if ( $op eq 'delete_confirm' ) {
Link Here
|
134 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
134 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
135 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
135 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
136 |
my $ordernumber = $myorder->{'ordernumber'}; |
136 |
my $ordernumber = $myorder->{'ordernumber'}; |
137 |
my $has_subscriptions = $biblio->subscriptions->count; |
137 |
my $cnt_subscriptions = $biblio->subscriptions->count; |
138 |
my $itemcount = $biblio->items->count; |
138 |
my $itemcount = $biblio->items->count; |
139 |
my $error; |
139 |
my $error; |
140 |
if ($countbiblio == 0 && $itemcount == 0 && not $has_subscriptions ) { |
140 |
if ($countbiblio == 0 && $itemcount == 0 && not $cnt_subscriptions ) { |
141 |
$error = DelBiblio($myorder->{biblionumber}) } |
141 |
$error = DelBiblio($myorder->{biblionumber}) } |
142 |
else { |
142 |
else { |
143 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
143 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
Lines 145-151
if ( $op eq 'delete_confirm' ) {
Link Here
|
145 |
author=> $myorder->{'author'}, |
145 |
author=> $myorder->{'author'}, |
146 |
countbiblio=> $countbiblio, |
146 |
countbiblio=> $countbiblio, |
147 |
itemcount=>$itemcount, |
147 |
itemcount=>$itemcount, |
148 |
subscriptions => $has_subscriptions}; |
148 |
subscriptions => $cnt_subscriptions}; |
149 |
} |
149 |
} |
150 |
if ($error) { |
150 |
if ($error) { |
151 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
151 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
Lines 474-493
sub get_order_infos {
Link Here
|
474 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
474 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
475 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
475 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
476 |
my $ordernumber = $order->{'ordernumber'}; |
476 |
my $ordernumber = $order->{'ordernumber'}; |
477 |
my $has_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 @items = GetItemnumbersFromOrder( $ordernumber ); |
480 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
481 |
my $itemholds = $biblio->holds->search({ itemnumber => { -in => \@items } })->count; |
481 |
my $itemholds = $biblio->holds->search({ itemnumber => { -in => \@items } })->count; |
482 |
|
482 |
|
483 |
# 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 |
483 |
# 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 |
484 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($has_subscriptions) && !($holds_count); |
484 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($cnt_subscriptions) && !($holds_count); |
485 |
$line{items} = ($itemcount) - (scalar @items); |
485 |
$line{items} = ($itemcount) - (scalar @items); |
486 |
$line{left_item} = 1 if $line{items} >= 1; |
486 |
$line{left_item} = 1 if $line{items} >= 1; |
487 |
$line{left_biblio} = 1 if $countbiblio > 1; |
487 |
$line{left_biblio} = 1 if $countbiblio > 1; |
488 |
$line{biblios} = $countbiblio - 1; |
488 |
$line{biblios} = $countbiblio - 1; |
489 |
$line{left_subscription} = 1 if $has_subscriptions; |
489 |
$line{left_subscription} = 1 if $cnt_subscriptions; |
490 |
$line{subscriptions} = $has_subscriptions; |
490 |
$line{subscriptions} = $cnt_subscriptions; |
491 |
($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0; |
491 |
($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0; |
492 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
492 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
493 |
$line{holds} = $holds_count; |
493 |
$line{holds} = $holds_count; |