From c9e1e9fc06e9f2f1f9a2e4e7a771556da074bd95 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 4 Dec 2012 10:00:26 -0500 Subject: [PATCH] EDI: ensure lineitem 'state' matches cancel state When cancelling a lineitem becuase all linked copies are cancelled, ensure that the lineitem state is set to "cancelled". Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm index dbabd2550d..09b6ce2d2f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm @@ -543,7 +543,10 @@ sub process_parsed_msg { $lids_cancelled += $cancel_count; # if ALL the items have the same cancel_reason, the LI gets it too - $li->cancel_reason($eg_reason->id) if $qty_count == $lid_count; + if ($qty_count == $lid_count) { + $li->cancel_reason($eg_reason->id); + $li->state("cancelled"); + } $li->edit_time('now'); unless ($e->update_acq_lineitem($li)) { @@ -604,8 +607,11 @@ sub process_parsed_msg { # All LIDs cancelled with same reason, apply # the same cancel reason to the lineitem - $li->cancel_reason($reason->id) if $remaining_lids == $order_qty; - + if ($remaining_lids == $order_qty) { + $li->cancel_reason($reason->id); + $li->state("cancelled"); + } + $li->edit_time('now'); unless ($e->update_acq_lineitem($li)) { $logger->error("EDI: update_acq_lineitem failed " . $e->die_event); -- 2.11.0