From: Bill Erickson Date: Mon, 10 Aug 2015 20:05:45 +0000 (-0400) Subject: LP#1251415: Skip deleted users in juvenile update X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3b630bd4e022d926f952ae099ba5cc6a8c2e5b1d;p=evergreen%2Fpines.git 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 Signed-off-by: Galen Charlton --- 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 ff9327ff11..e2a4edc3dd 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);