From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Mon, 7 Jun 2010 20:00:13 +0000 (+0000) Subject: re-adds the duplicate-barcode check that was lost with the new patron editor. TODO... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a2cdfaa59cde9cab4ffb72a781efa6ae930d2702;p=contrib%2FConifer.git 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 --- 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 4964d291f1..93a21292c3 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 af67820f21..7f3506a273 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 @@ <tbody id='uedit-tbody'> <tr fmclass='ac' fmfield='barcode' required='required'> <td/><td/><td/> - <td><button dojoType='dijit.form.Button' jsId='replaceBarcode'>Replace Barcode</button></td> + <td> + <button dojoType='dijit.form.Button' jsId='replaceBarcode'>Replace Barcode</button> + <span id='uedit-dupe-barcode-warning' style='color:red; font-weight:bold' class='hidden'> + Barcode is already in use + </span> + </td> <td id='uedit-all-barcodes' class='hidden'> <button dojoType='dijit.form.Button' jsId='allCards'>See All</button> </td>