moved ethnicity fixing out of moremember.pl into a function,
[koha_ffzg] / C4 / Koha.pm
1 package C4::Koha;
2
3 use strict;
4 require Exporter;
5
6 use vars qw($VERSION @ISA @EXPORT);
7   
8 $VERSION = 0.01;
9     
10 @ISA = qw(Exporter);
11 @EXPORT = qw(&slashifyDate
12              &fixEthnicity); 
13
14 use vars qw();
15         
16
17 sub slashifyDate {
18     # accepts a date of the form xx-xx-xx[xx] and returns it in the 
19     # form xx/xx/xx[xx]
20     my @dateOut = split('-', shift);
21     return("$dateOut[2]/$dateOut[1]/$dateOut[0]")
22 }
23
24 sub fixEthnicity($) { # a temporary fix ethnicity, it should really be handled
25                       # in Search.pm or the DB ... 
26
27     my $ethnicity = shift;
28     if ($ethnicity eq 'maori') {
29         $ethnicity = 'Maori';
30     } elsif ($ethnicity eq 'european') {
31         $ethnicity = 'European/Pakeha';
32     } elsif ($ethnicity eq 'pi') {
33         $ethnicity = 'Pacific Islander'
34     } elsif ($ehtnicity eq 'asian') {
35         $ethnicity = 'Asian';
36     }
37     return $ethnicity;
38 }
39
40
41 1;
42 __END__
43
44 =head1 NAME
45
46 Koha - Perl Module containing convenience functions for Koha scripts
47
48 =head1 SYNOPSIS
49
50   use Koha;
51
52
53   $date = slashifyDate("01-01-2002")
54
55
56
57 =head1 DESCRIPTION
58
59 Koha.pm provides many functions for Koha scripts.
60
61 slashifyDate() takes a dash separated date string and returns a slash 
62 separated date string
63
64 =head1 AUTHOR
65
66 Pat Eyler, pate@gnu.org
67
68 =head1 SEE ALSO
69
70 perl(1).
71
72 =cut
73
74
75
76
77