From 9982302a1c8007876bfb98642c9e1dc5d2165b40 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 28 Mar 2012 15:44:44 -0400 Subject: [PATCH] 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 --- .../Application/Storage/Publisher/action.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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); -- 2.43.2