From b460000b490b7b80bbef798c7405a2e5394a0360 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 22 Aug 2017 16:13:54 -0400 Subject: [PATCH] LP#1373690: add USE_ID_FOR_OWNING_LIB EDI attribute This attribute specifies that the copy owning library should have its ID emitted rather than its shortname, which can be used for Baker & Taylor, which imposes a five-character limit on certain fields. This takes effect only when the INCLUDE_OWNING_LIB EDI attribute is also in effect. Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm | 6 +++++- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 3 +++ Open-ILS/src/sql/Pg/upgrade/YYYY.data.edi_attr_set.sql | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm index 3b4cdfdbea..713d7c0b11 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIWriter.pm @@ -324,7 +324,11 @@ sub compile_copy { my $fund = $copy->fund ? $copy->fund->code : ''; my $item_type = $copy->circ_modifier || ''; my $call_number = $copy->cn_label || ''; - my $owning_lib = $copy->owning_lib ? $copy->owning_lib->shortname : ''; + my $owning_lib = $copy->owning_lib ? + $self->{compiled}->{edi_attrs}->{USE_ID_FOR_OWNING_LIB} ? + $copy->owning_lib->id : + $copy->owning_lib->shortname : + ''; my $location = $copy->location ? $copy->location->name : ''; my $collection_code = $copy->collection_code || ''; my $barcode = $copy->barcode || ''; diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index d8dbd03862..cad9960820 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -17215,6 +17215,9 @@ INSERT INTO acq.edi_attr (key, label) VALUES ('INCLUDE_OWNING_LIB', oils_i18n_gettext('INCLUDE_OWNING_LIB', 'Orders Include Copy Owning Library', 'aea', 'label')), + ('USE_ID_FOR_OWNING_LIB', + oils_i18n_gettext('USE_ID_FOR_OWNING_LIB', + 'Emit Owning Library ID Rather Than Short Name. Takes effect only if INCLUDE_OWNING_LIB is in use', 'aea', 'label')), ('INCLUDE_QUANTITY', oils_i18n_gettext('INCLUDE_QUANTITY', 'Orders Include Copy Quantities', 'aea', 'label')), diff --git a/Open-ILS/src/sql/Pg/upgrade/YYYY.data.edi_attr_set.sql b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.edi_attr_set.sql index 8e5c4b6b54..8ca76431bd 100644 --- a/Open-ILS/src/sql/Pg/upgrade/YYYY.data.edi_attr_set.sql +++ b/Open-ILS/src/sql/Pg/upgrade/YYYY.data.edi_attr_set.sql @@ -30,6 +30,9 @@ INSERT INTO acq.edi_attr (key, label) VALUES ('INCLUDE_OWNING_LIB', oils_i18n_gettext('INCLUDE_OWNING_LIB', 'Orders Include Copy Owning Library', 'aea', 'label')), + ('USE_ID_FOR_OWNING_LIB', + oils_i18n_gettext('USE_ID_FOR_OWNING_LIB', + 'Emit Owning Library ID Rather Than Short Name. Takes effect only if INCLUDE_OWNING_LIB is in use', 'aea', 'label')), ('INCLUDE_QUANTITY', oils_i18n_gettext('INCLUDE_QUANTITY', 'Orders Include Copy Quantities', 'aea', 'label')), -- 2.43.2