[Koha-cvs] CVS: koha/C4 Koha.pm,1.4.2.1,1.4.2.2
Chris Cormack
rangi at users.sourceforge.net
Thu May 23 12:05:14 CEST 2002
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv25846/C4
Modified Files:
Tag: rel-1-2
Koha.pm
Log Message:
Removing hardcoded ethnicity and category lists.
Fetched from the database instead.
Need to do the same for area
Index: Koha.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Koha.pm,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -r1.4.2.1 -r1.4.2.2
*** Koha.pm 18 May 2002 09:53:40 -0000 1.4.2.1
--- Koha.pm 23 May 2002 10:05:11 -0000 1.4.2.2
***************
*** 12,15 ****
--- 12,17 ----
@EXPORT = qw(&slashifyDate
&fixEthnicity
+ &borrowercategories
+ ðnicitycategories
$DEBUG);
***************
*** 37,40 ****
--- 39,71 ----
}
+ sub borrowercategories {
+ my $dbh=C4Connect;
+ my $sth=$dbh->prepare("Select categorycode,description from categories order by description");
+ $sth->execute;
+ my %labels;
+ my @codes;
+ while (my $data=$sth->fetchrow_hashref){
+ push @codes,$data->{'categorycode'};
+ $labels{$data->{'categorycode'}}=$data->{'description'};
+ }
+ $sth->finish;
+ $dbh->disconnect;
+ return(\@codes,\%labels);
+ }
+
+ sub ethnicitycategories {
+ my $dbh=C4Connect;
+ my $sth=$dbh->prepare("Select code,name from ethnicity order by name");
+ $sth->execute;
+ my %labels;
+ my @codes;
+ while (my $data=$sth->fetchrow_hashref){
+ push @codes,$data->{'code'};
+ $labels{$data->{'code'}}=$data->{'name'};
+ }
+ $sth->finish;
+ $dbh->disconnect;
+ return(\@codes,\%labels);
+ }
1;
***************
*** 51,56 ****
$date = slashifyDate("01-01-2002")
!
!
=head1 DESCRIPTION
--- 82,87 ----
$date = slashifyDate("01-01-2002")
! $ethnicity=fixEthnicity('asian');
! ($categories,$labels)=borrowercategories();
=head1 DESCRIPTION
More information about the Koha-cvs
mailing list