more flexibility for reading invoice identifiers, references edi-invoice-scratch
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 30 Jul 2012 18:20:26 +0000 (14:20 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Mon, 30 Jul 2012 18:21:03 +0000 (14:21 -0400)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/edi_translator/data/brodart/1130B766274.jedi
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm

index d1ed502..c2443fc 100644 (file)
           }
         ]
       ]
-    },
+    }
   ],
   "sender": "1697684",
   "header": [
index c1f1326..ca66926 100644 (file)
@@ -678,16 +678,18 @@ sub create_acq_invoice_from_edi {
         #   from LIN...
         try {
             my $c212 = $sg25->{LIN}[0]{C212};
-            push @identifiers, [$c212->{7143}, $c212->{7140}];
+            push @identifiers, [$c212->{7143}, $c212->{7140}] if
+                $c212 and ref $c212 eq 'HASH';
         } catch Error with {
             # move on
         };
 
         #   from PIA...
         try {
-            my $c212 = $sg25->{PIA}[0]{C212};
-            foreach my $h (@$c212) {
-                push @identifiers, [$h->{7143}, $h->{7140}];
+            foreach my $pia (@{ $sg25->{PIA} }) {
+                foreach my $h (@{$pia->{C212}}) {
+                    push @identifiers, [$h->{7143}, $h->{7140}];
+                }
             }
         } catch Error with {
             # move on
@@ -734,9 +736,9 @@ sub create_acq_invoice_from_edi {
                                 $log_prefix .
                                 "RFFs within lineitem disagree on PO # ?"
                             ) unless $acq_identifiers->{po} eq $po;
-
-                            $acq_identifiers->{li} = $li;
                         }
+                        $acq_identifiers->{li} = $li;
+                        $acq_identifiers->{po} = $po;
                     } else {
                         $logger->warn(
                             $log_prefix .