Bug 15758: Koha::Libraries - Remove GetBranches

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-02-04 15:24:23 +00:00 committed by Kyle M Hall
parent 79f4afe26a
commit df97814f30
101 changed files with 292 additions and 690 deletions

View File

@ -1078,7 +1078,7 @@ sub checkauth {
$branchcode = $query->param('branch');
$branchname = Koha::Libraries->find($branchcode)->branchname;
}
my $branches = C4::Branch::GetBranches();
my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
# we have to check they are coming from the right ip range
@ -1528,7 +1528,7 @@ sub check_api_auth {
$branchcode = $query->param('branch');
$branchname = Koha::Libraries->find($branchcode)->branchname;
}
my $branches = C4::Branch::GetBranches();
my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
foreach my $br ( keys %$branches ) {
# now we work with the treatment of ip

View File

@ -28,7 +28,6 @@ BEGIN {
@ISA = qw(Exporter);
@EXPORT = qw(
&GetBranch
&GetBranches
);
@EXPORT_OK = qw( &onlymine );
}
@ -47,76 +46,8 @@ The functions in this module deal with branches.
=head1 FUNCTIONS
=head2 GetBranches
$branches = &GetBranches();
Returns informations about ALL branches, IndependentBranches Insensitive.
Create a branch selector with the following code.
=head3 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;
}
=head3 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>
=cut
sub GetBranches {
my ($onlymine) = @_;
# returns a reference to a hash of references to ALL branches...
my %branches;
my $dbh = C4::Context->dbh;
my $sth;
my $query = "SELECT * FROM branches";
my @bind_parameters;
if ( $onlymine && C4::Context->userenv && C4::Context->userenv->{branch} ) {
$query .= ' WHERE branchcode = ? ';
push @bind_parameters, C4::Context->userenv->{branch};
}
$query .= " ORDER BY branchname";
$sth = $dbh->prepare($query);
$sth->execute(@bind_parameters);
my $relations_sth =
$dbh->prepare("SELECT branchcode,categorycode FROM branchrelations");
$relations_sth->execute();
my %relations;
while ( my $rel = $relations_sth->fetchrow_hashref ) {
push @{ $relations{ $rel->{branchcode} } }, $rel->{categorycode};
}
while ( my $branch = $sth->fetchrow_hashref ) {
foreach my $cat ( @{ $relations{ $branch->{branchcode} } } ) {
$branch->{category}{$cat} = 1;
}
$branches{ $branch->{'branchcode'} } = $branch;
}
return ( \%branches );
}
sub onlymine {
return
C4::Context->preference('IndependentBranches')

View File

@ -33,7 +33,6 @@ use C4::Accounts;
use C4::ItemCirculationAlertPreference;
use C4::Message;
use C4::Debug;
use C4::Branch; # GetBranches
use C4::Log; # logaction
use C4::Koha qw(
GetAuthorisedValueByCode
@ -310,7 +309,6 @@ sub transferbook {
my ( $tbr, $barcode, $ignoreRs ) = @_;
my $messages;
my $dotransfer = 1;
my $branches = GetBranches();
my $itemnumber = GetItemnumberFromBarcode( $barcode );
my $issue = GetItemIssue($itemnumber);
my $biblio = GetBiblioFromItemNumber($itemnumber);
@ -339,7 +337,10 @@ sub transferbook {
}
# if is permanent...
if ( $hbr && $branches->{$hbr}->{'PE'} ) {
# FIXME Is this still used by someone?
# See other FIXME in AddReturn
my $library = Koha::Libraries->find($hbr);
if ( $library and $library->get_categories->search({'me.categorycode' => 'PE'})->count ) {
$messages->{'IsPermanent'} = $hbr;
$dotransfer = 0;
}
@ -1899,8 +1900,10 @@ sub AddReturn {
# check if the book is in a permanent collection....
# FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality.
if ( $returnbranch ) {
my $branches = GetBranches(); # a potentially expensive call for a non-feature.
$branches->{$returnbranch}->{PE} and $messages->{'IsPermanent'} = $returnbranch;
my $library = Koha::Libraries->find($returnbranch);
if ( $library and $library->get_categories->search({'me.categorycode' => 'PE'})->count ) {
$messages->{'IsPermanent'} = $returnbranch;
}
}
# check if the return is allowed at this branch

View File

@ -1030,6 +1030,12 @@ sub interface {
return $context->{interface} // 'opac';
}
# always returns a string for OK comparison via "eq" or "ne"
sub mybranch {
C4::Context->userenv or return '';
return C4::Context->userenv->{branch} || '';
}
1;
__END__

View File

@ -23,7 +23,6 @@ use warnings;
use C4::Members;
use C4::Items;
use C4::Circulation;
use C4::Branch;
use C4::Accounts;
use C4::Biblio;
use C4::Reserves qw(AddReserve GetReservesFromBiblionumber GetReservesFromBorrowernumber CanBookBeReserved CanItemBeReserved IsAvailableForItemLevelRequest);
@ -630,8 +629,7 @@ sub HoldTitle {
# Pickup branch management
if ( $cgi->param('pickup_location') ) {
$branch = $cgi->param('pickup_location');
my $branches = GetBranches;
return { code => 'LocationNotFound' } unless $$branches{$branch};
return { code => 'LocationNotFound' } unless Koha::Libraries->find($branch);
} else { # if the request provide no branch, use the borrower's branch
$branch = $$borrower{branchcode};
}
@ -708,8 +706,7 @@ sub HoldItem {
my $branch;
if ( $cgi->param('pickup_location') ) {
$branch = $cgi->param('pickup_location');
my $branches = GetBranches();
return { code => 'LocationNotFound' } unless $$branches{$branch};
return { code => 'LocationNotFound' } unless Koha::Libraries->find($branch);
} else { # if the request provide no branch, use the borrower's branch
$branch = $$borrower{branchcode};
}

View File

@ -1337,6 +1337,7 @@ sub GetItemsInfo {
COALESCE( localization.translation, itemtypes.description ) AS translated_description,
itemtypes.notforloan as notforloan_per_itemtype,
holding.branchurl,
holding.branchcode,
holding.branchname,
holding.opac_info as holding_branch_opac_info,
home.opac_info as home_branch_opac_info

View File

@ -36,6 +36,7 @@ use C4::Debug;
use Koha::DateUtils;
use Koha::Account::Line;
use Koha::Account::Lines;
use Koha::Libraries;
use vars qw(@ISA @EXPORT);
@ -788,8 +789,7 @@ sub GetBranchcodesWithOverdueRules {
|);
if ( $branchcodes->[0] eq '' ) {
# If a default rule exists, all branches should be returned
my $availbranches = C4::Branch::GetBranches();
return keys %$availbranches;
return map { $_->branchcode } Koha::Libraries->search({}, { order_by => 'branchname' });
}
return @$branchcodes;
}

View File

@ -28,7 +28,6 @@ use C4::Search::PazPar2;
use XML::Simple;
use C4::Members qw(GetHideLostItemsPreference);
use C4::XSLT;
use C4::Branch;
use C4::Reserves; # GetReserveStatus
use C4::Debug;
use C4::Charset;
@ -857,6 +856,8 @@ sub pazGetRecords {
$query_type, $scan
) = @_;
$branches ||= { map { $_->branchcode => $_->branchname } Koha::Libraries->search };
my $paz = C4::Search::PazPar2->new(C4::Context->config('pazpar2url'));
$paz->init();
$paz->search($simple_query);
@ -1843,14 +1844,8 @@ sub searchResults {
}
#Build branchnames hash
#find branchname
#get branch information.....
my %branches;
my $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches"); # FIXME : use C4::Branch::GetBranches
$bsth->execute();
while ( my $bdata = $bsth->fetchrow_hashref ) {
$branches{ $bdata->{'branchcode'} } = $bdata->{'branchname'};
}
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
# FIXME - We build an authorised values hash here, using the default framework
# though it is possible to have different authvals for different fws.

View File

@ -23,9 +23,9 @@ use strict;
use warnings;
use C4::Biblio;
use C4::Branch;
use C4::Context;
use C4::Koha;
use Koha::Libraries;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ -117,7 +117,6 @@ sub GetNearbyItems {
if $gap <= $num_each_side;
my $dbh = C4::Context->dbh;
my $branches = GetBranches();
my $sth_get_item_details = $dbh->prepare("SELECT cn_sort,homebranch,location,ccode from items where itemnumber=?");
$sth_get_item_details->execute($itemnumber);
@ -129,7 +128,7 @@ sub GetNearbyItems {
if (C4::Context->preference('ShelfBrowserUsesHomeBranch') &&
defined($item_details_result->{'homebranch'})) {
$start_homebranch->{code} = $item_details_result->{'homebranch'};
$start_homebranch->{description} = $branches->{$item_details_result->{'homebranch'}}{branchname};
$start_homebranch->{description} = Koha::Libraries->find($item_details_result->{'homebranch'})->branchname;
}
if (C4::Context->preference('ShelfBrowserUsesLocation') &&
defined($item_details_result->{'location'})) {

View File

@ -276,7 +276,8 @@ sub buildKohaItemsNamespace {
my $shelflocations = GetKohaAuthorisedValues('items.location',GetFrameworkCode($biblionumber), 'opac');
my $ccodes = GetKohaAuthorisedValues('items.ccode',GetFrameworkCode($biblionumber), 'opac');
my $branches = GetBranches();
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
my $itemtypes = GetItemTypes();
my $location = "";
my $ccode = "";
@ -317,8 +318,8 @@ sub buildKohaItemsNamespace {
} else {
$status = "available";
}
my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):'';
my $holdingbranch = $item->{holdingbranch}? xml_escape($branches->{$item->{holdingbranch}}->{'branchname'}):'';
my $homebranch = $item->{homebranch}? xml_escape($branches{$item->{homebranch}}):'';
my $holdingbranch = $item->{holdingbranch}? xml_escape($branches{$item->{holdingbranch}}):'';
$location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):'';
$ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):'';
my $itemcallnumber = xml_escape($item->{itemcallnumber});

View File

@ -21,8 +21,9 @@ use Modern::Perl;
use Carp;
use Koha::Database;
use C4::Context;
use Koha::Database;
use Koha::Library;
use base qw(Koha::Objects);
@ -37,6 +38,24 @@ Koha::Libraries - Koha Library Object set class
=cut
=head3 search_filtered
=cut
sub search_filtered {
my ( $self, $params, $attributes ) = @_;
if ( C4::Context->preference('IndependentBranches')
and C4::Context->userenv
and not C4::Context->IsSuperLibrarian()
and C4::Context->userenv->{branch}
) {
$params->{branchcode} = C4::Context->userenv->{branch};
}
return $self->SUPER::search( $params, $attributes );
}
=head3 type
=cut

View File

@ -25,6 +25,7 @@ use base qw( Template::Plugin );
use C4::Koha;
use C4::Context;
use Koha::Libraries;
sub GetName {
my ( $self, $branchcode ) = @_;
@ -61,21 +62,11 @@ sub OnlyMine {
sub all {
my ( $self, $params ) = @_;
my $selected = $params->{selected};
my $dbh = C4::Context->dbh;
my @params;
my $query = q|
SELECT branchcode, branchname
FROM branches
|;
if ( C4::Context->preference('IndependentBranches')
and C4::Context->userenv
&& !C4::Context->IsSuperLibrarian()
and C4::Context->userenv->{branch} )
{
$query .= q| WHERE branchcode = ? |;
push @params, C4::Context->userenv->{branch};
}
my $libraries = $dbh->selectall_arrayref( $query, { Slice => {} }, @params );
my $unfiltered = $params->{unfiltered} || 0;
my $libraries = $unfiltered
? Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed
: Koha::Libraries->search_filtered( {}, { order_by => ['branchname'] } )->unblessed;
for my $l ( @$libraries ) {
if ( $selected and $l->{branchcode} eq $selected

View File

@ -21,7 +21,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
@ -52,9 +51,6 @@ my $search_patrons_with_acq_perm_only =
( $referer =~ m|acqui/basket.pl| )
? 1 : 0;
my $onlymine = C4::Branch::onlymine;
my $branches = C4::Branch::GetBranches( $onlymine );
my $patron_categories = Koha::Patron::Categories->search_limited;
$template->param(
patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
@ -64,7 +60,6 @@ $template->param(
selection_type => 'add',
alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
categories => $patron_categories,
branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
aaSorting => 1,
);
output_html_with_http_headers( $input, $cookie, $template->output );

View File

@ -39,7 +39,6 @@ use C4::Koha;
use C4::Budgets;
use C4::Acquisition;
use C4::Suggestions; # GetSuggestion
use C4::Branch; # GetBranches
use C4::Members;
use Koha::Number::Price;

View File

@ -28,13 +28,13 @@ use C4::Output;
use CGI qw ( -utf8 );
use C4::Acquisition;
use C4::Budgets;
use C4::Branch;
use C4::Contract;
use C4::Debug;
use C4::Biblio;
use C4::Members qw/GetMember/; #needed for permissions checking for changing basketgroup of a basket
use C4::Items;
use C4::Suggestions;
use Koha::Libraries;
use Date::Calc qw/Add_Delta_Days/;
use Koha::Database;
use Koha::EDI qw( create_edi_order get_edifact_ean );
@ -236,6 +236,7 @@ elsif ( $op eq 'ediorder' ) {
exit 1;
}
}
if (!defined $basket->{branch} or $basket->{branch} eq $userenv->{branch}) {
push @branches_loop, {
branchcode => $userenv->{branch},
@ -245,20 +246,17 @@ elsif ( $op eq 'ediorder' ) {
}
} else {
# get branches
my $branches = C4::Branch::GetBranches;
my @branchcodes = sort {
$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
} keys %$branches;
foreach my $branch (@branchcodes) {
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
foreach my $branch (@$branches) {
my $selected = 0;
if (defined $basket->{branch}) {
$selected = 1 if $branch eq $basket->{branch};
$selected = 1 if $branch->{branchcode} eq $basket->{branch};
} else {
$selected = 1 if $branch eq C4::Context->userenv->{branch};
$selected = 1 if $branch->{branchcode} eq C4::Context->userenv->{branch};
}
push @branches_loop, {
branchcode => $branch,
branchname => $branches->{$branch}->{branchname},
branchcode => $branch->{branchcode},
branchname => $branch->{branchname},
selected => $selected
};
}

View File

@ -50,7 +50,6 @@ use warnings;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Auth;
use C4::Branch;
use C4::Output;
use C4::Acquisition qw/GetBasket NewBasket ModBasketHeader/;
use C4::Contract qw/GetContracts/;
@ -72,7 +71,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
#parameters:
my $booksellerid = $input->param('booksellerid');
my $basketno = $input->param('basketno');
my $branches = GetBranches;
my $basket;
my $op = $input ->param('op');
my $is_an_edit= $input ->param('is_an_edit');

View File

@ -34,7 +34,6 @@ use C4::Auth;
use C4::Output;
use C4::Acquisition qw/GetInvoices/;
use C4::Branch qw/GetBranches/;
use C4::Budgets;
use Koha::DateUtils;
@ -107,24 +106,6 @@ foreach (@suppliers) {
};
}
# Build branches list
my $branches = GetBranches();
my $branches_loop = [];
my $branchname;
foreach ( sort keys %$branches ) {
my $selected = 0;
if ( $branch && $branch eq $_ ) {
$selected = 1;
$branchname = $branches->{$_}->{'branchname'};
}
push @{$branches_loop},
{
branchcode => $_,
branchname => $branches->{$_}->{branchname},
selected => $selected,
};
}
my $budgets = GetBudgets();
my @budgets_loop;
foreach my $budget (@$budgets) {
@ -149,9 +130,7 @@ $template->param(
publisher => $publisher,
publicationyear => $publicationyear,
branch => $branch,
branchname => $branchname,
suppliers_loop => $suppliers_loop,
branches_loop => $branches_loop,
);
output_html_with_http_headers $input, $cookie, $template->output;

View File

@ -52,7 +52,6 @@ use C4::Output;
use C4::Context;
use C4::Acquisition;
use C4::Letters;
use C4::Branch; # GetBranches
use Koha::DateUtils;
my $input = new CGI;

View File

@ -81,7 +81,6 @@ use C4::Biblio; # GetBiblioData GetMarcPrice
use C4::Items; #PrepareItemRecord
use C4::Output;
use C4::Koha;
use C4::Branch; # GetBranches
use C4::Members;
use C4::Search qw/FindDuplicate/;

View File

@ -21,7 +21,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Acquisition;
use C4::Auth;
use C4::Branch;
use C4::Context;
use C4::Output;
use C4::Serials;
@ -76,18 +75,6 @@ foreach my $sub (@subscriptions) {
}
}
my $branches = GetBranches();
my @branches_loop;
foreach (sort keys %$branches){
my $selected = 0;
$selected = 1 if defined $branch && $branch eq $_;
push @branches_loop, {
branchcode => $_,
branchname => $branches->{$_}->{branchname},
selected => $selected,
};
}
$template->param(
subs_loop => \@subscriptions,
title_filter => $title,
@ -96,7 +83,6 @@ $template->param(
publisher_filter => $publisher,
supplier_filter => $supplier,
branch_filter => $branch,
branches_loop => \@branches_loop,
done_searched => $searched,
routing => $routing,
booksellerid => $booksellerid,

View File

@ -69,7 +69,6 @@ use C4::Auth;
use C4::Output;
use C4::Budgets qw/ GetBudget GetBudgetHierarchy CanUserUseBudget GetBudgetPeriods /;
use C4::Members;
use C4::Branch; # GetBranches
use C4::Items;
use C4::Biblio;
use C4::Suggestions;

View File

@ -21,7 +21,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
@ -53,9 +52,6 @@ my $search_patrons_with_acq_perm_only =
( $referer =~ m|admin/aqbudgets.pl| )
? 1 : 0;
my $onlymine = C4::Branch::onlymine;
my $branches = C4::Branch::GetBranches( $onlymine );
my $patron_categories = Koha::Patron::Categories->search_limited;
$template->param(
patrons_with_acq_perm_only => $search_patrons_with_acq_perm_only,
@ -65,7 +61,6 @@ $template->param(
selection_type => $selection_type,
alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
categories => $patron_categories,
branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
aaSorting => 1,
);
output_html_with_http_headers( $input, $cookie, $template->output );

View File

@ -26,7 +26,6 @@ use List::Util qw/min/;
use Koha::Database;
use C4::Auth qw/get_user_subpermissions/;
use C4::Branch; # GetBranches
use C4::Auth;
use C4::Acquisition;
use C4::Budgets;
@ -141,18 +140,6 @@ if ($op eq 'add_form') {
}
$budget_parent = GetBudget($budget_parent_id);
# build branches select
my $branches = GetBranches;
my @branchloop_select;
foreach my $thisbranch ( sort keys %$branches ) {
my %row = (
value => $thisbranch,
branchname => $branches->{$thisbranch}->{'branchname'},
);
$row{selected} = 1 if $budget and $thisbranch eq $budget->{'budget_branchcode'};
push @branchloop_select, \%row;
}
# populates the YUI planning button
my $categories = GetAuthorisedValueCategories();
my @auth_cats_loop1 = ();
@ -200,7 +187,6 @@ if ($op eq 'add_form') {
budget_has_children => BudgetHasChildren( $budget->{budget_id} ),
budget_parent_id => $budget_parent->{'budget_id'},
budget_parent_name => $budget_parent->{'budget_name'},
branchloop_select => \@branchloop_select,
%$period,
%$budget,
);
@ -258,7 +244,6 @@ if ($op eq 'add_form') {
}
if ( $op eq 'list' ) {
my $branches = GetBranches();
$template->param(
budget_id => $budget_id,
%$period,

View File

@ -21,12 +21,12 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch;
use C4::Context;
use C4::Koha;
use C4::Output;
use Koha::AuthorisedValues;
use Koha::Libraries;
my $input = new CGI;
my $id = $input->param('id');
@ -56,15 +56,14 @@ if ($op eq 'add_form') {
$category = $input->param('category');
}
my $branches = GetBranches;
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
my @branches_loop;
foreach my $branchcode ( sort { uc($branches->{$a}->{branchname}) cmp uc($branches->{$b}->{branchname}) } keys %$branches ) {
my $selected = ( grep {$_ eq $branchcode} @$selected_branches ) ? 1 : 0;
foreach my $branch ( @$branches ) {
my $selected = ( grep {$_ eq $branch->{branchcode}} @$selected_branches ) ? 1 : 0;
push @branches_loop, {
branchcode => $branchcode,
branchname => $branches->{$branchcode}->{branchname},
selected => $selected,
branchcode => $branch->{branchcode},
branchname => $branch->{branchname},
selected => $selected,
};
}

View File

@ -26,7 +26,6 @@ use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Koha;
use C4::Branch;
use C4::Circulation qw{ IsBranchTransferAllowed DeleteBranchTransferLimits CreateBranchTransferLimit };
my $input = new CGI;
@ -50,18 +49,6 @@ else
$branchcode = $input->param('branchcode');
}
# Getting the branches for user selection
my $branches = GetBranches();
my @branch_loop;
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
my %row =(value => $thisbranch,
branchname => $branches->{$thisbranch}->{'branchname'},
selected => $thisbranch eq $branchcode ? 1 : 0,
);
push @branch_loop, \%row;
}
# Set the template language for the correct limit type using $limitType
my $limitType = C4::Context->preference("BranchTransferLimitsType") || "ccode";
@ -132,7 +119,6 @@ foreach my $code ( @codes ) {
$template->param(
branchcount => $branchcount,
codes_loop => \@codes_loop,
branch_loop => \@branch_loop,
branchcode_loop => \@branchcode_loop,
branchcode => $branchcode,
limitType => $limitType,

View File

@ -23,13 +23,13 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Auth;
use C4::Branch;
use C4::Output;
use C4::Form::MessagingPreferences;
use Koha::Patrons;
use Koha::Database;
use Koha::DateUtils;
use Koha::Patron::Categories;
use Koha::Libraries;
my $input = new CGI;
my $searchfield = $input->param('description') // q||;
@ -55,13 +55,13 @@ if ( $op eq 'add_form' ) {
$selected_branches = $category->branch_limitations;
}
my $branches = GetBranches;
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
my @branches_loop;
foreach my $branchcode ( sort { uc( $branches->{$a}->{branchname} ) cmp uc( $branches->{$b}->{branchname} ) } keys %$branches ) {
my $selected = ( grep { $_ eq $branchcode } @$selected_branches ) ? 1 : 0;
foreach my $branch ( @$branches ) {
my $selected = ( grep { $_ eq $branch->{branchcode} } @$selected_branches ) ? 1 : 0;
push @branches_loop,
{ branchcode => $branchcode,
branchname => $branches->{$branchcode}->{branchname},
{ branchcode => $branch->{branchcode},
branchname => $branch->{branchname},
selected => $selected,
};
}

View File

@ -26,7 +26,6 @@ use JSON;
use C4::Auth;
use C4::Context;
use C4::Branch;
use C4::ItemCirculationAlertPreference;
use C4::Output;
@ -51,28 +50,13 @@ sub show {
}
);
my $br = GetBranches;
my $branch = $input->param('branch') || '*';
my @branches = (
{
branchcode => '*',
branchname => 'Default',
},
sort { $a->{branchname} cmp $b->{branchname} } values %$br,
);
for (@branches) {
$_->{selected} = "selected" if ($branch eq $_->{branchcode});
}
my $branch_name = exists($br->{$branch}) && $br->{$branch}->{branchname};
my @categories = Koha::Patron::Categories->search_limited;
my @item_types = Koha::ItemTypes->search;
my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
my $grid_checkin = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
$template->param(branch => $branch);
$template->param(branch_name => $branch_name || 'Default');
$template->param(branches => \@branches);
$template->param(categories => \@categories);
$template->param(item_types => \@item_types);
$template->param(grid_checkout => $grid_checkout);

View File

@ -25,12 +25,12 @@ use CGI qw ( -utf8 );
use List::MoreUtils qw/uniq/;
use C4::Auth;
use C4::Branch;
use C4::Context;
use C4::Output;
use C4::Koha;
use C4::Members::AttributeTypes;
use Koha::Libraries;
use Koha::Patron::Categories;
my $script_name = "/cgi-bin/koha/admin/patron-attr-types.pl";
@ -84,7 +84,7 @@ exit 0;
sub add_attribute_type_form {
my $template = shift;
my $branches = GetBranches;
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
my @branches_loop;
foreach my $branch (sort keys %$branches) {
push @branches_loop, {
@ -252,14 +252,14 @@ sub edit_attribute_type_form {
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
my $branches = GetBranches;
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
my @branches_loop;
my $selected_branches = $attr_type->branches;
foreach my $branch (sort keys %$branches) {
my $selected = ( grep {$$_{branchcode} eq $branch} @$selected_branches ) ? 1 : 0;
foreach my $branch (@$branches) {
my $selected = ( grep {$_->{branchcode} eq $branch->{branchcode}} @$selected_branches ) ? 1 : 0;
push @branches_loop, {
branchcode => $branches->{$branch}{branchcode},
branchname => $branches->{$branch}{branchname},
branchcode => $branch->{branchcode},
branchname => $branch->{branchname},
selected => $selected,
};
}

View File

@ -25,7 +25,7 @@ use C4::Output;
use C4::Auth;
use C4::Koha;
use C4::Debug;
use C4::Branch; # GetBranches
use C4::Branch;
use Koha::DateUtils;
use Koha::Database;
use Koha::IssuingRule;

View File

@ -25,9 +25,10 @@ use C4::Output;
use C4::Auth;
use C4::Koha;
use C4::Debug;
use C4::Branch; # GetBranches
use C4::HoldsQueue qw(TransportCostMatrix UpdateTransportCostMatrix);
use Koha::Libraries;
use Data::Dumper;
my $input = new CGI;
@ -50,11 +51,7 @@ unless ($update) {
$have_matrix = keys %$cost_matrix if $cost_matrix;
}
my $branches = GetBranches();
my @branchloop = map { code => $_,
name => $branches->{$_}->{'branchname'} },
sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
keys %$branches;
my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' });
my (@branchfromloop, @errors);
foreach my $branchfrom ( @branchloop ) {
my $fromcode = $branchfrom->{code};

View File

@ -28,7 +28,6 @@ use C4::Output;
use C4::Biblio;
use C4::Items;
use C4::Circulation;
use C4::Branch;
use C4::Reserves;
use C4::Members; # to use GetMember
use C4::Serials;
@ -127,7 +126,6 @@ my $marchostsarray = GetMarcHosts($record,$marcflavour);
my $subtitle = GetRecordValue('subtitle', $record, $fw);
# Get Branches, Itemtypes and Locations
my $branches = GetBranches();
my $itemtypes = GetItemTypes();
my $dbh = C4::Context->dbh;
@ -258,7 +256,7 @@ foreach my $item (@items) {
$item->{ReservedForBorrowernumber} = $reservedfor;
$item->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'};
$item->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'};
$item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname};
$item->{ExpectedAtLibrary} = $expectedAt;
$item->{Reservedcardnumber} = $ItemBorrowerReserveInfo->{'cardnumber'};
# Check waiting status
$item->{waitingdate} = $wait;
@ -269,8 +267,8 @@ foreach my $item (@items) {
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($item->{itemnumber});
if ( defined( $transfertwhen ) && ( $transfertwhen ne '' ) ) {
$item->{transfertwhen} = $transfertwhen;
$item->{transfertfrom} = $branches->{$transfertfrom}{branchname};
$item->{transfertto} = $branches->{$transfertto}{branchname};
$item->{transfertfrom} = $transfertfrom;
$item->{transfertto} = $transfertto;
$item->{nocancel} = 1;
}

View File

@ -25,11 +25,11 @@ use C4::Auth;
use C4::Output;
use C4::Items;
use C4::Biblio;
use C4::Branch;
use C4::Koha;
use Koha::Item::Search::Field qw(GetItemSearchFields);
use Koha::ItemTypes;
use Koha::Libraries;
my $cgi = new CGI;
my %params = $cgi->Vars;
@ -247,14 +247,7 @@ if (scalar keys %params > 0) {
if ($format eq 'html') {
# Retrieve data required for the form.
my $branches = GetBranches();
my @branches;
foreach my $branchcode ( sort { uc($branches->{$a}->{branchname}) cmp uc($branches->{$b}->{branchname}) } keys %$branches) {
push @branches, {
value => $branchcode,
label => $branches->{$branchcode}->{branchname},
};
}
my @branches = map { value => $_->branchcode => label => $_->branchname }, Koha::Libraries->search( {}, { order_by => 'branchname' } );
my @locations;
foreach my $location (@$location_values) {
push @locations, {

View File

@ -149,7 +149,6 @@ use C4::Koha;
use C4::Members qw(GetMember);
use URI::Escape;
use POSIX qw(ceil floor);
use C4::Branch; # GetBranches
use C4::Search::History;
use Koha::LibraryCategories;
@ -216,7 +215,10 @@ if($cgi->cookie("intranet_bib_list")){
# load the branches
my $categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
$template->param(searchdomainloop => $categories);
$template->param(
selected_branchcode => ( C4::Context->IsSuperLibrarian ? C4::Context->userenv : '' ),
searchdomainloop => $categories
);
# load the Type stuff
my $itemtypes = GetItemTypes;

View File

@ -31,13 +31,14 @@ use C4::Context;
use MARC::Record;
use C4::Log;
use C4::Koha;
use C4::Branch;
use C4::ClassSource;
use C4::ImportBatch;
use C4::Charset;
use Koha::BiblioFrameworks;
use Koha::DateUtils;
use Koha::Libraries;
use Date::Calc qw(Today);
use MARC::File::USMARC;
use MARC::File::XML;
@ -173,18 +174,11 @@ sub build_authorized_values_list {
#---- branch
if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
#Use GetBranches($onlymine)
my $onlymine =
C4::Context->preference('IndependentBranches')
&& C4::Context->userenv
&& !C4::Context->IsSuperLibrarian()
&& C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
foreach my $thisbranch ( sort keys %$branches ) {
push @authorised_values, $thisbranch;
$authorised_lib{$thisbranch} = $branches->{$thisbranch}->{'branchname'};
my $libraries = Koha::Libraries->search_filtered({}, {order_by => ['branchname']});
while ( my $l = $libraries->next ) {
push @authorised_values, $l->branchcode;;
$authorised_lib{$l->branchcode} = $l->branchname;
}
}
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
push @authorised_values, ""

View File

@ -31,7 +31,6 @@ use C4::Output;
use C4::Biblio;
use C4::Koha;
use MARC::Record;
use C4::Branch; # GetBranches
use Koha::ItemTypes;

View File

@ -29,7 +29,6 @@ use C4::Circulation;
use C4::Output;
use C4::Koha;
use C4::Auth;
use C4::Branch; # GetBranches
use C4::Biblio; # GetBiblioItemData
use Koha::DateUtils;
use Koha::Libraries;
@ -38,14 +37,10 @@ my $input = new CGI;
my $itm = $input->param('itm');
my $bi = $input->param('bi');
my $biblionumber = $input->param('biblionumber');
my $branches = GetBranches;
my $idata = itemdatanum($itm);
my $data = GetBiblioItemData($bi);
my $homebranch = $branches->{ $idata->{'homebranch'} }->{'branchname'};
my $holdingbranch = $branches->{ $idata->{'holdingbranch'} }->{'branchname'};
my $lastmove = lastmove($itm);
my $lastdate;
@ -83,8 +78,8 @@ $template->param(
author => $data->{'author'},
barcode => $idata->{'barcode'},
biblioitemnumber => $bi,
homebranch => $homebranch,
holdingbranch => $holdingbranch,
homebranch => $idata->{homebranch},
holdingbranch => $idata->{holdingbranch},
lastdate => $lastdate ? $lastdate : 0,
count => $count,
libraries => $libraries,

View File

@ -29,7 +29,6 @@ use C4::Reserves;
use C4::Biblio;
use C4::Items;
use C4::Auth qw/:DEFAULT get_session/;
use C4::Branch; # GetBranches
use C4::Koha;
use C4::Members;
@ -61,8 +60,6 @@ my ($template, $user, $cookie) = get_template_and_user(
}
);
my $branches = GetBranches;
my $messages;
my $found;
my $reserved;
@ -131,8 +128,7 @@ if ($barcode) {
$item{'ccode'} = $iteminformation->{'ccode'};
$item{'itemcallnumber'} = $iteminformation->{'itemcallnumber'};
$item{'location'} = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'});
$item{'frbrname'} = $branches->{$frbranchcd}->{'branchname'};
$item{'tobrname'} = $branches->{$tobranchcd}->{'branchname'};
$item{'tobrname'} = $tobranchcd;
# }
$item{counter} = 0;
$item{barcode} = $barcode;
@ -164,8 +160,7 @@ foreach ( $query->param ) {
$item{'ccode'} = $iteminformation->{'ccode'};
$item{'itemcallnumber'} = $iteminformation->{'itemcallnumber'};
$item{'location'} = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'});
$item{'frbrname'} = $branches->{$frbcd}->{'branchname'};
$item{'tobrname'} = $branches->{$tobcd}->{'branchname'};
$item{'tobrname'} = $tobcd;
push( @trsfitemloop, \%item );
}
@ -196,16 +191,16 @@ foreach my $code ( keys %$messages ) {
$err{errbadcode} = 1;
}
elsif ( $code eq "NotAllowed" ) {
warn "NotAllowed: $messages->{'NotAllowed'} to " . $branches->{ $messages->{'NotAllowed'} }->{'branchname'};
warn "NotAllowed: $messages->{'NotAllowed'} to branchcode " . $messages->{'NotAllowed'};
# Do we really want a error log message here? --atz
$err{errnotallowed} = 1;
my ( $tbr, $typecode ) = split( /::/, $messages->{'NotAllowed'} );
$err{tbr} = $branches->{ $tbr }->{'branchname'};
$err{tbr} = $tbr;
$err{code} = $typecode;
}
elsif ( $code eq 'IsPermanent' ) {
$err{errispermanent} = 1;
$err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
$err{msg} = $messages->{'IsPermanent'};
}
elsif ( $code eq 'WasReturned' ) {
$err{errwasreturned} = 1;

View File

@ -30,7 +30,6 @@ use DateTime::Duration;
use C4::Output;
use C4::Print;
use C4::Auth qw/:DEFAULT get_session haspermission/;
use C4::Branch; # GetBranches
use C4::Koha; # GetPrinter
use C4::Circulation;
use C4::Utils::DataTables::Members;

View File

@ -45,7 +45,6 @@ use C4::Biblio;
use C4::Items;
use C4::Members;
use C4::Members::Messaging;
use C4::Branch; # GetBranches
use C4::Koha; # FIXME : is it still useful ?
use C4::RotatingCollections;
use Koha::DateUtils;
@ -83,7 +82,6 @@ if ( $query->param('print_slip') ) {
#####################
#Global vars
my $branches = GetBranches();
my $printers = GetPrinters();
my $userenv = C4::Context->userenv;
my $userenv_branch = $userenv->{'branch'} // '';
@ -401,7 +399,6 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
);
my $reserve = $messages->{'ResFound'};
my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
my $borr = C4::Members::GetMember( borrowernumber => $reserve->{'borrowernumber'} );
my $name = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
$template->param(
@ -427,7 +424,6 @@ if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
#
if ( $messages->{'ResFound'}) {
my $reserve = $messages->{'ResFound'};
my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
my $borr = C4::Members::GetMember( borrowernumber => $reserve->{'borrowernumber'} );
my $holdmsgpreferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $reserve->{'borrowernumber'}, message_name => 'Hold_Filled' } );
if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) {
@ -447,8 +443,6 @@ if ( $messages->{'ResFound'}) {
# same params for Waiting or Reserved
$template->param(
found => 1,
currentbranch => $branches->{$userenv_branch}->{'branchname'},
destbranchname => $branches->{ $reserve->{'branchcode'} }->{'branchname'},
name => $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'},
borfirstname => $borr->{'firstname'},
borsurname => $borr->{'surname'},
@ -485,7 +479,7 @@ foreach my $code ( keys %$messages ) {
elsif ( $code eq 'NotIssued' ) {
$err{notissued} = 1;
$err{msg} = '';
$err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'} if $messages->{'IsPermanent'};
$err{msg} = $messages->{'IsPermanent'} if $messages->{'IsPermanent'};
}
elsif ( $code eq 'LocalUse' ) {
$err{localuse} = 1;
@ -512,8 +506,7 @@ foreach my $code ( keys %$messages ) {
elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
$err{ispermanent} = 1;
$err{msg} =
$branches->{ $messages->{'IsPermanent'} }->{'branchname'};
$err{msg} = $messages->{'IsPermanent'};
}
}
elsif ( $code eq 'WrongTransfer' ) {
@ -617,18 +610,9 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
}
push @riloop, \%ri;
}
my ($genbrname, $genprname);
if (my $b = $branches->{$userenv_branch}) {
$genbrname = $b->{'branchname'};
}
if (my $p = $printers->{$printer}) {
$genprname = $p->{'printername'};
}
$template->param(
riloop => \@riloop,
genbrname => $genbrname,
genprname => $genprname,
branchname => $genbrname,
printer => $printer,
errmsgloop => \@errmsgloop,
exemptfine => $exemptfine,

View File

@ -26,7 +26,6 @@ use C4::Output;
use C4::Auth qw/:DEFAULT get_session/;
use C4::Print; # GetPrinters
use C4::Koha;
use C4::Branch; # GetBranches
use Koha::Libraries;
@ -47,7 +46,6 @@ my $sessionID = $query->cookie("CGISESSID");
my $session = get_session($sessionID);
# try to get the branch and printer settings from http, fallback to userenv
my $branches = GetBranches();
my $printers = GetPrinters();
my $branch = $query->param('branch' );
my $printer = $query->param('printer');
@ -58,9 +56,9 @@ my $userenv_printer = C4::Context->userenv->{'branchprinter'} || '';
my @updated;
# $session lddines here are doing the updating
if ($branch and $branches->{$branch}) {
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
if (! $userenv_branch or $userenv_branch ne $branch ) {
my $branchname = Koha::Libraries->find($branch)->branchname;
my $branchname = $library->branchname;
$template->param(LoginBranchname => $branchname); # update template for new branch
$template->param(LoginBranchcode => $branch); # update template for new branch
$session->param('branchname', $branchname); # update sesssion in DB
@ -94,10 +92,6 @@ if ($printer) {
$template->param(updated => \@updated) if (scalar @updated);
unless ($branches->{$branch}) {
$branch = (keys %$branches)[0]; # if branch didn't really exist, then replace it w/ one that does
}
my @printkeys = sort keys %$printers;
if (scalar(@printkeys) == 1 or not $printers->{$printer}) {
$printer = $printkeys[0]; # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does

View File

@ -23,7 +23,6 @@ use warnings;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Output;
use C4::Branch; # GetBranches
use C4::Auth;
use Koha::DateUtils;
use C4::Biblio;
@ -37,6 +36,7 @@ use Date::Calc qw(
use C4::Koha;
use C4::Reserves;
use Koha::Libraries;
my $input = new CGI;
my $itemnumber = $input->param('itemnumber');
@ -56,18 +56,18 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $default = C4::Context->userenv->{'branch'};
# get the all the branches for reference
my $branches = GetBranches();
my $libraries = Koha::Libraries->search({}, { order_by => 'branchname' });
my @branchesloop;
my $latetransfers;
foreach my $br ( keys %$branches ) {
while ( my $library = $libraries->next ) {
my @transferloop;
my %branchloop;
my @gettransfers =
GetTransfersFromTo( $branches->{$br}->{'branchcode'}, $default );
GetTransfersFromTo( $library->branchcode, $default );
if (@gettransfers) {
$branchloop{'branchname'} = $branches->{$br}->{'branchname'};
$branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
$branchloop{'branchname'} = $library->branchname;
$branchloop{'branchcode'} = $library->branchcode;
foreach my $num (@gettransfers) {
my %getransf;

View File

@ -11,12 +11,12 @@ END %]
[% FOREACH branch IN branches %]
<div class="branchgriditem">
[% IF branch.selected || (selectall == 1) %]
<input id="branch_[% branch.value %]" class="branch_select" type="checkbox" name="branch" value="[% branch.value %]" checked="checked" />
<input id="branch_[% branch.branchcode %]" class="branch_select" type="checkbox" name="branch" value="[% branch.branchcode %]" checked="checked" />
[% ELSE %]
<input id="branch_[% branch.value %]" class="branch_select" type="checkbox" name="branch" value="[% branch.value %]" />
<input id="branch_[% branch.branchcode %]" class="branch-select" type="checkbox" name="branch" value="[% branch.branchcode %]" />
[% END %]
<label for="branch_[% branch.value %]">[% branch.branchname %]</label>
<label for="branch_[% branch.branchcode %]">[% branch.branchname %]</label>
</div>
[% IF loop.count() % 4 == 0 && !loop.last() %]
</div>

View File

@ -30,13 +30,8 @@
<label for="branch">Library:</label>
<select id="branch" name="branch_filter">
<option value="">All</option>
[% FOREACH branch IN branches_loop %]
[% IF (branch.selected) %]
<option selected="branch.selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% ELSE %]
<option value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% END %]
[% END %]
[%# FIXME Should not we filter the libraries? %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch_filter, unfiltered => 1 ) %]
</select>
</li>
</ol>

View File

@ -1,4 +1,5 @@
[% USE KohaDates %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; Invoices</title>
@ -262,7 +263,7 @@ $(document).ready(function() {
<li>Publication year: [% publicationyear %]</li>
[% END %]
[% IF ( branch ) %]
<li>Library: [% branchname %]</li>
<li>Library: [% Branches.GetName( branch ) %]</li>
[% END %]
</ul>
</p>
@ -348,13 +349,8 @@ $(document).ready(function() {
<label for="branch">Library:</label>
<select id="branch" name="branch">
<option value="">All</option>
[% FOREACH branch IN branches_loop %]
[% IF ( branch.selected ) %]
<option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% ELSE %]
<option value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% END %]
[% END %]
[%# FIXME Should not we filter the libraries %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
</select>
</li>
</ol>

View File

@ -1,3 +1,4 @@
[% USE Branches %]
[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
@ -522,7 +523,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
<label for="budget_branchcode">Library: </label>
<select name="budget_branchcode" id="budget_branchcode">
<option value=""></option>
[% PROCESS options_for_libraries libraries => branchloop_select %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
</select>
</li>
@ -653,7 +654,7 @@ var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget")
<label for="filter_budgetbranch2">Library: </label>
<select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
<option value=""></option>
[% PROCESS options_for_libraries libraries => branchloop_select %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
</select>
</li>
<li class="radio">

View File

@ -58,15 +58,9 @@
<h1>Library [% branchcode %] - [% Branches.GetName( branchcode ) %] Checkin and transfer policy</h1>
<form method="get" action="/cgi-bin/koha/admin/branch_transfer_limits.pl" id="selectlibrary">
<label for="branchselect">Select a library :</label>
<select name="branchcode" id="branchselect">
[% FOREACH branch_loo IN branch_loop %]
[% IF ( branch_loo.selected ) %]
<option value="[% branch_loo.value %]" selected="selected">[% branch_loo.branchname %]</option>
[% ELSE %]
<option value="[% branch_loo.value %]">[% branch_loo.branchname %]</option>
[% END %]
[% END %]
</select>
<select name="branchcode" id="branchselect">
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1 ) %]
</select>
</form>
<p class="help">Check the boxes for the libraries you accept to checkin items from.</p>

View File

@ -1,3 +1,4 @@
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Item circulation alerts</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -103,13 +104,8 @@ $(function(){
<h2>Select a library:</h2>
<form id="branch_selector" method="get" action="/cgi-bin/koha/admin/item_circulation_alerts.pl">
<select id="branch" name="branch">
[% FOREACH branche IN branches %]
[% IF ( branche.selected ) %]
<option value="[% branche.branchcode %]" selected="selected">[% branche.branchname %]</option>
[% ELSE %]
<option value="[% branche.branchcode %]">[% branche.branchname %]</option>
[% END %]
[% END %]
<option value="*">Default</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
</select>
<input type="submit" name="pick" value="Pick" />
</form>
@ -141,7 +137,7 @@ $(function(){
</div>
</div>
<h2>Circulation alerts for [% branch_name %]</h2>
<h2>Circulation alerts for [% Branches.GetName( branch ) || 'Default' %]</h2>
<p>Click on the grid to toggle the settings.</p>
<div id="alerttabs" class="toptabs">

View File

@ -143,7 +143,7 @@ $(document).ready(function() {
Select a library :
<select name="branch" id="branch" style="width:20em;">
<option value="*">All libraries</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch ) %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => current_branch, unfiltered => 1 ) %]
</select>
</form>
[% IF ( definedbranch ) %]
@ -151,9 +151,7 @@ $(document).ready(function() {
<label for="tobranch"><strong>Clone these rules to:</strong></label>
<input type="hidden" name="frombranch" value="[% current_branch %]" />
<select name="tobranch" id="tobranch">
[% FOREACH l IN Branches.all() %]
<option value="[% l.value %]">[% l.branchname %]</option>
[% END %]
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
</select>
<input type="submit" value="Clone" />
</form>

View File

@ -1,3 +1,4 @@
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo;
[% IF ( nopermission ) %]Access denied[% END %]
@ -57,7 +58,7 @@
<p><label for="branch">Library:</label>
<select name="branch" id="branch" class="input" tabindex="3">
<option value="">My library</option>
[% FOREACH l IN Branches.all() %]
[% FOREACH l IN Branches.all( unfiltered => 1 ) %]
<option value="[% l.branchcode %]">[% l.branchname %]</option>
[% END %]
</select>

View File

@ -1,3 +1,4 @@
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Catalog &rsaquo; Advanced search</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -252,7 +253,8 @@
<fieldset id="select-libs">
<p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
<option value="">All libraries</option>
[% PROCESS options_for_libraries libraries => Branches.all() %]
[%# FIXME Should not we filter the libraries displayed? %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => selected_branchcode, unfiltered => 1 ) %]
</select></p>
<!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
[% IF ( searchdomainloop ) %]

View File

@ -675,7 +675,7 @@ function verify_images() {
: due [% item.datedue %]
</span>
[% ELSIF ( item.transfertwhen ) %]
<span class="intransit">In transit from [% item.transfertfrom %] to [% item.transfertto %] since [% item.transfertwhen | $KohaDates %]</span>
<span class="intransit">In transit from [% Branches.GetName( item.transfertfrom ) %] to [% Branches.GetName( item.transfertto ) %] since [% item.transfertwhen | $KohaDates %]</span>
[% END %]
[% IF ( item.itemlost ) %]
@ -715,9 +715,9 @@ function verify_images() {
[% IF ( item.reservedate ) %]
[% IF ( item.waitingdate ) %]
Waiting at [% item.ExpectedAtLibrary %] since [% item.waitingdate | $KohaDates %].
Waiting at [% Branches.GetName( item.ExpectedAtLibrary ) %] since [% item.waitingdate | $KohaDates %].
[% ELSE %]
Item-level hold (placed [% item.reservedate | $KohaDates %]) for delivery at [% item.ExpectedAtLibrary %].
Item-level hold (placed [% item.reservedate | $KohaDates %]) for delivery at [% Branches.GetName( item.ExpectedAtLibrary ) %].
[% END %]
[% IF ( canreservefromotherbranches ) %]
Hold for: <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% item.ReservedForBorrowernumber %]">

View File

@ -1,4 +1,5 @@
[% USE KohaDates %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Circulation &rsaquo; Circulation statistics for [% title |html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -25,9 +26,9 @@ $(document).ready(function(){
<h3>Barcode [% barcode %]</h3>
<table>
<tr><th>Home library</th><th>Current library</th><th>Date arrived<br />at current library </th><th>Number of checkouts<br />since last transfer</th></tr>
<tr><td>[% homebranch %]</td>
<td>[% holdingbranch %]</td>
<tr><td>[% Branches.GetName( homebranch ) %]</td>
<td>[% Branches.GetName( holdingbranch ) %]</td>
<td>[% IF ( lastdate ) %][% lastdate | $KohaDates %][% ELSE %]Item has no transfer record[% END %]</td>
<td>[% count %]</td>
</tr>

View File

@ -111,7 +111,7 @@
<li>No Item with barcode: [% errmsgloo.msg | html %]</li>
[% END %]
[% IF ( errmsgloo.errispermanent ) %]
<li>Please return item to home library: [% errmsgloo.msg %]</li>
<li>Please return item to home library: [% Branches.GetName( errmsgloo.msg ) %]</li>
[% END %]
[% IF ( errmsgloo.errnotallowed ) %]
<li>Transfer is not allowed for:
@ -121,7 +121,7 @@
[% ELSE %]
<li>Collection code: <b>[% AuthorisedValues.GetByCode( 'CCODE', errmsgloo.code ) %]</b></li>
[% END %]
<li>Destination library: <b>[% errmsgloo.tbr %]</b></li>
<li>Destination library: <b>[% Branches.GetName( errmsgloo.tbr ) %]</b></li>
</ol>
</li>
[% END %]
@ -187,7 +187,7 @@
<td class="tf-itemcallnumber">[% trsfitemloo.itemcallnumber %]</td>
<td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.itemtype ) %]</td>
<td class="tf-ccode">[% AuthorisedValues.GetByCode( 'CCODE', trsfitemloo.ccode ) %]</td>
<td class="tf-destination">[% trsfitemloo.tobrname %]</td>
<td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrname ) %]</td>
</tr>
[% END %]
</table>

View File

@ -301,9 +301,9 @@ $(document).ready(function () {
[% END %]
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
<h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% destbranchname %]</h4>
<h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) %]</h4>
[% END %]
[% FOREACH inputloo IN inputloop %]
@ -361,10 +361,10 @@ $(document).ready(function () {
[% IF ( debarred ) %]<li class="error">Patron is RESTRICTED</li>[% END %]
[% IF ( gonenoaddress ) %]<li class="error">Patron's address is in doubt</li>[% END %]
</ul>
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% destbranchname %]</h4>
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) %]</h4>
[% END %]
<form method="post" action="returns.pl" class="confirm">
@ -514,9 +514,9 @@ $(document).ready(function () {
[% END %]
[% IF ( transfertodo ) %]
<h4><strong>Transfer to:</strong> [% destbranchname %]</h4>
<h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) %]</h4>
[% ELSE %]
<h4><strong>Hold at</strong> [% destbranchname %]</h4>
<h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) %]</h4>
[% END %]
<input type="hidden" name="print_slip" value="0" />
@ -594,7 +594,7 @@ $(document).ready(function () {
<p class="problem">No item with barcode: [% errmsgloo.msg | html %]</p>
[% END %]
[% IF ( errmsgloo.ispermanent ) %]
<p class="problem">Please return item to: [% errmsgloo.msg %]</p>
<p class="problem">Please return item to: [% Branches.GetName( errmsgloo.msg ) %]</p>
[% END %]
[% IF ( errmsgloo.notissued ) %]
<p class="problem">Not checked out.</p>

View File

@ -1,4 +1,5 @@
[% USE Koha %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Patron search</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -194,11 +195,12 @@ function filterByFirstLetterSurname(letter) {
<li>
<label for="branchcode_filter">Library:</label>
<select id="branchcode_filter">
[% IF branches.size != 1 %]
[% SET libraries = Branches.all() %]
[% IF libraries.size != 1 %]
<option value="">Any</option>
[% END %]
[% FOREACH branch IN branches %]
<option value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% FOREACH l IN libraries %]
<option value="[% l.branchcode %]">[% l.branchname %]</option>
[% END %]
</select>
</li>

View File

@ -142,7 +142,7 @@
<td>
<select name="Filter" size="1" id="branch">
<option value=""></option>
[% FOREACH l IN Branches.all() %]
[% FOREACH l IN Branches.all( unfiltered => 1 ) %]
<option value="[% l.branchcode %]">[% l.branchcode %] - [% l.branchname || 'UNKNOWN' %]</option>
[% END %]
</select>

View File

@ -16,10 +16,10 @@
<script type="text/javascript">
// <![CDATA[
var MSG_CONFIRM_DELETE_HOLD = _("Are you sure you want to cancel this hold?");
var patron_homebranch = "[% borrower_branchname |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
var patron_homebranch = "[% Branches.GetName( borrower_branchcode ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
[% itemloo.itemnumber %]: {
homebranch: "[% itemloo.homebranchname |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
homebranch: "[% Branches.GetName( itemloo.homebranch ) |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]",
holdallowed: [% itemloo.holdallowed %]
},
[% END %][% END %][% END %]
@ -537,10 +537,10 @@ function checkMultiHold() {
[% itemloo.barcode %]
</td>
<td>
[% itemloo.homebranchname %]
[% Branches.GetName( itemloo.homebranch ) %]
</td>
<td>
[% itemloo.holdingbranchname %]
[% Branches.GetName( itemloo.holdingbranch ) %]
</td>
<td>
[% itemloo.itemcallnumber %]
@ -559,8 +559,8 @@ function checkMultiHold() {
[% ELSE %]
<span title="0000-00-00">
[% IF ( itemloo.transfertwhen ) %]
In transit from [% itemloo.transfertfrom %],
to [% itemloo.transfertto %], since [% itemloo.transfertwhen %]
In transit from [% Branches.GetName( itemloo.transfertfrom ) %],
to [% Branches.GetName( itemloo.transfertto ) %], since [% itemloo.transfertwhen %]
[% END %]
</span>
[% END %]
@ -578,7 +578,7 @@ function checkMultiHold() {
Can't be cancelled when item is in transit
[% ELSE %]
[% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
[% IF ( itemloo.canreservefromotherbranches ) %]for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedForBorrowernumber %]">[% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %]</a>[% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %]
[% IF ( itemloo.canreservefromotherbranches ) %]for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedForBorrowernumber %]">[% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %]</a>[% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% Branches.GetName( itemloo.ExpectedAtLibrary ) %]
since
[% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate | $KohaDates %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. <a class="info" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber %]&amp;CancelBorrowerNumber=[% itemloo.ReservedForBorrowernumber %]&amp;CancelItemnumber=[% itemloo.itemnumber %]" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);">Cancel hold</a>

View File

@ -1,3 +1,4 @@
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections &rsaquo; Transfer collection</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -37,13 +38,7 @@
<li>
<label for="toBranch">Choose your library:</label>
<select id="toBranch" name="toBranch">
[% FOREACH branchoptionloo IN branchoptionloop %]
[% IF ( branchoptionloo.selected ) %]
<option value="[% branchoptionloo.code %]" selected="selected">[% branchoptionloo.name %]</option>
[% ELSE %]
<option value="[% branchoptionloo.code %]">[% branchoptionloo.name %]</option>
[% END %]
[% END %]
[% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
</select>
</li>
</ol>
@ -61,4 +56,4 @@
[% INCLUDE 'tools-menu.inc' %]
</div>
</div> <!-- /#bd -->
[% INCLUDE 'intranet-bottom.inc' %]
[% INCLUDE 'intranet-bottom.inc' %]

View File

@ -89,13 +89,8 @@
<label for="branch">Library:</label>
<select id="branch" name="branch_filter">
<option value="">All</option>
[% FOREACH branch IN branches_loop %]
[% IF ( branch.selected ) %]
<option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% ELSE %]
<option value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% END %]
[% END %]
[%# FIXME Should not we filter the libraries? %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch_filter, unfiltered => 1 ) %]
</select>
</li>
<li>
@ -398,13 +393,8 @@
<label for="branch">Library:</label>
<select id="branch" name="branch_filter">
<option value="">All</option>
[% FOREACH branch IN branches_loop %]
[% IF ( branch.selected ) %]
<option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% ELSE %]
<option value="[% branch.branchcode %]">[% branch.branchname %]</option>
[% END %]
[% END %]
[%# FIXME Should not we filter the libraries? %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch_filter, unfiltered => 1 ) %]
</select>
</li>
<li>

View File

@ -559,12 +559,10 @@ $(document).ready(function() {
[% UNLESS ( Independentbranches ) %]
<option value="">None</option>
[% END %]
[% 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 %]
[% IF CAN_user_serials_superserials %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1 ) %]
[% ELSE %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
[% END %]
</select> (select a library)
</li>

View File

@ -421,8 +421,12 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
<fieldset class="rows"> <legend>Acquisition information</legend><ol>
<li><label for="branchcode">Library:</label>
<select name="branchcode" id="branchcode">
<option value="">Any</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 %]
<option value="">Any</option>
[% IF branchfilter %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
[% ELSE %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
[% END %]
</select>
</li>
<li><label for="budgetid">Fund:</label>
@ -787,9 +791,12 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
</select></li>
<li><label for="branchcode">Library:</label>
<select name="branchcode" id="branchcode">
<option value="__ANY__">Any</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 %]
<option value="__ANY__">Any</option>
[% IF branchfilter %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
[% ELSE %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
[% END %]
</select></li><li><input type="submit" value="Go" /></li></ol>
</fieldset>
</div>

View File

@ -1,3 +1,4 @@
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Export data</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -92,7 +93,7 @@ $(document).ready(function() {
<li>
<label>Library: </label>
[% INCLUDE 'branch-selector.inc'
branches = branchloop %]
branches = libraries %]
</li>
</ol>

View File

@ -320,7 +320,6 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl
<!-- ***************************** Panel to deal with new holidays ********************** -->
<div class="panel" id="newHoliday">
<form action="/cgi-bin/koha/tools/newHolidays.pl" method="post">
<input type="hidden" name="branchCodes" id="branchCodes" value="[% branchcodes %]" />
<fieldset class="brief">
<h3>Add new holiday</h3>
<ol>

View File

@ -139,7 +139,7 @@ $(document).ready(function(){
</li><li>
<label for="branchloop">Library: </label><select id="branchloop" name="branchcode" style="width:12em;">
<option value="">All libraries</option>
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
</select>
</li>
[% IF (authorised_values) %]

View File

@ -1,4 +1,5 @@
[% USE KohaDates %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; News</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -112,18 +113,12 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
<li>
<label for="branch">Library: </label>
<select id="branch" name="branch">
[% IF ( new_detail.branchcode == '' ) %]
<option value="" selected="selected">All libraries</option>
[% ELSE %]
<option value="" >All libraries</option>
[% END %]
[% FOREACH branch_item IN branch_list %]
[% IF ( branch_item.value.branchcode == new_detail.branchcode ) %]
<option value="[% branch_item.value.branchcode %]" selected="selected">[% branch_item.value.branchname %]</option>
[% ELSE %]
<option value="[% branch_item.value.branchcode %]">[% branch_item.value.branchname %]</option>
[% END %]
[% END %]
[% IF ( new_detail.branchcode == '' ) %]
<option value="" selected="selected">All libraries</option>
[% ELSE %]
<option value="" >All libraries</option>
[% END %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
</select>
</li>
<li>
@ -191,17 +186,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
[% ELSE %]
<option value="" >All libraries</option>
[% END %]
[% FOREACH branch_item IN branch_list %]
[% IF ( branch_item.value.branchcode == branchcode ) %]
<option value="[% branch_item.value.branchcode %]"
selected="selected">[% branch_item.value.branchname %]
</option>
[% ELSE %]
<option value="[% branch_item.value.branchcode %]"
>[% branch_item.value.branchname %]
</option>
[% END %]
[% END %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
</select>
<input type="submit" class="button" value="Filter" />
</form>

View File

@ -37,8 +37,8 @@ not use an API to fetch items that populates item.datedue.
[% IF ( item.transfertwhen ) %]
[% SET itemavailable = 0 %]
<span class="item-status intransit">In transit from [% item.transfertfrom %]
to [% item.transfertto %] since [% item.transfertwhen | $KohaDates %]</span>
<span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) %]
to [% Branches.GetName( item.transfertto ) %] since [% item.transfertwhen | $KohaDates %]</span>
[% END %]
[% IF ( item.waiting ) %]

View File

@ -344,8 +344,8 @@
<td class="barcode">[% itemLoo.barcode %]</td>
[% UNLESS ( singleBranchMode ) %]
<td class="homebranch">[% itemLoo.homeBranchName %]</td>
<td class="holdingbranch">[% itemLoo.holdingBranchName %]</td>
<td class="homebranch">[% Branches.GetName( itemLoo.homeBranchName ) %]</td>
<td class="holdingbranch">[% Branches.GetName( itemLoo.holdingBranchName ) %]</td>
[% END %]
<td class="call_no">[% itemLoo.callNumber %]</td>
[% IF ( itemdata_enumchron ) %]
@ -355,7 +355,7 @@
[% IF ( itemLoo.dateDue ) %]
<span class="checkedout">Due [% itemLoo.dateDue %]</span>
[% ELSIF ( itemLoo.transfertwhen ) %]
<span class="intransit">In transit from [% itemLoo.transfertfrom %] to [% itemLoo.transfertto %] since [% itemLoo.transfertwhen %]</span>
<span class="intransit">In transit from [% Branches.GetName( itemLoo.transfertfrom ) %] to [% Branches.GetName( itemLoo.transfertto ) %] since [% itemLoo.transfertwhen %]</span>
[% END %]
[% IF ( itemLoo.message ) %]

View File

@ -1,4 +1,5 @@
[% USE Koha %]
[% USE Branches %]
[% USE AuthorisedValues %]
[% USE ItemTypes %]
[% INCLUDE 'doc-head-open.inc' %]
@ -41,7 +42,7 @@
[% END %]
[% IF ( branch ) %]
at
[% branch %]
[% Branches.GetName( branch ) %]
[% END %]
[% IF ( timeLimit != 999 ) %]
in the past [% timeLimit |html %] months

View File

@ -30,7 +30,6 @@ use C4::Context;
use C4::Output;
use C4::Auth;
use C4::Members;
use C4::Branch; # GetBranches
use Module::Load;
use Koha::Patron::Images;
use Koha::Token;

View File

@ -21,7 +21,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
@ -45,9 +44,6 @@ my $op = $input->param('op') || '';
my $referer = $input->referer();
my $onlymine = C4::Branch::onlymine;
my $branches = C4::Branch::GetBranches( $onlymine );
my $patron_categories = Koha::Patron::Categories->search_limited;
$template->param(
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
@ -56,7 +52,6 @@ $template->param(
selection_type => 'select',
alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
categories => $patron_categories,
branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
aaSorting => 1,
);
output_html_with_http_headers( $input, $cookie, $template->output );

View File

@ -37,7 +37,6 @@ use C4::Members::AttributeTypes;
use C4::Koha;
use C4::Log;
use C4::Letters;
use C4::Branch; # GetBranches
use C4::Form::MessagingPreferences;
use Koha::Patron::Debarments;
use Koha::Cities;

View File

@ -39,7 +39,6 @@ use C4::Accounts;
use C4::Stats;
use C4::Koha;
use C4::Overdues;
use C4::Branch;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Patron::Images;

View File

@ -28,7 +28,6 @@ use C4::Members;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Accounts;
use C4::Koha;
use C4::Branch;
use Koha::Patron::Images;
use Koha::Patron::Categories;

View File

@ -28,7 +28,6 @@ use CGI qw ( -utf8 );
use C4::Auth;
use C4::Output;
use C4::Members;
use C4::Branch qw(GetBranches);
use List::MoreUtils qw/any uniq/;
use Koha::DateUtils;
use C4::Members::Attributes qw(GetBorrowerAttributes);
@ -74,8 +73,6 @@ if ( $borrowernumber eq C4::Context->preference('AnonymousPatron') ){
$issues = GetAllIssues($borrowernumber,$order,$limit);
}
my $branches = GetBranches();
# barcode export
if ( $op eq 'export_barcodes' ) {
if ( $data->{'privacy'} < 2) {
@ -128,7 +125,6 @@ $template->param(
privacy => $data->{'privacy'},
categoryname => $data->{description},
is_child => ( $data->{category_type} eq 'C' ),
branchname => $branches->{ $data->{branchcode} }->{branchname},
loop_reading => $issues,
activeBorrowerRelationship =>
( C4::Context->preference('borrowerRelationship') ne '' ),

View File

@ -22,7 +22,6 @@ use strict;
use CGI qw ( -utf8 );
use C4::Output;
use C4::Auth qw/:DEFAULT/;
use C4::Branch; # GetBranches
use C4::Members;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Context;
@ -42,8 +41,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
}
);
my $branches = GetBranches();
my $findborrower = $query->param('findborrower');
$findborrower =~ s|,| |g;

View File

@ -20,7 +20,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Koha;
use C4::Biblio;
use C4::Branch;
use C4::Items;
use C4::Circulation;
use C4::Auth;
@ -98,7 +97,6 @@ foreach my $biblionumber ( @bibs ) {
$dat->{'even'} = 1;
}
my $branches = GetBranches();
for my $itm (@items) {
if ($itm->{'location'}){
$itm->{'location_opac'} = $shelflocations->{$itm->{'location'} };
@ -106,8 +104,8 @@ my $branches = GetBranches();
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
$itm->{transfertwhen} = $transfertwhen;
$itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
$itm->{transfertto} = $branches->{$transfertto}{branchname};
$itm->{transfertfrom} = $transfertfrom;
$itm->{transfertto} = $transfertto;
}
}
$num++;

View File

@ -205,7 +205,6 @@ if ($session->param('busc')) {
my ($arrParamsBusc, $offset, $results_per_page) = @_;
my $expanded_facet = $arrParamsBusc->{'expand'};
my $branches = GetBranches();
my $itemtypes = GetItemTypes;
my @servers;
@servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
@ -217,7 +216,7 @@ if ($session->param('busc')) {
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
my ($error, $results_hashref, $facets);
eval {
($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
};
my $hits;
my @newresults;
@ -497,7 +496,6 @@ if ($hideitems) {
@items = @all_items;
}
my $branches = GetBranches();
my $branch = '';
if (C4::Context->userenv){
$branch = C4::Context->userenv->{branch};
@ -508,19 +506,19 @@ if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
||
C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
) {
my $branchname;
my $branchcode;
if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
$branchname = $branches->{$branch}->{'branchname'};
$branchcode = $branch;
}
elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
$branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'};
$branchcode = $ENV{'BRANCHCODE'};
}
my @our_items;
my @other_items;
foreach my $item ( @items ) {
if ( $item->{'branchname'} eq $branchname ) {
if ( $item->{branchcode} eq $branchcode ) {
$item->{'this_branch'} = 1;
push( @our_items, $item );
} else {
@ -680,8 +678,8 @@ if ( not $viewallitems and @items > $max_items_to_display ) {
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
$itm->{transfertwhen} = $transfertwhen;
$itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
$itm->{transfertto} = $branches->{$transfertto}{branchname};
$itm->{transfertfrom} = $transfertfrom;
$itm->{transfertto} = $transfertto;
}
if ( C4::Context->preference('OPACAcquisitionDetails')

View File

@ -30,7 +30,6 @@ use C4::Items;
use C4::Output;
use C4::Context;
use C4::Members;
use C4::Branch; # GetBranches
use C4::Overdues;
use C4::Debug;
use Koha::DateUtils;
@ -88,8 +87,7 @@ if ( $borr->{'BlockExpiredPatronOpacActions'} ) {
if ($borr->{reservefee} > 0){
$template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
}
# get branches and itemtypes
my $branches = GetBranches();
my $itemTypes = GetItemTypes();
# There are two ways of calling this script, with a single biblio num
@ -124,7 +122,6 @@ if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) {
# pass the pickup branch along....
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
($branches->{$branch}) or $branch = ""; # Confirm branch is real
$template->param( branch => $branch );
# Is the person allowed to choose their branch
@ -423,7 +420,7 @@ foreach my $biblioNum (@biblionumbers) {
$itemLoopIter->{itemnumber} = $itemNum;
$itemLoopIter->{barcode} = $itemInfo->{barcode};
$itemLoopIter->{homeBranchName} = $branches->{$itemInfo->{homebranch}}{branchname};
$itemLoopIter->{homeBranchName} = $itemInfo->{homebranch};
$itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber};
$itemLoopIter->{enumchron} = $itemInfo->{enumchron};
$itemLoopIter->{copynumber} = $itemInfo->{copynumber};
@ -436,8 +433,7 @@ foreach my $biblioNum (@biblionumbers) {
# If the holdingbranch is different than the homebranch, we show the
# holdingbranch of the document too.
if ( $itemInfo->{homebranch} ne $itemInfo->{holdingbranch} ) {
$itemLoopIter->{holdingBranchName} =
$branches->{ $itemInfo->{holdingbranch} }{branchname};
$itemLoopIter->{holdingBranchName} = $itemInfo->{holdingbranch};
}
# If the item is currently on loan, we display its return date and
@ -492,9 +488,8 @@ foreach my $biblioNum (@biblionumbers) {
GetTransfers($itemNum);
if ( $transfertwhen && ($transfertwhen ne '') ) {
$itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfertwhen), dateonly => 1 });
$itemLoopIter->{transfertfrom} =
$branches->{$transfertfrom}{branchname};
$itemLoopIter->{transfertto} = $branches->{$transfertto}{branchname};
$itemLoopIter->{transfertfrom} = $transfertfrom;
$itemLoopIter->{transfertto} = $transfertto;
$itemLoopIter->{nocancel} = 1;
}

View File

@ -49,7 +49,6 @@ use C4::Search::History;
use C4::Biblio; # GetBiblioData
use C4::Koha;
use C4::Tags qw(get_tags);
use C4::Branch; # GetBranches
use C4::SocialData;
use C4::Ratings;
use C4::External::OverDrive;
@ -213,7 +212,6 @@ if ($cgi->cookie("search_path_code")) {
}
}
my $branches = GetBranches(); # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established
my $library_categories = Koha::LibraryCategories->search( { categorytype => 'searchdomain' }, { order_by => [ 'categorytype', 'categorycode' ] } );
$template->param( searchdomainloop => $library_categories );
@ -608,7 +606,7 @@ if ($tag) {
# FIXME: No facets for tags search.
} elsif ($build_grouped_results) {
eval {
($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,undef,$query_type,$scan);
};
} else {
$pasarParams .= '&amp;query=' . uri_escape_utf8($query);
@ -616,7 +614,7 @@ if ($tag) {
$pasarParams .= '&amp;simple_query=' . uri_escape_utf8($simple_query);
$pasarParams .= '&amp;query_type=' . uri_escape_utf8($query_type) if ($query_type);
eval {
($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan,1);
($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,undef,$itemtypes,$query_type,$scan,1);
};
}
@ -798,12 +796,12 @@ for (my $i=0;$i<@servers;$i++) {
||
C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
) {
my $branchname;
my $branchcode;
if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
$branchname = $branches->{$branch}->{'branchname'};
$branchcode = $branch;
}
elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
$branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'};
$branchcode = $ENV{'BRANCHCODE'};
}
foreach my $res ( @newresults ) {
@ -811,7 +809,7 @@ for (my $i=0;$i<@servers;$i++) {
my @top_loop;
my @old_loop = @{$res->{'available_items_loop'}};
foreach my $item ( @old_loop ) {
if ( $item->{'branchname'} eq $branchname ) {
if ( $item->{'branchcode'} eq $branchcode ) {
$item->{'this_branch'} = 1;
push( @top_loop, $item );
} else {

View File

@ -49,7 +49,6 @@ if ( ! C4::Context->preference('OpacTopissue') ) {
exit;
}
my $branches = GetBranches();
my $itemtypes = GetItemTypes();
my ($template, $borrowernumber, $cookie) = get_template_and_user(
@ -95,7 +94,7 @@ my @results = GetTopIssues($params);
$template->param(
limit => $limit,
branch => $branches->{$branch}->{branchname},
branch => $branch,
timeLimit => $timeLimit,
results => \@results,
);

View File

@ -33,7 +33,6 @@ use C4::Output;
use C4::Biblio;
use C4::Items;
use C4::Letters;
use C4::Branch; # GetBranches
use Koha::DateUtils;
use Koha::Holds;
use Koha::Database;

View File

@ -21,7 +21,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
@ -45,9 +44,6 @@ my $op = $input->param('op') || '';
my $referer = $input->referer();
my $onlymine = C4::Branch::onlymine;
my $branches = C4::Branch::GetBranches( $onlymine );
my $patron_categories = Koha::Patron::Categories->search_limited;
$template->param(
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
@ -56,7 +52,6 @@ $template->param(
selection_type => 'add',
alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
categories => $patron_categories,
branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
aaSorting => 1,
);
output_html_with_http_headers( $input, $cookie, $template->output );

View File

@ -26,9 +26,9 @@ use C4::Reports;
use C4::Output;
use C4::Koha;
use C4::Circulation;
use C4::Branch;
use C4::Biblio;
use Koha::DateUtils;
use Koha::Libraries;
=head1 NAME
@ -185,11 +185,7 @@ else {
my $CGIsepChoice = GetDelimiterChoices;
my $branches = GetBranches;
my @branches;
foreach ( sort keys %$branches ) {
push @branches, $branches->{$_};
}
my @branches = Koha::Libraries->search({}, { order_by => 'branchname' });
my $ccode_subfield_structure = GetMarcSubfieldStructureFromKohaField('items.ccode', '');
my $ccode_label;

View File

@ -23,7 +23,6 @@ use List::MoreUtils qw/uniq/;
use C4::Auth;
use C4::Context;
use C4::Branch; # GetBranches
use C4::Koha;
use Koha::DateUtils;
use C4::Acquisition;
@ -32,6 +31,7 @@ use C4::Reports;
use C4::Circulation;
use C4::Members::AttributeTypes;
use Koha::Libraries;
use Koha::Patron::Categories;
use Date::Calc qw(
@ -228,9 +228,10 @@ sub calculate {
}
}
my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
($status ) and push @loopfilter,{crit=>"Status", filter=>$status };
($activity) and push @loopfilter,{crit=>"Activity",filter=>$activity};
push @loopfilter,{debug=>1, crit=>"Branches",filter=>join(" ", sort keys %$branches)};
push @loopfilter,{debug=>1, crit=>"Branches",filter=>join(" ", sort @branchcodes)};
push @loopfilter,{debug=>1, crit=>"(line, column)", filter=>"($line,$column)"};
# year of activity
my ( $period_year, $period_month, $period_day )=Add_Delta_YM( Today(),-$period, 0);

View File

@ -23,7 +23,6 @@ use strict;
use C4::Auth;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Circulation;

View File

@ -27,8 +27,6 @@ use C4::Output;
use C4::Koha;
use C4::Members;
use C4::Branch; # GetBranches
use Koha::Patron::Categories;
=head1 NAME

View File

@ -28,7 +28,6 @@ script to place reserves/requests
use Modern::Perl;
use C4::Branch;
use CGI qw ( -utf8 );
use List::MoreUtils qw/uniq/;
use Date::Calc qw/Date_to_Days/;
@ -63,8 +62,6 @@ my $multihold = $input->param('multi_hold');
$template->param(multi_hold => $multihold);
my $showallitems = $input->param('showallitems');
# get Branches and Itemtypes
my $branches = GetBranches();
my $itemtypes = GetItemTypes();
# Select borrowers infos
@ -364,13 +361,12 @@ foreach my $biblionumber (@biblionumbers) {
$item->{itypename} = $itemtypes->{ $item->{itype} }{description};
$item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
$item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
$item->{homebranch} = $item->{homebranch};
# if the holdingbranch is different than the homebranch, we show the
# holdingbranch of the document too
if ( $item->{homebranch} ne $item->{holdingbranch} ) {
$item->{holdingbranchname} =
$branches->{ $item->{holdingbranch} }{branchname};
$item->{holdingbranch} = $item->{holdingbranch};
}
if($item->{biblionumber} ne $biblionumber){
@ -396,7 +392,7 @@ foreach my $biblionumber (@biblionumbers) {
$item->{ReservedForBorrowernumber} = $reservedfor;
$item->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'};
$item->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'};
$item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname};
$item->{ExpectedAtLibrary} = $expectedAt;
$item->{waitingdate} = $wait;
}
@ -428,9 +424,8 @@ foreach my $biblionumber (@biblionumbers) {
if ( defined $transfertwhen && $transfertwhen ne '' ) {
$item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 });
$item->{transfertfrom} =
$branches->{$transfertfrom}{branchname};
$item->{transfertto} = $branches->{$transfertto}{branchname};
$item->{transfertfrom} = $transfertfrom;
$item->{transfertto} = $transfertto;
$item->{nocancel} = 1;
}
@ -609,10 +604,7 @@ foreach my $biblionumber (@biblionumbers) {
C4::Search::enabled_staff_search_views,
);
if (defined $borrowerinfo && exists $borrowerinfo->{'branchcode'}) {
$template->param(
borrower_branchname => $branches->{$borrowerinfo->{'branchcode'}}->{'branchname'},
borrower_branchcode => $borrowerinfo->{'branchcode'},
);
$template->param( borrower_branchcode => $borrowerinfo->{'branchcode'},);
}
$biblioloopiter{biblionumber} = $biblionumber;

View File

@ -22,7 +22,6 @@ use C4::Output;
use C4::Auth;
use C4::Context;
use C4::RotatingCollections;
use C4::Branch;
use CGI qw ( -utf8 );
@ -60,17 +59,6 @@ if ($toBranch) {
}
}
## Set up the toBranch select options
my $branches = GetBranches();
my @branchoptionloop;
foreach my $br ( keys %$branches ) {
my %branch;
$branch{code} = $br;
$branch{name} = $branches->{$br}->{'branchname'};
push( @branchoptionloop, \%branch );
}
@branchoptionloop = sort {$a->{name} cmp $b->{name}} @branchoptionloop;
## Get data about collection
my ( $colTitle, $colDesc, $colBranchcode );
( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection($colId);
@ -79,7 +67,6 @@ $template->param(
colTitle => $colTitle,
colDesc => $colDesc,
colBranchcode => $colBranchcode,
branchoptionloop => \@branchoptionloop
);
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -21,7 +21,6 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
@ -45,10 +44,7 @@ my $op = $input->param('op') || '';
my $referer = $input->referer();
my $onlymine = C4::Branch::onlymine;
my $branches = C4::Branch::GetBranches( $onlymine );
my $patron_categories = Koha::Patron::Categories->search_limited;
$template->param(
view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
columns => ['cardnumber', 'name', 'branch', 'action'],
@ -56,7 +52,6 @@ $template->param(
selection_type => 'add',
alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
categories => $patron_categories,
branches => [ map { { branchcode => $_->{branchcode}, branchname => $_->{branchname} } } values %$branches ],
aaSorting => 1,
);
output_html_with_http_headers( $input, $cookie, $template->output );

View File

@ -31,7 +31,6 @@ this script is the search page for serials
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Branch;
use C4::Context;
use C4::Koha qw( GetAuthorisedValues );
use C4::Output;
@ -131,19 +130,6 @@ for my $sub ( @subscriptions ) {
}
}
my $branches = GetBranches();
my @branches_loop;
foreach (sort keys %$branches){
my $selected = 0;
$selected = 1 if( defined $branch and $branch eq $_ );
push @branches_loop, {
branchcode => $_,
branchname => $branches->{$_}->{'branchname'},
selected => $selected,
};
}
$template->param(
openedsubscriptions => \@openedsubscriptions,
closedsubscriptions => \@closedsubscriptions,
@ -157,7 +143,6 @@ $template->param(
branch_filter => $branch,
location_filter => $location,
expiration_date_filter => $expiration_date_dt,
branches_loop => \@branches_loop,
done_searched => $searched,
routing => $routing,
additional_field_filters => $additional_field_filters,

View File

@ -26,7 +26,6 @@ use C4::Auth;
use C4::Acquisition;
use C4::Output;
use C4::Context;
use C4::Branch; # GetBranches
use C4::Serials;
use C4::Serials::Frequency;
use C4::Serials::Numberpattern;
@ -126,29 +125,10 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
}
my $onlymine =
C4::Context->preference('IndependentBranches')
&& C4::Context->userenv
&& !C4::Context->IsSuperLibrarian
&& (
not C4::Auth::haspermission( C4::Context->userenv->{id}, { serials => 'superserials' } )
)
&& C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my $branchloop;
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) {
my $selected = 0;
$selected = 1 if (defined($subs) && $thisbranch eq $subs->{'branchcode'});
push @{$branchloop}, {
value => $thisbranch,
selected => $selected,
branchname => $branches->{$thisbranch}->{'branchname'},
};
}
my $locations_loop = GetAuthorisedValues("LOC");
$template->param(branchloop => $branchloop,
$template->param(
branchcode => $subs->{branchcode},
locations_loop=>$locations_loop,
);

View File

@ -25,7 +25,6 @@ use C4::Auth; # get_template_and_user
use C4::Output;
use C4::Suggestions;
use C4::Koha; #GetItemTypes
use C4::Branch;
use C4::Budgets;
use C4::Search;
use C4::Members;
@ -61,7 +60,7 @@ sub GetCriteriumDesc{
}
return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i);
}
return Koha::Libraries->find($criteriumvalue)->branchname;
return Koha::Libraries->find($criteriumvalue)->branchname
if $displayby =~ /branchcode/;
return GetAuthorisedValueByCode('SUGGEST_FORMAT', $criteriumvalue) || "Unknown" if ($displayby =~/itemtype/);
if ($displayby =~/suggestedby/||$displayby =~/managedby/||$displayby =~/acceptedby/){
@ -299,31 +298,11 @@ if(defined($returnsuggested) and $returnsuggested ne "noone")
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=".$returnsuggested."#suggestions");
}
####################
## Initializing selection lists
my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : C4::Context->userenv->{'branch'};
#branch display management
my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : '';
my $onlymine =
C4::Context->preference('IndependentBranches')
&& C4::Context->userenv
&& !C4::Context->IsSuperLibrarian()
&& C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
foreach my $thisbranch ( sort {$branches->{$a}->{'branchname'} cmp $branches->{$b}->{'branchname'}} keys %$branches ) {
my %row = (
value => $thisbranch,
branchname => $branches->{$thisbranch}->{'branchname'},
selected => ($branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) || ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} )
);
push @branchloop, \%row;
}
$branchfilter=C4::Context->userenv->{'branch'} if ($onlymine && !$branchfilter);
$template->param( branchloop => \@branchloop,
branchfilter => $branchfilter);
$template->param(
branchfilter => $branchfilter,
);
$template->param( returnsuggestedby => $returnsuggestedby );

View File

@ -3,12 +3,12 @@
use Modern::Perl '2009';
use CGI;
use C4::Branch;
use C4::ClassSource;
use C4::Context;
use C4::Biblio;
use C4::Service;
use Koha::Database;
use Koha::Libraries;
my ( $query, $response ) = C4::Service->init( editcatalogue => 'edit_catalogue' );
@ -29,12 +29,8 @@ foreach my $tag ( sort keys %$tagslib ) {
my $schema = Koha::Database->new->schema;
my $authorised_values = {};
my $branches = { map { $_->branchcode => $_->branchname } Koha::Libraries->search_filtered };
$authorised_values->{branches} = [];
my $onlymine=C4::Context->preference('IndependentBranches') &&
C4::Context->userenv &&
C4::Context->userenv->{flags} % 2 == 0 &&
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
foreach my $thisbranch ( sort keys %$branches ) {
push @{ $authorised_values->{branches} }, { value => $thisbranch, lib => $branches->{$thisbranch}->{'branchname'} };
}

View File

@ -7,9 +7,9 @@ use Test::MockModule;
use C4::Biblio;
use C4::Items;
use C4::Members;
use C4::Branch;
use C4::Circulation;
use Koha::Library;
use Koha::Libraries;
use Koha::Patron::Categories;
use MARC::Record;
@ -21,9 +21,9 @@ $dbh->do(q|DELETE FROM issues|);
my $branchcode;
my $branch_created;
my @branches = keys %{ GetBranches() };
if (@branches) {
$branchcode = $branches[0];
my @libraries = Koha::Libraries->search;
if (@libraries) {
$branchcode = $libraries[0]->branchcode;
} else {
$branchcode = 'B';
Koha::Library->new({ branchcode => $branchcode, branchname => 'Branch' })->store;

View File

@ -4,7 +4,7 @@ use Modern::Perl;
use Test::More tests => 16;
use C4::Context;
use C4::Branch;
use Koha::Libraries;
use_ok('C4::Overdues');
can_ok('C4::Overdues', 'GetOverdueMessageTransportTypes');
can_ok('C4::Overdues', 'GetBranchcodesWithOverdueRules');
@ -83,8 +83,7 @@ $dbh->do(q|
( '', '', 1, 'LETTER_CODE1', 1, 5, 'LETTER_CODE2', 1, 10, 'LETTER_CODE3', 1 )
|);
my $all_branches = C4::Branch::GetBranches;
my @branchcodes = keys %$all_branches;
my @branchcodes = map { $_->branchcode } Koha::Libraries->search;
my @overdue_branches = C4::Overdues::GetBranchcodesWithOverdueRules();
is_deeply( [ sort @overdue_branches ], [ sort @branchcodes ], 'If a default rule exists, all branches should be returned' );

View File

@ -21,7 +21,6 @@ use CGI qw ( -utf8 );
use MARC::File::XML;
use List::MoreUtils qw(uniq);
use C4::Auth;
use C4::Branch; # GetBranches
use C4::Koha; # GetItemTypes
use C4::Output;
@ -31,6 +30,7 @@ use Koha::CsvProfiles;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Exporter::Record;
use Koha::Libraries;
my $query = new CGI;
@ -68,32 +68,26 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
);
my @branch = $query->multi_param("branch");
my $only_my_branch;
# Limit to local branch if IndependentBranches and not superlibrarian
if (
(
C4::Context->preference('IndependentBranches')
&& C4::Context->userenv
&& !C4::Context->IsSuperLibrarian()
&& C4::Context->userenv->{branch}
)
# Limit result to local branch strip_nonlocal_items
or $query->param('strip_nonlocal_items')
) {
$only_my_branch = 1;
@branch = ( C4::Context->userenv->{'branch'} );
}
my %branchmap = map { $_ => 1 } @branch; # for quick lookups
if ( $op eq "export" ) {
my $export_remove_fields = $query->param("export_remove_fields") || q||;
my @biblionumbers = $query->multi_param("biblionumbers");
my @itemnumbers = $query->multi_param("itemnumbers");
my $strip_nonlocal_items = $query->param('strip_nonlocal_items');
my @sql_params;
my $sql_query;
my $libraries = $strip_nonlocal_items
? [ Koha::Libraries->find(C4::Context->userenv->{branch})->unblessed ]
: Koha::Libraries->search_filtered->unblessed;
my @branchcodes;
for my $branchcode ( @branch ) {
if ( grep { $_->{branchcode} eq $branchcode } @$libraries ) {
push @branchcodes, $branchcode;
}
}
if ( $record_type eq 'bibs' or $record_type eq 'auths' ) {
# No need to retrieve the record_ids if we already get them
unless ( @record_ids ) {
@ -140,7 +134,7 @@ if ( $op eq "export" ) {
}
)
: (),
( @branch ? ( 'items.homebranch' => { in => \@branch } ) : () ),
( @branchcodes ? ( 'items.homebranch' => { in => \@branchcodes } ) : () ),
( $itemtype
?
C4::Context->preference('item-level_itypes')
@ -274,23 +268,14 @@ else {
);
push @itemtypesloop, \%row;
}
my $branches = GetBranches($only_my_branch);
my @branchloop;
for my $thisbranch (
sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
keys %{$branches}
)
{
push @branchloop,
{
value => $thisbranch,
selected => %branchmap ? $branchmap{$thisbranch} : 1,
branchname => $branches->{$thisbranch}->{'branchname'},
};
}
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
my $libraries = Koha::Libraries->search_filtered({}, { order_by => ['branchname'] })->unblessed;
for my $library ( @$libraries ) {
$library->{selected} = 1 if grep { $library->{branchcode} eq $_ } @branch;
}
if ( $flags->{superlibrarian}
&& C4::Context->config('backup_db_via_tools')
&& $backupdir
@ -312,7 +297,7 @@ else {
}
$template->param(
branchloop => \@branchloop,
libraries => $libraries,
itemtypeloop => \@itemtypesloop,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),

View File

@ -24,7 +24,6 @@ use CGI qw ( -utf8 );
use C4::Auth;
use C4::Output;
use C4::Branch; # GetBranches
use C4::Calendar;
use Koha::DateUtils;
@ -52,9 +51,6 @@ $keydate =~ s/-/\//g;
my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
# branches calculated - put branch codes in a single string so they can be passed in a form
my $branchcodes = join '|', keys %{$branches};
# Get all the holidays
my $calendar = C4::Calendar->new(branchcode => $branch);
@ -130,7 +126,6 @@ $template->param(
DAY_MONTH_HOLIDAYS_LOOP => \@day_month_holidays,
calendardate => $calendardate,
keydate => $keydate,
branchcodes => $branchcodes,
branch => $branch,
);

View File

@ -32,7 +32,6 @@ use C4::Output;
use C4::Biblio;
use C4::Items;
use C4::Koha;
use C4::Branch; # GetBranches
use C4::Circulation;
use C4::Reports::Guided; #_get_column_defs
use C4::Charset;

View File

@ -32,7 +32,6 @@ use C4::Output;
use C4::NewsChannels;
use C4::Languages qw(getTranslatedLanguages);
use Date::Calc qw/Date_to_Days Today/;
use C4::Branch qw/GetBranches/;
use Koha::DateUtils;
my $cgi = new CGI;
@ -84,10 +83,7 @@ foreach my $language ( @$tlangs ) {
}
}
my $branches = GetBranches;
$template->param( lang_list => \@lang_list,
branch_list => $branches,
branchcode => $branchcode );
my $op = $cgi->param('op') // '';

View File

@ -46,7 +46,6 @@ use CGI qw ( -utf8 );
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Branch; # GetBranches
use C4::Letters;
use C4::Members::Attributes;

Some files were not shown because too many files have changed in this diff Show More