From: Josh Stompro Date: Tue, 13 Jan 2015 19:36:40 +0000 (-0600) Subject: LP#1205072 - Action Trigger Granularity Case Sensitivity X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e7bbd0fcb0179722e1070296444570fd24218766;p=working%2FEvergreen.git LP#1205072 - Action Trigger Granularity Case Sensitivity This change makes the granularity settings case insensitive. To test this issue 1. Create/Modify an action trigger to have an all uppercase granularity settings. 2. Run action_trigger_runner.pl with the same granularity set to lowercase 3. Observe that the events are not processed. After the change is applied the granularity case doesn't matter for either the event_definition or the flag to action_trigger_runner.pl. I didn't modify the code path for when the granularity only flag isn't set since it never gets used, and I don't want to change what I cannot test. Maybe the best course of action would just be to remove that section? Added "weekdays" option to match up with example crontab file. Replace the release notes entry since the behavior has changed. Signed-off-by: Josh Stompro --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm index ed83cbae1b..70b89a90ae 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm @@ -70,7 +70,7 @@ sub create_active_events_for_object { ); for my $def ( @$defs ) { - next if ($granularity && $def->granularity ne $granularity ); + next if ($granularity && lc($def->granularity) ne lc($granularity) ); if ($def->usr_field && $def->opt_in_setting) { my $ufield = $def->usr_field; @@ -418,7 +418,7 @@ sub create_batch_events { } for my $def ( @$defs ) { - next if ($granularity && $def->granularity ne $granularity ); + next if ($granularity && lc($def->granularity) ne lc($granularity) ); my $date = DateTime->now->subtract( seconds => interval_to_seconds($def->delay) ); @@ -649,7 +649,12 @@ sub pending_events { if (defined $granularity) { if ($granflag) { - $query->[0]->{'+atevdef'} = {granularity => $granularity}; + $query->[0]->{'+atevdef'} = {granularity => { + '=' => { + transform => 'evergreen.lowercase', + value => lc($granularity) + } + }}; } else { $query->[0]->{'+atevdef'} = {'-or' => [ {granularity => $granularity}, {granularity => undef} ] }; } diff --git a/Open-ILS/src/templates/conify/global/action_trigger/event_definition.tt2 b/Open-ILS/src/templates/conify/global/action_trigger/event_definition.tt2 index 56ce24ba9d..abf9ba7c6d 100644 --- a/Open-ILS/src/templates/conify/global/action_trigger/event_definition.tt2 +++ b/Open-ILS/src/templates/conify/global/action_trigger/event_definition.tt2 @@ -9,6 +9,7 @@ un-translated since they are codes, not labels. --> + diff --git a/docs/RELEASE_NOTES_NEXT/Administration/action-trigger-granularity.txt b/docs/RELEASE_NOTES_NEXT/Administration/action-trigger-granularity.txt index 215e6c6cdf..ddfd5b98ff 100644 --- a/docs/RELEASE_NOTES_NEXT/Administration/action-trigger-granularity.txt +++ b/docs/RELEASE_NOTES_NEXT/Administration/action-trigger-granularity.txt @@ -1,11 +1,10 @@ ==== Upgrade Notes ==== -The 'granularity' field in the staff client Action Trigger Event -Definition configuration interface (Admin -> Local Administration -> -Notifications / Action Triggers) is now case sensitive. Previously, -entering, for example, 'hourly' would be automatically modified to -'Hourly'. Now, 'hourly' and 'Hourly' are each valid, distinct values. +The --granularity setting of the action_trigger_runner.pl is now +case insensitive. So events that have different settings for +their 'granularity' field that only differ in case +will be processed together. -This is important because the granularitiy values configured on the -server for processing action/trigger events are case sensitive as -well. +If you relied upon different events being processed seperately when +their granularity setting differed only by case the you will need +to modify your setup to use more distinct granularity settings.