LP#1373690 template continued
authorBill Erickson <berickxx@gmail.com>
Wed, 13 May 2015 21:41:38 +0000 (17:41 -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 5765ce3..adab421 100644 (file)
@@ -5,7 +5,7 @@ INSERT INTO action_trigger.event_definition
     (id, active, owner, name, hook, validator, reactor, cleanup_success, 
     cleanup_failure, delay, delay_field, group_field, template) 
 VALUES 
-    (51, true, 1, 'PO EDI', 'acqpo.activated', 
+    (54, true, 1, 'PO EDI', 'acqpo.activated', 
         'Acq::PurchaseOrderEDIRequired', 'GeneratePurchaseOrderJEDI', 
         NULL, NULL, '00:00:00', NULL, NULL,
 $$
@@ -266,10 +266,10 @@ GIR+[% GIR_INDEX.format('%03d') -%][% END -%]
     FIELD_COUNT = FIELD_COUNT + 1 -%]
 +[% copy.copy_id %]:LCO[%- END -%]
 '[%# finalize the GIR segment with a "'" -%]
-[% END %] [%# FOR copies %]
+[%- END -%][%# FOR copies %]
 [%- FOR note IN li_hash.notes -%]
 FTX+LIN+1+[% note %]'
-[% END -%]
+[%- END -%]
 PRI+AAB:[% li.estimated_unit_price || "0.00" %]'
 [%- IF INC_PO_NAME -%]
 RFF+LI:[% helpers.escape_edi(target.name) %]/[% li.id %]'
@@ -279,7 +279,7 @@ RFF+LI:[% target.id %]/[% li.id %]'
 [%- END -%][%# for lineitems %]
 UNS+S'
 CNT+2:[% target.lineitems.size %]'
-UNT+40+1'
+UNT+[% SEGMENT_COUNT %]+1'
 UNZ+1+1'
 [% END %][%# block %]
 [% 
@@ -291,16 +291,16 @@ $$
 );
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-  (51, 'lineitems.attributes'), 
-  (51, 'lineitems.lineitem_details.owning_lib'),
-  (51, 'lineitems.lineitem_details.location'),
-  (51, 'lineitems.lineitem_details.fund'),
-  (51, 'lineitems.lineitem_details.eg_copy_id.location'),
-  (51, 'lineitems.lineitem_details.eg_copy_id.call_number'),
-  (51, 'lineitems.lineitem_notes'), 
-  (51, 'ordering_agency.mailing_address'), 
-  (51, 'provider'),
-  (51, 'provider.edi_default');
+  (54, 'lineitems.attributes'), 
+  (54, 'lineitems.lineitem_details.owning_lib'),
+  (54, 'lineitems.lineitem_details.location'),
+  (54, 'lineitems.lineitem_details.fund'),
+  (54, 'lineitems.lineitem_details.eg_copy_id.location'),
+  (54, 'lineitems.lineitem_details.eg_copy_id.call_number'),
+  (54, 'lineitems.lineitem_notes'), 
+  (54, 'ordering_agency.mailing_address'), 
+  (54, 'provider'),
+  (54, 'provider.edi_default');
 
 COMMIT;
 
@@ -308,15 +308,15 @@ COMMIT;
 -- UNDO:
 
 BEGIN;
-DELETE FROM action_trigger.event where event_def = 51;
-DELETE FROM action_trigger.environment where event_def = 51;
-DELETE FROM action_trigger.event_definition WHERE id = 51;
+DELETE FROM action_trigger.event where event_def = 54;
+DELETE FROM action_trigger.environment where event_def = 54;
+DELETE FROM action_trigger.event_definition WHERE id = 54;
 COMMIT;
 
 -- TESTING
 
 \i /home/berick/code/Evergreen/Open-ILS/src/sql/Pg/upgrade/XXXX.data.acq-order-edi.sql
-INSERT INTO action_trigger.event (target, event_def, run_time,state) VALUES (1, 51, now(), 'pending');
+INSERT INTO action_trigger.event (target, event_def, run_time,state) VALUES (6, 54, now(), 'pending');
 
 */