[open-ils-commits] r13579 - in trunk/Open-ILS/web: js/dojo/openils js/dojo/openils/actor js/dojo/openils/actor/nls js/ui/default/actor/user templates/default/actor/user (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jul 13 15:12:36 EDT 2009
Author: erickson
Date: 2009-07-13 15:12:33 -0400 (Mon, 13 Jul 2009)
New Revision: 13579
Added:
trunk/Open-ILS/web/js/dojo/openils/actor/
trunk/Open-ILS/web/js/dojo/openils/actor/nls/
trunk/Open-ILS/web/js/dojo/openils/actor/nls/register.js
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
trunk/Open-ILS/web/templates/default/actor/user/register.tt2
Log:
added duplicate phone / address searching. added and started using locale strings bundle
Added: trunk/Open-ILS/web/js/dojo/openils/actor/nls/register.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/actor/nls/register.js (rev 0)
+++ trunk/Open-ILS/web/js/dojo/openils/actor/nls/register.js 2009-07-13 19:12:33 UTC (rev 13579)
@@ -0,0 +1,7 @@
+{
+ DUPE_PATRON_NAME : 'Found ${0} patron(s) with the same name',
+ DUPE_PATRON_EMAIL : 'Found ${0} patron(s) with the same email address',
+ DUPE_PATRON_IDENT : 'Found ${0} patron(s) with the same identification',
+ DUPE_PATRON_PHONE : 'Found ${0} patron(s) with the same phone number',
+ DUPE_PATRON_ADDR : 'Found ${0} patron(s) with the same address'
+}
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-07-13 18:03:45 UTC (rev 13578)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-07-13 19:12:33 UTC (rev 13579)
@@ -12,6 +12,10 @@
dojo.require('openils.CGI');
dojo.require('openils.XUL');
+dojo.requireLocalization('openils.actor', 'register');
+var localeStrings = dojo.i18n.getLocalization('openils.actor', 'register');
+
+
var pcrud;
var fmClasses = ['au', 'ac', 'aua', 'actsc', 'asv', 'asvq', 'asva'];
var fieldDoc = {};
@@ -333,6 +337,13 @@
function(newVal) { uEditDupeSearch('ident', newVal); });
return;
+ case 'day_phone':
+ case 'evening_phone':
+ case 'other_phone':
+ dojo.connect(widget.widget, 'onChange',
+ function(newVal) { uEditDupeSearch('phone', newVal); });
+ return;
+
}
}
@@ -347,6 +358,7 @@
params: [e],
oncomplete : function(r) {
var res = openils.Util.readResponse(r);
+ if(!res) return;
var callback = function(w) { return w._addr == widget._addr; };
if(res.city) findWidget('aua', 'city', callback).widget.attr('value', res.city);
if(res.state) findWidget('aua', 'state', callback).widget.attr('value', res.state);
@@ -358,6 +370,24 @@
}
);
return;
+
+ case 'street1':
+ case 'street2':
+ case 'city':
+ dojo.connect(widget.widget, 'onChange',
+ function(e) {
+ var callback = function(w) { return w._addr == widget._addr; };
+ var args = {
+ street1 : findWidget('aua', 'street1', callback).widget.attr('value'),
+ street2 : findWidget('aua', 'street2', callback).widget.attr('value'),
+ city : findWidget('aua', 'city', callback).widget.attr('value'),
+ post_code : findWidget('aua', 'post_code', callback).widget.attr('value')
+ };
+ if(args.street1 && args.city && args.post_code)
+ uEditDupeSearch('address', args);
+ }
+ );
+ return;
}
}
}
@@ -386,32 +416,60 @@
openils.Util.hide('uedit-dupe-ident-link');
search = {ident : {value : value, group : 2}};
break;
+
+ case 'phone':
+ openils.Util.hide('uedit-dupe-phone-link');
+ search = {phone : {value : value, group : 2}};
+ break;
+
+ case 'address':
+ openils.Util.hide('uedit-dupe-address-link');
+ search = {};
+ dojo.forEach(['street1', 'street2', 'city', 'post_code'],
+ function(field) {
+ if(value[field])
+ search[field] = {value : value[field], group: 1};
+ }
+ );
+ break;
}
+ // find possible duplicate patrons
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);
+ resp = resp.filter(function(id) { return (id != patron.id()); });
if(resp && resp.length > 0) {
+
openils.Util.hide('uedit-help-div');
openils.Util.show('uedit-dupe-div');
var link;
+
switch(type) {
case 'name':
link = dojo.byId('uedit-dupe-names-link');
- link.innerHTML = 'Found ' + resp.length + ' patrons with the same name';
+ link.innerHTML = dojo.string.substitute(localeStrings.DUPE_PATRON_NAME, [resp.length]);
break;
case 'email':
link = dojo.byId('uedit-dupe-email-link');
- link.innerHTML = 'Found ' + resp.length + ' patrons with the same email';
+ link.innerHTML = dojo.string.substitute(localeStrings.DUPE_PATRON_EMAIL, [resp.length]);
break;
case 'ident':
link = dojo.byId('uedit-dupe-ident-link');
- link.innerHTML = 'Found ' + resp.length + ' patrosn with the same identification';
+ link.innerHTML = dojo.string.substitute(localeStrings.DUPE_PATRON_IDENT, [resp.length]);
break;
+ case 'phone':
+ link = dojo.byId('uedit-dupe-phone-link');
+ link.innerHTML = dojo.string.substitute(localeStrings.DUPE_PATRON_PHONE, [resp.length]);
+ break;
+ case 'address':
+ link = dojo.byId('uedit-dupe-address-link');
+ link.innerHTML = dojo.string.substitute(localeStrings.DUPE_PATRON_ADDR, [resp.length]);
+ break;
}
openils.Util.show(link);
Modified: trunk/Open-ILS/web/templates/default/actor/user/register.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2009-07-13 18:03:45 UTC (rev 13578)
+++ trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2009-07-13 19:12:33 UTC (rev 13579)
@@ -184,6 +184,8 @@
<div><a href='javascript:void(0);' id='uedit-dupe-names-link'></a></div>
<div><a href='javascript:void(0);' id='uedit-dupe-email-link'></a></div>
<div><a href='javascript:void(0);' id='uedit-dupe-ident-link'></a></div>
+ <div><a href='javascript:void(0);' id='uedit-dupe-phone-link'></a></div>
+ <div><a href='javascript:void(0);' id='uedit-dupe-address-link'></a></div>
</div>
[% END %]
More information about the open-ils-commits
mailing list