From: Bill Erickson Date: Mon, 3 Dec 2012 14:20:29 +0000 (-0500) Subject: EDI: protect against invalid order response X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=62e15ea09a0e974b721df5f4c4b5d476ffc03a88;p=evergreen%2Fpines.git EDI: protect against invalid order response Do not attempt to createI EDI messages for order responses which reference nonexistent purchase orders, since it results in transaction commit errors on invalid foreign keys, preventing subsequent EDI files from getting processed. Instead, log it and skip it. Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- 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 f41d29cd52..1ed4697c96 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm @@ -184,6 +184,10 @@ sub process_retrieval { if ($msg_hash->{purchase_order}) { $logger->info("EDI: processing message for PO " . $msg_hash->{purchase_order}); $incoming->purchase_order($msg_hash->{purchase_order}); + unless ($e->retrieve_acq_purchase_order($incoming->purchase_order)) { + $logger->warn("EDI: received order response for nonexistent PO. Skipping..."); + next; + } } $e->xact_begin;