From 2fd3e8a20e73f78bb1f997fbdd120dea4f24a3b8 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 15 Nov 2012 12:49:05 -0500 Subject: [PATCH] Make the "state" field in registration a togglable YAOUS Some countries do not use "State" therefore we need to create a YAOUS to make it non-required/displaying. This also requires that we no longer force a "not null" on state in actor.usr_address. Signed-off-by: Michael Peters Signed-off-by: Pasi Kallinen Signed-off-by: Ben Shum --- Open-ILS/src/sql/Pg/005.schema.actors.sql | 2 +- .../XXXX.state_field_required_toggle.sql | 69 +++++++++++++++++++ .../templates/actor/user/register_table.tt2 | 2 +- .../web/js/ui/default/actor/user/register.js | 5 +- 4 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.state_field_required_toggle.sql diff --git a/Open-ILS/src/sql/Pg/005.schema.actors.sql b/Open-ILS/src/sql/Pg/005.schema.actors.sql index 8d63430acf..f27af046f9 100644 --- a/Open-ILS/src/sql/Pg/005.schema.actors.sql +++ b/Open-ILS/src/sql/Pg/005.schema.actors.sql @@ -564,7 +564,7 @@ CREATE TABLE actor.usr_address ( street2 TEXT, city TEXT NOT NULL, county TEXT, - state TEXT NOT NULL, + state TEXT, country TEXT NOT NULL, post_code TEXT NOT NULL, pending BOOL NOT NULL DEFAULT FALSE, diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.state_field_required_toggle.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.state_field_required_toggle.sql new file mode 100644 index 0000000000..82892314f5 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.state_field_required_toggle.sql @@ -0,0 +1,69 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +-- state can no longer be a "not null" +ALTER TABLE actor.usr_address ALTER COLUMN state DROP NOT NULL; + +-- create new YAOUS +INSERT into config.org_unit_setting_type + (name, grp, label, description, datatype) + VALUES ( + 'ui.patron.edit.au.state.require', + 'gui', + oils_i18n_gettext( + 'ui.patron.edit.au.state.require', + 'Require State on registration', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'ui.patron.edit.au.state.require', + 'Require the State field to be filled when registering or editing a patron.', + 'coust', + 'description' + ), + 'bool' + ); + +INSERT into config.org_unit_setting_type + (name, grp, label, description, datatype) + VALUES ( + 'ui.patron.edit.au.state.show', + 'gui', + oils_i18n_gettext( + 'ui.patron.edit.au.state.show', + 'Show State on registration', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'ui.patron.edit.au.state.show', + 'Show the state field when registering or editing a patron.', + 'coust', + 'description' + ), + 'bool' + ); + +INSERT into config.org_unit_setting_type + (name, grp, label, description, datatype) + VALUES ( + 'ui.patron.edit.au.state.suggest', + 'gui', + oils_i18n_gettext( + 'ui.patron.edit.au.state.suggest', + 'Suggest State on registration', + 'coust', + 'label' + ), + oils_i18n_gettext( + 'ui.patron.edit.au.state.suggest', + 'Suggest filling the state field when registering or editing a patron.', + 'coust', + 'description' + ), + 'bool' + ); + +COMMIT; diff --git a/Open-ILS/src/templates/actor/user/register_table.tt2 b/Open-ILS/src/templates/actor/user/register_table.tt2 index f9bdf90aa0..ba3f246a8c 100644 --- a/Open-ILS/src/templates/actor/user/register_table.tt2 +++ b/Open-ILS/src/templates/actor/user/register_table.tt2 @@ -91,7 +91,7 @@ - + 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 eee55693ba..810ab3a82e 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -189,7 +189,10 @@ function load() { 'ui.patron.edit.default_suggested', 'opac.barcode_regex', 'opac.username_regex', - 'sms.enable' + 'sms.enable', + 'ui.patron.edit.au.state.require', + 'ui.patron.edit.au.state.suggest', + 'ui.patron.edit.au.state.show' ]); for(k in orgSettings) -- 2.43.2