https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44288 Bug ID: 44288 Summary: EDI ORDRSP: cancel holds, with a reason and patron notice, when a cancelled order line leaves no holdable item 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 cancels an order line by EDIFACT ORDRSP, Koha cancels the order line and removes its on-order items (bug 42789). If patrons have placed holds on that record while it was on order (possible when AcqCreateItem is "placing an order"), nothing happens to those holds and nobody is told. An item that cannot be deleted because of a hold stays on the record (and, with the preference added by bug 44187, is given a not for loan status), so the record remains in the catalogue with holds that can never be filled. If the item is deleted, the holds remain on the record with no item, and staff and the patron have no way of knowing the title will not arrive. Bug 14797 describes the same gap for manual cancellation of an order. Koha already has what is needed to do this properly: Koha::Hold->cancel() takes a cancellation_reason (a HOLD_CANCELLATION authorised value), records it, and sends the patron the HOLD_CANCELLATION notice. Nothing calls it from the order cancellation paths. Proposal: * A new system preference, off by default because it is patron facing, chooses a HOLD_CANCELLATION reason to use when a supplier cancellation leaves a record with no holdable item. When it is empty nothing changes. * After a cancellation by ORDRSP (Koha::EDI::process_ordrsp), if the record has no remaining holdable items (no other uncancelled order line and no other item that can fill the hold), cancel the holds on it with that reason, so the patron receives the HOLD_CANCELLATION notice. * Item level holds on the item being cancelled are cancelled too; holds already waiting, in transit or found are left alone, as the item was never available. * Record what was done: the cancelled holds are reported with the other cancellation issues on the EDI message (bug 44256) and appear in the staff notification (bug 42787). Open questions: * Whether to cancel holds when only some of the order lines for a record are cancelled and another is still on order. The proposal is not to. * Whether the same behaviour should apply to a manual order cancellation. That is the subject of bug 14797 and could share the helper written here. Test plan: 1. Set AcqCreateItem to "placing an order" and order a line with an on-order item. Place a hold for a patron. 2. Process an ORDRSP cancelling the order line. 3. Before the patch: the order is cancelled, and the hold stays with no notice to the patron. 4. After the patch, with the preference set to a HOLD_CANCELLATION reason: the hold is cancelled with that reason, the patron is sent the HOLD_CANCELLATION notice, and the action is listed on the EDI message. 5. With the preference empty, behaviour is unchanged. 6. With a second uncancelled order line on the same record, the holds are kept. Related: 14797 (alert on manual cancel), 42789, 44187, 44256, 42787. 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 watching all bug changes. You are the assignee for the bug.