https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43874 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 208632 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208632&action=edit Bug 43874: Expand EDIFACT GIR part-order sets into one entry per copy The EDItEUR Library EDI Implementation Guidelines let a GIR segment stand for a part-order set: several copies of an order line with the same branch, fund, shelfmark and servicing, instead of one GIR for each copy. The set number in the first element is L01 to L99 rather than a copy number 001 to 999, and the number of copies is given by the LQT code. For example GIR+L01+3:LQT+BR1:LLO+FIC:LSQ' is 3 copies to branch BR1 in the FIC sequence. Koha::Edifact::Line read LQT but never used it, and treated every GIR as one copy. On a quote, more than one GIR had to match the quantity, so two part-order sets for 5 copies recorded "Order for 5 items, 2 segments present" and an "Invalid budget" error for each copy the sets did not cover, and made two order lines of one copy instead of one for 5. On an invoice only the first copy of a set was matched by its branch. Koha::Edifact::Line now expands a part-order set into one entry per copy, so that quotes and invoices both see one GIR for each copy and need no changes of their own. A GIR with an LQT above 1 becomes that many copies with the same fields, whatever its set number is, as some suppliers put LQT on numbered sets. The accession numbers of the copies are given by a list of LAC, or by an LAF and LAL range, and are spread over the copies in order. They are only used when they account for every copy, so a barcode is never given to two copies. A repeated LAC used to overwrite the one before it in a GIR segment, and now the barcodes of all the segments of a set are kept. The private subs in Koha::Edifact::Line that had no POD are documented, as the QA script requires it of a file that is changed. Test plan: 1. Apply the patch 2. prove t/Edifact.t t/db_dependent/Koha/EDI.t => they pass, including 'GIR part-order sets are expanded into copies', 'process_quote with a GIR part-order set' and 'process_invoice with a GIR part-order set' 3. Process a QUOTE whose line has QTY+21:5 and two part-order sets, GIR+L01+2:LQT+BR1:LLO+REF:LFN and GIR+L02+3:LQT+BR2:LLO+REF:LFN => one order line for 5 copies, with 2 items at BR1 and 3 at BR2, and no error about the number of segments or the budget 4. Process an INVOIC for an order of 4 copies, 3 of them at BR1, with QTY+47:3 and GIR+L01+3:LQT+BR1:LLO => the 3 items at BR1 are moved to the received order and received Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.