[open-ils-commits] r13367 - trunk/Open-ILS/web/js/ui/default/actor/user (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jun 10 15:41:13 EDT 2009
Author: erickson
Date: 2009-06-10 15:41:09 -0400 (Wed, 10 Jun 2009)
New Revision: 13367
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
Log:
part 1, duplicate patron searching plugin
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-06-10 16:00:49 UTC (rev 13366)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-06-10 19:41:09 UTC (rev 13367)
@@ -30,6 +30,7 @@
var cgi;
var cloneUser;
+
if(!window.xulG) var xulG = null;
@@ -314,6 +315,24 @@
}
);
return;
+
+ case 'first_given_name':
+ case 'family_name':
+ dojo.connect(widget.widget, 'onChange',
+ function(newVal) { uEditDupeSearch('name', newVal); });
+ return;
+
+ case 'email':
+ dojo.connect(widget.widget, 'onChange',
+ function(newVal) { uEditDupeSearch('email', newVal); });
+ return;
+
+ case 'ident_value':
+ case 'ident_value2':
+ dojo.connect(widget.widget, 'onChange',
+ function(newVal) { uEditDupeSearch('ident', newVal); });
+ return;
+
}
}
@@ -343,6 +362,41 @@
}
}
+function uEditDupeSearch(type, value) {
+ var search;
+ switch(type) {
+
+ case 'name':
+ var fname = findWidget('au', 'first_given_name').widget.attr('value');
+ var lname = findWidget('au', 'family_name').widget.attr('value');
+ if( !(fname && lname) ) return;
+ search = {
+ first_given_name : {value : fname, group : 0},
+ family_name : {value : lname, group : 0},
+ };
+ break;
+
+ case 'email':
+ search = {email : {value : value, group : 0}};
+ break;
+
+ case 'ident':
+ search = {ident : {value : value, group : 2}};
+ break;
+ }
+
+ fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.patron.search.advanced'],
+ { async: true,
+ params: [openils.User.authtoken, search],
+ oncomplete : function(r) {
+ var resp = openils.Util.readResponse(r);
+ console.log(js2JSON(resp));
+ }
+ }
+ );
+}
+
function getByName(node, name) {
return dojo.query('[name='+name+']', node)[0];
}
More information about the open-ils-commits
mailing list