4 INSERT INTO config.upgrade_log (version) VALUES ('0189');
6 UPDATE action_trigger.event_definition SET template =
10 # find a lineitem attribute by name and optional type
12 FOR attr IN li.attributes;
13 IF attr.attr_name == attr_name;
14 IF !attr_type OR attr_type == attr.attr_type;
23 <h2>Purchase Order [% target.id %]</h2>
25 date <b>[% date.format(date.now, '%Y%m%d') %]</b>
29 table td { padding:5px; border:1px solid #aaa;}
30 table { width:95%; border-collapse:collapse; }
31 #vendor-notes { padding:5px; border:1px solid #aaa; }
33 <table id='vendor-table'>
35 <td valign='top'>Vendor</td>
37 <div>[% target.provider.name %]</div>
38 <div>[% target.provider.addresses.0.street1 %]</div>
39 <div>[% target.provider.addresses.0.street2 %]</div>
40 <div>[% target.provider.addresses.0.city %]</div>
41 <div>[% target.provider.addresses.0.state %]</div>
42 <div>[% target.provider.addresses.0.country %]</div>
43 <div>[% target.provider.addresses.0.post_code %]</div>
45 <td valign='top'>Ship to / Bill to</td>
47 <div>[% target.ordering_agency.name %]</div>
48 <div>[% target.ordering_agency.billing_address.street1 %]</div>
49 <div>[% target.ordering_agency.billing_address.street2 %]</div>
50 <div>[% target.ordering_agency.billing_address.city %]</div>
51 <div>[% target.ordering_agency.billing_address.state %]</div>
52 <div>[% target.ordering_agency.billing_address.country %]</div>
53 <div>[% target.ordering_agency.billing_address.post_code %]</div>
59 <fieldset id='vendor-notes'>
60 <legend>Notes to the Vendor</legend>
62 [% FOR note IN target.notes %]
63 [% IF note.vendor_public == 't' %]
64 <li>[% note.value %]</li>
75 <th>ISBN or Item #</th>
86 [% FOR li IN target.lineitems %]
89 [% count = li.lineitem_details.size %]
90 [% price = li.estimated_unit_price %]
91 [% litotal = (price * count) %]
92 [% subtotal = subtotal + litotal %]
93 [% isbn = PROCESS get_li_attr attr_name = 'isbn' %]
94 [% ident = PROCESS get_li_attr attr_name = 'identifier' %]
96 <td>[% target.id %]</td>
97 <td>[% isbn || ident %]</td>
98 <td>[% PROCESS get_li_attr attr_name = 'title' %]</td>
101 <td>[% litotal %]</td>
104 [% FOR note IN li.lineitem_notes %]
105 [% IF note.vendor_public == 't' %]
106 <li>[% note.value %]</li>
116 <td>[% subtotal %]</td>
123 Total Line Item Count: [% target.lineitems.size %]
127 INSERT INTO action_trigger.environment (event_def, path) VALUES
128 (4, 'lineitems.lineitem_notes'),