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

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 208622
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208622&action=edit
Bug 43755: Match EDI invoice lines with no GIR to the items on the order

Koha::EDI::receipt_items and transfer_items find the items that belong
to an invoice line by the branch given in its GIR segments (LLO). GIR is
conditional on an invoice line in the EDItEUR Library EDI Implementation
Guidelines (INVOIC segment 39A, which is not part of the regular EANCOM
subset), and the worked example in those guidelines has none, so an
invoice with no GIR segments is valid. Such a line has no branch, so
nothing matched:

- on a full receipt the order was completed but an edifact_errors row
  was written for every copy, the items were not touched (so
  AcqItemSetSubfieldsWhenReceived was not applied), and Perl warned
  about an uninitialized $branch
- on a part receipt transfer_items moved no items, so the new completed
  order had none and all the items stayed on the original order

A copy that has no branch, because the line has no GIR or fewer GIRs
than the quantity invoiced, now takes the first item linked to the order
that is not already taken, in itemnumber order. Copies with a branch are
matched first, as before, so an invoice with matching GIR segments
behaves as it did. transfer_items and receipt_items use the same order,
so the items moved to the completed order are the ones that are
received.

Test plan:
1. Apply the patch
2. prove t/db_dependent/Koha/EDI.t
   => the subtest 'process_invoice without GIR segments' passes
3. Create a vendor with an EDI account (no plugin) and a basket with
   AcqCreateItem=ordering. Order 3 copies of a record so 3 items are
   linked to the order.
4. Process an INVOIC for that order with QTY+47:1 and no GIR segments
   => the first item is moved to the completed order and received, the
      other 2 stay on the original order, and there are no errors
5. Repeat with QTY+47:3 and no GIR segments
   => all 3 items are received with no errors
6. Repeat with a matching GIR+LLO segment
   => behaviour is unchanged: the item at that branch is used

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
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