[open-ils-commits] [GIT] Evergreen ILS branch master updated. 894694aee327ae0700ea3ef84190497675ec9bff

Evergreen Git git at git.evergreen-ils.org
Tue Nov 27 00:36:39 EST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  894694aee327ae0700ea3ef84190497675ec9bff (commit)
       via  fa363a9d3917a7f6dba48cf5c91e125decd6d8d9 (commit)
       via  0456d89acfc9b0fc7c4928d3c0c74996d5085655 (commit)
      from  df53ab3462ff5a93d628aa6b95525e148700da7d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 894694aee327ae0700ea3ef84190497675ec9bff
Author: Jason Etheridge <jason at EquinoxInitiative.org>
Date:   Tue Nov 27 00:34:44 2018 -0500

    LP#1714070 Stamping upgrade script
    
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index b50f39d..fa9a8bb 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1138', :eg_version); -- rhamby/berick/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1139', :eg_version); -- berick/kmlussier/phasefx
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron-guardian.sql b/Open-ILS/src/sql/Pg/upgrade/1139.schema.patron-guardian.sql
similarity index 98%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron-guardian.sql
rename to Open-ILS/src/sql/Pg/upgrade/1139.schema.patron-guardian.sql
index c63e1ce..06c12e7 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron-guardian.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1139.schema.patron-guardian.sql
@@ -1,6 +1,8 @@
 
 BEGIN;
 
+SELECT evergreen.upgrade_deps_block_check('1139', :eg_version);
+
 ALTER TABLE actor.usr ADD COLUMN guardian TEXT;
 
 CREATE INDEX actor_usr_guardian_idx 

commit fa363a9d3917a7f6dba48cf5c91e125decd6d8d9
Author: Bill Erickson <berickxx at gmail.com>
Date:   Sun Oct 28 10:10:12 2018 -0400

    LP#1714070 Parent/guardian field release notes
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/patron-guardian-field.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/patron-guardian-field.adoc
new file mode 100644
index 0000000..c629214
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Circulation/patron-guardian-field.adoc
@@ -0,0 +1,52 @@
+Patron Parent/Guardian Field
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Patrons now have a new dedicated parent/guardian field.  This field is 
+editable in the patron edit interface, displays in the patron
+summary side bar on the browser client, and is search-able from the
+patron search interface in the browser client.
+
+Patron Editor
++++++++++++++
+
+In addition to the standard "show" and "suggest" visibility settings, 
+the new guardian field comes with a library setting 
+'ui.patron.edit.guardian_required_for_juv' ("GUI: Juvenile account 
+requires parent/guardian").  When this setting is applied, a value 
+will be required in the patron editor when the juvenile flag is active.
+
+Upgrade Notes
++++++++++++++
+
+Sites who traditionally store parent/guardian information in the
+patron 'Secondary Identification' field can migrate values from this
+field to the new guardian field with the following SQL:
+
+[source,sql]
+-------------------------------------------------------------------------
+BEGIN;
+
+-- 1. Find the local ID of the parent/guardian identification type
+
+SELECT * FROM config.identification_type;
+
+-- 2. On my test system, the id is "101".  It will vary!.
+-- Migrate the value from the ident2 field to the guardian field.
+
+UPDATE actor.usr 
+    SET guardian = ident_value2 
+WHERE 
+    ident_type2 = 101 -- !! CHANGE TO SUIT
+    AND ident_value2 IS NOT NULL 
+    AND ident_value2 <> '';
+
+-- 3. delete the original secondary identification data
+
+UPDATE actor.usr 
+    SET ident_value2 = NULL, ident_type2 = NULL
+WHERE
+    ident_type2 = 101; -- !! CHANGE TO SUIT
+
+COMMIT;
+-------------------------------------------------------------------------
+

commit 0456d89acfc9b0fc7c4928d3c0c74996d5085655
Author: Bill Erickson <berickxx at gmail.com>
Date:   Sun Oct 21 20:10:19 2018 -0400

    LP#1714070 Patron parent/guardian field
    
    Adds a new dedicated patron parent/guardian field.  This field is
    editable in the patron edit interface, displays in the patron summary
    side bar on the browser client, and is search-able from the patron
    search interface in the browser client.
    
    Adds patron editor "show" and "suggest" library settings.
    
    Also adds a new library setting
    'ui.patron.edit.guardian_required_for_juv' ("GUI: Juvenile account
    requires parent/guardian").  When this setting is applied, a value
    will be required in the patron editor when the juvenile flag is active.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index c883f47..1be2c88 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -3648,6 +3648,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Preferred Middle Name" name="pref_second_given_name" reporter:datatype="text"/>
 			<field reporter:label="Preferred Last Name" name="pref_family_name"  reporter:datatype="text"/>
 			<field reporter:label="Preferred Suffix" name="pref_suffix" reporter:datatype="text"/>
+			<field reporter:label="Parent/Guardian" name="guardian" reporter:datatype="text"/>
 			<field reporter:label="Name Keywords" name="name_keywords" reporter:datatype="text"/>
 			<field reporter:label="Additional Permission Groups" name="groups" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Is Deleted" name="deleted" reporter:datatype="bool"/>
diff --git a/Open-ILS/src/sql/Pg/005.schema.actors.sql b/Open-ILS/src/sql/Pg/005.schema.actors.sql
index 61d5bae..c387967 100644
--- a/Open-ILS/src/sql/Pg/005.schema.actors.sql
+++ b/Open-ILS/src/sql/Pg/005.schema.actors.sql
@@ -42,6 +42,7 @@ CREATE TABLE actor.usr (
 	second_given_name	TEXT,
 	family_name		TEXT				NOT NULL,
 	suffix			TEXT,
+    guardian        TEXT,
     pref_prefix TEXT,
     pref_first_given_name TEXT,
     pref_second_given_name TEXT,
@@ -93,6 +94,8 @@ CREATE INDEX actor_usr_first_given_name_unaccent_idx ON actor.usr (evergreen.una
 CREATE INDEX actor_usr_second_given_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(second_given_name));
 CREATE INDEX actor_usr_family_name_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(family_name));
 CREATE INDEX actor_usr_usrname_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(usrname));
+CREATE INDEX actor_usr_guardian_idx ON actor.usr (evergreen.lowercase(guardian));
+CREATE INDEX actor_usr_guardian_unaccent_idx ON actor.usr (evergreen.unaccent_and_squash(guardian));
 
 CREATE INDEX actor_usr_pref_first_given_name_idx ON actor.usr (evergreen.lowercase(pref_first_given_name));
 CREATE INDEX actor_usr_pref_second_given_name_idx ON actor.usr (evergreen.lowercase(pref_second_given_name));
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 949021b..e83dc04 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -19414,4 +19414,46 @@ VALUES (
 );
 
 
+INSERT into config.org_unit_setting_type (name, label, description, datatype) 
+VALUES ( 
+    'ui.patron.edit.au.guardian.show',
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.show', 
+        'GUI: Show guardian field on patron registration', 
+        'coust', 'label'
+    ),
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.show', 
+        'The guardian field will be shown on the patron registration screen. Showing a field makes it appear with required fields even when not required. If the field is required this setting is ignored.', 
+        'coust', 'description'
+    ),
+    'bool'
+), (
+    'ui.patron.edit.au.guardian.suggest',
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.suggest', 
+        'GUI: Suggest guardian field on patron registration', 
+        'coust', 'label'
+    ),
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.suggest', 
+        'The guardian field will be suggested on the patron registration screen. Suggesting a field makes it appear when suggested fields are shown. If the field is shown or required this setting is ignored.', 
+        'coust', 'description'),
+    'bool'
+), (
+    'ui.patron.edit.guardian_required_for_juv',
+    oils_i18n_gettext(
+        'ui.patron.edit.guardian_required_for_juv',
+        'GUI: Juvenile account requires parent/guardian',
+        'coust', 'label'
+    ),
+    oils_i18n_gettext(
+        'ui.patron.edit.guardian_required_for_juv',
+        'Require a value for the parent/guardian field in the patron editor for patrons marked as juvenile',
+        'coust', 'description'),
+    'bool'
+);
+
+
+
 
diff --git a/Open-ILS/src/sql/Pg/999.functions.global.sql b/Open-ILS/src/sql/Pg/999.functions.global.sql
index 661ba4f..388d10b 100644
--- a/Open-ILS/src/sql/Pg/999.functions.global.sql
+++ b/Open-ILS/src/sql/Pg/999.functions.global.sql
@@ -831,6 +831,7 @@ BEGIN
 			family_name = new_name,
 			suffix = NULL,
 			alias = NULL,
+            guardian = NULL,
 			day_phone = NULL,
 			evening_phone = NULL,
 			other_phone = NULL,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron-guardian.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron-guardian.sql
