From cf090f3f503264616e91c980c34ed79a4caf1ad2 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 8 Aug 2006 21:27:54 +0000 Subject: [PATCH] dob no longer required, added dup barcode checking git-svn-id: svn://svn.open-ils.org/ILS/trunk@5377 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/ue.xhtml | 4 +++ .../xul/staff_client/server/patron/ue_config.js | 30 ++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/ue.xhtml b/Open-ILS/xul/staff_client/server/patron/ue.xhtml index 21a4b8128e..aed9828c48 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue.xhtml +++ b/Open-ILS/xul/staff_client/server/patron/ue.xhtml @@ -966,6 +966,10 @@ The selected username is in use by another user. Please choose a different username. + + The selected barcode is in use by another user. + Please choose a different barcode. + Are you sure you wish to cancel this editing session? Canceling will destroy any unsaved changes you have made thus far to the user. 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 a4749bf592..07abee73fe 100644 --- a/Open-ILS/xul/staff_client/server/patron/ue_config.js +++ b/Open-ILS/xul/staff_client/server/patron/ue_config.js @@ -12,6 +12,7 @@ const ZIP_SEARCH = 'open-ils.search:open-ils.search.zip'; const FETCH_ADDR_MEMS = 'open-ils.actor:open-ils.actor.address.members'; const FETCH_GRP_MEMS = 'open-ils.actor:open-ils.actor.usergroup.members.retrieve'; const CREATE_USER_NOTE = 'open-ils.actor:open-ils.actor.note.create'; +const CHECK_BARCODE = 'open-ils.actor:open-ils.actor.barcode.exists'; const defaultState = 'GA'; const defaultCountry = 'USA'; const defaultNetAccess = 'None'; @@ -71,6 +72,30 @@ function uEditUsrnameBlur(field) { } +function uEditBarcodeBlur(field) { + var barcode = uEditNodeVal(field); + if(!barcode) return; + var req = new Request(CHECK_BARCODE, SESSION, barcode); + req.callback( + function(r) { + var res = r.getResultObject(); + if( res && res != patron.id() ) { + field.widget.onblur = null; /* prevent alert storm */ + alertId('ue_dup_barcode'); + field.widget.onblur = uEditBarcodeBlur; + setTimeout( + function() { + field.widget.node.focus(); + field.widget.node.select(); + }, 10 + ); + } + } + ); + req.send(); +} + + function uEditDefineData(patron) { var fields = [ @@ -82,7 +107,8 @@ function uEditDefineData(patron) { widget : { id : 'ue_barcode', regex : wordRegex, - type : 'input' + type : 'input', + onblur : uEditBarcodeBlur } }, { @@ -184,7 +210,7 @@ function uEditDefineData(patron) { } }, { - required : true, + required : false, object : patron, key : 'dob', errkey : 'ue_bad_dob', -- 2.11.0