Code cleaning :

Sub renamed.
This commit is contained in:
toins 2006-07-12 07:45:39 +00:00
parent adb2fba8ad
commit e94f7f5efd

View file

@ -51,7 +51,7 @@ Koha.pm provides many functions for Koha scripts.
&subfield_is_koha_internal_p &subfield_is_koha_internal_p
&getbranches &getbranch &getbranchdetail &getbranches &getbranch &getbranchdetail
&getprinters &getprinter &getprinters &getprinter
&getitemtypes &getitemtypeinfo &GetItemTypes &getitemtypeinfo
get_itemtypeinfos_of get_itemtypeinfos_of
&getframeworks &getframeworkinfo &getframeworks &getframeworkinfo
&getauthtypes &getauthtype &getauthtypes &getauthtype
@ -285,9 +285,9 @@ sub getletters {
return ($count,\%letters); return ($count,\%letters);
} }
=head2 getitemtypes =head2 GetItemTypes
$itemtypes = &getitemtypes(); $itemtypes = &GetItemTypes();
Returns information about existing itemtypes. Returns information about existing itemtypes.
@ -295,7 +295,7 @@ build a HTML select with the following code :
=head3 in PERL SCRIPT =head3 in PERL SCRIPT
my $itemtypes = getitemtypes; my $itemtypes = GetItemTypes;
my @itemtypesloop; my @itemtypesloop;
foreach my $thisitemtype (sort keys %$itemtypes) { foreach my $thisitemtype (sort keys %$itemtypes) {
my $selected = 1 if $thisitemtype eq $itemtype; my $selected = 1 if $thisitemtype eq $itemtype;
@ -323,11 +323,15 @@ $template->param(itemtypeloop => \@itemtypesloop);
=cut =cut
sub getitemtypes { sub GetItemTypes {
# returns a reference to a hash of references to branches... # returns a reference to a hash of references to branches...
my %itemtypes; my %itemtypes;
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select * from itemtypes"); my $query = qq|
SELECT *
FROM itemtypes
|;
my $sth=$dbh->prepare($query);
$sth->execute; $sth->execute;
while (my $IT=$sth->fetchrow_hashref) { while (my $IT=$sth->fetchrow_hashref) {
$itemtypes{$IT->{'itemtype'}}=$IT; $itemtypes{$IT->{'itemtype'}}=$IT;
@ -335,7 +339,7 @@ sub getitemtypes {
return (\%itemtypes); return (\%itemtypes);
} }
# FIXME this function is better and should replace getitemtypes everywhere # FIXME this function is better and should replace GetItemTypes everywhere
sub get_itemtypeinfos_of { sub get_itemtypeinfos_of {
my @itemtypes = @_; my @itemtypes = @_;