https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43875
Bug ID: 43875
Summary: Do not auto-close invoices that have EDIFACT
processing errors
Initiative type: ---
Sponsorship ---
status:
Product: Koha
Version: Main
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Acquisitions
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
Depends on: 40932
Target Milestone: ---
Bug 40932 adds three ways of closing an invoice automatically, and all of them
call Koha::Acquisition::Invoice::check_and_close: circulation check-in when
AutoCloseInvoicesOnCheckin is set, the "close completed invoices" background
job, and the "check and close" action on the invoice page. check_and_close
closes an invoice when every item on its non-cancelled orders has been
received.
It only looks at the orders that are linked to the invoice. An invoice line
that EDI processing could not receive is not linked to it, so check_and_close
cannot see it. For example, since bug 43756 an invoice line that refers to a
cancelled order is skipped and an error is recorded in edifact_errors; the same
happens for a line with no order number, an unknown order, or an order whose
record has been deleted. The supplier has invoiced for those lines, so the
invoice total in Koha is less than the supplier's and part of the invoice has
not been dealt with. Once the other items are checked in, the invoice is closed
automatically.
Closing an invoice is often what triggers a finance integration to pay it, so
an invoice that includes a line for something cancelled and never received
could be paid in full, or the shortfall could go unnoticed.
Proposed change: check_and_close does not close an invoice that has EDIFACT
processing errors, and returns 0 as it does for an invoice that is not ready.
The errors that count are those for the invoice (the same invoice number in the
message) and the message-level ones that affect the whole file, as shown on the
invoice page under "Processing errors". Staff can still close the invoice by
hand once they have checked it with the supplier. A method on the invoice
returns those errors, and the invoice page uses it instead of repeating the
query.
This is deliberately cautious: any recorded error, including a warning such as
an invoice line for an order that is already complete, keeps an invoice from
closing automatically. A flag that only covers the lines that were skipped
would be more precise, but needs a change to the database.
Related to bug 43756.
Test plan:
1. Set AutoCloseInvoicesOnCheckin. Receive an EDIFACT invoice for two orders
with items, where one line refers to an order that has been cancelled
2. Check in all the items of the order that was received
3. Without the patch: the invoice is closed
4. With the patch: the invoice stays open and the invoice page shows the
processing error
5. Check and close the invoice from the invoice page, or run the close
completed invoices job
=> the invoice is still open
6. Close the invoice by hand
=> it closes
Referenced Bugs:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40932
[Bug 40932] Automated trigger for invoice closure
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/