Koha::Edifact::Order
Format an Edifact Order message from a Koha basket
Generates an Edifact format Order message for a Koha basket. Normally the only methods used directly by the caller would be new to set up the message, encode to return the formatted message and filename to obtain a name under which to store the message
Should integrate into Koha::Edifact namespace Can caller interface be made cleaner? Make handling of GIR segments more customizable
my $edi_order = Edifact::Order->new( orderlines => \@orderlines, vendor => $vendor_edi_account, ean => $library_ean ); instantiate the Edifact::Order object, all parameters are Schema::Resultset objects Called in Koha::Edifact create_edi_order
my $filename = $edi_order->filename() returns a filename for the edi order. The filename embeds a reference to the basket the message was created to encode
my $edifact_message = $edi_order->encode(); Encodes the basket as a valid edifact message ready for transmission
Creates the service segments which begin the message
Return an interchange header encoding sender and recipient ids message date and standards
Include message data within the encoded message
Terminate message data including control data on number of messages and segments included
Include the service segments occurring at the end of the message
Returns the unique interchange control reference as a 14 digit number
On generates and subsequently returns the unique message reference number as a 12 digit number preceded by ME, to generate a new number pass the string 'new'. In practice we encode 1 message per transmission so there is only one message referenced. were we to encode multiple messages a new reference would be neaded for each
Commences a new message
returns the UNZ segment which ends the tranmission encoding the message count and control reference for the interchange
Formats the message header segments
Returns the BGM segment which includes the Koha basket number
Parameters: Function ( BUYER, DELIVERY, INVOICE, SUPPLIER) Id Agency Returns a NAD segment containg the id and agency for for the Function value. Handles the fact that NAD segments encode the value for 'EAN' differently to elsewhere.
Creates the message segments wncoding an order line
Encodes the biblio item fields Author, title, publisher, date of publication binding
Formats an IMD segment, handles the chunking of data into the 35 character lengths required and the creation of repeat segments
Add item level information
Handle the formatting of a GIR element return empty string if no data
Adds a parssed array of segments to the objects segment list ensures all segments are properly terminated by '
Adds a LIN segment consisting of the line number and the ean number if the passed isbn is valid
Add a PIA segment for an additional product id
Passed a DateTime object returns a correctly formatted DTM segment
Stores and returns constant strings for service_string_advice and message_identifier TBD replace with class variables
Format sender and receipient identifiers for use in the interchange header
Encode textual data into the standard character set ( iso 8859-1 ) and quote any Edifact metacharacters
Convenient routine which returns message date as a Y-m-d string useful if the caller wants to log date of creation
Colin Campbell <colin.campbell@ptfs-europe.com>
Copyright 2014,2015,2016 PTFS-Europe Ltd This program is free software, You may redistribute it under under the terms of the GNU General Public License