$circulator->script_runner->cleanup;
- return circ_events($circulator);
+ $conn->respond_complete(circ_events($circulator));
+
+ unless($circulator->bail_out) {
+ $logger->info("circulator: running delayed hold notify process");
+ $circulator->do_hold_notify($circulator->notify_hold)
+ if $circulator->notify_hold;
+ }
}
sub circ_events {
# Add a pile of automagic getter/setter methods
# --------------------------------------------------------------------------
my @AUTOLOAD_FIELDS = qw/
+ notify_hold
penalty_request
remote_hold
backdate
$copy->status(OILS_COPY_STATUS_ON_HOLDS_SHELF);
$self->push_events(OpenILS::Event->new('SUCCESS'));
- $self->do_hold_notify($hold->id);
+ #$self->do_hold_notify($hold->id);
+ $self->notify_hold($hold->id);
} else {
sub do_hold_notify {
my( $self, $holdid ) = @_;
+
my $notifier = OpenILS::Application::Circ::HoldNotify->new(
editor => $self->editor, hold_id => $holdid );
$logger->info("ciculator: attempt at sending hold notification for hold $holdid");
my $stat = $notifier->send_email_notify;
- $logger->info("ciculator: hold notify succeeded for hold $holdid") if $stat eq '1';
- $logger->warn("ciculator: * hold notify failed for hold $holdid") if $stat ne '1';
+ if( $stat == '1' ) {
+ $logger->info("ciculator: hold notify succeeded for hold $holdid");
+ $self->editor->commit;
+ return;
+ }
+
+ $logger->warn("ciculator: * hold notify failed for hold $holdid");
} else {
$logger->info("ciculator: Not sending hold notification since the patron has no email address");
}
+
+ $self->editor->rollback;
}
sub checkin_build_hold_transit {
my $self = shift;
-
my $copy = $self->copy;
my $hold = $self->hold;
my $trans = Fieldmapper::action::hold_transit_copy->new;
my $ishold = 0;
if($hold_transit) {
- $self->do_hold_notify($hold_transit->hold);
+ #$self->do_hold_notify($hold_transit->hold);
+ $self->notify_hold($hold_transit->hold);
$ishold = 1;
}