From: Michael Peters Date: Thu, 15 Nov 2012 17:49:05 +0000 (-0500) Subject: Make the "state" field in registration a togglable YAOUS X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2fd3e8a20e73f78bb1f997fbdd120dea4f24a3b8;p=evergreen%2Fpines.git 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 --- 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)