https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43535

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 205794
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205794&action=edit
Bug 43535: Support matching EDIFACT invoice lines to orders via RFF+SLI/QLI

Koha::EDI's process_invoice previously matched every incoming EDIFACT
INVOIC line to an aqorders row only via RFF+LI - Koha's own internal
ordernumber, echoed back by the vendor because Koha sent it in the
original EDIFACT ORDERS message. If RFF+LI was missing or did not
resolve, the line was skipped and logged as an error.

This adds a fallback: when RFF+LI is absent or does not match an order,
try the supplier's own line reference (RFF+SLI), or failing that their
quotation reference (RFF+QLI), against aqorders.suppliers_reference_number
- scoped to the invoice's vendor to avoid cross-vendor collisions. Both
qualifiers were already parsed by Koha::Edifact::Line but never
consulted during invoice matching.

This matters for vendors such as GOBI/YBP, which support ordering via
MARC file import (see bug 43534, which this depends on) rather than
EDIFACT ORDERS, but still return EDIFACT invoices referencing their own
order/line ID via RFF+SLI. Previously those invoice lines could never
be matched at all, since Koha never sent an ORDERS message containing a
Koha ordernumber for the vendor to echo back.

Test plan:
1. Apply this patch and bug 43534's patch.
2. Set MarcFieldsToOrder to map suppliers_reference_number and a literal
   suppliers_reference_qualifier (e.g. SLI), then create an order line
   via a MARC order file as per bug 43534's test plan, noting the
   resulting suppliers_reference_number.
3. Construct or receive an EDIFACT INVOIC message for that vendor whose
   line has no RFF+LI (or an unresolvable one) but has an RFF+SLI (or
   RFF+QLI) matching that suppliers_reference_number.
4. Process the invoice (Koha::EDI::process_invoice) and confirm the order
   line is receipted correctly, with no "cannot find order" error logged.
5. Confirm existing EDI invoice processing (RFF+LI matching, and the
   "missing ordernumber" / "cannot find order with ordernumber X" error
   paths) is unaffected when no supplier reference is present or
   applicable.
6. prove t/db_dependent/Koha/EDI.t

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to