https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44256 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 212557 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212557&action=edit Bug 44256: Don't cancel received lines from ORDRSP and report item deletion failures An ORDRSP cancellation was applied to any order line, including lines that had already been received or invoiced. Cancelling such a line sets its cancellation date, which removes it from both the fund's ordered and spent totals, so money that had really been spent silently disappeared from the fund. Separately, items that Koha::Acquisition::Order->cancel() could not delete (for example the last item on a record with a hold) were only written to the EDI log, so the librarian was never told. process_ordrsp now: - leaves an already received or invoiced line untouched (quantityreceived, an invoiceid or a complete status) and records why - skips a line that is already cancelled, as suppliers repeat cancellations - records item deletion failures from cancel() - stores each of these as an edifact_errors row on the ORDRSP message and sets the message status to 'error', so it appears with errors on the EDI messages page The outstanding remainder of a part-received line (status partial, nothing received against it) can still be cancelled. To test: 1. prove t/db_dependent/Koha/EDI.t 2. Receive an order line, then process an ORDRSP cancelling it: the line stays as it was, the fund's spent total is unchanged and the message is listed with errors on Acquisitions > EDIFACT messages. 3. Place a hold on the only on-order item of a line, then process an ORDRSP cancelling it: the line is cancelled, the item remains and the error says which item and why. Sponsored-by: OpenFifth <https://openfifth.co.uk/> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.