[Koha-patches] [PATCH] Bug #2974 Adding category code to BorrowerMandatoryField produced a "The following fields are mandatory: categorycode"

Garry Collum gcollum at gmail.com
Fri May 1 03:54:31 CEST 2009


If you made a column that is implemented by a select box mandatory in
BorrowerMandatoryField, Members.js would throw an error on the first
element.  The original intent of the function was probably to catch
the first option for a drop-down list such as "Salutation" where the
text is blank.  Added code to check for an empty string in the first
element.

You can test this by making salutation (title) mandatory.

Also fixed some typos in some of the comments.  Why?  Because I'm a Librarian.

---
 koha-tmpl/intranet-tmpl/prog/en/js/members.js |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/members.js
b/koha-tmpl/intranet-tmpl/prog/en/js/members.js
index 3798e03..ee05c7a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/members.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/members.js
@@ -109,10 +109,12 @@ function check_form_borrowers(nav){
 				var ref_champ=eval("document.form."+champ_verif[i]);
 				//check if it's a select
 				if (ref_champ.type=='select-one'){
-					if (ref_champ.options[0].selected ){
+					// check to see if first option is selected and is blank
+					if (ref_champ.options[0].selected &&
+					    ref_champ.options[0].text == ''){
 						// action if field is empty
 						message_champ+=champ_verif[i]+"\n";
-						//test to konw if you must show a message with error
+						//test to know if you must show a message with error
 						statut=1;
 					}
 				} else {
@@ -125,7 +127,7 @@ function check_form_borrowers(nav){
 			}
 		}
 	}
-	//patrons form to test if you chcked no to the quetsion of double
+	//patrons form to test if you checked no to the question of double
  	if (statut!=1 && document.form.check_member.value > 0 ) {
 		if (!(document.form_double.answernodouble.checked)){
 			message ="";
-- 
1.5.6.5



More information about the Koha-patches mailing list