From 3be1252e1bab40bd43821e66e2cfc69471e24132 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 15 Nov 2011 12:01:19 -0500 Subject: [PATCH] Bug 7225 - "Delete all items" should be greyed out when a title has no items 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 Signed-off-by: Paul Poulain --- koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 6c7ffaeb82..4b54c40daa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -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 %]&frameworkcode=&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({ -- 2.39.5