Fix for Bug 4851 - Batch delete shouldn't show delete button if no items were found
authorOwen Leonard <oleonard@myacpl.org>
Sat, 13 Nov 2010 18:42:35 +0000 (13:42 -0500)
committerChris Nighswonger <chris.nighswonger@gmail.com>
Fri, 3 Dec 2010 00:09:07 +0000 (19:09 -0500)
- Adding template flag to indicate valid results (hidden or not)
 - Clarifying warning messages based on various outcomes

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit e6ebf10bba5d9ebec0f8d9995df16d2eb384f44f)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tmpl
tools/batchMod.pl

index c6f82b9..441f4c5 100644 (file)
@@ -52,7 +52,9 @@
     <!-- TMPL_UNLESS name="action" -->
 
     <!-- TMPL_IF name="notfoundbarcodes" -->
-           <div class="dialog alert"><p>Warning, the following barcodes were not found :</p></div>
+           <div class="dialog alert">
+           <!-- TMPL_IF NAME="itemresults" --><p>Warning, the following barcodes were not found:</p><!-- TMPL_ELSE --><p>Warning: no barcodes were found</p><!-- /TMPL_IF -->
+               </div>
            <table style="margin:auto;">
                <thead>
                    <tr>
@@ -66,7 +68,7 @@
                </tbody>
            </table>
            <!-- TMPL_UNLESS name="too_many_items" -->
-           <h4>The following barcodes were found: </h4>
+           <!-- TMPL_IF name="item_loop" --><h4>The following barcodes were found: </h4><!-- /TMPL_IF -->
            <!-- /TMPL_UNLESS -->
        <!-- /TMPL_IF -->
 
@@ -77,7 +79,7 @@
      <input type="hidden" name="completedJobID" id="completedJobID" value="" />
 
 <!-- TMPL_IF name="item_loop" -->
-       <!-- TMPL_IF NAME="show" --><div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div><!-- TMPL_ELSE --><!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="show" --><div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div><!-- /TMPL_IF -->
        <div id="cataloguing_additem_itemlist">
                <div style="overflow:auto">
                <table id="itemst">
 <!-- /TMPL_IF -->
 
 
-
-       <!-- TMPL_IF name="show" -->
+<!-- TMPL_IF name="show" -->
 
 <!-- TMPL_IF name="too_many_items" -->
-    <p>Too many items (<!-- TMPL_VAR NAME="too_many_items" -->): not displaying each one individually.</p>
+    <p>Too many items (<!-- TMPL_VAR NAME="too_many_items" -->) to display individually.</p>
     <!-- TMPL_LOOP name="itemnumbers_hashref" -->
   <input type="hidden" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber" -->" />
     <!-- /TMPL_LOOP -->
 <!-- /TMPL_IF -->   
 
-
+<!-- TMPL_IF NAME="itemresults" -->
                <div id="cataloguing_additem_newitem">
             <input type="hidden" name="op" value="<!-- TMPL_VAR NAME="op" -->" />
             <p>This will delete <!-- TMPL_IF NAME="too_many_items" -->all the<!-- TMPL_ELSE -->the selected<!-- /TMPL_IF --> items.</p>
                    <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
                    <div id="jobfailed"></div>
                </div>
-               <input type="submit" name="mainformsubmit" value="Delete selected items" onclick="return submitBackgroundJob(this.form);" />
+               <!-- TMPL_IF NAME="too_many_items" --><input type="submit" name="mainformsubmit" value="Delete ALL submitted items" onclick="return submitBackgroundJob(this.form);" /><!-- TMPL_ELSE -->
+               <input type="submit" name="mainformsubmit" value="Delete selected items" onclick="return submitBackgroundJob(this.form);" /><!-- /TMPL_IF -->
+
                <a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a>
            </fieldset>
        </div>
+       <!-- TMPL_ELSE -->
+       <p><a href="/cgi-bin/koha/tools/batchMod.pl?del=1">Return to batch item deletion</a></p>
+       <!-- /TMPL_IF -->
        <!-- /TMPL_IF -->
     <!-- /TMPL_UNLESS -->
 
index 9982e2d..b2007bc 100755 (executable)
@@ -203,6 +203,9 @@ if ($op eq "show"){
 
         }
     }
+
+    # Flag to tell the template there are valid results, hidden or not
+    if(scalar(@itemnumbers) > 0){ $template->param("itemresults" => 1); }
     # Only display the items if there are no more than 1000
     if (scalar(@itemnumbers) <= 1000) {
         $items_display_hashref=BuildItemsData(@itemnumbers);