From ee186a748837e175c23e834a0ce4ef6acc5ef895 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Fri, 7 Apr 2017 08:45:06 -0400 Subject: [PATCH] LP#1257915 - Also check whether to mark the PO received when canceling. Signed-off-by: Chris Sharp Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../perlmods/lib/OpenILS/Application/Acq/Order.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index 58a6550d65..07aab00d8f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -1199,9 +1199,9 @@ sub check_purchase_order_received { "jub" => {"acqcr" => {"type" => "left"}} }, "where" =>{ - "+jub" => {"id" => $po_id}, + "+jub" => {"purchase_order" => $po_id}, "-or" => [ - {"+jub" => {"state" => "received"}}, + {"+jub" => {"state" => {"!=" => "received"}}}, {"+acqcr" => {"keep_debits" =>"t"}} ] } @@ -3229,7 +3229,7 @@ sub cancel_lineitem { } } } - + update_lineitem($mgr, $li) or return 0; $result->{"li"} = { $li_id => { @@ -3237,6 +3237,12 @@ sub cancel_lineitem { "cancel_reason" => $cancel_reason } }; + + # check to see if this cancelation should result in + # marking the purchase order "received" + my $po; + return 0 unless check_purchase_order_received($mgr, $li->purchase_order->id); + return $result; } -- 2.43.2