[Patches] [PATCH] Added check for 0 as a list name - bug 4158

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Wed Dec 21 03:13:02 NZDT 2011


From: Duncan Tyler <duncan at catalyst.net.nz>
Date: Tue, 20 Dec 2011 15:48:54 +1300
Subject: [PATCH] Added check for 0 as a list name - bug 4158

---
 .../prog/en/modules/virtualshelves/shelves.tt      |    9 +++++++--
 .../opac-tmpl/prog/en/modules/opac-shelves.tt      |    4 +++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
index b432020..5e9c175 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
@@ -94,14 +94,19 @@ function placeHold () {
       function Check(f) {
 		var _alertString="";
 		var alertString2;
+		
+	    if($("#addshelf").val() == "0"){
+		alert("The number 0 is not a valid name for a list, please enter another name.");
+	    }
 
-	    if($("#shelfname").val() == ""){
+	    if($("#addshelf").val() == ""){
 			_alertString += _("- You must enter a List Name") + "\n";
 		}
 
 		if (_alertString.length==0) {
             f.submit();
-		} else {
+		}
+		else {
 			alertString2 = _("Form not submitted because of the following problem(s)");
 			alertString2 += "\n------------------------------------------------------------------------------------\n\n";
 			alertString2 += _alertString;
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
index 391037f..abf78b4 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
@@ -121,7 +121,9 @@ $(function() {
 	    if(f.addshelf.value.length ==0){
 			_alertString += _("- You must enter a List Name") + "\n";
 		}
-
+	    else if(f.addshelf.value == "0"){
+		alert("The number '0' is not a valid name for a list, please enter another name.");
+	    }
 		if (_alertString.length==0) {
 			f.submit();
 		} else {
-- 
1.7.5.4




More information about the Patches mailing list