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 <oleonard@myacpl.org>

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 <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Colin Campbell 2020-11-10 14:30:15 +00:00 committed by Jonathan Druart
parent 078c88ea95
commit d82684a328
1 changed files with 6 additions and 0 deletions

View File

@ -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},