only flesh up to, but not including, the leaf for the group_field
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Sep 2010 02:12:02 +0000 (02:12 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 23 Sep 2010 02:12:02 +0000 (02:12 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17903 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm

index 6a916c0..a4d022a 100644 (file)
@@ -656,16 +656,16 @@ sub grouped_events {
 
             # split the grouping link steps
             my @steps = split /\./, $group;
+            my $group_field = pop(@steps); # we didn't flesh to this, it's a field not an object
 
             # find the grouping object
             my $node = $e->target;
             $node = $node->$_() for ( @steps );
 
-            # get the pkey value for the grouping object on this event
-            my $node_ident = $node->Identity;
-            my $ident_value = $node->$node_ident();
+            # get the grouping value for the grouping object on this event
+            my $ident_value = $node->$group_field();
 
-            # push this event onto the event+grouping_pkey_value stack
+            # push this event onto the event+grouping_value stack
             $groups{$e->event->event_def->id}{$ident_value} ||= [];
             push @{ $groups{$e->event->event_def->id}{$ident_value} }, $e;
         } else {
index 5faef1b..244df30 100644 (file)
@@ -397,7 +397,8 @@ sub build_environment {
 
         if ($self->event->event_def->group_field) {
             my @group_path = split(/\./, $self->event->event_def->group_field);
-            my $group_object = $self->_object_by_path( $self->target, undef, [], \@group_path );
+            pop(@group_path); # the last part is a field, should not get fleshed
+            my $group_object = $self->_object_by_path( $self->target, undef, [], \@group_path ) if (@group_path);
         }
     
         $self->environment->{complete} = 1;