# -----------------------------------------------------------
# find the order identifier type and value
- my $ident_attr = $helpers->get_li_order_ident($li->attributes);
$li->{idqual} = 'EN';
+ my $ident_attr = $helpers->get_li_order_ident($li->attributes);
if ($ident_attr) {
my $idname = $ident_attr->attr_name;
# -----------------------------------------------------------
# Common EDI "display" fields
if ($li->attributes) {
- $li_hash->{title} = $helpers->get_li_attr_edi('title', '', $li->attributes);
- $li_hash->{author} = $helpers->get_li_attr_edi('author', '', $li->attributes);
- $li_hash->{edition} = $helpers->get_li_attr_edi('edition', '', $li->attributes);
- $li_hash->{pubdate} = $helpers->get_li_attr_edi('pubdate', '', $li->attributes);
- $li_hash->{publisher} = $helpers->get_li_attr_edi('publisher', '', $li->attributes);
- $li_hash->{pagination} = $helpers->get_li_attr_edi('pagination', '', $li->attributes);
+ $li_hash->{$_} =
+ $helpers->get_li_attr_edi($_, '', $li->attributes)
+ for qw/title author edition pubdate publisher pagination/;
}
next unless $li->lineitem_details;
$copy->{location} = $acp->location->name;
}
- # see if already have a copy_groups item that matches the current copy
+ # see if we already have a copy_groups item that matches the current copy
my ($match) = grep {
($_->{fund} eq $copy->{fund} or
(!$_->{fund} and !$copy->fund))
} @{$li->{copy_groups}};
if ($match) {
- # if we have a match, just increment the counter
- # of copies we want to order.
+ # If we have a match, just increment the counter
+ # of copies of this type we want to order.
$match->{quantity}++;
} else {
- # a copy group with these values is not yet represented, add it.
+ # A copy group with these values is not yet represented.
push(@{$li->{copy_groups}}, $copy);
}
--- /dev/null
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('', :eg_version);
+
+-- org unit shortname mapping?
+
+CREATE TABLE acq.edi_attribute (
+ name TEXT PRIMARY KEY,
+ label TEXT UNIQUE NOT NULL
+);
+
+CREATE TABLE acq.edi_account_attr_map (
+ id SERIAL PRIMARY KEY,
+ edi_account INTEGER NOT NULL REFERENCES acq.edi_account (id),
+ attr TEXT NOT NULL REFERENCES acq.edi_attribute (name),
+ CONSTRAINT edi_attr_once_per_accout UNIQUE (edi_account, attr)
+);
+
+
+INSERT INTO acq.edi_attribute (name, label) VALUES
+ ('delivery.orders', oils_i18n_gettext(
+ 'delivery.orders', 'Sends Orders', 'aea', 'label')),
+ ('delivery.ordrsp', oils_i18n_gettext(
+ 'delivery.ordrsp', 'Receives Order Responses', 'aea', 'label')),
+ ('delivery.invoic', oils_i18n_gettext(
+ 'delivery.invoic', 'Receives Invoices', 'aea', 'label')),
+ ('order.fields.po_name', oils_i18n_gettext(
+ 'order.fields.po_name', 'Order Includes PO Name', 'aea', 'label')),
+ ('order.fields.copies', oils_i18n_gettext(
+ 'order.fields.copies', 'Order Includes Copies', 'aea', 'label')),
+ ('order.fields.fund', oils_i18n_gettext(
+ 'order.fields.fund', 'Order Includes Funds', 'aea', 'label')),
+ ('order.fields.call_number', oils_i18n_gettext(
+ 'order.fields.call_number', 'Order Includes Call Numbers', 'aea', 'label')),
+ ('order.fields.item_type', oils_i18n_gettext(
+ 'order.fields.item_type', 'Order Includes Copy Item Type', 'aea', 'label')),
+ ('order.fields.location', oils_i18n_gettext(
+ 'order.fields.location', 'Order Includes Copy Location', 'aea', 'label')),
+ ('order.fields.collection_code', oils_i18n_gettext(
+ 'order.fields.collection_code', 'Order Includes Copy Collection Code', 'aea', 'label')),
+ ('order.fields.owning_lib', oils_i18n_gettext(
+ 'order.fields.owning_lib', 'Order Includes Copy Owning Lib', 'aea', 'label')),
+ ('order.fields.quantity', oils_i18n_gettext(
+ 'order.fields.quantity', 'Order Includes Copy Quantity', 'aea', 'label')),
+ ('order.fields.copy_id', oils_i18n_gettext(
+ 'order.fields.copy_id', 'Order Includes Copy ID', 'aea', 'label')),
+ ('order.fields.author', oils_i18n_gettext(
+ 'order.fields.author', 'Order Includes Author', 'aea', 'label')),
+ ('order.fields.edition', oils_i18n_gettext(
+ 'order.fields.edition', 'Order Includes Edition', 'aea', 'label')),
+ ('order.fields.pagination', oils_i18n_gettext(
+ 'order.fields.pagination', 'Order Includes Pagination', 'aea', 'label')),
+ ('order.fields.inc_empty_ftx', oils_i18n_gettext(
+ 'order.fields.inc_empty_ftx', 'Order Includes Empty FTX', 'aea', 'label')),
+ ('order.fields.inc_empty_gir', oils_i18n_gettext(
+ 'order.fields.inc_empty_ftx', 'Order Includes Empty GIR', 'aea', 'label'));
+
+-- boolean fields
+ROLLBACK;
+
# munge the lineitem / copy data for easier template integration
-LINEITEMS = [];
FOR li_hash IN po_pre_process.lineitems;
SEGMENT_COUNT = SEGMENT_COUNT + 10; # needs verification
ftx_vals.push(note.value);
END;
IF VENDOR_BRODART; # look for copy-level spec code
- FOR lid IN li.lineitem_details;
- IF lid.note;
- spec_note = lid.note.match('spec code ([a-zA-Z0-9_])');
+ FOR lid IN li_hash.all_copies;
+ IF lid.source_note;
+ spec_note = lid.source_note.match('spec code ([a-zA-Z0-9_])');
IF spec_note.0; ftx_vals.push(spec_note.0); END;
END;
END;
li_hash.notes = notes;
+ # Including the copy ID implies one GIR section per copy.
+ # Otherwise, there is one GIR segement per copy group
+ IF INC_COPIES;
+ IF INC_COPY_ID;
+ li_hash.copies = li_hash.all_copies;
+ ELSE;
+ li_hash.copies = li_hash.copy_groups;
+ END;
+ END;
+
END; # for lineitem
# IMD fields are limited to 70 chars per value. Any values longer
NAD+SU+[% VENDOR_SAN %]::31B'
NAD+SU+[% target.provider.id %]::92'
CUX+2:[% target.provider.currency_type %]:9'
-[%- FOR li_hash IN LINEITEMS -%]
+[%- FOR li_hash IN po_pre_process.lineitems -%]
LIN+[% li_hash.id %]++[% li_hash.idval %]:[% li_hash.idqual %]'
PIA+5+[% li_hash.idval %]:[% li_hash.idqual %]'
[% IMD('BTI', li_hash.title) -%]