Assigning bug 1835 : change password would never log password change.
[koha.git] / C4 / ClassSortRoutine / Generic.pm
1 package C4::ClassSortRoutine::Generic;
2
3 # Copyright (C) 2007 LibLime
4
5 # This file is part of Koha.
6 #
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
11 #
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA  02111-1307 USA
19
20 use strict;
21 require Exporter;
22
23 use vars qw($VERSION);
24
25 # set the version for version checking
26 $VERSION = 3.00;
27
28 =head1 NAME 
29
30 C4::ClassSortRoutine::Generic - generic call number sorting key routine
31
32 =head1 SYNOPSIS
33
34 use C4::ClassSortRoutine;
35
36 my $cn_sort = GetClassSortKey('Generic', $cn_class, $cn_item);
37
38 =head1 FUNCTIONS
39
40 =head2 get_class_sort_key
41
42   my $cn_sort = C4::ClassSortRoutine::Generic::Generic($cn_class, $cn_item);
43
44 Generates sorting key using the following rules:
45
46 * Concatenates class and item part.
47 * Removes leading and trailing whitespace.
48 * Converts each run of whitespace to an underscore.
49 * Converts to upper-case and removes non-alphabetical, non-numeric, non-underscore characters.
50
51 =cut
52
53 sub get_class_sort_key {
54     my ($cn_class, $cn_item) = @_;
55
56     my $key = uc "$cn_class $cn_item";
57     $key =~ s/^\s+//;
58     $key =~ s/\s+$//;
59     $key =~ s/\s+/_/g;
60     $key =~ s/[^\p{IsAlnum}_]//g;
61     return $key;
62
63 }
64
65 1;
66
67 =head1 AUTHOR
68
69 Koha Developement team <info@koha.org>
70
71 =cut
72