From e8667a37a3faf007f1d3cb5133fad8f604ebfd65 Mon Sep 17 00:00:00 2001
From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 1 Apr 2010 05:15:13 +0000
Subject: [PATCH] param tweak to get copies to flesh on lineitem details, and
 yes, open-ils.cat will handle volume and bib deletion, as well as hold
 retargeting.  But we still need to cancel holds in the case where the bib
 gets deleted.  If the bib isn't deleted (because other copies were added
 outside of acq), holds that came from acq may or may not target those non-acq
 copies.  If they don't and any holds become unfulfillable (say due to hold
 permit policies), we'll just let them lay for now rather than try to figure
 that out.

From my open-ils.acq.lineitem.cancel branch


git-svn-id: svn://svn.open-ils.org/ILS/trunk@16079 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
index 0fcd56243f..2cbf412c58 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
@@ -2403,7 +2403,7 @@ sub cancel_lineitem_api {
 sub cancel_lineitem {
     my ($mgr, $li_id, $cancel_reason) = @_;
     my $li = $mgr->editor->retrieve_acq_lineitem([
-        $li_id, {"flesh" => 1, "flesh_fields" => {"jub" => ["purchase_order"]}}
+        $li_id, {flesh => 1, flesh_fields => {jub => ['purchase_order']}}
     ]) or return 0;
 
     return 0 unless $mgr->editor->allowed(
@@ -2427,12 +2427,12 @@ sub cancel_lineitem {
     $li->state("cancelled");
     $li->cancel_reason($cancel_reason);
 
-    my $lids = $mgr->editor->search_acq_lineitem_detail({
+    my $lids = $mgr->editor->search_acq_lineitem_detail([{
         "lineitem" => $li_id
     }, {
         flesh => 1,
         flesh_fields => { acqlid => ['eg_copy_id'] }
-    });
+    }]);
 
     my $result = {"lid" => {}};
     my $copies = [];
@@ -2455,7 +2455,7 @@ sub cancel_lineitem {
         $result->{"lid"}->{$k} = $v;
     }
 
-    # attempt to delete the gathered copies (will this may handle volume deletion and do hold retargeting for us?)
+    # attempt to delete the gathered copies (this will also handle volume deletion, bib deletion, and attempt hold retargeting)
     my $cat_service = OpenSRF::AppSession->create('open-ils.cat');
     $cat_service->connect;
     my $cat_req = $cat_service->request('open-ils.cat.asset.copy.fleshed.batch.update', $mgr->editor->authtoken, $copies);
-- 
2.11.0