<<

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. GetBranchInfo() returns the same information without the problems of this function (namespace collision, mainly).

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

ModBranch

$error = &ModBranch($newvalue);

This function modify an existing branch

$newvalue is a ref to an array wich is containt all the column from branches table.

GetBranchCategory

$results = GetBranchCategory($categorycode);

$results is an hashref

GetBranchCategories

  my $categories = GetBranchCategories($categorytype,$show_in_pulldown,$selected_in_pulldown);

Returns a list ref of anon hashrefs with keys eq columns of branchcategories table, i.e. categorydescription, categorytype, categoryname.

GetCategoryTypes

$categorytypes = GetCategoryTypes; returns a list of category types. Currently these types are HARDCODED. type: 'searchdomain' defines a group of agencies that the calling library may search in. Other usage of agency categories falls under type: 'properties'. to allow for other uses of categories. The searchdomain bit may be better implemented as a separate module, but the categories were already here, and minimally used.

GetBranch

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

GetBranchDetail

    $branch = &GetBranchDetail($branchcode);

Given the branch code, the function returns a hashref for the corresponding row in the branches table.

GetBranchesInCategory

  my $branches = GetBranchesInCategory($categorycode);

Returns a href: keys %$branches eq (branchcode,branchname) .

GetBranchInfo

$results = GetBranchInfo($branchcode);

returns $results, a reference to an array of hashes containing branches. if $branchcode, just this branch, with associated categories. if ! $branchcode && $categorytype, all branches in the category.

DelBranch

&DelBranch($branchcode);

ModBranchCategoryInfo

&ModBranchCategoryInfo($data); sets the data from the editbranch form, and writes to the database...

CheckCategoryUnique

if (CheckCategoryUnique($categorycode)){ # do something }

DeleteBranchCategory

DeleteBranchCategory($categorycode);

CheckBranchCategorycode

$number_rows_affected = CheckBranchCategorycode($categorycode);

AUTHOR

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

<<