[Patches] [PATCH] Bug 7225 - "Delete all items" should be greyed out when a

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Sat Dec 3 14:15:27 NZDT 2011


From: Owen Leonard <oleonard at myacpl.org>
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 <chrisc at catalyst.net.nz>
---
 .../intranet-tmpl/prog/en/includes/cat-toolbar.inc |    5 ++++-
 1 files changed, 4 insertions(+), 1 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 6c7ffae..4b54c40 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({
-- 
1.7.5.4


More information about the Patches mailing list