From bb6161029f401266f17f669d1a7124edb9387023 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 Signed-off-by: Jonathan Druart (cherry picked from commit d82684a328fd4a6d11bd6b414536ee4c05642f0e) Signed-off-by: Fridolin Somers --- 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.39.5