[open-ils-commits] [GIT] Evergreen ILS branch rel_2_10 updated. fbf20f9ef105ee55a526f90f105bc7667ed76bd8

Evergreen Git git at git.evergreen-ils.org
Thu Feb 2 15:38:43 EST 2017


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, rel_2_10 has been updated
       via  fbf20f9ef105ee55a526f90f105bc7667ed76bd8 (commit)
      from  c42247edb255ce7c593700152b27395936597552 (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 fbf20f9ef105ee55a526f90f105bc7667ed76bd8
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Jan 31 12:35:05 2017 -0500

    LP#1660059: Protect against null value in group field
    
    If a nullable event grouping field is configured, and a null value is indeed
    encountered when pulling together events, the Action/Trigger code will exit
    unceremoniously.  To prevent this, we will now collect events with either
    a null grouping object or grouping field, and use a new batch invalidation
    API call to get rid of them as quickly as possible after group sorting is
    complete.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm
index ed83cba..fb5720a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm
@@ -749,6 +749,7 @@ sub grouped_events {
         $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
     }
 
+    my @invalid; # sync for events with a null grouping field
     for my  $e (@fleshed_events) {
         if (my $group = $e->event->event_def->group_field) {
 
@@ -763,12 +764,19 @@ sub grouped_events {
             };
 
             unless($node) { # should not get here, but to be safe..
-                $e->update_state('invalid');
+                push @invalid, $e;
                 next;
             }
 
             # get the grouping value for the grouping object on this event
             my $ident_value = $node->$group_field();
+
+            # could by false-y, so check definedness
+            if (!defined($ident_value)) {
+                push @invalid, $e;
+                next;
+            }
+
             if(ref $ident_value) {
                 my $ident_field = $ident_value->Identity; 
                 $ident_value = $ident_value->$ident_field()
@@ -783,6 +791,7 @@ sub grouped_events {
         }
     }
 
+    OpenILS::Application::Trigger::Event->invalidate(@invalid) if @invalid;
 
     return \%groups;
 }
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Event.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Event.pm
index 91c7994..bd85e38 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Event.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Event.pm
@@ -10,6 +10,27 @@ use Safe;
 
 my $log = 'OpenSRF::Utils::Logger';
 
+sub invalidate {
+    my $class = shift;
+    my @events = @_;
+
+    # if called as an instance method
+    unshift(@events,$class) if ref($class);
+
+    my $e = new_editor();
+    $e->xact_begin;
+
+    map {
+        $_->editor($e);
+        $_->standalone(0);
+        $_->update_state('invalid');
+    } @events;
+
+    $e->commit;
+
+    return @events;
+}
+
 sub new {
     my $class = shift;
     my $id = shift;

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Trigger.pm    |   11 +++++++++-
 .../lib/OpenILS/Application/Trigger/Event.pm       |   21 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list