Bug 41996: Filter EDI errors on invoice page by invoicenumber
The invoice page previously fetched all edifact_errors for the EDI message, causing errors from unrelated invoice lines to appear on every invoice generated from the same EDI file. For example, one unmatched ordernumber in a file with 20 invoices would flag all 20 as having errors. Now only errors where invoicenumber matches the current invoice (or where invoicenumber is NULL, indicating a message-level error) are displayed. Signed-off-by: Ray Delahunty <lib-systems@arts.ac.uk> Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
a3889a7d90
commit
e9a442e933
|
|
@ -328,8 +328,17 @@ if ( $edifact_enabled && $details->{'message_id'} ) {
|
|||
|
||||
if ($edifact_message) {
|
||||
|
||||
# Get any processing errors for this message using the relation accessor
|
||||
my $errors = $edifact_message->errors;
|
||||
# Get processing errors for this specific invoice, plus any message-level
|
||||
# errors (invoicenumber IS NULL) that affect the whole EDI file.
|
||||
# This avoids showing errors from other invoices in the same EDI file.
|
||||
my $errors = $edifact_message->errors->search(
|
||||
{
|
||||
-or => [
|
||||
{ invoicenumber => $details->{'invoicenumber'} },
|
||||
{ invoicenumber => undef },
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
while ( my $error = $errors->next ) {
|
||||
push @$edifact_errors, {
|
||||
|
|
|
|||
Loading…
Reference in New Issue