LP#1373690 template repair empty notes
authorBill Erickson <berickxx@gmail.com>
Mon, 18 May 2015 15:57:02 +0000 (11:57 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 5 Nov 2015 15:02:08 +0000 (10:02 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/upgrade/XXXX.data.acq-order-edi.sql

index 352e92a..486ee59 100644 (file)
@@ -131,17 +131,20 @@ FOR li IN target.lineitems;
     END; 
     IF xtra_ftx; ftx_vals.unshift(xtra_ftx); END; 
 
+    notes = [];
+
     # BT & ULS want FTX+LIN for every LI, even if empty
     IF ((VENDOR_BT OR VENDOR_ULS) AND ftx_vals.size == 0);
-        ftx_vals.unshift('');
-    END;  
+        notes.push('');
 
-    # EDI FTX fields have a max length of 512
-    notes = [];
-    FOR note IN ftx_vals;
-        sub_notes = note.chunk(512);
-        FOR sub_note IN sub_notes;
-            notes.push(helpers.escape_edi(sub_note));
+    ELSE;
+
+        # EDI FTX fields have a max length of 512
+        FOR note IN ftx_vals;
+            sub_notes = note.chunk(512);
+            FOR sub_note IN sub_notes;
+                notes.push(helpers.escape_edi(sub_note));
+            END;
         END;
     END;