4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
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
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.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
25 use vars qw($VERSION @ISA @EXPORT);
30 @EXPORT = qw(&slashifyDate
41 # accepts a date of the form xx-xx-xx[xx] and returns it in the
43 my @dateOut = split('-', shift);
44 return("$dateOut[2]/$dateOut[1]/$dateOut[0]")
49 my $ethnicity = shift;
51 my $sth=$dbh->prepare("Select name from ethnicity where code = ?");
52 $sth->execute($ethnicity);
53 my $data=$sth->fetchrow_hashref;
56 return $data->{'name'};
59 sub borrowercategories {
61 my $sth=$dbh->prepare("Select categorycode,description from categories order by description");
65 while (my $data=$sth->fetchrow_hashref){
66 push @codes,$data->{'categorycode'};
67 $labels{$data->{'categorycode'}}=$data->{'description'};
71 return(\@codes,\%labels);
74 sub ethnicitycategories {
76 my $sth=$dbh->prepare("Select code,name from ethnicity order by name");
80 while (my $data=$sth->fetchrow_hashref){
81 push @codes,$data->{'code'};
82 $labels{$data->{'code'}}=$data->{'name'};
86 return(\@codes,\%labels);
94 Koha - Perl Module containing convenience functions for Koha scripts
101 $date = slashifyDate("01-01-2002")
102 $ethnicity=fixEthnicity('asian');
103 ($categories,$labels)=borrowercategories();
107 Koha.pm provides many functions for Koha scripts.
109 slashifyDate() takes a dash separated date string and returns a slash
110 separated date string
114 Pat Eyler, pate@gnu.org