From 8e1e7f7fbcf63b6e5d95f9cca4c86ba5cefcf40f Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 10 Nov 2020 14:30:15 +0000 Subject: [PATCH] Bug 26989: Safeguard Order Messages from unwanted characters Carriage returns in notes were causing a supplier's parser to truncate Order messages received from Koha. Have removed those and also made a global removal of CR, Line feeds and tabs - the latter two having the possibility of causing errors in the future Signed-off-by: Owen Leonard There was no test plan to follow, but the patch appears to be making sensible changes. If someone wants to provide a thorough test plan I can re-test. Signed-off-by: Kyle M Hall --- Koha/Edifact/Order.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Koha/Edifact/Order.pm b/Koha/Edifact/Order.pm index b5434872ae..fa356b0928 100644 --- a/Koha/Edifact/Order.pm +++ b/Koha/Edifact/Order.pm @@ -104,6 +104,10 @@ sub encode { $self->{transmission} .= $self->user_data_message_segments(); $self->{transmission} .= $self->trailing_service_segments(); + + # Guard against CR LF etc being added in data from DB + $self->{transmission}=~s/[\r\n\t]//g; + return $self->{transmission}; } @@ -406,7 +410,9 @@ sub order_line { my $ol_fields = { budget_code => $budget->{budget_code}, }; if ( $orderline->order_vendornote ) { $ol_fields->{servicing_instruction} = $orderline->order_vendornote; + chomp $ol_fields->{servicing_instruction}; } + my $item_fields = []; for my $item (@items) { push @{$item_fields}, -- 2.24.3 (Apple Git-128)