From 7a8ee4c4bef0a3067eb08fcad2785fee21303595 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 18 Aug 2017 11:51:39 -0400 Subject: [PATCH] LP#1373690 EDI 'use_attrs' configuration option Adds a new configuration option for EDI accounts specifying wether purchase orders delivered via a given account should be constructed using the new EDI Attributes in lieu of the traditional JEDI A/T template. The PurchaseOrderEDIRequired A/T validator now bypasses orders with use_attrs=true accounts. The new edi_order_pusher.pl script only process providers whose default EDI accounts have use_attrs=true (except when a specific PO ID is provided). Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/examples/fm_IDL.xml | 1 + .../Validator/Acq/PurchaseOrderEDIRequired.pm | 10 +++++----- Open-ILS/src/sql/Pg/200.schema.acq.sql | 3 ++- .../src/sql/Pg/upgrade/XXXX.schema.edi_attr_set.sql | 5 +++-- Open-ILS/src/support-scripts/edi_order_pusher.pl | 13 +++++++++++-- .../Administration/acq-edi-attrs.adoc | 12 ++++++++++++ 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 7f6e192ce0..77871ff426 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -9214,6 +9214,7 @@ SELECT usr, + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Acq/PurchaseOrderEDIRequired.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Acq/PurchaseOrderEDIRequired.pm index 211d75fee0..a0ae31f6b0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Acq/PurchaseOrderEDIRequired.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Validator/Acq/PurchaseOrderEDIRequired.pm @@ -16,11 +16,11 @@ sub handler { new_editor->retrieve_acq_provider($po->provider); return 1 if - ($po->state eq 'on-order' or - $po->state eq 'retry' ) and - $provider and - $provider->edi_default and - $U->is_true($provider->active); + ($po->state eq 'on-order' || $po->state eq 'retry') + and $provider + and $provider->edi_default + and $U->is_true($provider->active) + and !$U->is_true($provider->edi_default->use_attrs); return 0; } diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index 7fa60e32e8..c0670bb14c 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -763,7 +763,8 @@ CREATE TABLE acq.edi_account ( -- similar tables can extend remote_account in_dir TEXT, -- incoming messages dir (probably different than config.remote_account.path, the outgoing dir) vendcode TEXT, vendacct TEXT, - attr_set INTEGER REFERENCES acq.edi_attr_set(id) -- NULL OK + attr_set INTEGER REFERENCES acq.edi_attr_set(id), -- NULL OK + use_attrs BOOLEAN NOT NULL DEFAULT FALSE ) INHERITS (config.remote_account); -- We need a UNIQUE constraint here also, to support the FK from acq.provider.edi_default diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.edi_attr_set.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.edi_attr_set.sql index be1aa23943..970f54284a 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.edi_attr_set.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.edi_attr_set.sql @@ -23,8 +23,9 @@ CREATE TABLE acq.edi_attr_set_map ( -- An attr_set is not strictly required, since some edi_accounts/vendors -- may not need to apply any attributes. -ALTER TABLE acq.edi_account ADD COLUMN attr_set - INTEGER REFERENCES acq.edi_attr_set(id); +ALTER TABLE acq.edi_account + ADD COLUMN attr_set INTEGER REFERENCES acq.edi_attr_set(id), + ADD COLUMN use_attrs BOOLEAN NOT NULL DEFAULT FALSE; COMMIT; diff --git a/Open-ILS/src/support-scripts/edi_order_pusher.pl b/Open-ILS/src/support-scripts/edi_order_pusher.pl index 380ed493ce..3d383f288d 100755 --- a/Open-ILS/src/support-scripts/edi_order_pusher.pl +++ b/Open-ILS/src/support-scripts/edi_order_pusher.pl @@ -49,7 +49,8 @@ sub help { 1. PO must be activated. 2. PO provider must be active. 3. PO must use a provider that supports EDI delivery (via edi_default) - 4. PO must have no EDI ORDERS messages attached or, if it does, + 4. EDI account linked to provider must have 'use_attrs' set to true. + 5. PO must have no EDI ORDERS messages attached or, if it does, the message has a status of "retry". Usage: @@ -118,7 +119,12 @@ if ($po_id) { type => 'left', filter => {message_type => 'ORDERS'} }, - acqpro => {} + acqpro => { + join => { + acqedi => { + } + } + } } }, where => { @@ -129,6 +135,9 @@ if ($po_id) { active => 't', edi_default => {'!=' => undef} }, + '+acqedi' => { + use_attrs => 't' + }, '+acqedim' => { '-or' => [ {id => undef}, # no ORDERS message exists diff --git a/docs/RELEASE_NOTES_NEXT/Administration/acq-edi-attrs.adoc b/docs/RELEASE_NOTES_NEXT/Administration/acq-edi-attrs.adoc index db69841bb8..6100824911 100644 --- a/docs/RELEASE_NOTES_NEXT/Administration/acq-edi-attrs.adoc +++ b/docs/RELEASE_NOTES_NEXT/Administration/acq-edi-attrs.adoc @@ -36,3 +36,15 @@ attributes. . After moving to edi_order_pusher.pl, the JEDI Action/Trigger event definition is no longer required. It can be disabled. +Migration ++++++++++ + +EDI accounts have a new boolean field "Use EDI Attributes" (use_attrs) that +specifies whether PO's generated via the account should be built using +EDI attributes or fall back to traditional JEDI A/T template generation. + +This allows sites to activate EDI attributes on a per-account basis, making +it possible to migrate piecemeal to EDI attributes. For the initial roll +out of this new features, no accounts will be configured to use EDI +attributes by default. + -- 2.43.2