[Koha-patches] [PATCH] Fix for Bug 4851 - Batch delete shouldn't show delete button if no items were found
Owen Leonard
oleonard at myacpl.org
Tue Jul 20 18:00:16 CEST 2010
- Adding template flag to indicate valid results (hidden or not)
- Clarifying warning messages based on various outcomes
---
.../prog/en/modules/tools/batchMod-del.tmpl | 22 ++++++++++++-------
tools/batchMod.pl | 2 +
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tmpl
index c6f82b9..441f4c5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tmpl
@@ -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">
@@ -111,17 +113,16 @@
<!-- /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>
@@ -131,10 +132,15 @@
<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 -->
diff --git a/tools/batchMod.pl b/tools/batchMod.pl
index f5138d1..1f4b519 100755
--- a/tools/batchMod.pl
+++ b/tools/batchMod.pl
@@ -209,6 +209,8 @@ 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);
--
1.7.0.4
More information about the Koha-patches
mailing list