From 154b68e3a35a0d0d6becf760e0a6218cb6f4bb90 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Sun, 25 Sep 2016 13:33:19 -0400 Subject: [PATCH] LP#1627373 - Add handling for EDI availabilty status codes. Brodart uses availability status codes (8B) in EDI order response messages. Previously these were stored, but did nothing in the code. This implementation adds them to two possible categories: 1) backorder statuses, which result in the "Delayed: Backorder" cancel reason and 2) cancel statuses, which result in the "Canceled: By Vendor" cancel reason. Signed-off-by: Chris Sharp --- .../perlmods/lib/OpenILS/Application/Acq/EDI.pm | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 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 ee978e23c4..2581ab82b0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm @@ -791,11 +791,29 @@ sub process_parsed_msg { } elsif ($stat = $li_hash->{avail_status}) { $logger->info("EDI: lineitem has availability status $stat"); - - if ($stat eq 'NP') { - # not yet published - # TODO: needs cancellation? - } + # These codes are based on documentation provided to GPLS + # from Brodart, who uses these codes rather than the 12B codes + # handled in the order_status block above. + # TODO: should these be in a database table? + my @backorder_statuses = ( + 'OB', # temporarily out of stock + 'NP', # not yet published + 'NK' # item not known + ); + my @cancel_statuses = ( + 'NN', # vendor does not supply item + 'RF', # refer to other publisher/distributor + 'PN', # publisher no longer in business + 'OP', # out of print + 'AD', # must order direct from publisher + 'AB', # publication abandoned + 'UC' # unavailable + ); + if (grep $stat, @backorder_statuses) { + $reason_id = 1283; # back-order + } elsif (grep $stat, @cancel_statuses) { + $reason_id = 1285; # canceled by vendor + } } if ($reason_id) { -- 2.11.0