<<

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, IndependantBranches 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">
        <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>

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 ref to an array.

GetBranchCategories

  my $categories = GetBranchCategories($branchcode,$categorytype);

Returns a list ref of anon hashrefs with keys eq columns of branchcategories table, i.e. categorycode, categorydescription, categorytype, categoryname. if $branchcode and/or $categorytype are passed, limit set to categories that $branchcode is a member of , and to $categorytype.

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.

get_branchinfos_of

  my $branchinfos_of = get_branchinfos_of(@branchcodes);

Associates a list of branchcodes to the information of the branch, taken in branches table.

Returns a href where keys are branchcodes and values are href where keys are branch information key.

  print 'branchname is ', $branchinfos_of->{$code}->{branchname};

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

DeleteBranchCategory

DeleteBranchCategory($categorycode);

CheckBranchCategorycode

$number_rows_affected = CheckBranchCategorycode($categorycode);

AUTHOR

Koha Developement team <info@koha.org>

<<