LP2007591 Allow Last-Copy Delete to Create Hold Notices
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Feb 2023 16:02:49 +0000 (11:02 -0500)
committerMike Rylander <mrylander@gmail.com>
Wed, 1 Mar 2023 16:55:46 +0000 (11:55 -0500)
Fixes an issue where attempting to create A/T events for recently
canceled holds fails becuase the cancel_time on the hold is the
pre-insert value of "now" instead of a valid date string.

Resolve the issue by fetching the post-insert copy of the hold, so it has
all of the correct in-database values, before passing the hold to A/T
for processing.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm

index 079fed6..42e0451 100644 (file)
@@ -575,6 +575,10 @@ sub cancel_hold_list {
         $hold->cancel_cause(1); # un-targeted expiration.  Do we need an alternate "target deleted" cause?
         $editor->update_action_hold_request($hold) or return $editor->die_event;
 
+        # Update our copy of the hold to pick up the cancel_time
+        # before we pass it off to A/T.
+        $hold = $editor->retrieve_action_hold_request($hold->id);
+
         # tell A/T the hold was cancelled.  Don't wait for a response..
         my $at_ses = OpenSRF::AppSession->create('open-ils.trigger');
         $at_ses->request(
index 5f48f7d..d10cfd1 100644 (file)
@@ -364,6 +364,10 @@ sub delete_rec {
         $hold->cancel_cause(1); # un-targeted expiration.
         $editor->update_action_hold_request($hold) or return $editor->die_event;
 
+        # Update our copy of the hold to pick up the cancel_time
+        # before we pass it off to A/T.
+        $hold = $editor->retrieve_action_hold_request($hold->id);
+
         my $at_ses = OpenSRF::AppSession->create('open-ils.trigger');
         $at_ses->request(
             'open-ils.trigger.event.autocreate',