Koha::EDI
Module exporting subroutines used in EDI processing for Koha
Subroutines called by batch processing to handle Edifact messages of various types and related utilities
These routines should really be methods of some object. get_edifact_ean is a stopgap which should be replaced
process_quote(quote_message); passed a message object for a quote, parses it creating an order basket and orderlines in the database updates the message's status to received in the database and adds the link to basket
process_invoice(invoice_message) passed a message object for an invoice, add the contained invoices and update the orderlines referred to in the invoice As an Edifact invoice is in effect a despatch note this receipts the appropriate quantities in the orders no meaningful return value
process_ordrsp(ordrsp_message) passed a message object for a supplier response, process the contents If an orderline is cancelled cancel the corresponding orderline in koha otherwise record the supplier message against it no meaningful return value
create_edi_order( { parameter_hashref } ) parameters must include basketno and ean branchcode can optionally be passed returns 1 on success undef otherwise if the parameter noingest is set the formatted order is returned and not saved in the database. This functionality is intended for debugging only
receipt_items( schema_obj, invoice_line, ordernumber, $quantity) receipts the items recorded on this invoice line no meaningful return
transfer_items(schema, invoice_line, originating_order, receiving_order, $quantity) Transfer the items covered by this invoice line from their original order to another order recording the partial fulfillment of the original order no meaningful return
$ean = get_edifact_ean(); routine to return the ean.
quote_item(lineitem, quote_message); Called by process_quote to handle an individual lineitem Generate the biblios and items if required and orderline linking to them Returns 1 on success undef on error Most usual cause of error is a line with no or incorrect budget codes which woild cause order creation to abort If other correct lines exist these are processed and the erroneous line os logged
classmark = title_level_class(edi_item) Trys to return a title level classmark from a quote message line Will return a dewey or lcc classmark if one exists according to the value in DefaultClassificationSource syspref If unable to returns the shelfmark or classification from the GIR segment If all else fails returns empty string
marc_record_obj = _create_bib_from_quote(lineitem, quote) Returns a MARC::Record object based on the info in the quote's lineitem
item_hashref = _create_item_from_quote( lineitem, quote) returns a hashref representing the item fields specified in the quote
(price, price_tax_excluded) = _get_invoiced_price(line_object, $quantity) Returns an array of unitprice and unitprice_tax_excluded derived from the lineitem monetary fields
ecost = _discounted_price(discount, item_price, discounted_price) utility subroutine to return a price calculated from the vendors discount and quoted price if invoice has a field containing discounted price that is returned instead of recalculating
(biblionumber, biblioitemnumber) = _check_for_existing_bib(isbn_or_ean) passed an isbn or ean attempts to locate a match bib On success returns biblionumber and biblioitemnumber On failure returns undefined/an empty list
b = _get_budget(schema_obj, budget_code) Returns the Aqbudget object for the active budget given the passed budget_code or undefined if one does not exist
bib_record = _handle_008_field($bib_record) Checks whether an 008 field exists on the record and adds a default field it does not Returns the bib_record
Colin Campbell <colin.campbell@ptfs-europe.com>
Copyright 2014,2015 PTFS-Europe Ltd This program is free software, You may redistribute it under under the terms of the GNU General Public License