[open-ils-commits] r16362 - in trunk/Open-ILS/src/sql/Pg: . upgrade (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 30 12:34:37 EDT 2010


Author: erickson
Date: 2010-04-30 12:34:33 -0400 (Fri, 30 Apr 2010)
New Revision: 16362

Modified:
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
   trunk/Open-ILS/src/sql/Pg/upgrade/0167.data.event_definition_po_jedi.sql
   trunk/Open-ILS/src/sql/Pg/upgrade/0246.data.event_definition_po_jedi.sql
Log:
Give event definition a proper id (23)

Signed-off-by: Joe Atzberger <atz at esilibrary.com>

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-04-30 15:43:10 UTC (rev 16361)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-04-30 16:34:33 UTC (rev 16362)
@@ -4659,7 +4659,56 @@
 INSERT INTO action_trigger.environment ( event_def, path) VALUES
     ( 13, 'open_billable_transactions_summary.circulation' );
 
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, cleanup_success, cleanup_failure, delay, delay_field, group_field, template) VALUES (23, true, 1, 'PO JEDI', 'format.po.jedi', 'NOOP_True', 'ProcessTemplate', NULL, NULL, '00:05:00', NULL, NULL,
+$$[%- USE date -%]
+[%# start JEDI document -%]
+[%- BLOCK big_block -%]
+["order", {
+    "po_number":[% target.id %],
+    "date":"[% date.format(date.now, '%Y%m%d') %]",
+    "buyer":[
+        {"id":"[% target.ordering_agency.mailing_address.san %]",
+         "reference":{"API":"[% target.ordering_agency.mailing_address.san %]"}}
+    ],
+    "vendor":[ 
+        "[% target.provider.san %]", // [% target.provider.name %] ([% target.provider.id %])
+        {"id-qualifier":"91", "reference":{"IA":"[% target.provider.id %]"}, "id":"[% target.provider.san %]"}
+    ],
+    "currency":"[% target.provider.currency_type %]",
+    "items":[
+        [% FOR li IN target.lineitems %]
+        {
+            "identifiers":[
+                {"id-qualifier":"SA","id":"[% li.id %]"},
+                {"id-qualifier":"IB","id":"[% helpers.get_li_attr('isbn', li.attributes) %]"}
+            ],
+            "price":[% helpers.get_li_attr('estimated_price', '', li.attributes) %],
+            "desc":[
+                {"BTI":"[% helpers.get_li_attr('title',     '', li.attributes) %]"}, 
+                {"BPU":"[% helpers.get_li_attr('publisher', '', li.attributes) %]"},
+                {"BPD":"[% helpers.get_li_attr('pubdate',   '', li.attributes) %]"},
+                {"BPH":"[% helpers.get_li_attr('pagination','', li.attributes) %]"}
+            ],
+            "quantity":[% li.lineitem_details.size %]
+            [%-# TODO: lineitem details (later) -%]
+        }[% UNLESS loop.last %],[% END -%]
+        [%- END %]
+    ],
+    "line_items":[% target.lineitems.size %]
+}]
+[% END %]
+[% tempo = PROCESS big_block; helpers.escape_json(tempo) %]
+$$
+);
 
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+  (23, 'lineitems.attributes'), 
+  (23, 'lineitems.lineitem_details'), 
+  (23, 'lineitems.lineitem_notes'), 
+  (23, 'ordering_agency.mailing_address'), 
+  (23, 'provider'),
+  (23, 'provider.edi_default');
+
 INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
     VALUES ( 
         'circ.offline.username_allowed',

Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0167.data.event_definition_po_jedi.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0167.data.event_definition_po_jedi.sql	2010-04-30 15:43:10 UTC (rev 16361)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0167.data.event_definition_po_jedi.sql	2010-04-30 16:34:33 UTC (rev 16362)
@@ -2,7 +2,7 @@
 
 INSERT INTO config.upgrade_log (version) VALUES ('0167');
 
-INSERT INTO action_trigger.event_definition (active, owner, name, hook, validator, reactor, cleanup_success, cleanup_failure, delay, delay_field, group_field, template) VALUES (true, 1, 'PO JEDI', 'format.po.jedi', 'NOOP_True', 'ProcessTemplate', NULL, NULL, '00:05:00', NULL, NULL,
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, cleanup_success, cleanup_failure, delay, delay_field, group_field, template) VALUES (23, true, 1, 'PO JEDI', 'format.po.jedi', 'NOOP_True', 'ProcessTemplate', NULL, NULL, '00:05:00', NULL, NULL,
 $$[%- USE date -%]
 [%# start JEDI document -%]
 [%- BLOCK big_block -%]
@@ -66,11 +66,11 @@
 
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-  ((SELECT id FROM action_trigger.event_definition WHERE name='PO JEDI'), 'lineitems.attributes'), 
-  ((SELECT id FROM action_trigger.event_definition WHERE name='PO JEDI'), 'lineitems.lineitem_details'), 
-  ((SELECT id FROM action_trigger.event_definition WHERE name='PO JEDI'), 'lineitems.lineitem_notes'), 
-  ((SELECT id FROM action_trigger.event_definition WHERE name='PO JEDI'), 'ordering_agency.mailing_address'), 
-  ((SELECT id FROM action_trigger.event_definition WHERE name='PO JEDI'), 'provider');
+  (23, 'lineitems.attributes'), 
+  (23, 'lineitems.lineitem_details'), 
+  (23, 'lineitems.lineitem_notes'), 
+  (23, 'ordering_agency.mailing_address'), 
+  (23, 'provider');
 
 -- The environment insert has to happen here because it relies on subquerying the user-editable field "name" to
 -- provide the FK.  Outside of this transaction, we cannot be sure the user hasn't changed the name to something else.

Modified: trunk/Open-ILS/src/sql/Pg/upgrade/0246.data.event_definition_po_jedi.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0246.data.event_definition_po_jedi.sql	2010-04-30 15:43:10 UTC (rev 16361)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0246.data.event_definition_po_jedi.sql	2010-04-30 16:34:33 UTC (rev 16362)
@@ -2,7 +2,7 @@
 
 INSERT INTO config.upgrade_log (version) VALUES ('0246');
 
-UPDATE action_trigger.event_definition SET template = 
+UPDATE action_trigger.event_definition SET id=23, template = 
 $$[%- USE date -%]
 [%# start JEDI document -%]
 [%- BLOCK big_block -%]
@@ -53,10 +53,10 @@
 [% END %]
 [% tempo = PROCESS big_block; helpers.escape_json(tempo) %]
 $$
-WHERE name='PO JEDI';
-
+WHERE name='PO JEDI' or id=23;  -- bring updated DB in line w/ baseline DB
+                                -- nobody but devs will have the old 100+ id, and only atz put it in use
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-  ((SELECT id FROM action_trigger.event_definition WHERE name='PO JEDI'), 'provider.edi_default');
+  (23, 'provider.edi_default');
 
 -- Hope they haven't changed the name...
 



More information about the open-ils-commits mailing list