From 8cd8e70646d9aecdcf8bf8bc4d0ef7568003bb37 Mon Sep 17 00:00:00 2001 From: Josh Stompro Date: Wed, 13 May 2015 21:11:08 -0500 Subject: [PATCH] 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? Signed-off-by: Josh Stompro --- Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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} ] }; } -- 2.11.0