Bug 23251: Correct formatting of IMD data ending in apostrophe
IMD text data may end in an apostrophe (e.g. dreamin' ) This was causing the segment to be incorrectly formatted as only the last character was checked, not the preceding character to check whether it was quoted add a test for this specific occurence Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
fea1d135be
commit
0c4112a200
|
|
@ -512,7 +512,7 @@ sub imd_segment {
|
|||
}
|
||||
$odd = !$odd;
|
||||
}
|
||||
if ( @segs && $segs[-1] !~ m/$seg_terminator$/o ) {
|
||||
if ( @segs && $segs[-1] !~ m/[^?]$seg_terminator$/o ) {
|
||||
$segs[-1] .= $seg_terminator;
|
||||
}
|
||||
return @segs;
|
||||
|
|
|
|||
13
t/Ediorder.t
13
t/Ediorder.t
|
|
@ -3,7 +3,7 @@ use strict;
|
|||
use warnings;
|
||||
use FindBin qw( $Bin );
|
||||
|
||||
use Test::More tests => 8;
|
||||
use Test::More tests => 10;
|
||||
|
||||
BEGIN { use_ok('Koha::Edifact::Order') }
|
||||
|
||||
|
|
@ -55,6 +55,17 @@ $data_to_encode .= '??';
|
|||
cmp_ok( $segs[1], 'eq', q{IMD+L+010+:::CCCCCCCCCC??'},
|
||||
'IMD segment deals with quoted character at end' );
|
||||
|
||||
# special case for text ending in apostrophe e.g. nuthin'
|
||||
$data_to_encode .= q{?'};
|
||||
@segs = Koha::Edifact::Order::imd_segment( $code, $data_to_encode );
|
||||
cmp_ok( $segs[1], 'eq', q{IMD+L+010+:::CCCCCCCCCC???''},
|
||||
'IMD segment deals with quoted apostrophe at end' );
|
||||
|
||||
$data_to_encode =~s/\?'$//;
|
||||
@segs = Koha::Edifact::Order::imd_segment( $code, $data_to_encode );
|
||||
cmp_ok( $segs[1], 'eq', q{IMD+L+010+:::CCCCCCCCCC??'},
|
||||
'IMD segment deals with apostrophe preceded by quoted ? at end' );
|
||||
|
||||
my $isbn = '3540556753';
|
||||
my $ean = '9783540556756';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue