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

Evergreen Git git at git.evergreen-ils.org
Wed Nov 4 17:04:47 EST 2015


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  dd1510738b97915c8ae3d045f83b407a7d163ee9 (commit)
       via  fef3298eb9249e7bc4d4323fbd985eaf89cf9aa6 (commit)
       via  1b142bedfcde94b104042d622660ada37057a057 (commit)
       via  3f46924a4f207f59e0464d0791f75eb1736c22c3 (commit)
       via  3b630bd4e022d926f952ae099ba5cc6a8c2e5b1d (commit)
       via  0fd4ecc461258320328bb5a63aa24ca0e9488a03 (commit)
      from  a9d80dc4111a760bfb9d8cb94876a41ec40cb0d9 (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 dd1510738b97915c8ae3d045f83b407a7d163ee9
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Nov 4 22:03:59 2015 +0000

    LP#1251415: (follow-up) fix typos
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/live_t/10-lp1251415_udpate_juv.t b/Open-ILS/src/perlmods/live_t/10-lp1251415_update_juv.t
similarity index 91%
rename from Open-ILS/src/perlmods/live_t/10-lp1251415_udpate_juv.t
rename to Open-ILS/src/perlmods/live_t/10-lp1251415_update_juv.t
index 2425503..62b6328 100644
--- a/Open-ILS/src/perlmods/live_t/10-lp1251415_udpate_juv.t
+++ b/Open-ILS/src/perlmods/live_t/10-lp1251415_update_juv.t
@@ -38,7 +38,7 @@ $req->recv;
 
 $e->xact_begin;
 $user = $e->retrieve_actor_user(USER_ID);
-is($user->juvenile, 'f', 'Junenile flag should be false');
+is($user->juvenile, 'f', 'Juvenile flag should be false');
 
 # -------------
 # User is 17 years old.  Juv-to-adult with 18 years should leave the flag.
@@ -57,7 +57,7 @@ $req->recv;
 
 $e->xact_begin;
 $user = $e->retrieve_actor_user(USER_ID);
-is($user->juvenile, 't', 'Junenile flag should be true');
+is($user->juvenile, 't', 'Juvenile flag should be true');
 
 # -------------
 # User is 17 years old, but the juv org unit setting is 16,
@@ -77,7 +77,7 @@ $req = $storage->request(
 $req->recv;
 
 $user = $e->retrieve_actor_user(USER_ID);
-is($user->juvenile, 'f', 'Junenile flag should be false');
+is($user->juvenile, 'f', 'Juvenile flag should be false');
 
 # -------------
 # Delete the user.  No modification should occur.
@@ -94,7 +94,7 @@ $req = $storage->request(
 $req->recv;
 
 $user = $e->retrieve_actor_user(USER_ID);
-is($user->juvenile, 't', 'Junenile flag should be left true after deletion');
+is($user->juvenile, 't', 'Juvenile flag should be left true after deletion');
 
 # for ease of repeating this test, delete the new org setting
 $e->xact_begin;

commit fef3298eb9249e7bc4d4323fbd985eaf89cf9aa6
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Wed Nov 4 21:57:16 2015 +0000

    LP#1251415: (follow-up) update release note extension
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.txt b/docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.adoc
similarity index 100%
rename from docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.txt
rename to docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.adoc

commit 1b142bedfcde94b104042d622660ada37057a057
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed Aug 19 10:02:37 2015 -0400

    LP#1251415: juv-to-adult release notes
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.txt b/docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.txt
new file mode 100644
index 0000000..55c0ea8
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.txt
@@ -0,0 +1,9 @@
+Juvenile-to-Adult Batch Script Honors Org Unit Setting
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The batch juv_to_adult.srfsh script, which is typically run via CRON,
+that is responsible for toggling a patron from juvenile to adult now
+honors the age value set in the org unit setting named "Juvenile Age
+Threshold" (global.juvenile_age_threshold).  When no org setting value
+is present at a given patron's home library, the value passed in to the
+script will be used as a default.

commit 3f46924a4f207f59e0464d0791f75eb1736c22c3
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Aug 14 10:54:31 2015 -0400

    LP#1251415: Juv-to-adult live test
    
    Confirms org unit setting takes precedence and deleted users are
    ignored.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/live_t/10-lp1251415_udpate_juv.t b/Open-ILS/src/perlmods/live_t/10-lp1251415_udpate_juv.t
new file mode 100644
index 0000000..2425503
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/10-lp1251415_udpate_juv.t
@@ -0,0 +1,105 @@
+#!perl
+
+use Test::More tests => 8;
+
+diag("Test juv-to-adult batch updater.");
+
+use strict; use warnings;
+
+use constant USER_ID => 2;
+
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::CStoreEditor qw/:funcs/;
+use OpenILS::Utils::Fieldmapper;
+
+my $script = OpenILS::Utils::TestUtils->new();
+$script->bootstrap;
+
+my $e = new_editor(xact => 1);
+$e->init;
+
+# -------------
+# User is 19 years old.  Juv-to-adult with 18 years should clear the flag.
+
+my $user = $e->retrieve_actor_user(USER_ID);
+
+my $dt = DateTime->now;
+$dt->set_year($dt->year - 19);
+$user->dob($dt->strftime('%F'));
+$user->juvenile('t');
+my $stat = $e->update_actor_user($user);
+ok($stat, 'User update succeeded');
+$e->xact_commit;
+
+my $storage = $script->session('open-ils.storage');
+my $req = $storage->request(
+    'open-ils.storage.actor.user.juvenile_to_adult', '18 years');
+$req->recv;
+
+$e->xact_begin;
+$user = $e->retrieve_actor_user(USER_ID);
+is($user->juvenile, 'f', 'Junenile flag should be false');
+
+# -------------
+# User is 17 years old.  Juv-to-adult with 18 years should leave the flag.
+
+$dt = DateTime->now;
+$dt->set_year($dt->year - 17);
+$user->dob($dt->strftime('%F'));
+$user->juvenile('t');
+$stat = $e->update_actor_user($user);
+ok($stat, 'User update succeeded');
+$e->xact_commit;
+
+$req = $storage->request(
+    'open-ils.storage.actor.user.juvenile_to_adult', '18 years');
+$req->recv;
+
+$e->xact_begin;
+$user = $e->retrieve_actor_user(USER_ID);
+is($user->juvenile, 't', 'Junenile flag should be true');
+
+# -------------
+# User is 17 years old, but the juv org unit setting is 16,
+# so the flag should be cleared.
+
+my $aous = Fieldmapper::actor::org_unit_setting->new;
+$aous->org_unit(1);
+$aous->name('global.juvenile_age_threshold');
+$aous->value('"16 years"');
+$stat = $e->create_actor_org_unit_setting($aous);
+ok($stat, 'Org unit setting create successfully');
+$e->xact_commit;
+
+# passing "18 years", but the org unit setting should supercede it.
+$req = $storage->request(
+    'open-ils.storage.actor.user.juvenile_to_adult', '18 years');
+$req->recv;
+
+$user = $e->retrieve_actor_user(USER_ID);
+is($user->juvenile, 'f', 'Junenile flag should be false');
+
+# -------------
+# Delete the user.  No modification should occur.
+$user->juvenile('t');
+$user->deleted('t');
+$e->xact_begin;
+$stat = $e->update_actor_user($user);
+ok($stat, 'User successfully deleted');
+$e->xact_commit;
+
+# passing "18 years", but the org unit setting should supercede it.
+$req = $storage->request(
+    'open-ils.storage.actor.user.juvenile_to_adult', '18 years');
+$req->recv;
+
+$user = $e->retrieve_actor_user(USER_ID);
+is($user->juvenile, 't', 'Junenile flag should be left true after deletion');
+
+# for ease of repeating this test, delete the new org setting
+$e->xact_begin;
+$aous = $e->search_actor_org_unit_setting(
+    {name => 'global.juvenile_age_threshold', org_unit => 1})->[0];
+$e->delete_actor_org_unit_setting($aous);
+$e->commit;
+

commit 3b630bd4e022d926f952ae099ba5cc6a8c2e5b1d
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Aug 10 16:05:45 2015 -0400

    LP#1251415: Skip deleted users in juvenile update
    
    Avoid setting juvenile = false on deleted users during the batch
    juvenile update routine, even if they are a million years old.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
index ff9327f..e2a4edc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
@@ -30,13 +30,13 @@ sub juv_to_adult {
     my $adult_age = shift;
 
     my $sql = <<"    SQL";
-            UPDATE  actor.usr
-              SET   juvenile = FALSE
-              WHERE id IN (
-              SELECT au.id
-              FROM actor.usr au
-              WHERE AGE(au.dob) > COALESCE( BTRIM( (SELECT value FROM actor.org_unit_ancestor_setting('global.juvenile_age_threshold', au.home_ou)),'"' ), ? )::INTERVAL
-              AND au.juvenile IS TRUE)
+        UPDATE actor.usr
+            SET juvenile = FALSE
+            WHERE juvenile IS TRUE
+            AND deleted IS FALSE
+            AND AGE(dob) > COALESCE( BTRIM( (
+                    SELECT value FROM actor.org_unit_ancestor_setting(
+                    'global.juvenile_age_threshold', home_ou)),'"' ), ?)::INTERVAL
     SQL
 
     my $sth = actor::user->db_Main->prepare_cached($sql);

commit 0fd4ecc461258320328bb5a63aa24ca0e9488a03
Author: Steven Callender <stevecallender at esilibrary.com>
Date:   Thu Nov 14 15:07:33 2013 -0500

    LP#1251415: Use the juvenile setting when removing juvenile flag.
    
    When calling the API open-ils.storage.actor.user.juvenile_to_adult,
    most notably from the juv_to_adult.srfsh support script, instead of
    strictly using the hardcoded passed value, first check the
    global.juvenile_age_threshold from the settings based on the user's
    home library. If the setting does not exist, then fall back on the
    hardcoded passed value.
    
    This will allow each library to be able to set different juvenile
    thresholds if needed and at the very least, give control to the
    settings rather than rely strictly on the hardcoded passed value.
    
    Signed-off-by: Steven Callender <stevecallender at esilibrary.com>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
index f55da8c..ff9327f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
@@ -32,8 +32,11 @@ sub juv_to_adult {
     my $sql = <<"    SQL";
             UPDATE  actor.usr
               SET   juvenile = FALSE
-              WHERE AGE(dob) > ?::INTERVAL
-              AND juvenile IS TRUE;
+              WHERE id IN (
+              SELECT au.id
+              FROM actor.usr au
+              WHERE AGE(au.dob) > COALESCE( BTRIM( (SELECT value FROM actor.org_unit_ancestor_setting('global.juvenile_age_threshold', au.home_ou)),'"' ), ? )::INTERVAL
+              AND au.juvenile IS TRUE)
     SQL
 
     my $sth = actor::user->db_Main->prepare_cached($sql);

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

Summary of changes:
 .../OpenILS/Application/Storage/Publisher/actor.pm |   11 ++-
 .../src/perlmods/live_t/10-lp1251415_update_juv.t  |  105 ++++++++++++++++++++
 .../Administration/juv-to-adult.adoc               |    9 ++
 3 files changed, 121 insertions(+), 4 deletions(-)
 create mode 100644 Open-ILS/src/perlmods/live_t/10-lp1251415_update_juv.t
 create mode 100644 docs/RELEASE_NOTES_NEXT/Administration/juv-to-adult.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list