Bug 7791: (follow-up) tidy up some cruft in the main patch
authorMathieu Saby <mathieu.saby@univ-rennes2.fr>
Thu, 19 Sep 2013 08:57:44 +0000 (10:57 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 2 Dec 2013 16:07:28 +0000 (16:07 +0000)
This patch
- delete warns
- add a missing }
- add a condition in template of avoiding asking to delete orders or
  records if the basket is empty

To test :
1. Make the same tests as defined in test plan of main patch. It should
   behave the same way
2. Try to delete a basket with no records inside. You will only have a
   "Delete basket" button, with fewer warnings

Signed-off-by: Cedric Vita <cedric.vita@dracenie.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
acqui/basket.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt

index df37788..03e5d06 100755 (executable)
@@ -115,7 +115,6 @@ if ( $op eq 'delete_confirm' ) {
 #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)){
@@ -126,9 +125,8 @@ if ( $op eq 'delete_confirm' ) {
             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 );
index 057ab51..23b94d9 100644 (file)
                     [% END %]
                         <div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
                 </div>
-            <!-- Modal for confirm deletion box-->
+<!-- Modal for confirm deletion box-->
                 <div class="modal hide" id="deleteBasketModal" tabindex="-1" role="dialog" aria-labelledby="delbasketModalLabel" aria-hidden="true">
                     <div class="modal-header">
                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
                         <h3>Confirm deletion</h3>
                     </div>
-                    <div class="modal-body">
-                       <p>Are you sure you want to delete this basket?</p>
-                       <p>Warning:</p>
-                       <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
-                       <p>If items have been created at ordering or receipt stage, they will be deleted.</p>
-                       <p>You can choose to delete records if possible (if they don't have any item attached, any subscription and any other order).</p>
-                    </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
-                        <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket and orders</button>
-                        <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
-                    </div>
+                    [% UNLESS book_foot_loop.size > 0 %]
+                        <div class="modal-body">
+                           <p>Are you sure you want to delete this basket?</p>
+                        </div>
+                        <div class="modal-footer">
+                            <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
+                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket</button>
+                        </div>
+                    [% ELSE %]
+                        <div class="modal-body">
+                           <p>Are you sure you want to delete this basket?</p>
+                           <p>Warning:</p>
+                           <p>All orders of this basket will be cancelled and used funds will be refunded.</p>
+                           <p>If items have been created when ordering or receiving, they will be deleted.</p>
+                           <p>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).</p>
+                        </div>
+                        <div class="modal-footer">
+                            <button type="button" class="btn btn-primary" data-dismiss="modal">Cancel</button>
+                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],0); return false;" >Delete basket and orders</button>
+                            <button type="submit" class="btn btn-default" onclick="delete_basket([% basketno %],[% booksellerid %],1); return false;">Delete basket, orders and records</button>
+                        </div>
+                    [% END %]
                 </div>
-            <!-- End of Modal-->
+<!-- End of Modal-->
             [% ELSE %]
                 [% UNLESS ( grouped ) %]
                 <div id="toolbar" class="btn-toolbar">