From e125711a8b6de594705f2c7169eb5182fffef650 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 3 Dec 2012 09:20:29 -0500 Subject: [PATCH] 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 --- Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.11.0