my $class = shift;
my $id = shift;
my $editor = shift;
+ my $nochanges = shift; # no guarantees, yet...
$class = ref($class) || $class;
my $standalone = $editor ? 0 : 1;
return $id;
}
- my $self = bless { id => $id, editor => $editor, standalone => $standalone } => $class;
+ my $self = bless { id => $id, editor => $editor, standalone => $standalone, nochanges => $nochanges } => $class;
return $self->init()
}
$self->cleanedup(0);
}
-
- $self->update_state('found') || die 'Unable to update event state';
+ unless ($self->nochanges) {
+ $self->update_state('found') || die 'Unable to update event state';
+ }
my $class = $self->_fm_class_by_hint( $self->event->event_def->hook->core_type );
$self->editor->xact_rollback || return undef;
}
- unless($self->target) {
- $self->update_state('invalid');
+ unless ($self->target) {
+ $self->update_state('invalid') unless $self->nochanges;
$self->valid(0);
}
return $self->{editor};
}
+sub nochanges {
+ # no guarantees, yet.
+ my $self = shift;
+ return undef unless (ref $self);
+
+ my $e = shift;
+ $self->{nochanges} = $e if (defined $e);
+ return $self->{nochanges};
+}
+
sub unfind {
my $self = shift;
return undef unless (ref $self);
my $log = 'OpenSRF::Utils::Logger';
-sub new {
+sub new_impl {
my $class = shift;
- my @ids = @_;
+ my @ids = @{shift()};
+ my $nochanges = shift;
+
$class = ref($class) || $class;
my $editor = new_editor(xact=>1);
map {
ref($_) ?
do { $_->standalone(0); $_->editor($editor); $_ } :
- OpenILS::Application::Trigger::Event->new($_, $editor)
+ OpenILS::Application::Trigger::Event->new($_, $editor, $nochanges)
} @ids
],
ids => [ map { ref($_) ? $_->id : $_ } @ids ],
return $self;
}
+sub new_nochanges {
+ my $class = shift;
+ my @ids = @_;
+
+ return new_impl($class, \@ids, 1);
+}
+
+sub new {
+ my $class = shift;
+ my @ids = @_;
+
+ return new_impl($class, \@ids);
+}
+
sub react {
my $self = shift;