<<

NAME

C4::Branch - Koha branch module

SYNOPSIS

use C4::Branch;

DESCRIPTION

The functions in this module deal with branches.

FUNCTIONS

GetBranches

  $branches = &GetBranches();

Returns informations about ALL branches, IndependentBranches Insensitive.

Create a branch selector with the following code.

in PERL SCRIPT

    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;
    }

in TEMPLATE

    <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>

Note that you often will want to just use GetBranchesLoop, for exactly the example above.

GetBranchName

GetBranch

$branch = GetBranch( $query, $branches );

AUTHOR

Koha Development Team <http://koha-community.org/>

<<