[Koha-patches] [PATCH] bug 4929 - add validation to patron administration

Robin Sheat robin at catalyst.net.nz
Wed Jul 7 06:43:30 CEST 2010


This validation requires an enrollment period or a date to be provided
before the form will save, which will prevent invalid dates getting into
the system.
---
 .../prog/en/modules/admin/categorie.tmpl           |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl
index 2c1f022..db66f34 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tmpl
@@ -60,16 +60,20 @@
 			_alertString += _("- upperagelimit is not a number") + "\n";
 				
 		}
+                if(!(ff.enrolmentperioddate.value || ff.enrolmentperiod.value)) {
+                    ok=1;
+                    _alertString += _("- either Enrollment period or Until date must be provided") + "\n";
+                }
 		if(ff.enrolmentperioddate.value && ff.enrolmentperiod.value){
 			document.getElementById('enrolmentmessage').className = "error";
 			return false;
 		}
 		
 		if (ok) { // if there is a problem
-			alert(_alertString);
-             return false;
-        }
-        // if all is good
+		    alert(_alertString);
+                    return false;
+                }
+                // if all is good
 		ff.submit();
 	}
 	//]]>
-- 
1.7.0.4



More information about the Koha-patches mailing list