&newitems &modbibitem
&modsubtitle &modsubject &modaddauthor &moditem &countitems
&delitem &deletebiblioitem &delbiblio
- &getitemtypes &getbiblio
+ &getbiblio
&getbiblioitembybiblionumber
&getbiblioitem &getitemsbybiblioitem
&skip
&MARCdelbiblio($dbh,$bibid,0);
}
-sub getitemtypes {
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("select * from itemtypes order by description");
- my $count = 0;
- my @results;
-
- $sth->execute;
- while (my $data = $sth->fetchrow_hashref) {
- $results[$count] = $data;
- $count++;
- } # while
-
- $sth->finish;
- return($count, @results);
-} # sub getitemtypes
-
sub getbiblio {
my ($biblionumber) = @_;
my $dbh = C4::Context->dbh;
# $Id$
# $Log$
+# Revision 1.87 2004/05/18 11:54:07 tipaul
+# getitemtypes moved in Koha.pm
+#
# Revision 1.86 2004/05/03 09:19:22 tipaul
# some fixes for mysql prepare & execute
#
&borrowercategories
ðnicitycategories
&subfield_is_koha_internal_p
- &getbranches &getbranch &CGIbranches
+ &getbranches &getbranch
&getprinters &getprinter
+ &getitemtypes &getitemtypeinfo
$DEBUG);
use vars qw();
my $DEBUG = 0;
-=item slashifyDate
+=head2 slashifyDate
$slash_date = &slashifyDate($dash_date);
return("$dateOut[2]/$dateOut[1]/$dateOut[0]")
}
-=item fixEthnicity
+=head2 fixEthnicity
$ethn_name = &fixEthnicity($ethn_code);
return $data->{'name'};
}
-=item borrowercategories
+=head2 borrowercategories
($codes_arrayref, $labels_hashref) = &borrowercategories();
return(\@codes,\%labels);
}
-=item ethnicitycategories
+=head2 ethnicitycategories
($codes_arrayref, $labels_hashref) = ðnicitycategories();
return length $subfield != 1;
}
-=item getbranches
+=head2 getbranches
$branches = &getbranches();
- @branch_codes = keys %$branches;
- %main_branch_info = %{$branches->{"MAIN"}};
-
-Returns information about existing library branches.
+ returns informations about branches.
+ Create a branch selector with the following code
+
+=head3 in PERL SCRIPT
+
+my $branches = getbranches;
+my @branchloop;
+foreach my $thisbranch (keys %$branches) {
+ my $selected = 1 if $thisbranch eq $branch;
+ my %row =(value => $thisbranch,
+ selected => $selected,
+ branchname => $branches->{$thisbranch}->{'branchname'},
+ );
+ push @branchloop, \%row;
+}
-C<$branches> is a reference-to-hash. Its keys are the branch codes for
-all of the existing library branches, and its values are
-references-to-hash describing that particular branch.
-In each branch description (C<%main_branch_info>, above), there is a
-key for each field in the branches table of the Koha database. In
-addition, there is a key for each branch category code to which the
-branch belongs (the category codes are taken from the branchrelations
-table).
+=head3 in TEMPLATE
+ <select name="branch">
+ <option value="">Default</option>
+ <!-- TMPL_LOOP name="branchloop" -->
+ <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
=cut
return (\%branches);
}
-=item getprinters
+=head2 itemtypes
+
+ $itemtypes = &getitemtypes();
+
+Returns information about existing itemtypes.
+
+build a HTML select with the following code :
+
+=head3 in PERL SCRIPT
+
+my $itemtypes = getitemtypes;
+my @itemtypesloop;
+foreach my $thisitemtype (keys %$itemtypes) {
+ my $selected = 1 if $thisitemtype eq $itemtype;
+ my %row =(value => $thisitemtype,
+ selected => $selected,
+ description => $itemtypes->{$thisitemtype}->{'description'},
+ );
+ push @itemtypesloop, \%row;
+}
+$template->param(itemtypeloop => \@itemtypesloop);
+
+=head3 in TEMPLATE
+
+<form action='<!-- TMPL_VAR name="script_name" -->' method=post>
+ <select name="itemtype">
+ <option value="">Default</option>
+ <!-- TMPL_LOOP name="itemtypeloop" -->
+ <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="description" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+ <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->">
+ <input type="submit" value="OK" class="button">
+</form>
+
+
+=cut
+
+sub getitemtypes {
+# returns a reference to a hash of references to branches...
+ my %itemtypes;
+ my $dbh = C4::Context->dbh;
+ my $sth=$dbh->prepare("select * from itemtypes");
+ $sth->execute;
+ while (my $IT=$sth->fetchrow_hashref) {
+ $itemtypes{$IT->{'itemtype'}}=$IT;
+ }
+ return (\%itemtypes);
+}
+
+
+=head2 itemtypes
+
+ $itemtype = &getitemtype($itemtype);
+
+Returns information about an itemtype.
+
+=cut
+
+sub getitemtypeinfo {
+ my ($itemtype) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth=$dbh->prepare("select * from itemtypes where itemtype=?");
+ $sth->execute($itemtype);
+ my $res = $sth->fetchrow_hashref;
+ return $res;
+}
+
+=head2 getprinters
$printers = &getprinters($env);
@queues = keys %$printers;
=head1 AUTHOR
-Pat Eyler, pate@gnu.org
+Koha Team
=cut