From 2d0476d6d9f558c0d1f341828479ac4abf6ee58d Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Wed, 27 May 2009 11:30:14 -0400 Subject: [PATCH] Bug 2500 Tweaking DDCN Split for Hyphenated Volumn Numbers Presently 252.051 T147 v.1-2 is split as 252.051 T147 v.1 -2 This patch corrects the algorithm so that it splits as 252.051 T147 v.1-2 It also updates Labels_split_ddcn.t to include this particular case. Signed-off-by: Galen Charlton --- C4/Labels.pm | 2 +- t/Labels_split_ddcn.t | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/C4/Labels.pm b/C4/Labels.pm index 5a3ee18192..9992526093 100644 --- a/C4/Labels.pm +++ b/C4/Labels.pm @@ -997,7 +997,7 @@ sub split_ddcn { push @parts, split /\s+/, pop @parts; # split the last piece into an arbitrary number of pieces at spaces - if ($parts[-1] =~ /^(.*\d+)(\D.*)$/) { + if ($parts[-1] !~ /^.*\d-\d.*$/ && $parts[-1] =~ /^(.*\d+)(\D.*)$/) { pop @parts; # pull off the mathching last element, like example 2 push @parts, $1, $2; # replace it with the two pieces } diff --git a/t/Labels_split_ddcn.t b/t/Labels_split_ddcn.t index 7927ec0c31..eac8496e45 100755 --- a/t/Labels_split_ddcn.t +++ b/t/Labels_split_ddcn.t @@ -5,7 +5,11 @@ use strict; use warnings; +<<<<<<< HEAD:t/Labels_split_ddcn.t use Test::More tests => 62; +======= +use Test::More tests => 82; +>>>>>>> e72a02e... Bug 2500 Tweaking DDCN Split for Hyphenated Volumn Numbers:t/Labels_split_ddcn.t BEGIN { use_ok('C4::Labels'); @@ -18,6 +22,8 @@ my $ddcns = { 'J DAR G7c.11' => [qw( J DAR G7 c.11)], 'R220.3 H2793Z H32 c.2' => [qw(R 220.3 H2793Z H32 c.2)], 'CD-ROM 787.87 EAS' => [qw(CD-ROM 787.87 EAS)], + 'MP3-CD F PARKER' => [qw(MP3-CD F PARKER)], + '252.051 T147 v.1-2' => [qw(252.051 T147 v.1-2)], }; foreach my $ddcn (sort keys %$ddcns) { -- 2.39.5