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;
<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>