[Koha-patches] [PATCH] Bug 2500 - Standing enhancement request for adding/updating call number splitting algorithms in C4/Labels.pm
Chris Nighswonger
cnighswonger at foundations.edu
Mon Mar 14 22:33:59 CET 2011
Adding code to support splitting of LCCN numbers with "segmentation" markers like '/' in them.
Ie. 917.1/0022/2 which is expected to split to 917.1 0022 2
This patch also adds a test case based on this example
---
C4/Labels/Label.pm | 1 +
t/Labels_split_lccn.t | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm
index 0ea2de9..25b8c0b 100644
--- a/C4/Labels/Label.pm
+++ b/C4/Labels/Label.pm
@@ -109,6 +109,7 @@ sub _get_text_fields {
sub _split_lccn {
my ($lccn) = @_;
+ $lccn =~ s/\// /g; # in theory we should be able to simply remove all segmentation markers and arrive at the correct call number...
$_ = $lccn;
# lccn examples: 'HE8700.7 .P6T44 1983', 'BS2545.E8 H39 1996';
my (@parts) = m/
diff --git a/t/Labels_split_lccn.t b/t/Labels_split_lccn.t
index da32317..10919ac 100755
--- a/t/Labels_split_lccn.t
+++ b/t/Labels_split_lccn.t
@@ -33,6 +33,7 @@ BEGIN {
'HE8700.7 .P6T44 1983' => [qw(HE 8700.7 .P6 T44 1983)],
'BS2545.E8 H39 1996' => [qw(BS 2545 .E8 H39 1996)],
'NX512.S85 A4 2006' => [qw(NX 512 .S85 A4 2006)],
+ '917.1/0022/2' => [qw(917.1 0022 2)],
};
}
my $test_num = 1;
--
1.7.0.4
More information about the Koha-patches
mailing list