From 976d33c2d1fcb6a4fccd684e7d21f0c8854c2adb Mon Sep 17 00:00:00 2001
From: Bill Erickson <berick@esilibrary.com>
Date: Wed, 12 Dec 2012 12:50:47 -0500
Subject: [PATCH] EDIReader: improve monetary regexes

Make no attempt to enforce/decipher monetary amounts in the regexes,
simply capture the values.  If they are invalid, Postgres will let us
know.

This change allows us to capture non-numeric (\d) characters (e.g. "."),
which are of course common in monetary amounts.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
---
 Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIReader.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIReader.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIReader.pm
index 532af2d2d7..7096883c68 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIReader.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/EDIReader.pm
@@ -26,16 +26,16 @@ my %edi_fields = (
     vendor_acct     => qr/^NAD\+SU\+([^:]+)::91/,
     purchase_order  => qr/^RFF\+ON:(\S+)/,
     invoice_ident   => qr/^BGM\+380\+([^\+]+)/,
-    total_billed    => qr/^MOA\+86:(\d+)/,
+    total_billed    => qr/^MOA\+86:([^:]+)/,
     invoice_date    => qr/^DTM\+137:([^:]+)/
 );
 
 my %edi_li_fields = (
     id      => qr/^RFF\+LI:\S+\/(\S+)/,
     index   => qr/^LIN\+([^\+]+)/,
-    amount_billed   => qr/^MOA\+203:(\d+)/,
-    net_unit_price  => qr/^PRI\+AAA:(\d+)/,
-    gross_unit_price=> qr/^PRI\+AAB:(\d+)/,
+    amount_billed   => qr/^MOA\+203:([^:]+)/,
+    net_unit_price  => qr/^PRI\+AAA:([^:]+)/,
+    gross_unit_price=> qr/^PRI\+AAB:([^:]+)/,
     expected_date   => qr/^DTM\+44:([^:]+)/,
     avail_status    => qr/^FTX\+LIN\++([^:]+):8B:28/,
     # "1B" codes are deprecated, but still in use.  
@@ -55,7 +55,7 @@ my %edi_li_quant_fields = (
 
 my %edi_charge_fields = (
     charge_type   => qr/^ALC\+C\++([^\+]+)/,
-    charge_amount => qr/^MOA\+(8|131):(\d+)/
+    charge_amount => qr/^MOA\+(8|131):([^:]+)/
 );
 
 sub new {
-- 
2.11.0