Bug 7225 - "Delete all items" should be greyed out when a title has no items github/bug_7225 origin/new/bug_7225
authorOwen Leonard <oleonard@myacpl.org>
Tue, 15 Nov 2011 17:01:19 +0000 (12:01 -0500)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 6 Dec 2011 16:07:57 +0000 (17:07 +0100)
This patch changes the catalog toolbar so that when there are no
items attached to a record the "Delete all items" menu item appears
to be disabled. Clicking it will trigger an alert, "This record
has no items."

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc

index 6c7ffae..4b54c40 100644 (file)
@@ -55,6 +55,9 @@ function confirm_items_deletion() {
             }else{
                 return false;
             }
+               } else {
+                       alert(_("This record has no items."));
+                       return false;
                }
 }
 [% END %]
@@ -102,7 +105,7 @@ function confirm_items_deletion() {
                [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&amp;frameworkcode=&amp;op=duplicate" },[% END %]
                        [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Replace Record via Z39.50"), onclick: {fn: PopupZ3950 } },[% END %]
                        [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Delete Record"), onclick: {fn: confirm_deletion }[% IF ( count ) %],id:'disabled'[% END %] },[% END %]
-               [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } }[% END %]
+               [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Delete all Items"), onclick: {fn: confirm_items_deletion }[% UNLESS ( count ) %],id:'disabled'[% END %] }[% END %]
            ];
                if(editmenu.length){
                        new YAHOO.widget.Button({