Make the "state" field in registration a togglable YAOUS
authorMichael Peters <mrpeters@library.in.gov>
Thu, 15 Nov 2012 17:49:05 +0000 (12:49 -0500)
committerBen Shum <bshum@biblio.org>
Fri, 7 Jun 2013 20:18:24 +0000 (16:18 -0400)
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 <mrpeters@library.in.gov>
Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.state_field_required_toggle.sql [new file with mode: 0644]
Open-ILS/src/templates/actor/user/register_table.tt2
Open-ILS/web/js/ui/default/actor/user/register.js

index 8d63430..f27af04 100644 (file)
@@ -564,7 +564,7 @@ CREATE TABLE actor.usr_address (
        street2                 TEXT,
        city                    TEXT    NOT NULL,
        county                  TEXT,
        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,
        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 (file)
index 0000000..8289231
--- /dev/null
@@ -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;
index f9bdf90..ba3f246 100644 (file)
@@ -91,7 +91,7 @@
     <tr fmclass='aua' fmfield='street2' type='addr-template' required='show'/>
     <tr fmclass='aua' fmfield='city' type='addr-template' required='required'/>
     <tr fmclass='aua' fmfield='county' type='addr-template' required='show'/>
     <tr fmclass='aua' fmfield='street2' type='addr-template' required='show'/>
     <tr fmclass='aua' fmfield='city' type='addr-template' required='required'/>
     <tr fmclass='aua' fmfield='county' type='addr-template' required='show'/>
-    <tr fmclass='aua' fmfield='state' type='addr-template' required='required'/>
+    <tr fmclass='aua' fmfield='state' type='addr-template'/>
     <tr fmclass='aua' fmfield='country' type='addr-template' required='required'/>
     <tr fmclass='aua' fmfield='valid' type='addr-template' required='show'/>
     <tr fmclass='aua' fmfield='within_city_limits' type='addr-template' required='show'/>
     <tr fmclass='aua' fmfield='country' type='addr-template' required='required'/>
     <tr fmclass='aua' fmfield='valid' type='addr-template' required='show'/>
     <tr fmclass='aua' fmfield='within_city_limits' type='addr-template' required='show'/>
index eee5569..810ab3a 100644 (file)
@@ -189,7 +189,10 @@ function load() {
         'ui.patron.edit.default_suggested',
         'opac.barcode_regex',
         'opac.username_regex',
         '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)
     ]);
 
     for(k in orgSettings)