From edc503b788fd587b014932b0b2fbaf44b295d170 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 21 Jul 2017 14:50:17 -0400 Subject: [PATCH] LP#1695029 Patron reg. supports bool opt-in defaults Support default values for boolean user opt-in settings during patron registration. A default value of True, true, T, or t (or really anything starting with a 't') is treated as true. Any other value (including null) means false. Signed-off-by: Bill Erickson Signed-off-by: Josh Stompro Signed-off-by: Jason Etheridge --- Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 0ec59dfb9d..92c4a5f97a 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -516,8 +516,14 @@ angular.module('egCoreMod') // apply default user setting values angular.forEach(setting_types, function(stype, index) { if (stype.reg_default() != undefined) { - service.user_settings[stype.name()] = - Boolean(stype.reg_default()); + var val = stype.reg_default(); + if (stype.datatype() == 'bool') { + // A boolean user setting type whose default + // value starts with t/T is considered 'true', + // false otherwise. + val = Boolean((val+'').match(/^t/i)); + } + service.user_settings[stype.name()] = val; } }); } -- 2.43.2