diff --git a/acqui/basket.pl b/acqui/basket.pl index 03e5d0667e..6833eb6512 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -118,14 +118,32 @@ if ( $op eq 'delete_confirm' ) { } # if $delbiblio = 1, delete the records if possible if ((defined $delbiblio)and ($delbiblio ==1)){ + my @cannotdelbiblios ; foreach my $myorder (@orders){ my $biblionumber = $myorder->{'biblionumber'}; my $countbiblio = CountBiblioInOrders($biblionumber); my $ordernumber = $myorder->{'ordernumber'}; - my @subscriptions = GetSubscriptionsId ($biblionumber); + my $subscriptions = scalar GetSubscriptionsId ($biblionumber); my $itemcount = GetItemsCount($biblionumber); - DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions)); + my $error; + if ($countbiblio == 0 && $itemcount == 0 && $subscriptions == 0) { + $error = DelBiblio($myorder->{biblionumber}) } + else { + push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), + title=> $myorder->{'title'}, + author=> $myorder->{'author'}, + countbiblio=> $countbiblio, + itemcount=>$itemcount, + subscriptions=>$subscriptions}; + } + if ($error) { + push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}), + title=> $myorder->{'title'}, + author=> $myorder->{'author'}, + othererror=> $error}; + } } + $template->param( cannotdelbiblios => \@cannotdelbiblios ); } # delete the basket DelBasket($basketno,); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 23b94d9919..3e1975362a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -211,11 +211,11 @@
Warning:
All orders of this basket will be cancelled and used funds will be refunded.
If items have been created when ordering or receiving, they will be deleted.
-You can choose to delete records if possible (if they don't have any item attached, any subscription and are not used in any other order).
+You can choose to delete records if possible (records with some items, used in a subscription, or an other order will not be deleted).
[% END %] @@ -236,7 +236,27 @@ [% ELSE %] [% IF ( delete_confirmed ) %]Warning:
+The following records could not be deleted:
+