https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40932 --- Comment #18 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 201855 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201855&action=edit Bug 40932: Add automatic invoice closing on physical item receipt On circulation check-in (AddReturn), if the checked-in item is linked to a non-cancelled acquisitions order and the AutoCloseInvoicesOnCheckin system preference is enabled, aqorders_items.received is stamped with the current datetime (first check-in only) and the linked invoice is closed if every item on every non-cancelled order line of that invoice has now been received. The whole feature - both the stamp and the close - is gated behind the preference, so libraries who leave it disabled see no extra queries on this hot circulation path. New Koha::Acquisition::Order::Item/Items classes wrap aqorders_items. Koha::Acquisition::Invoice gains check_and_close(), independent of the AutoCloseInvoicesOnCheckin preference so it can also be triggered manually or in bulk. Additional features: - "Check & close if all items received" button on the invoice page (acqui/invoice.pl + invoice.tt), surfacing closed/not_ready/error results distinctly. - Batch "Close completed invoices" tool (acqui/close-completed-invoices.pl + close-completed-invoices.tt), implemented as a Koha::BackgroundJob (Koha::BackgroundJob::CloseCompletedInvoices) so a large open-invoice backlog doesn't block the CGI process; per-invoice results distinguish closed/not_ready/error in the job report. - Staff home page alert when open invoices have items outstanding for more than AutoCloseInvoiceAlertDays days (mainpage.pl + intranet-main.tt), cached for a day at a time since the underlying query joins aqinvoices/aqorders/aqorders_items. Failures caught internally are logged via Koha::Logger rather than a bare warn. Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/> Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/> Sponsored-by: OpenFifth <https://openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.