[OPEN-ILS-DEV] ***SPAM*** Re: EDI Problems

Ben Shum bshum at biblio.org
Thu Dec 1 10:09:06 EST 2011


I'm not sure yet, still thinking on this, but curious, when you deleted entries, did you remove any extra outputs from action_trigger.event_output?  Perhaps you have remnant entries in there that are still trying to be pushed, but since you deleted the associated acq.* contents, it doesn't operate correctly.

I'll ponder this some more, but that's my first gut reaction.

-- Ben

On Dec 1, 2011, at 8:40 AM, Tim Spindler wrote:

> I have been doing a bit of testing of EDI and now i get the following error after doing the following:
> 
> 1. Create a test order connected to an EDI account (i have been successfully running this until I changed the notification/trigger template)
> 2. Issue to send order to test site
> ./action_trigger_runner.pl --run_pending
> ./edi_pusher.pl
> 3. The following error is generated and no edi message created
> Can't call method "id" on an undefined value at ./edi_pusher.pl line 139.
> 
> The other thing I did do is delete a bunch of orders form the database to clean up all the testing we had been doing.  I deleted rows in the tables acq.purchase_order, acq.po_item, acq.po_note, acq.line_item, acq.line_item detail.  I modified the PO_JEDI template to read as follows.  The line I changes is this 
> 
> "buyer":[
>             [%   IF   target.provider.edi_default.vendcode && (target.provider.code == 'BT' || target.provider.name.match('(?i)^BAKER & TAYLOR'))  -%]
>                 {"id-qualifier": 91, "id":"[% target.ordering_agency.mailing_address.san _ ' ' _ target.provider.edi_default.vendcode %]"}
>             [%- ELSIF target.provider.edi_default.vendcode && (target.provider.code == 'INGRAM' || target.provider.name.match('(?i)^ingra')) || target.provider.name.match('(?i)^ingrb'))  -%]
>                 {"id":"[% target.ordering_agency.mailing_address.san %]"},
>                 {"id-qualifier": 91, "id":"[% target.provider.edi_default.vendcode %]"}
>             [%- ELSE -%]
>                 {"id":"[% target.ordering_agency.mailing_address.san %]"}
>             [%- END -%]
>         ],
> 
> ----------full template code below---------------------------
> 
> [%- USE date -%]
> [%# start JEDI document 
>   # Vendor specific kludges:
>   # BT      - vendcode goes to NAD/BY *suffix*  w/ 91 qualifier
>   # INGRAM  - vendcode goes to NAD/BY *segment* w/ 91 qualifier (separately)
>   # BRODART - vendcode goes to FTX segment (lineitem level)
> -%]
> [%- 
> IF target.provider.edi_default.vendcode && target.provider.code == 'BRODART';
>     xtra_ftx = target.provider.edi_default.vendcode;
> END;
> -%]
> [%- BLOCK big_block -%]
> {
>    "recipient":"[% target.provider.san %]",
>    "sender":"[% target.ordering_agency.mailing_address.san %]",
>    "body": [{
>      "ORDERS":[ "order", {
>         "po_number":[% target.id %],
>         "date":"[% date.format(date.now, '%Y%m%d') %]",
>         "buyer":[
>             [%   IF   target.provider.edi_default.vendcode && (target.provider.code == 'BT' || target.provider.name.match('(?i)^BAKER & TAYLOR'))  -%]
>                 {"id-qualifier": 91, "id":"[% target.ordering_agency.mailing_address.san _ ' ' _ target.provider.edi_default.vendcode %]"}
>             [%- ELSIF target.provider.edi_default.vendcode && (target.provider.code == 'INGRAM' || target.provider.name.match('(?i)^ingra')) || target.provider.name.match('(?i)^ingrb'))  -%]
>                 {"id":"[% target.ordering_agency.mailing_address.san %]"},
>                 {"id-qualifier": 91, "id":"[% target.provider.edi_default.vendcode %]"}
>             [%- ELSE -%]
>                 {"id":"[% target.ordering_agency.mailing_address.san %]"}
>             [%- END -%]
>         ],
>         "vendor":[
>             [%- # target.provider.name (target.provider.id) -%]
>             "[% target.provider.san %]",
>             {"id-qualifier": 92, "id":"[% target.provider.id %]"}
>         ],
>         "currency":"[% target.provider.currency_type %]",
>                 
>         "items":[
>         [%- FOR li IN target.lineitems %]
>         {
>             "line_index":"[% li.id %]",
>             "identifiers":[   [%-# li.isbns = helpers.get_li_isbns(li.attributes) %]
>             [% FOR isbn IN helpers.get_li_isbns(li.attributes) -%]
>                 [% IF isbn.length == 13 -%]
>                 {"id-qualifier":"EN","id":"[% isbn %]"},
>                 [% ELSE -%]
>                 {"id-qualifier":"IB","id":"[% isbn %]"},
>                 [%- END %]
>             [% END %]
>                 {"id-qualifier":"IN","id":"[% li.id %]"}
>             ],
>             "price":[% li.estimated_unit_price || '0.00' %],
>             "desc":[
>                 {"BTI":"[% helpers.get_li_attr_jedi('title',     '', li.attributes) %]"},
>                 {"BPU":"[% helpers.get_li_attr_jedi('publisher', '', li.attributes) %]"},
>                 {"BPD":"[% helpers.get_li_attr_jedi('pubdate',   '', li.attributes) %]"},
>                 {"BPH":"[% helpers.get_li_attr_jedi('pagination','', li.attributes) %]"}
>             ],
>             [%- ftx_vals = []; 
>                 FOR note IN li.lineitem_notes; 
>                     NEXT UNLESS note.vendor_public == 't'; 
>                     ftx_vals.push(note.value); 
>                 END; 
>                 IF xtra_ftx;           ftx_vals.unshift(xtra_ftx); END; 
>                 IF ftx_vals.size == 0; ftx_vals.unshift('');       END;  # BT needs FTX+LIN for every LI, even if it is an empty one
>             -%]
> 
>             "free-text":[ 
>                 [% FOR note IN ftx_vals -%] "[% note %]"[% UNLESS loop.last %], [% END %][% END %] 
>             ],            
>             "quantity":[% li.lineitem_details.size %]
>         }[% UNLESS loop.last %],[% END %]
>         [%-# TODO: lineitem details (later) -%]
>         [% END %]
>         ],
>         "line_items":[% target.lineitems.size %]
>      }]  [%# close ORDERS array %]
>    }]    [%# close  body  array %]
> }
> [% END %]
> [% tempo = PROCESS big_block; helpers.escape_json(tempo) %]
> 
> 
> And it had worked when I had the following but when I returned it to this state and rebooting the server I always get the above error.
> 
> [%- USE date -%]
> [%# start JEDI document 
>   # Vendor specific kludges:
>   # BT      - vendcode goes to NAD/BY *suffix*  w/ 91 qualifier
>   # INGRAM  - vendcode goes to NAD/BY *segment* w/ 91 qualifier (separately)
>   # BRODART - vendcode goes to FTX segment (lineitem level)
> -%]
> [%- 
> IF target.provider.edi_default.vendcode && target.provider.code == 'BRODART';
>     xtra_ftx = target.provider.edi_default.vendcode;
> END;
> -%]
> [%- BLOCK big_block -%]
> {
>    "recipient":"[% target.provider.san %]",
>    "sender":"[% target.ordering_agency.mailing_address.san %]",
>    "body": [{
>      "ORDERS":[ "order", {
>         "po_number":[% target.id %],
>         "date":"[% date.format(date.now, '%Y%m%d') %]",
>         "buyer":[
>             [%   IF   target.provider.edi_default.vendcode && (target.provider.code == 'BT' || target.provider.name.match('(?i)^BAKER & TAYLOR'))  -%]
>                 {"id-qualifier": 91, "id":"[% target.ordering_agency.mailing_address.san _ ' ' _ target.provider.edi_default.vendcode %]"}
>             [%- ELSIF target.provider.edi_default.vendcode && (target.provider.code == 'INGRAM' || target.provider.name.match('(?i)^ingra'))  -%]
>                 {"id":"[% target.ordering_agency.mailing_address.san %]"},
>                 {"id-qualifier": 91, "id":"[% target.provider.edi_default.vendcode %]"}
>             [%- ELSE -%]
>                 {"id":"[% target.ordering_agency.mailing_address.san %]"}
>             [%- END -%]
>         ],
>         "vendor":[
>             [%- # target.provider.name (target.provider.id) -%]
>             "[% target.provider.san %]",
>             {"id-qualifier": 92, "id":"[% target.provider.id %]"}
>         ],
>         "currency":"[% target.provider.currency_type %]",
>                 
>         "items":[
>         [%- FOR li IN target.lineitems %]
>         {
>             "line_index":"[% li.id %]",
>             "identifiers":[   [%-# li.isbns = helpers.get_li_isbns(li.attributes) %]
>             [% FOR isbn IN helpers.get_li_isbns(li.attributes) -%]
>                 [% IF isbn.length == 13 -%]
>                 {"id-qualifier":"EN","id":"[% isbn %]"},
>                 [% ELSE -%]
>                 {"id-qualifier":"IB","id":"[% isbn %]"},
>                 [%- END %]
>             [% END %]
>                 {"id-qualifier":"IN","id":"[% li.id %]"}
>             ],
>             "price":[% li.estimated_unit_price || '0.00' %],
>             "desc":[
>                 {"BTI":"[% helpers.get_li_attr_jedi('title',     '', li.attributes) %]"},
>                 {"BPU":"[% helpers.get_li_attr_jedi('publisher', '', li.attributes) %]"},
>                 {"BPD":"[% helpers.get_li_attr_jedi('pubdate',   '', li.attributes) %]"},
>                 {"BPH":"[% helpers.get_li_attr_jedi('pagination','', li.attributes) %]"}
>             ],
>             [%- ftx_vals = []; 
>                 FOR note IN li.lineitem_notes; 
>                     NEXT UNLESS note.vendor_public == 't'; 
>                     ftx_vals.push(note.value); 
>                 END; 
>                 IF xtra_ftx;           ftx_vals.unshift(xtra_ftx); END; 
>                 IF ftx_vals.size == 0; ftx_vals.unshift('');       END;  # BT needs FTX+LIN for every LI, even if it is an empty one
>             -%]
> 
>             "free-text":[ 
>                 [% FOR note IN ftx_vals -%] "[% note %]"[% UNLESS loop.last %], [% END %][% END %] 
>             ],            
>             "quantity":[% li.lineitem_details.size %]
>         }[% UNLESS loop.last %],[% END %]
>         [%-# TODO: lineitem details (later) -%]
>         [% END %]
>         ],
>         "line_items":[% target.lineitems.size %]
>      }]  [%# close ORDERS array %]
>    }]    [%# close  body  array %]
> }
> [% END %]
> [% tempo = PROCESS big_block; helpers.escape_json(tempo) %]
> 
> 
> 
> -- 
> Tim Spindler
> Manager of Library Applications
> tspindler at cwmars.org
> 508-755-3323 x20
>  
> C/W MARS, Inc.
> 67 Millbrook St, Suite 201
> Worcester, MA 01606 
> http://www.cwmars.org
>  
> P   Go Green - Save a tree! Please don't print this e-mail unless it's really necessary.
>  
> 

Benjamin Shum
Open Source Software Coordinator
Bibliomation, Inc.
32 Crest Road
Middlebury, CT 06762
203-577-4070, ext. 113

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20111201/39655eee/attachment-0001.htm>


More information about the Open-ils-dev mailing list