https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43757 --- Comment #6 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- Created attachment 209587 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209587&action=edit Bug 43757: Accept syntax 4 UNA and flag unparsable EDIFACT interchanges Koha::Edifact::service_string_advice only accepted the exact string ":+.? '". In syntax version 3 the fifth character of the UNA is reserved (a space); in syntax version 4 it is the repetition separator, default "*". Koha does not use repetition, so the character can be ignored, but an interchange starting "UNA:+.?*'" was thrown away: the parser only carped, message_array returned nothing, and process_invoice, process_quote and process_ordrsp then marked the message 'received' having done nothing. An interchange that did not start with UNA made Koha::Edifact->new croak with the start of the file in the error, which is not caught in edi_cron.pl, so the cron run stopped, left the message in 'processing' and skipped everything after it. This patch: - ignores the fifth UNA character - makes Koha::Edifact->new throw Koha::Exceptions::FileNotParsed, with a short reason, for an empty transmission, a missing or unsupported UNA and an interchange containing no messages - adds Koha::EDI::_edifact_parser, used by process_invoice, process_quote and process_ordrsp, which catches that exception, sets the message status to 'error', adds an edifact_errors row and logs it, so the cron carries on with the next message. A parser supplied by a plugin through the 'edifact' hook is still used as before. Test plan: 1. Apply the patch 2. prove t/Edifact.t t/db_dependent/Koha/EDI.t => they pass 3. git stash the changes to Koha/ and run them again => the new subtests 'service string advice' and 'unparsable interchanges' fail 4. Optionally, add an INVOICE to edifact_messages whose raw_msg starts with UNA:+.?*' and run misc/cronjobs/edi_cron.pl => the invoice is created and the message is 'received' 5. Add an INVOICE with no UNA, then a valid one, and run the cron again => the first is 'error' with a row in edifact_errors, the second is processed and the cron completes Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.