[Bug 44255] New: EDI ORDRSP: partial line cancellation cancels the whole order line
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44255 Bug ID: 44255 Summary: EDI ORDRSP: partial line cancellation cancels the whole order line Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Blocks: 41852 Target Milestone: --- When a supplier's EDI ORDRSP message cancels only part of an order line (for example 3 copies ordered, supplier cancels 1), Koha::EDI::process_ordrsp cancels the whole order line. process_ordrsp() never looks at the quantity carried on the ORDRSP line. Any line whose action notification is "cancelled" results in Koha::Acquisition::Order->cancel(), which deletes every on-order item linked to the line, sets orderstatus=cancelled and sets datecancellationprinted. The copies the supplier is still going to deliver therefore lose their order line, their items and their encumbrance. Expected behaviour: handle a partial cancellation in the same way process_invoice() already handles a partial receipt/invoice (Koha/EDI.pm, "part receipt" branch): * If the cancelled quantity is lower than the order line quantity, reduce the original line's quantity by the cancelled amount and keep it open (ordered/partial). * Copy the line into a new order line for the cancelled quantity, then cancel that new line with Koha::Acquisition::Order->cancel() (so cancellation reason, cancellation date, suggestion handling and on-order item deletion all behave exactly as for a manual cancel). * Move only as many items as were cancelled onto the cancelled line (as transfer_items() does for invoices, using the GIR branch where the ORDRSP supplies it, otherwise falling back to any linked on-order items, preferring items without holds), and delete those. * If the cancelled quantity is missing or equals/exceeds the line quantity, keep the current behaviour (cancel the whole line). * Fund encumbrance then follows naturally: the remaining copies stay in "Ordered", the cancelled copies are released. Things to settle in the patch: * Koha::Edifact::Line->quantity currently stores the last QTY segment seen regardless of qualifier (only 47 is distinguished). The ORDRSP code needs the right qualifier for the cancelled/confirmed quantity (21 ordered, 12 despatched, 83 backorder, ...); check how suppliers send it for a line-level cancellation versus a partial one and add parsing and tests for that. * Behaviour when the line has already been received/invoiced is covered separately (do not cancel, notify the librarian). * Record a note in suppliers_report or the EDI message log when a line is split so the librarian can see what happened. Tests: t/db_dependent/Koha/EDI.t 'process_ordrsp' currently covers whole-line cancel, non-cancel and unknown ordernumber only. Add partial cancel (quantity reduced, new cancelled line, items split, Ordered figure reduced by the cancelled amount only), cancelled quantity >= line quantity, and missing quantity. Related: bug 42788 (encumbrance release), bug 42789 (ORDRSP cancel now uses ->cancel(), pushed), bug 44187 (cancelled items). Test plan (needs an ORDRSP file or a unit test): 1. Create an order line of quantity 3 with 3 on-order items against a fund, ordered via EDI. 2. Process an ORDRSP for that line cancelling quantity 1. 3. Before the patch: whole line cancelled, all 3 items deleted, full encumbrance released. 4. After the patch: the original line has quantity 2 with 2 items, a new cancelled line of quantity 1 exists, and the fund's Ordered figure drops by 1 copy's cost only. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41852 [Bug 41852] Modernize EDI support in Koha -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44255 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |44187 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44187 [Bug 44187] EDIFACT: Cancelled orderline items should be automatically deleted (as well as encumbrance released) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44255 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Status|NEW |ASSIGNED -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44255 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|44187 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44187 [Bug 44187] EDIFACT: Cancelled orderline items should be automatically deleted (as well as encumbrance released) -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org