Lines 133-142
if ( $op eq 'delete_confirm' ) {
Link Here
|
133 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
133 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
134 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
134 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
135 |
my $ordernumber = $myorder->{'ordernumber'}; |
135 |
my $ordernumber = $myorder->{'ordernumber'}; |
136 |
my $subscriptions = scalar GetSubscriptionsId ($biblionumber); |
136 |
my $has_subscriptions = $biblio->subscriptions->count; |
137 |
my $itemcount = $biblio->items->count; |
137 |
my $itemcount = $biblio->items->count; |
138 |
my $error; |
138 |
my $error; |
139 |
if ($countbiblio == 0 && $itemcount == 0 && $subscriptions == 0) { |
139 |
if ($countbiblio == 0 && $itemcount == 0 && not $has_subscriptions ) { |
140 |
$error = DelBiblio($myorder->{biblionumber}) } |
140 |
$error = DelBiblio($myorder->{biblionumber}) } |
141 |
else { |
141 |
else { |
142 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
142 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
Lines 144-150
if ( $op eq 'delete_confirm' ) {
Link Here
|
144 |
author=> $myorder->{'author'}, |
144 |
author=> $myorder->{'author'}, |
145 |
countbiblio=> $countbiblio, |
145 |
countbiblio=> $countbiblio, |
146 |
itemcount=>$itemcount, |
146 |
itemcount=>$itemcount, |
147 |
subscriptions=>$subscriptions}; |
147 |
subscriptions => $has_subscriptions}; |
148 |
} |
148 |
} |
149 |
if ($error) { |
149 |
if ($error) { |
150 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
150 |
push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), |
Lines 466-472
sub get_order_infos {
Link Here
|
466 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
466 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
467 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
467 |
my $countbiblio = CountBiblioInOrders($biblionumber); |
468 |
my $ordernumber = $order->{'ordernumber'}; |
468 |
my $ordernumber = $order->{'ordernumber'}; |
469 |
my @subscriptions = GetSubscriptionsId ($biblionumber); |
469 |
my $has_subscriptions = $biblio->subscriptions->count; |
470 |
my $itemcount = $biblio->items->count; |
470 |
my $itemcount = $biblio->items->count; |
471 |
my $holds_count = $biblio->holds->count; |
471 |
my $holds_count = $biblio->holds->count; |
472 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
472 |
my @items = GetItemnumbersFromOrder( $ordernumber ); |
Lines 478-490
sub get_order_infos {
Link Here
|
478 |
} |
478 |
} |
479 |
} |
479 |
} |
480 |
# 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 |
480 |
# 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 |
481 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds_count); |
481 |
$line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !($has_subscriptions) && !($holds_count); |
482 |
$line{items} = ($itemcount) - (scalar @items); |
482 |
$line{items} = ($itemcount) - (scalar @items); |
483 |
$line{left_item} = 1 if $line{items} >= 1; |
483 |
$line{left_item} = 1 if $line{items} >= 1; |
484 |
$line{left_biblio} = 1 if $countbiblio > 1; |
484 |
$line{left_biblio} = 1 if $countbiblio > 1; |
485 |
$line{biblios} = $countbiblio - 1; |
485 |
$line{biblios} = $countbiblio - 1; |
486 |
$line{left_subscription} = 1 if scalar @subscriptions >= 1; |
486 |
$line{left_subscription} = 1 if $has_subscriptions; |
487 |
$line{subscriptions} = scalar @subscriptions; |
487 |
$line{subscriptions} = $has_subscriptions; |
488 |
($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0; |
488 |
($holds_count >= 1) ? $line{left_holds} = 1 : $line{left_holds} = 0; |
489 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
489 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
490 |
$line{holds} = $holds_count; |
490 |
$line{holds} = $holds_count; |