From: Bill Erickson Date: Thu, 27 Sep 2012 19:10:44 +0000 (-0400) Subject: Be more specific in EDI invoice amount billed extraction X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=71041f41328c76b8dc1c7e5fbe528d42d4e6c088;p=working%2FEvergreen.git Be more specific in EDI invoice amount billed extraction The lineitem-level amount billed specifically lives in the MOA+203 segment. This change ensures that if there are multiple MOAs for a linetiem, we specifically use the MOA+203 to determine the price. Signed-off-by: Bill Erickson --- 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 97aa7ac7d2..6a5f34ef9f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm @@ -724,9 +724,22 @@ sub create_acq_invoice_from_edi { # Segment Group 26 concerns *lineitem* price (i.e, total for all copies # on this lineitem). + # e.g. MOA+203:56.62’ my $lineitem_price = $sg25->{SG26}[0]{MOA}[0]{C516}{5004}; + if (@{$sg25->{SG26}} > 1) { + # if there are multiple MOAs, use the MOA+203 + + for my $moa (@{$sg25->{SG26}}) { + $lineitem_price = $moa->{MOA}[0]{C516}{5004} + if $moa->{MOA}[0]{C516}{5025} eq '203'; + } + } + + $logger->info($log_prefix . "extracted LI price $lineitem_price"); + + # Segment Group 28 concerns *unit* (lineitem detail) price. We may # not actually use this. TBD. my $per_unit_price;