From 3d41f80786ccf388c2550d908ffe7a873918ffad Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 24 Sep 2009 06:25:15 +0000 Subject: [PATCH] Org unit setting for whether to obscure the Date of Birth field. If true, this will set the column visibility for Date of Birth in patron lists to false by default (though a Saved Columns state can specify otherwise), and it will also obscure the value in the patron summary sidebar, making it say unless the field label is clicked. git-svn-id: svn://svn.open-ils.org/ILS/trunk@14143 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 7 ++++++- .../src/sql/Pg/upgrade/0020.org-setting-obscure-dob.sql | 13 +++++++++++++ Open-ILS/xul/staff_client/server/patron/info_group.xul | 3 ++- Open-ILS/xul/staff_client/server/patron/search_result.js | 3 ++- Open-ILS/xul/staff_client/server/patron/summary.js | 9 +++++++-- 6 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0020.org-setting-obscure-dob.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index ba82fbe842..b16c97f19f 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0019'); -- mck9 +INSERT INTO config.upgrade_log (version) VALUES ('0020'); -- phasefx CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 5e294637c6..b97ee0e506 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1825,7 +1825,12 @@ INSERT into config.org_unit_setting_type ( 'circ.max_patron_claim_return_count', 'Max Patron Claims Returned Count', 'When this count is exceeded, a staff override is required to mark the item as claims returned', - 'integer' ); + 'integer' ), + +( 'circ.obscure_dob', + 'Obscure the Date of Birth field', + 'When true, the Date of Birth column in patron lists will default to Not Visible, and in the Patron Summary sidebar the value will display as unless the field label is clicked.', + 'bool' ); -- Org_unit_setting_type(s) that need an fm_class: INSERT into config.org_unit_setting_type diff --git a/Open-ILS/src/sql/Pg/upgrade/0020.org-setting-obscure-dob.sql b/Open-ILS/src/sql/Pg/upgrade/0020.org-setting-obscure-dob.sql new file mode 100644 index 0000000000..e2bf9e3bf2 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0020.org-setting-obscure-dob.sql @@ -0,0 +1,13 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0020'); + +INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES ( + 'circ.obscure_dob', + 'Obscure the Date of Birth field', + 'When true, the Date of Birth column in patron lists will default to Not Visible, and in the Patron Summary sidebar the value will display as unless the field label is clicked.', + 'bool' +); + +COMMIT; + diff --git a/Open-ILS/xul/staff_client/server/patron/info_group.xul b/Open-ILS/xul/staff_client/server/patron/info_group.xul index ced297f4fb..cf02250ce7 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_group.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_group.xul @@ -64,6 +64,7 @@ function tree_init() { JSAN.use('OpenILS.data'); g.OpenILS = {}; g.OpenILS.data = new OpenILS.data(); g.OpenILS.data.init({'via':'stash'}); + var obscure_dob = String( g.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true'; JSAN.use('util.list'); g.list = new util.list('patron_list'); @@ -75,7 +76,7 @@ 'family_name' : { 'hidden' : 'false' }, 'first_given_name' : { 'hidden' : 'false' }, 'second_given_name' : { 'hidden' : 'false' }, - 'dob' : { 'hidden' : 'false' }, + 'dob' : { 'hidden' : obscure_dob }, 'master_account' : { 'hidden' : 'false' }, } ); diff --git a/Open-ILS/xul/staff_client/server/patron/search_result.js b/Open-ILS/xul/staff_client/server/patron/search_result.js index 9f304d67ca..89c59d4a74 100644 --- a/Open-ILS/xul/staff_client/server/patron/search_result.js +++ b/Open-ILS/xul/staff_client/server/patron/search_result.js @@ -24,6 +24,7 @@ patron.search_result.prototype = { JSAN.use('OpenILS.data'); this.OpenILS = {}; obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'}); + var obscure_dob = String( obj.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true'; JSAN.use('util.list'); obj.list = new util.list('patron_list'); @@ -35,7 +36,7 @@ patron.search_result.prototype = { 'family_name' : { 'hidden' : 'false' }, 'first_given_name' : { 'hidden' : 'false' }, 'second_given_name' : { 'hidden' : 'false' }, - 'dob' : { 'hidden' : 'false' } + 'dob' : { 'hidden' : obscure_dob } }, { 'except_these' : [ diff --git a/Open-ILS/xul/staff_client/server/patron/summary.js b/Open-ILS/xul/staff_client/server/patron/summary.js index d326a44b50..ae8c6db9c0 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.js +++ b/Open-ILS/xul/staff_client/server/patron/summary.js @@ -28,6 +28,7 @@ patron.summary.prototype = { JSAN.use('OpenILS.data'); this.OpenILS = {}; obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'}); + var obscure_dob = String( obj.OpenILS.data.hash.aous['circ.obscure_dob'] ) == 'true'; JSAN.use('util.controller'); obj.controller = new util.controller(); obj.controller.init( @@ -318,7 +319,7 @@ patron.summary.prototype = { function(e) { return function() { var hide_value = e.getAttribute('hide_value'); - if ( hide_value == 'true' ) { + if ( obscure_dob && hide_value == 'true' ) { e.setAttribute( 'hidden_value', obj.patron.dob() ? obj.patron.dob().substr(0,10) : @@ -340,7 +341,11 @@ patron.summary.prototype = { var x = document.getElementById('PatronSummaryContact_date_of_birth_label'); if (x) { var click_to_hide_dob = x.getAttribute('click_to_hide_dob'); - if (click_to_hide_dob == 'true') { + if (!obscure_dob || click_to_hide_dob != 'true') { + removeCSSClass(x,'click_link'); + } + if (obscure_dob && click_to_hide_dob == 'true') { + addCSSClass(x,'click_link'); x.onclick = function() { hide_value = e.getAttribute('hide_value'); e.setAttribute('hide_value', hide_value == 'true' ? 'false' : 'true'); -- 2.11.0