From 1f9855413fbe4306ffdf3f64f079c35b6095371e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 22 Jun 2017 14:49:14 -0400 Subject: [PATCH] LP#1373690 Midwest Library Service EDI attrs Adds a new default collection of EDI attributes for Midwest Library Service. This includes 2 new attributes to support their EDI format: 1. BUYER_ID_ONLY_VENDCODE -- similar to BUYER_ID_INCLUDE_VENDCODE, except the buyer SAN is excluded from the NAD+BY segement. 2. INCLUDE_EMPTY_IMD_VALUES -- Render IMD+ fields (title, author, edition, etc.) as if they contain values even when they don't. Empty values are included as single-space strings. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../src/perlmods/lib/OpenILS/Utils/EDIWriter.pm | 24 ++++++++++++++++------ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 16 ++++++++++++++- .../src/sql/Pg/upgrade/YYYY.data.edi_attr_set.sql | 15 +++++++++++++- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm index 6d825f1e82..2b94467f13 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm @@ -131,10 +131,14 @@ sub compile_po { for @{$po->provider->edi_default->attr_set->attr_maps} } - $compiled{buyer_code} = - $compiled{edi_attrs}->{BUYER_ID_INCLUDE_VENDCODE} ? # B&T - $compiled{vendor_san}.' '.$po->provider->edi_default->vendcode : - $po->provider->edi_default->vendacct; + $compiled{buyer_code} = $po->provider->edi_default->vendacct; + + $compiled{buyer_code} = # B&T + $compiled{vendor_san}.' '.$po->provider->edi_default->vendcode + if $compiled{edi_attrs}->{BUYER_ID_INCLUDE_VENDCODE}; + + $compiled{buyer_code} = $po->provider->edi_default->vendcode + if $compiled{edi_attrs}->{BUYER_ID_ONLY_VENDCODE}; # MLS push(@{$compiled{lineitems}}, $self->compile_li($_)) for @{$po->lineitems}; @@ -346,6 +350,12 @@ sub compile_copy { # IMD fields should only display the +::: when a value is present sub IMD { my ($self, $code, $value) = @_; + + $value = ' ' if ( + $value eq '' && + $self->{compiled}->{edi_attrs}->{INCLUDE_EMPTY_IMD_VALUES} + ); + if ($value) { my $s = ''; for my $part ($value =~ m/.{1,70}/g) { @@ -388,8 +398,10 @@ BGM+220+$c{po_id}+9' DTM+137:$date:102' EDI - $edi .= "NAD+BY+$c{org_unit_san}::31B'\n" - unless $self->{compiled}->{edi_attrs}->{BUYER_ID_INCLUDE_VENDCODE}; + $edi .= "NAD+BY+$c{org_unit_san}::31B'\n" unless ( + $self->{compiled}->{edi_attrs}->{BUYER_ID_ONLY_VENDCODE} || + $self->{compiled}->{edi_attrs}->{BUYER_ID_INCLUDE_VENDCODE} + ); $edi .= <