From 8b9fcc742658837eef1dd063bda2215835cd144a Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 8 Sep 2010 18:10:15 +0000 Subject: [PATCH] org unit settings for default ident type and default country for new users and new addresses in patron editor git-svn-id: svn://svn.open-ils.org/ILS/trunk@17517 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 | 34 ++++++++++++++++++++ ....data.org-setting-ui.patron.editor_defaults.sql | 36 ++++++++++++++++++++++ Open-ILS/web/js/ui/default/actor/user/register.js | 8 +++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 1ae8bdb12..e22dd35d0 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0387'); -- gmc +INSERT INTO config.upgrade_log (version) VALUES ('0388'); -- 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 00db4cb58..e3bbc1013 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -6869,3 +6869,37 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) 'bool' ); +-- 0388.data.org-setting-ui.patron.editor_defaults.sql + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, fm_class ) VALUES ( + 'ui.patron.default_ident_type', + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'GUI: Default Ident Type for Patron Registration', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'This is the default Ident Type for new users in the patron editor.', + 'coust', + 'description'), + 'link', + 'cit' +); + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES ( + 'ui.patron.default_country', + oils_i18n_gettext( + 'ui.patron.default_country', + 'GUI: Default Country for New Addresses in Patron Editor', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_country', + 'This is the default Country for new addresses in the patron editor.', + 'coust', + 'description'), + 'string' +); + + diff --git a/Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql b/Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql new file mode 100644 index 000000000..b291be9af --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0388.data.org-setting-ui.patron.editor_defaults.sql @@ -0,0 +1,36 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0388'); -- phasefx + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, fm_class ) VALUES ( + 'ui.patron.default_ident_type', + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'GUI: Default Ident Type for Patron Registration', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_ident_type', + 'This is the default Ident Type for new users in the patron editor.', + 'coust', + 'description'), + 'link', + 'cit' +); + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES ( + 'ui.patron.default_country', + oils_i18n_gettext( + 'ui.patron.default_country', + 'GUI: Default Country for New Addresses in Patron Editor', + 'coust', + 'label'), + oils_i18n_gettext( + 'ui.patron.default_country', + 'This is the default Country for new addresses in the patron editor.', + 'coust', + 'description'), + 'string' +); + +COMMIT; diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 44bb3f118..4004dd0bd 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -82,6 +82,8 @@ function load() { 'global.juvenile_age_threshold', 'patron.password.use_phone', 'ui.patron.default_inet_access_level', + 'ui.patron.default_ident_type', + 'ui.patron.default_country', 'circ.holds.behind_desk_pickup_supported', 'circ.patron_edit.clone.copy_address' ]); @@ -1003,6 +1005,7 @@ function uEditNewPatron() { patron.card(card); patron.cards([card]); patron.net_access_level(orgSettings['ui.patron.default_inet_access_level'] || 1); + patron.ident_type(orgSettings['ui.patron.default_ident_type']); patron.stat_cat_entries([]); patron.survey_responses([]); patron.addresses([]); @@ -1060,6 +1063,7 @@ function _uEditSave(doClone) { addr.id(w._addr); addr.isnew(1); addr.usr(patron.id()); + addr.country(orgSettings['ui.patron.default_country']); var t = patron.addresses(); if (!t) { t = []; } t.push(addr); @@ -1208,6 +1212,10 @@ function uEditNewAddr(evt, id, mkLinks) { if(id < 0 && row.getAttribute('fmfield') == 'valid') widget.widget.attr('value', true); + // make new addresses use the org setting for default country + if(id < 0 && row.getAttribute('fmfield') == 'country') + widget.widget.attr('value',orgSettings['ui.patron.default_country']); + } else if(row.getAttribute('name') == 'uedit-addr-pending-row') { // if it's a pending address, show the 'approve' button -- 2.11.0