Bug 9370

Summary: use Library::CallNumber::LC when splitting LC call numbers for spine labels
Product: Koha Reporter: Galen Charlton <gmcharlt>
Component: Architecture, internals, and plumbingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P5 - low CC: bgkriegel, chris, chrish, jonathan.druart, kyle, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15241
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 6281    
Bug Blocks: 2500    
Attachments: bug 9370: test case for splitting LC call number
bug 9370: add invalid call number to LC splitting test cases
bug 9370: improve splitting of LC call numbers for labels
bug 9370: test case for splitting LC call number
bug 9370: add invalid call number to LC splitting test cases
bug 9370: improve splitting of LC call numbers for labels
bug 9370: test case for splitting LC call number
bug 9370: add invalid call number to LC splitting test cases
bug 9370: improve splitting of LC call numbers for labels

Description Galen Charlton 2013-01-09 01:57:25 UTC
We should switch to using Library::CallNumber::LC for splitting LC call numbers when generating spine labels for several reasons:

[1] Library::CallNumber::LC was written specifically for parsing LC call numbers, while the current code in Koha was developed based on very few examples.
[2] The module is currently being used by Evergreen.  Any future efforts to improve LC call number parsing by updating Library::CallNumber::LC would benefit both ILS projects.
[3] In bug 6281, I'm proposing using this module to improve sorting of LC call numbers.  Using the module would reduce redundancy in Koha's code base.
[4] And, perhaps most importantly, it solves a problem reported by a library.

The immediate motivation for this change is an example call number that one of our customers noted is being split incorrectly.  The LC number 'QH541.15.C6 C25 2012' is currently being split like this:

QH
541
.15
.C6
C25
2012

It should actually be split as follows:
    
QH
541.15
.C6
C25
2012

The ".15" after "541" is part of the main class number; it isn't a Cutter.

To test:

[1] Add an item record with the call number QH541.15.C6 C25 2012 and set it classification source to lcc.
[2] Generate a spine label and verify that the call number is split like this:

QH
541.15
.C6
C25
2012
Comment 1 Galen Charlton 2013-01-09 02:52:22 UTC Comment hidden (obsolete)
Comment 2 Galen Charlton 2013-01-09 02:53:09 UTC Comment hidden (obsolete)
Comment 3 Galen Charlton 2013-01-09 02:53:12 UTC Comment hidden (obsolete)
Comment 4 Galen Charlton 2013-01-09 02:53:55 UTC
Note that the three patches for this bug require installing the patches for bug 6281.
Comment 5 Kyle M Hall 2013-02-15 12:40:17 UTC Comment hidden (obsolete)
Comment 6 Kyle M Hall 2013-02-15 12:40:26 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall 2013-02-15 12:40:33 UTC Comment hidden (obsolete)
Comment 8 Galen Charlton 2013-05-24 17:16:58 UTC
Just noting that as of today, the patch series still applies cleanly.
Comment 9 Jonathan Druart 2013-05-30 13:25:53 UTC
(In reply to comment #8)
> Just noting that as of today, the patch series still applies cleanly.

Galen, yes but they depend on bug 6281 which fails qa.
Comment 10 Chris Cormack 2013-06-12 09:39:52 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > Just noting that as of today, the patch series still applies cleanly.
> 
> Galen, yes but they depend on bug 6281 which fails qa.

Its now in master, so QAing this now
Comment 11 Chris Cormack 2013-06-12 09:46:25 UTC
Created attachment 18865 [details] [review]
bug 9370: test case for splitting LC call number

QH541.15.C6 C25 2012 should be split as follows:

QH
541.15
.C6
C25
2012

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

http://bugs.koha-community.org/show_bug.cgi?id=9730
Comment 12 Chris Cormack 2013-06-12 09:46:38 UTC
Created attachment 18866 [details] [review]
bug 9370: add invalid call number to LC splitting test cases

'123 ABC FOO BAR' is intentionally *not* a valid LC call number,
but in order to preserve legacy behavior, it should be split on
whitespace.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

http://bugs.koha-community.org/show_bug.cgi?id=9730
Comment 13 Chris Cormack 2013-06-12 09:46:53 UTC
Created attachment 18867 [details] [review]
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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Comment 14 Galen Charlton 2013-06-12 14:45:08 UTC
Pushed to master.
Comment 15 Tomás Cohen Arazi 2013-06-28 15:18:38 UTC
This patch has been pushed to 3.12.x, will be in 3.12.2.

I'm not sure why marking it enh instead of normal.
Thanks Galen!
Comment 16 Bernardo Gonzalez Kriegel 2013-07-13 12:07:45 UTC
Pushed to 3.10.x, will be in 3.10.8
Comment 17 Chris Hall 2013-07-17 08:15:10 UTC
Pushed to 3.8.x, will be in 3.8.15