@@ -, +, @@ - adds a more detailed message describing the consequences of deletion - give the choice of also deleting biblio records if possible - an order from a new record A - an order from a record B which has already an item - an order from a record C used in a subscription - an order from a record D used in an other order - an order from a new record A - an order from a record B which has already an item - an order from a record C used in a subscription - an order from a record D used in an other order --- acqui/basket.pl | 24 +++++++++++- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 40 +++++++++++++------- 2 files changed, 49 insertions(+), 15 deletions(-) --- a/acqui/basket.pl +++ a/acqui/basket.pl @@ -97,7 +97,27 @@ $template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2'; if ( $op eq 'delete_confirm' ) { my $basketno = $query->param('basketno'); - DelBasket($basketno); + my $delbiblio = $query->param('delbiblio'); + my @orders = GetOrders($basketno); +#Delete all orders included in that basket, and all items received. + foreach my $myorder (@orders){ + DelOrder($myorder->{biblionumber},$myorder->{ordernumber}); + warn "suppression de ".$myorder->{biblionumber}.' '.$myorder->{ordernumber}; + } +# if $delbiblio = 1, delete the records if possible + if ((defined $delbiblio)and ($delbiblio ==1)){ + foreach my $myorder (@orders){ + my $biblionumber = $myorder->{'biblionumber'}; + my $countbiblio = CountBiblioInOrders($biblionumber); + my $ordernumber = $myorder->{'ordernumber'}; + my @subscriptions = GetSubscriptionsId ($biblionumber); + my $itemcount = GetItemsCount($biblionumber); + DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions)); + warn "suppression de la notice ".$myorder->{biblionumber}}; + } + + # delete the basket + DelBasket($basketno,); $template->param( delete_confirmed => 1 ); } elsif ( !$bookseller ) { $template->param( NO_BOOKSELLER => 1 ); @@ -399,7 +419,7 @@ sub get_order_infos { if ($nb){ $itemholds += $nb; } - } + } # 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 $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds); $line{items} = ($itemcount) - (scalar @items); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -43,12 +43,11 @@ window.location = "[% script_name %]?op=close&basketno=[% basketno %]"; } } - function confirm_deletion() { - var is_confirmed = confirm(_("Are you sure you want to delete this basket?")); - if (is_confirmed) { - window.location = "[% script_name %]?op=delete_confirm&basketno=[% basketno %]&booksellerid=[% booksellerid %]"; - } + + function delete_basket(basketno,booksellerid,delbiblio) { + window.location = "[% script_name %]?op=delete_confirm&delbiblio="+delbiblio+"&basketno="+basketno+"&booksellerid="+booksellerid; } + function confirm_delete_item(ordernumber, biblionumber) { var is_confirmed = confirm(_("Are you sure you want to delete this order ?")); if (is_confirmed) { @@ -112,11 +111,7 @@ } ) ); var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, { "sPaginationType": "four_button" - } ) ); - $("#delbasketbutton").on("click",function(e){ - e.preventDefault(); - confirm_deletion(); - }); + } ) ); $("#reopenbutton").on("click",function(e){ e.preventDefault(); confirm_reopen(); @@ -147,8 +142,8 @@
Add to basket
Edit basket
-
Delete this basket
- [% IF ( unclosable ) %] +
Delete this basket
+ [% IF ( unclosable ) %] [% ELSIF ( uncertainprices ) %]
Uncertain prices
[% ELSE %] @@ -157,8 +152,27 @@
[% END %]
Export this basket as CSV
- + + + [% ELSE %] [% UNLESS ( grouped ) %]
--