f5f4a1c85c24fcdf92a29e213b96a1aef3543774
[koha-equinox.git] / C4 / ClassSortRoutine / LCC.pm
1 package C4::ClassSortRoutine::LCC;
2
3 # Copyright (C) 2007 LibLime
4 # Copyright (C) 2012 Equinox Software, Inc.
5
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 use strict;
22 use warnings;
23 use Library::CallNumber::LC;
24
25 use vars qw($VERSION);
26
27 # set the version for version checking
28 $VERSION = 3.07.00.049;
29
30 =head1 NAME 
31
32 C4::ClassSortRoutine::LCC - generic call number sorting key routine
33
34 =head1 SYNOPSIS
35
36 use C4::ClassSortRoutine;
37
38 my $cn_sort = GetClassSortKey('LCC', $cn_class, $cn_item);
39
40 =head1 FUNCTIONS
41
42 =head2 get_class_sort_key
43
44   my $cn_sort = C4::ClassSortRoutine::LCC::LCC($cn_class, $cn_item);
45
46 Generates sorting key for LC call numbers.
47
48 =cut
49
50 sub get_class_sort_key {
51     my ($cn_class, $cn_item) = @_;
52
53     $cn_class = '' unless defined $cn_class;
54     $cn_item  = '' unless defined $cn_item;
55     my $call_number = Library::CallNumber::LC->new(uc "$cn_class $cn_item");
56     return '' unless defined $call_number;
57     my $key = $call_number->normalize();
58     $key = '' unless defined $key;
59     return $key;
60
61 }
62
63 1;
64
65 =head1 AUTHOR
66
67 Koha Development Team <http://koha-community.org/>
68
69 =cut
70