From 33d57aad0d9dd176eaa1ebd98fcda22b5adc7197 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 4 May 2006 13:34:37 +0000 Subject: [PATCH] names now have to start with a letter (no spaces) added magic address fetching git-svn-id: svn://svn.open-ils.org/ILS/trunk@4066 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/ue.js | 13 +++--- .../xul/staff_client/server/patron/ue.xhtml | 16 ++++++-- .../staff_client/server/patron/ue_config.js | 40 +++++++++---------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/ue.js b/Open-ILS/xul/staff_client/server/patron/ue.js index e7c85a60bd..97a06c97bf 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue.js +++ b/Open-ILS/xul/staff_client/server/patron/ue.js @@ -1,5 +1,4 @@ -var cgi = null; -var advanced = false; +/* var SC_FETCH_ALL = 'open-ils.circ:open-ils.circ.stat_cat.actor.retrieve.all'; var SC_CREATE_MAP = 'open-ils.circ:open-ils.circ.stat_cat.actor.user_map.create'; var SV_FETCH_ALL = 'open-ils.circ:open-ils.circ.survey.retrieve.all'; @@ -7,9 +6,12 @@ var FETCH_ID_TYPES = 'open-ils.actor:open-ils.actor.user.ident_types.retrieve'; var FETCH_GROUPS = 'open-ils.actor:open-ils.actor.groups.tree.retrieve'; var UPDATE_PATRON = 'open-ils.actor:open-ils.actor.patron.update'; var defaultState = 'GA'; -var counter = 0; var dataFields; -var patron; +*/ + +var cgi = null; +var patron = null; +var counter = 0; var identTypesCache = {}; var statCatsCache = {}; var surveysCache = {}; @@ -23,10 +25,8 @@ function uEditInit() { cgi = new CGI(); session = cgi.param('ses'); - if(cgi.param('adv')) advanced = true if(!session) throw "User session is not defined"; - fetchUser(session); $('uedit_user').appendChild(text(USER.usrname())); @@ -111,7 +111,6 @@ function uEditCreateNewAddr() { addr.id(uEditVirtualAddrId--); addr.isnew(1); addr.usr(patron.id()); - addr.state(defaultState); addr.country(defaultCountry); if(patron.addresses().length == 0) { patron.mailing_address(addr); diff --git a/Open-ILS/xul/staff_client/server/patron/ue.xhtml b/Open-ILS/xul/staff_client/server/patron/ue.xhtml index b6e6ec21ee..edc5d42ab2 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue.xhtml +++ b/Open-ILS/xul/staff_client/server/patron/ue.xhtml @@ -418,11 +418,17 @@
Label
- +
+
Zip
+ +
+ +
+
Street 1
@@ -448,7 +454,7 @@
County
- +
@@ -456,19 +462,21 @@
State
- +
+
Country
- +
diff --git a/Open-ILS/xul/staff_client/server/patron/ue_config.js b/Open-ILS/xul/staff_client/server/patron/ue_config.js index f544b69d85..b9016c0cb3 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue_config.js +++ b/Open-ILS/xul/staff_client/server/patron/ue_config.js @@ -1,6 +1,5 @@ /* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ - var SC_FETCH_ALL = 'open-ils.circ:open-ils.circ.stat_cat.actor.retrieve.all'; var SC_CREATE_MAP = 'open-ils.circ:open-ils.circ.stat_cat.actor.user_map.create'; var SV_FETCH_ALL = 'open-ils.circ:open-ils.circ.survey.retrieve.all'; @@ -8,6 +7,7 @@ var FETCH_ID_TYPES = 'open-ils.actor:open-ils.actor.user.ident_types.retrieve'; var FETCH_GROUPS = 'open-ils.actor:open-ils.actor.groups.tree.retrieve'; var UPDATE_PATRON = 'open-ils.actor:open-ils.actor.patron.update'; var PATRON_SEARCH = 'open-ils.actor:open-ils.actor.patron.search.advanced'; +var ZIP_SEARCH = 'open-ils.search:open-ils.search.zip'; var defaultState = 'GA'; var defaultCountry = 'USA'; var CSS_INVALID_DATA = 'invalid_value'; @@ -21,7 +21,7 @@ var wordRegex = /^\w+$/; var ssnRegex = /^\d{3}-\d{2}-\d{4}$/; var dlRegex = /^[a-zA-Z]{2}-\w+/; /* driver's license */ var phoneRegex = /\d{3}-\d{3}-\d{4}/; -var nonumRegex = /^\D+$/; +var nonumRegex = /^[a-zA-Z]\D*$/; /* no numbers, no beginning whitespace */ var dateRegex = /^\d{4}-\d{2}-\d{2}/; @@ -85,23 +85,6 @@ function uEditDefineData(patron) { } } }, - - /* - { - required : true, - object : patron, - key : 'first_given_name', - errkey : 'ue_bad_firstname', - widget : { - id : 'ue_firstname', - regex : nonumRegex, - type : 'input', - onblur : function(field) { - uEditCheckNamesDup('first', field ); - } - }, - */ - { required : true, object : patron, @@ -616,7 +599,24 @@ function uEditBuildAddrFields(patron, address) { base : row, name : 'ue_addr_zip', type : 'input', - regex : /^\d{5}$/ + regex : /^\d{5}$/, + onblur : function(f) { + var v = uEditNodeVal(f); + var req = new Request(ZIP_SEARCH, v); + req.callback( + function(r) { + var info = r.getResultObject(); + if(!info) return; + var state = $n(f.widget.base, 'ue_addr_state'); + var county = $n(f.widget.base, 'ue_addr_county'); + var city = $n(f.widget.base, 'ue_addr_city'); + if(!state.value) state.value = info.state; + if(!county.value) county.value = info.county; + if(!city.value) city.value = info.city; + } + ); + req.send(); + } } }, { -- 2.43.2