[open-ils-commits] r11458 - trunk/Open-ILS/xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 8 19:15:26 EST 2008
Author: erickson
Date: 2008-12-08 19:15:25 -0500 (Mon, 08 Dec 2008)
New Revision: 11458
Modified:
trunk/Open-ILS/xul/staff_client/server/patron/ue.js
trunk/Open-ILS/xul/staff_client/server/patron/ue_config.js
Log:
use the org setting for juvenile age threshold if present. only hide the juvenile note field if the user not a juvenile and there is no data already present in the field
Modified: trunk/Open-ILS/xul/staff_client/server/patron/ue.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/ue.js 2008-12-08 23:14:38 UTC (rev 11457)
+++ trunk/Open-ILS/xul/staff_client/server/patron/ue.js 2008-12-09 00:15:25 UTC (rev 11458)
@@ -10,6 +10,7 @@
var userCache = {};
var groupsCache = {};
var netLevelsCache = {};
+var orgSettings = [];
//var guardianNote = null;
if(!window.xulG) var xulG = null;
@@ -140,6 +141,8 @@
if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
patron = fetchFleshedUser(usr);
if(!patron) patron = uEditNewPatron();
+
+ orgSettings = fetchBatchOrgSetting(USER.ws_ou(), ['global.juvenile_age_threshold']);
uEditDraw(
uEditFetchIdentTypes(),
Modified: trunk/Open-ILS/xul/staff_client/server/patron/ue_config.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/ue_config.js 2008-12-08 23:14:38 UTC (rev 11457)
+++ trunk/Open-ILS/xul/staff_client/server/patron/ue_config.js 2008-12-09 00:15:25 UTC (rev 11458)
@@ -19,8 +19,8 @@
const defaultNetLevel = 1;
const CSS_INVALID_DATA = 'invalid_value';
-// XXX Should become an org unit setting XXX
-const ADULT_AGE = 18;
+// if no org setting exists
+const DEFAULT_ADULT_AGE = '18 years';
//const GUARDIAN_NOTE = 'SYSTEM: Parent/Guardian';
@@ -1060,21 +1060,21 @@
}
var base = new Date();
- base.setYear( today.getYear() + 1900 - ADULT_AGE );
+ var age = orgSettings['global.juvenile_age_threshold'].value || DEFAULT_ADULT_AGE;
+ base.setTime(base.getTime() - Number(interval_to_seconds(age) + '000'));
- /* patron is at least 18 */
-
var f = uEditFindFieldByKey('ident_value2');
+ unHideMe(f.widget.node.parentNode.parentNode.parentNode);
if( dob < base ) { /* patron is of age */
f.required = false;
- hideMe(f.widget.node.parentNode.parentNode.parentNode);
+ if(!uEditNodeVal(f))
+ hideMe(f.widget.node.parentNode.parentNode.parentNode);
return;
}
uEditFindFieldByKey('juvenile').widget.node.checked = true;
- unHideMe(f.widget.node.parentNode.parentNode.parentNode);
f.required = true;
uEditCheckErrors();
}
More information about the open-ils-commits
mailing list