Bugzilla – Attachment 14483 Details for
Bug 9370
use Library::CallNumber::LC when splitting LC call numbers for spine labels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug 9370: improve splitting of LC call numbers for labels
bug-9370-improve-splitting-of-LC-call-numbers-for-.patch (text/plain), 2.11 KB, created by
Galen Charlton
on 2013-01-09 02:53:12 UTC
(
hide
)
Description:
bug 9370: improve splitting of LC call numbers for labels
Filename:
MIME Type:
Creator:
Galen Charlton
Created:
2013-01-09 02:53:12 UTC
Size:
2.11 KB
patch
obsolete
>From 083ce05cf9cc69dc1ab263cb6f31bffb37b365e8 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Tue, 8 Jan 2013 17:32:47 -0800 >Subject: [PATCH] bug 9370: improve splitting of LC call numbers for labels > >Use the Perl module Library::CallNumber::LC to parse and split >LC call numbers when generating spine labels. > >For example, QH541.15.C6 C25 2012 should be split as follows: > >QH >541.15 >.C6 >C25 >2012 > >To test, create an item with call number QH541.15.C6 C25 2012 >and classification source LC, then create a spine label for that >item using a layout of type 'biblio' that has the split call numbers >option enabled. The call number should be split as indicated above. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >--- > C4/Labels/Label.pm | 15 ++++----------- > 1 files changed, 4 insertions(+), 11 deletions(-) > >diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm >index 760bacf..f62d50c 100644 >--- a/C4/Labels/Label.pm >+++ b/C4/Labels/Label.pm >@@ -7,6 +7,7 @@ use Text::Wrap; > use Algorithm::CheckDigits; > use Text::CSV_XS; > use Data::Dumper; >+use Library::CallNumber::LC; > > use C4::Context; > use C4::Debug; >@@ -113,18 +114,10 @@ sub _split_lccn { > my ($lccn) = @_; > $_ = $lccn; > # lccn examples: 'HE8700.7 .P6T44 1983', 'BS2545.E8 H39 1996'; >- my (@parts) = m/ >- ^([a-zA-Z]+) # HE # BS >- (\d+(?:\.\d)*) # 8700.7 # 2545 >- \s* >- (\.*\D+\d*) # .P6 # .E8 >- \s* >- (.*) # T44 1983 # H39 1996 # everything else (except any bracketing spaces) >- \s* >- /x; >- unless (scalar @parts) { >+ my @parts = Library::CallNumber::LC->new($lccn)->components(); >+ unless (scalar @parts && defined $parts[0]) { > warn sprintf('regexp failed to match string: %s', $_); >- push @parts, $_; # if no match, just push the whole string. >+ @parts = $_; # if no match, just use the whole string. > } > push @parts, split /\s+/, pop @parts; # split the last piece into an arbitrary number of pieces at spaces > $debug and warn "split_lccn array: ", join(" | ", @parts), "\n"; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9370
:
14481
|
14482
|
14483
|
15355
|
15356
|
15357
|
18865
|
18866
|
18867