<<

NAME

Koha::Edifact::Order

SYNOPSIS

Format an Edifact Order message from a Koha basket

DESCRIPTION

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

BUGS

Should integrate into Koha::Edifact namespace Can caller interface be made cleaner? Make handling of GIR segments more customizable

METHODS

new

  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

filename

   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

encode

   my $edifact_message = $edi_order->encode();

   Encodes the basket as a valid edifact message ready for transmission

initial_service_segments

    Creates the service segments which begin the message

interchange_header

    Return an interchange header encoding sender and recipient
    ids message date and standards

user_data_message_segments

    Include message data within the encoded message

message_trailer

    Terminate message data including control data on number
    of messages and segments included

trailing_service_segments

   Include the service segments occurring at the end of the message

interchange_control_reference

   Returns the unique interchange control reference as a 14 digit number

message_reference

    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

message_header

    Commences a new message

interchange_trailer

    returns the UNZ segment which ends the tranmission encoding the
    message count and control reference for the interchange

order_msg_header

    Formats the message header segments

beginning_of_message

    Returns the BGM segment which includes the Koha basket number

name_and_address

    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.

order_line

    Creates the message segments wncoding an order line

item_description

    Encodes the biblio item fields Author, title, publisher, date of publication
    binding

imd_segment

    Formats an IMD segment, handles the chunking of data into the 35 character
    lengths required and the creation of repeat segments

gir_segments

    Add item level information

add_gir_identity_number

    Handle the formatting of a GIR element
    return empty string if no data

add_seg

    Adds a parssed array of segments to the objects segment list
    ensures all segments are properly terminated by '

lin_segment

    Adds a LIN segment consisting of the line number and the ean number
    if the passed isbn is valid

additional_product_id

    Add a PIA segment for an additional product id

message_date_segment

    Passed a DateTime object returns a correctly formatted DTM segment

_const

    Stores and returns constant strings for service_string_advice
    and message_identifier
    TBD replace with class variables

_interchange_sr_identifier

    Format sender and receipient identifiers for use in the interchange header

encode_text

    Encode textual data into the standard character set ( iso 8859-1 )
    and quote any Edifact metacharacters

msg_date_string

    Convenient routine which returns message date as a Y-m-d string
    useful if the caller wants to log date of creation

AUTHOR

   Colin Campbell <colin.campbell@ptfs-europe.com>

COPYRIGHT

   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

<<