C4::Branch - Koha branch module
use C4::Branch;
The functions in this module deal with branches.
$branches = &GetBranches();
Returns informations about ALL branches, IndependentBranches Insensitive.
Create a branch selector with the following code.
my $branches = GetBranches; my @branchloop; foreach my $thisbranch (sort keys %$branches) { my $selected = 1 if $thisbranch eq $branch; my %row =(value => $thisbranch, selected => $selected, branchname => $branches->{$thisbranch}->{branchname}, ); push @branchloop, \%row; }
<select name="branch" id="branch"> <option value=""></option> [% FOREACH branchloo IN branchloop %] [% IF ( branchloo.selected ) %] <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> [% ELSE %] <option value="[% branchloo.value %]" >[% branchloo.branchname %]</option> [% END %] [% END %] </select>
$branch = GetBranch( $query, $branches );
Koha Development Team <http://koha-community.org/>