[open-ils-commits] r16620 - in trunk/Open-ILS/web: js/ui/default/actor/user templates/default/actor/user (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Jun 7 16:00:18 EDT 2010


Author: phasefx
Date: 2010-06-07 16:00:13 -0400 (Mon, 07 Jun 2010)
New Revision: 16620

Modified:
   trunk/Open-ILS/web/js/ui/default/actor/user/register.js
   trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2
Log:
re-adds the duplicate-barcode check that was lost with the new patron editor.  TODO: disable the save buttons when there are form errors

Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2010-06-07 19:31:05 UTC (rev 16619)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2010-06-07 20:00:13 UTC (rev 16620)
@@ -601,9 +601,25 @@
         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;

Modified: trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2	2010-06-07 19:31:05 UTC (rev 16619)
+++ trunk/Open-ILS/web/templates/default/actor/user/register_table.tt2	2010-06-07 20:00:13 UTC (rev 16620)
@@ -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>



More information about the open-ils-commits mailing list