From: Bill Erickson Date: Wed, 28 Mar 2012 19:44:44 +0000 (-0400) Subject: Hold targeter cancellation action/trigger repairs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9982302a1c8007876bfb98642c9e1dc5d2165b40;p=contrib%2FConifer.git Hold targeter cancellation action/trigger repairs When a hold/reservation is cancelled via the targeter and passed off to action/trigger for possible event creation, ensure that all fields on the hold are in sync w/ the master db before the hand-off. Otherwise, critical values, like cancel_time may be null, which can cause A/T event creation to fail. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index cc61ba48a1..0f36c83ebc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -1138,10 +1138,13 @@ sub new_hold_copy_targeter { # cancel cause = un-targeted expiration $hold->update( { cancel_time => 'now', cancel_cause => 1 } ); + + # refresh fields from the DB while still in the xact + my $fm_hold = $hold->to_fieldmapper; + $self->method_lookup('open-ils.storage.transaction.commit')->run; # tell A/T the hold was cancelled - my $fm_hold = $hold->to_fieldmapper; my $ses = OpenSRF::AppSession->create('open-ils.trigger'); $ses->request('open-ils.trigger.event.autocreate', 'hold_request.cancel.expire_no_target', $fm_hold, $fm_hold->pickup_lib); @@ -1447,10 +1450,13 @@ sub new_hold_copy_targeter { # cancel cause = un-targeted expiration $hold->update( { cancel_time => 'now', cancel_cause => 1 } ); + + # refresh fields from the DB while still in the xact + my $fm_hold = $hold->to_fieldmapper; + $self->method_lookup('open-ils.storage.transaction.commit')->run; # tell A/T the hold was cancelled - my $fm_hold = $hold->to_fieldmapper; my $ses = OpenSRF::AppSession->create('open-ils.trigger'); $ses->request('open-ils.trigger.event.autocreate', 'hold_request.cancel.expire_no_target', $fm_hold, $fm_hold->pickup_lib); @@ -1670,10 +1676,13 @@ sub reservation_targeter { # cancel cause = un-targeted expiration $bresv->update( { cancel_time => 'now' } ); + + # refresh fields from the DB while still in the xact + my $fm_bresv = $bresv->to_fieldmapper; + $self->method_lookup('open-ils.storage.transaction.commit')->run; # tell A/T the reservation was cancelled - my $fm_bresv = $bresv->to_fieldmapper; my $ses = OpenSRF::AppSession->create('open-ils.trigger'); $ses->request('open-ils.trigger.event.autocreate', 'booking.reservation.cancel.expire_no_target', $fm_bresv, $fm_bresv->pickup_lib);