From 9d4d33cf023f19ad5a272c88443cd63d7fdf9558 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 --- 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.28.0