this patch disable the button to delete all of items if there is no item 
attached to the marc record.
---
 .../intranet-tmpl/prog/en/includes/cat-toolbar.inc |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc 
b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
index 0b3fcbb..3449e94 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
@@ -29,11 +29,12 @@ function confirm_deletion() {
 
 function confirm_items_deletion() {
         var count = <!-- TMPL_VAR NAME="count" -->;
-        if(confirm(_('Are you sure you want to delete the ' + count + ' 
attached items? '))){
-            
window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&amp;biblionumber=<!--
 TMPL_VAR NAME="biblionumber" -->";
-        }else{
-            return false;
-        }
+        if(count > 0)
+            if(confirm(_('Are you sure you want to delete the ' + count + ' 
attached items? '))){
+                
window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&amp;biblionumber=<!--
 TMPL_VAR NAME="biblionumber" -->";
+            }else{
+                return false;
+            }
 }
 
        // prepare DOM for YUI Toolbar
@@ -65,7 +66,7 @@ function confirm_items_deletion() {
                { text: _("Edit Items"), url: 
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" -->" },
                { text: _("Edit as New (Duplicate)"), url: 
"/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR 
NAME="biblionumber" -->&amp;frameworkcode=&amp;op=duplicate" },
                        { text: _("Delete Record"), onclick: {fn: 
confirm_deletion }<!-- TMPL_IF NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> 
},
-            { text: _("Delete all Items"), onclick: {fn: 
confirm_items_deletion } }
+            { text: _("Delete all Items"), onclick: {fn: 
confirm_items_deletion }<!-- TMPL_UNLESS NAME="count" -->,id:'disabled'<!-- 
/TMPL_IF --> }
            ];
                
                var savemenu = [
-- 
1.5.6.3

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to