From a2cdfaa59cde9cab4ffb72a781efa6ae930d2702 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 7 Jun 2010 20:00:13 +0000 Subject: [PATCH] re-adds the duplicate-barcode check that was lost with the new patron editor. TODO: disable the save buttons when there are form errors git-svn-id: svn://svn.open-ils.org/ILS/trunk@16620 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/actor/user/register.js | 22 +++++++++++++++++++--- .../default/actor/user/register_table.tt2 | 7 ++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 4964d291f..93a21292c 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -601,9 +601,25 @@ function attachWidgetEvents(fmcls, fmfield, widget) { if(fmfield == 'barcode') { dojo.connect(widget.widget, 'onChange', function() { - var un = findWidget('au', 'usrname'); - if(!un.widget.attr('value')) - un.widget.attr('value', this.attr('value')); + var barcode = this.attr('value'); + dojo.addClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden'); + fieldmapper.standardRequest( + ['open-ils.actor', 'open-ils.actor.barcode.exists'], + { + params: [openils.User.authtoken, barcode], + oncomplete : function(r) { + var res = openils.Util.readResponse(r); + if(res) { + dojo.removeClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden'); + } else { + dojo.addClass(dojo.byId('uedit-dupe-barcode-warning'), 'hidden'); + var un = findWidget('au', 'usrname'); + if(!un.widget.attr('value')) + un.widget.attr('value', barcode); + } + } + } + ); } ); return; diff --git a/Open-ILS/web/templates/default/actor/user/register_table.tt2 b/Open-ILS/web/templates/default/actor/user/register_table.tt2 index af67820f2..7f3506a27 100644 --- a/Open-ILS/web/templates/default/actor/user/register_table.tt2 +++ b/Open-ILS/web/templates/default/actor/user/register_table.tt2 @@ -1,7 +1,12 @@ - + + + + -- 2.11.0