new file mode 100644
index 0000000..c63e1ce
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron-guardian.sql
@@ -0,0 +1,171 @@
+
+BEGIN;
+
+ALTER TABLE actor.usr ADD COLUMN guardian TEXT;
+
+CREATE INDEX actor_usr_guardian_idx 
+    ON actor.usr (evergreen.lowercase(guardian));
+CREATE INDEX actor_usr_guardian_unaccent_idx 
+    ON actor.usr (evergreen.unaccent_and_squash(guardian));
+
+-- Modify auditor tables accordingly.
+SELECT auditor.update_auditors();
+
+-- clear the guardian field on delete
+CREATE OR REPLACE FUNCTION actor.usr_delete(
+	src_usr  IN INTEGER,
+	dest_usr IN INTEGER
+) RETURNS VOID AS $$
+DECLARE
+	old_profile actor.usr.profile%type;
+	old_home_ou actor.usr.home_ou%type;
+	new_profile actor.usr.profile%type;
+	new_home_ou actor.usr.home_ou%type;
+	new_name    text;
+	new_dob     actor.usr.dob%type;
+BEGIN
+	SELECT
+		id || '-PURGED-' || now(),
+		profile,
+		home_ou,
+		dob
+	INTO
+		new_name,
+		old_profile,
+		old_home_ou,
+		new_dob
+	FROM
+		actor.usr
+	WHERE
+		id = src_usr;
+	--
+	-- Quit if no such user
+	--
+	IF old_profile IS NULL THEN
+		RETURN;
+	END IF;
+	--
+	perform actor.usr_purge_data( src_usr, dest_usr );
+	--
+	-- Find the root grp_tree and the root org_unit.  This would be simpler if we 
+	-- could assume that there is only one root.  Theoretically, someday, maybe,
+	-- there could be multiple roots, so we take extra trouble to get the right ones.
+	--
+	SELECT
+		id
+	INTO
+		new_profile
+	FROM
+		permission.grp_ancestors( old_profile )
+	WHERE
+		parent is null;
+	--
+	SELECT
+		id
+	INTO
+		new_home_ou
+	FROM
+		actor.org_unit_ancestors( old_home_ou )
+	WHERE
+		parent_ou is null;
+	--
+	-- Truncate date of birth
+	--
+	IF new_dob IS NOT NULL THEN
+		new_dob := date_trunc( 'year', new_dob );
+	END IF;
+	--
+	UPDATE
+		actor.usr
+		SET
+			card = NULL,
+			profile = new_profile,
+			usrname = new_name,
+			email = NULL,
+			passwd = random()::text,
+			standing = DEFAULT,
+			ident_type = 
+			(
+				SELECT MIN( id )
+				FROM config.identification_type
+			),
+			ident_value = NULL,
+			ident_type2 = NULL,
+			ident_value2 = NULL,
+			net_access_level = DEFAULT,
+			photo_url = NULL,
+			prefix = NULL,
+			first_given_name = new_name,
+			guardian = NULL,
+			family_name = new_name,
+			suffix = NULL,
+			alias = NULL,
+            guardian = NULL,
+			day_phone = NULL,
+			evening_phone = NULL,
+			other_phone = NULL,
+			mailing_address = NULL,
+			billing_address = NULL,
+			home_ou = new_home_ou,
+			dob = new_dob,
+			active = FALSE,
+			master_account = DEFAULT, 
+			super_user = DEFAULT,
+			barred = FALSE,
+			deleted = TRUE,
+			juvenile = DEFAULT,
+			usrgroup = 0,
+			claims_returned_count = DEFAULT,
+			credit_forward_balance = DEFAULT,
+			last_xact_id = DEFAULT,
+			alert_message = NULL,
+			create_date = now(),
+			expire_date = now()
+	WHERE
+		id = src_usr;
+END;
+$$ LANGUAGE plpgsql;
+
+INSERT into config.org_unit_setting_type (name, label, description, datatype) 
+VALUES ( 
+    'ui.patron.edit.au.guardian.show',
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.show', 
+        'GUI: Show guardian field on patron registration', 
+        'coust', 'label'
+    ),
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.show', 
+        'The guardian field will be shown on the patron registration screen. Showing a field makes it appear with required fields even when not required. If the field is required this setting is ignored.', 
+        'coust', 'description'
+    ),
+    'bool'
+), (
+    'ui.patron.edit.au.guardian.suggest',
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.suggest', 
+        'GUI: Suggest guardian field on patron registration', 
+        'coust', 'label'
+    ),
+    oils_i18n_gettext(
+        'ui.patron.edit.au.guardian.suggest', 
+        'The guardian field will be suggested on the patron registration screen. Suggesting a field makes it appear when suggested fields are shown. If the field is shown or required this setting is ignored.', 
+        'coust', 'description'),
+    'bool'
+), (
+    'ui.patron.edit.guardian_required_for_juv',
+    oils_i18n_gettext(
+        'ui.patron.edit.guardian_required_for_juv',
+        'GUI: Juvenile account requires parent/guardian',
+        'coust', 'label'
+    ),
+    oils_i18n_gettext(
+        'ui.patron.edit.guardian_required_for_juv',
+        'Require a value for the parent/guardian field in the patron editor for patrons marked as juvenile',
+        'coust', 'description'),
+    'bool'
+);
+
+
+COMMIT;
+
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
index 3f95036..05e0d94 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
@@ -393,6 +393,16 @@ within the "form" by name for validation.
   </div>
 </div>
 
