From 5c24ce01d42811fb010b53971d2735c17862cbf2 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 27 Feb 2006 20:40:15 +0000 Subject: [PATCH] removed some more field requirements and fixed a bug with the ident_type2 git-svn-id: svn://svn.open-ils.org/ILS/trunk@3204 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/server/patron/user_editor.js | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/user_editor.js b/Open-ILS/xul/staff_client/server/patron/user_editor.js index eea8a30d6e..6102972fd9 100644 --- a/Open-ILS/xul/staff_client/server/patron/user_editor.js +++ b/Open-ILS/xul/staff_client/server/patron/user_editor.js @@ -659,9 +659,9 @@ function uEditAddBasicPatronInfo(patron) { function uEditAddPhones(patron) { - /* verifies the phone numbers are formatted correctly */ var verify = function(n1, n2, n3) { + if(!(a || p||s) ) return null; var a = n1.value; var p = n2.value; var s = n3.value; @@ -669,26 +669,20 @@ function uEditAddPhones(patron) { return a + '-' + p + '-' + s; } - var er = 'ue_bad_phone' - uEditSetVal( patron, "day_phone", - verify($('ue_day_phone_area'), - $('ue_day_phone_prefix'), - $('ue_day_phone_suffix')), 'phone', er ); - - uEditSetVal( patron, "evening_phone", - verify($('ue_night_phone_area'), - $('ue_night_phone_prefix'), - $('ue_night_phone_suffix')), 'phone', er ); - - if( $('ue_other_phone_prefix').value ) { - uEditSetVal( patron, "other_phone", - verify($('ue_other_phone_area'), - $('ue_other_phone_prefix'), - $('ue_other_phone_suffix')), 'phone', er ); - } + var r1 = verify($('ue_day_phone_area'), $('ue_day_phone_prefix'),$('ue_day_phone_suffix')); + var r2 = verify($('ue_night_phone_area'), $('ue_night_phone_prefix'),$('ue_night_phone_suffix')); + var r3 = verify($('ue_other_phone_area'), $('ue_other_phone_prefix'),$('ue_other_phone_suffix')); + + if(r1 != null) + uEditSetVal( patron, "day_phone", r1, 'phone', er); + + if(r2 != null) + uEditSetVal( patron, "evening_phone", r2, 'phone', er); + if(r3 != null) + uEditSetVal( patron, "other_phone", r3, 'phone', er); } function uEditFleshCard(card) { @@ -709,13 +703,16 @@ function uEditAddIdents(patron) { uEditSetVal( patron, "ident_type", getSelectorVal($('ue_primary_ident_type')), 'isnum', err ); + uEditSetVal( patron, "ident_value", $('ue_primary_ident'), null, err ); - - uEditSetVal( patron, "ident_value", - $('ue_primary_ident'), null, err ); - - patron.ident_type2(getSelectorVal($('ue_secondary_ident_type'))); - patron.ident_value2($('ue_secondary_ident').value); + var val = getSelectorVal($('ue_secondary_ident_type')); + if( val && val.match(/^\d+$/) ) { + patron.ident_type2(getSelectorVal($('ue_secondary_ident_type'))); + patron.ident_value2($('ue_secondary_ident').value); + } else { + patron.ident_type2(null); + patron.ident_value2(null); + } } -- 2.43.2