EDIReader: improve monetary regexes
authorBill Erickson <berick@esilibrary.com>
Wed, 12 Dec 2012 17:50:47 +0000 (12:50 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 14 Jan 2013 22:10:31 +0000 (17:10 -0500)
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

index 532af2d..7096883 100644 (file)
@@ -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 {