+<!-- GUARDIAN -->
+
+<div class="row reg-field-row" ng-show="show_field('au.guardian')">
+  [% draw_field_label('au', 'guardian') %]
+  [% draw_form_input('au', 'guardian'); %]
+  <div class="col-md-6 patron-reg-example">
+    [% draw_example_text('au', 'guardian') %]
+  </div>
+</div>
+
 <!-- ident_type -->
 
 <div class="row reg-field-row" ng-show="show_field('au.ident_type')">
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2
index 6b16b66..11cf06a 100644
--- a/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/t_summary.tt2
@@ -67,6 +67,10 @@
       <div class="col-md-7" ng-show="now_show_dob()">{{patron().dob() | date:$root.egDateFormat}}</div>
     </div>
     <div class="row">
+      <div class="col-md-5">[% l('Parent/Guardian') %]</div>
+      <div class="col-md-7">{{patron().guardian()}}</div>
+    </div>
+    <div class="row">
       <div class="col-md-5">[% l('Last Activity') %]</div>
       <div class="col-md-7">{{patron().usr_activity()[0].event_time() | date:$root.egDateFormat}}</div>
     </div>
diff --git a/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2 b/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
index e9de365..dd1a9dc 100644
--- a/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
+++ b/Open-ILS/src/templates/staff/share/t_patron_search_form.tt2
@@ -139,12 +139,8 @@
         </div>
 
         <div class="col-md-2">
-          <div class="checkbox">
-            <label>
-              <input type="checkbox" ng-model="searchArgs.inactive" ng-change="onSearchInactiveChanged()"/>
-              [% l('Include Inactive?') %]
-            </label>
-          </div>
+          <input type="text" class="form-control" 
+            ng-model="searchArgs.guardian" placeholder="[% l('Parent/Guardian') %]"/>
         </div>
       </div>
       <div class="form-group" ng-show="showExtras">
@@ -164,6 +160,14 @@
           <input type="text" class="form-control" 
             ng-model="searchArgs.id" placeholder="[% l('Database ID') %]"/>
         </div>
+        <div class="col-md-2">
+          <div class="checkbox">
+            <label>
+              <input type="checkbox" ng-model="searchArgs.inactive" ng-change="onSearchInactiveChanged()"/>
+              [% l('Include Inactive?') %]
+            </label>
+          </div>
+        </div>
       </div>
     </form>
   </div>
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
index 7599020..cd8843a 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js
@@ -391,6 +391,9 @@ angular.module('egCoreMod')
             'ui.patron.edit.aua.post_code.regex',
             'ui.patron.edit.aua.post_code.example',
             'ui.patron.edit.aua.county.require',
+            'ui.patron.edit.au.guardian.show',
+            'ui.patron.edit.au.guardian.suggest',
+            'ui.patron.edit.guardian_required_for_juv',
             'format.date',
             'ui.patron.edit.default_suggested',
             'opac.barcode_regex',
@@ -1365,6 +1368,10 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
         apply_username_regex();
 
         add_date_watchers();
+
+        if ($scope.org_settings['ui.patron.edit.guardian_required_for_juv']) {
+            add_juv_watcher();
+        }
     });
 
     function add_date_watchers() {
@@ -1381,6 +1388,17 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
         // No need to watch expire_date
     }
 
+    function add_juv_watcher() {
+        $scope.$watch('patron.juvenile', function(newVal, oldVal) {
+            if (newVal === oldVal) return;
+            if (newVal) {
+                field_visibility['au.guardian'] = 3; // required
+            } else {
+                // Value will be reassessed by show_field()
+                delete field_visibility['au.guardian'];
+            }
+        });
+    }
 
     // update the currently displayed field documentation
     $scope.set_selected_field_doc = function(cls, field) {

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |    1 +
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/005.schema.actors.sql          |    3 +
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   42 +++++
 Open-ILS/src/sql/Pg/999.functions.global.sql       |    1 +
 .../sql/Pg/upgrade/1139.schema.patron-guardian.sql |  173 ++++++++++++++++++++
 .../src/templates/staff/circ/patron/t_edit.tt2     |   10 +
 .../src/templates/staff/circ/patron/t_summary.tt2  |    4 +
 .../templates/staff/share/t_patron_search_form.tt2 |   16 +-
 .../web/js/ui/default/staff/circ/patron/regctl.js  |   18 ++
 .../Circulation/patron-guardian-field.adoc         |   52 ++++++
 11 files changed, 315 insertions(+), 7 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/1139.schema.patron-guardian.sql
 create mode 100644 docs/RELEASE_NOTES_NEXT/Circulation/patron-guardian-field.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list