$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
$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
@ISA = qw(Exporter);
@EXPORT = qw(
&GetBranch
- &GetBranches
);
@EXPORT_OK = qw( &onlymine );
}
=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')
use C4::ItemCirculationAlertPreference;
use C4::Message;
use C4::Debug;
-use C4::Branch; # GetBranches
use C4::Log; # logaction
use C4::Koha qw(
GetAuthorisedValueByCode
my ( $tbr, $barcode, $ignoreRs ) = @_;
my $messages;
my $dotransfer = 1;
- my $branches = GetBranches();
my $itemnumber = GetItemnumberFromBarcode( $barcode );
my $issue = GetItemIssue($itemnumber);
my $biblio = GetBiblioFromItemNumber($itemnumber);
}
# 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;
}
# 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
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__
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);
# 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};
}
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};
}
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
use Koha::DateUtils;
use Koha::Account::Line;
use Koha::Account::Lines;
+use Koha::Libraries;
use vars qw(@ISA @EXPORT);
|);
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;
}
use XML::Simple;
use C4::Members qw(GetHideLostItemsPreference);
use C4::XSLT;
-use C4::Branch;
use C4::Reserves; # GetReserveStatus
use C4::Debug;
use C4::Charset;
$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);
}
#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.
use warnings;
use C4::Biblio;
-use C4::Branch;
use C4::Context;
use C4::Koha;
+use Koha::Libraries;
use vars qw(@ISA @EXPORT @EXPORT_OK);
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);
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'})) {
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 = "";
} 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});
use Carp;
-use Koha::Database;
+use C4::Context;
+use Koha::Database;
use Koha::Library;
use base qw(Koha::Objects);
=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
use C4::Koha;
use C4::Context;
+use Koha::Libraries;
sub GetName {
my ( $self, $branchcode ) = @_;
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
use CGI qw ( -utf8 );
use C4::Auth;
-use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
( $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,
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 );
use C4::Budgets;
use C4::Acquisition;
use C4::Suggestions; # GetSuggestion
-use C4::Branch; # GetBranches
use C4::Members;
use Koha::Number::Price;
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 );
exit 1;
}
}
+
if (!defined $basket->{branch} or $basket->{branch} eq $userenv->{branch}) {
push @branches_loop, {
branchcode => $userenv->{branch},
}
} 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
};
}
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/;
#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');
use C4::Output;
use C4::Acquisition qw/GetInvoices/;
-use C4::Branch qw/GetBranches/;
use C4::Budgets;
use Koha::DateUtils;
};
}
-# 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) {
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;
use C4::Context;
use C4::Acquisition;
use C4::Letters;
-use C4::Branch; # GetBranches
use Koha::DateUtils;
my $input = new CGI;
use C4::Items; #PrepareItemRecord
use C4::Output;
use C4::Koha;
-use C4::Branch; # GetBranches
use C4::Members;
use C4::Search qw/FindDuplicate/;
use CGI qw ( -utf8 );
use C4::Acquisition;
use C4::Auth;
-use C4::Branch;
use C4::Context;
use C4::Output;
use C4::Serials;
}
}
-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,
publisher_filter => $publisher,
supplier_filter => $supplier,
branch_filter => $branch,
- branches_loop => \@branches_loop,
done_searched => $searched,
routing => $routing,
booksellerid => $booksellerid,
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;
use CGI qw ( -utf8 );
use C4::Auth;
-use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
( $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,
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 );
use Koha::Database;
use C4::Auth qw/get_user_subpermissions/;
-use C4::Branch; # GetBranches
use C4::Auth;
use C4::Acquisition;
use C4::Budgets;
}
$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 = ();
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,
);
}
if ( $op eq 'list' ) {
- my $branches = GetBranches();
$template->param(
budget_id => $budget_id,
%$period,
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');
$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,
};
}
use C4::Context;
use C4::Output;
use C4::Koha;
-use C4::Branch;
use C4::Circulation qw{ IsBranchTransferAllowed DeleteBranchTransferLimits CreateBranchTransferLimit };
my $input = new CGI;
$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";
$template->param(
branchcount => $branchcount,
codes_loop => \@codes_loop,
- branch_loop => \@branch_loop,
branchcode_loop => \@branchcode_loop,
branchcode => $branchcode,
limitType => $limitType,
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||;
$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,
};
}
use C4::Auth;
use C4::Context;
-use C4::Branch;
use C4::ItemCirculationAlertPreference;
use C4::Output;
}
);
- 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);
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";
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, {
$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,
};
}
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;
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;
$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};
use C4::Biblio;
use C4::Items;
use C4::Circulation;
-use C4::Branch;
use C4::Reserves;
use C4::Members; # to use GetMember
use C4::Serials;
my $subtitle = GetRecordValue('subtitle', $record, $fw);
# Get Branches, Itemtypes and Locations
-my $branches = GetBranches();
my $itemtypes = GetItemTypes();
my $dbh = C4::Context->dbh;
$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;
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;
}
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;
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, {
use C4::Members qw(GetMember);
use URI::Escape;
use POSIX qw(ceil floor);
-use C4::Branch; # GetBranches
use C4::Search::History;
use Koha::LibraryCategories;
# 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;
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;
#---- 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, ""
use C4::Biblio;
use C4::Koha;
use MARC::Record;
-use C4::Branch; # GetBranches
use Koha::ItemTypes;
use C4::Output;
use C4::Koha;
use C4::Auth;
-use C4::Branch; # GetBranches
use C4::Biblio; # GetBiblioItemData
use Koha::DateUtils;
use Koha::Libraries;
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;
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,
use C4::Biblio;
use C4::Items;
use C4::Auth qw/:DEFAULT get_session/;
-use C4::Branch; # GetBranches
use C4::Koha;
use C4::Members;
}
);
-my $branches = GetBranches;
-
my $messages;
my $found;
my $reserved;
$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;
$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 );
}
$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;
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;
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;
#####################
#Global vars
-my $branches = GetBranches();
my $printers = GetPrinters();
my $userenv = C4::Context->userenv;
my $userenv_branch = $userenv->{'branch'} // '';
);
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(
#
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" ) {
# 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'},
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;
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' ) {
}
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,
use C4::Auth qw/:DEFAULT get_session/;
use C4::Print; # GetPrinters
use C4::Koha;
-use C4::Branch; # GetBranches
use Koha::Libraries;
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');
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
$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
use CGI qw ( -utf8 );
use C4::Context;
use C4::Output;
-use C4::Branch; # GetBranches
use C4::Auth;
use Koha::DateUtils;
use C4::Biblio;
use C4::Koha;
use C4::Reserves;
+use Koha::Libraries;
my $input = new CGI;
my $itemnumber = $input->param('itemnumber');
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;
[% 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>
<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>
[% USE KohaDates %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions › Invoices</title>
<li>Publication year: [% publicationyear %]</li>
[% END %]
[% IF ( branch ) %]
- <li>Library: [% branchname %]</li>
+ <li>Library: [% Branches.GetName( branch ) %]</li>
[% END %]
</ul>
</p>
<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>
+[% USE Branches %]
[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Funds[% IF op == 'add_form' %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
<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>
<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">
<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>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Item circulation alerts</title>
[% INCLUDE 'doc-head-close.inc' %]
<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>
</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">
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 ) %]
<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>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha ›
[% IF ( nopermission ) %]Access denied[% END %]
<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>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Catalog › Advanced search</title>
[% INCLUDE 'doc-head-close.inc' %]
<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 ) %]
: 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 ) %]
[% 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 %]">
[% USE KohaDates %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Circulation › Circulation statistics for [% title |html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<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>
<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:
[% 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 %]
<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>
[% 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 %]
[% 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">
[% 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" />
<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>
[% USE Koha %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patron search</title>
[% INCLUDE 'doc-head-close.inc' %]
<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>
<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>
<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 %]
[% itemloo.barcode %]
</td>
<td>
- [% itemloo.homebranchname %]
+ [% Branches.GetName( itemloo.homebranch ) %]
</td>
<td>
- [% itemloo.holdingbranchname %]
+ [% Branches.GetName( itemloo.holdingbranch ) %]
</td>
<td>
[% itemloo.itemcallnumber %]
[% 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 %]
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 %]&CancelBorrowerNumber=[% itemloo.ReservedForBorrowernumber %]&CancelItemnumber=[% itemloo.itemnumber %]" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);">Cancel hold</a>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Tools › Rotating collections › Transfer collection</title>
[% INCLUDE 'doc-head-close.inc' %]
<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>
[% INCLUDE 'tools-menu.inc' %]
</div>
</div> <!-- /#bd -->
-[% INCLUDE 'intranet-bottom.inc' %]
\ No newline at end of file
+[% INCLUDE 'intranet-bottom.inc' %]
<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>
<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>
[% 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>
<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>
</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>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Tools › Export data</title>
[% INCLUDE 'doc-head-close.inc' %]
<li>
<label>Library: </label>
[% INCLUDE 'branch-selector.inc'
- branches = branchloop %]
+ branches = libraries %]
</li>
</ol>
<!-- ***************************** 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>
</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) %]
[% USE KohaDates %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Tools › News</title>
[% INCLUDE 'doc-head-close.inc' %]
<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>
[% 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>
[% 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 ) %]
<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 ) %]
[% 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 ) %]
[% USE Koha %]
+[% USE Branches %]
[% USE AuthorisedValues %]
[% USE ItemTypes %]
[% INCLUDE 'doc-head-open.inc' %]
[% END %]
[% IF ( branch ) %]
at
- [% branch %]
+ [% Branches.GetName( branch ) %]
[% END %]
[% IF ( timeLimit != 999 ) %]
in the past [% timeLimit |html %] months
use C4::Output;
use C4::Auth;
use C4::Members;
-use C4::Branch; # GetBranches
use Module::Load;
use Koha::Patron::Images;
use Koha::Token;
use CGI qw ( -utf8 );
use C4::Auth;
-use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
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",
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 );
use C4::Koha;
use C4::Log;
use C4::Letters;
-use C4::Branch; # GetBranches
use C4::Form::MessagingPreferences;
use Koha::Patron::Debarments;
use Koha::Cities;
use C4::Stats;
use C4::Koha;
use C4::Overdues;
-use C4::Branch;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Patron::Images;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Accounts;
use C4::Koha;
-use C4::Branch;
use Koha::Patron::Images;
use Koha::Patron::Categories;
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);
$issues = GetAllIssues($borrowernumber,$order,$limit);
}
-my $branches = GetBranches();
-
# barcode export
if ( $op eq 'export_barcodes' ) {
if ( $data->{'privacy'} < 2) {
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 '' ),
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;
}
);
-my $branches = GetBranches();
-
my $findborrower = $query->param('findborrower');
$findborrower =~ s|,| |g;
use CGI qw ( -utf8 );
use C4::Koha;
use C4::Biblio;
-use C4::Branch;
use C4::Items;
use C4::Circulation;
use C4::Auth;
$dat->{'even'} = 1;
}
-my $branches = GetBranches();
for my $itm (@items) {
if ($itm->{'location'}){
$itm->{'location_opac'} = $shelflocations->{$itm->{'location'} };
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++;
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'};
$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;
@items = @all_items;
}
-my $branches = GetBranches();
my $branch = '';
if (C4::Context->userenv){
$branch = C4::Context->userenv->{branch};
||
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 {
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')
use C4::Output;
use C4::Context;
use C4::Members;
-use C4::Branch; # GetBranches
use C4::Overdues;
use C4::Debug;
use Koha::DateUtils;
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
# 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
$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};
# 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
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;
}
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;
}
}
-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 );
# 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 .= '&query=' . uri_escape_utf8($query);
$pasarParams .= '&simple_query=' . uri_escape_utf8($simple_query);
$pasarParams .= '&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);
};
}
||
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 ) {
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 {
exit;
}
-my $branches = GetBranches();
my $itemtypes = GetItemTypes();
my ($template, $borrowernumber, $cookie) = get_template_and_user(
$template->param(
limit => $limit,
- branch => $branches->{$branch}->{branchname},
+ branch => $branch,
timeLimit => $timeLimit,
results => \@results,
);
use C4::Biblio;
use C4::Items;
use C4::Letters;
-use C4::Branch; # GetBranches
use Koha::DateUtils;
use Koha::Holds;
use Koha::Database;
use CGI qw ( -utf8 );
use C4::Auth;
-use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
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",
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 );
use C4::Output;
use C4::Koha;
use C4::Circulation;
-use C4::Branch;
use C4::Biblio;
use Koha::DateUtils;
+use Koha::Libraries;
=head1 NAME
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;
use C4::Auth;
use C4::Context;
-use C4::Branch; # GetBranches
use C4::Koha;
use Koha::DateUtils;
use C4::Acquisition;
use C4::Circulation;
use C4::Members::AttributeTypes;
+use Koha::Libraries;
use Koha::Patron::Categories;
use Date::Calc qw(
}
}
+ 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);
use C4::Auth;
use CGI qw ( -utf8 );
use C4::Context;
-use C4::Branch; # GetBranches
use C4::Output;
use C4::Koha;
use C4::Circulation;
use C4::Koha;
use C4::Members;
-use C4::Branch; # GetBranches
-
use Koha::Patron::Categories;
=head1 NAME
use Modern::Perl;
-use C4::Branch;
use CGI qw ( -utf8 );
use List::MoreUtils qw/uniq/;
use Date::Calc qw/Date_to_Days/;
$template->param(multi_hold => $multihold);
my $showallitems = $input->param('showallitems');
-# get Branches and Itemtypes
-my $branches = GetBranches();
my $itemtypes = GetItemTypes();
# Select borrowers infos
$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){
$item->{ReservedForBorrowernumber} = $reservedfor;
$item->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'};
$item->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'};
- $item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname};
+ $item->{ExpectedAtLibrary} = $expectedAt;
$item->{waitingdate} = $wait;
}
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;
}
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;
use C4::Auth;
use C4::Context;
use C4::RotatingCollections;
-use C4::Branch;
use CGI qw ( -utf8 );
}
}
-## 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);
colTitle => $colTitle,
colDesc => $colDesc,
colBranchcode => $colBranchcode,
- branchoptionloop => \@branchoptionloop
);
output_html_with_http_headers $query, $cookie, $template->output;
use CGI qw ( -utf8 );
use C4::Auth;
-use C4::Branch qw( GetBranches );
use C4::Output;
use C4::Members;
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'],
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 );
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
-use C4::Branch;
use C4::Context;
use C4::Koha qw( GetAuthorisedValues );
use C4::Output;
}
}
-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,
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,
use C4::Acquisition;
use C4::Output;
use C4::Context;
-use C4::Branch; # GetBranches
use C4::Serials;
use C4::Serials::Frequency;
use C4::Serials::Numberpattern;
}
-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,
);
use C4::Output;
use C4::Suggestions;
use C4::Koha; #GetItemTypes
-use C4::Branch;
use C4::Budgets;
use C4::Search;
use C4::Members;
}
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/){
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=".$returnsuggested."#suggestions");
}
-####################
-## Initializing selection lists
-
-#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);
+my $branchfilter = ($displayby ne "branchcode") ? $input->param('branchcode') : C4::Context->userenv->{'branch'};
-$template->param( branchloop => \@branchloop,
- branchfilter => $branchfilter);
+$template->param(
+ branchfilter => $branchfilter,
+);
$template->param( returnsuggestedby => $returnsuggestedby );
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' );
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'} };
}
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;
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;
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');
( '', '', 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' );
use MARC::File::XML;
use List::MoreUtils qw(uniq);
use C4::Auth;
-use C4::Branch; # GetBranches
use C4::Koha; # GetItemTypes
use C4::Output;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Exporter::Record;
+use Koha::Libraries;
my $query = new CGI;
);
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 ) {
}
)
: (),
- ( @branch ? ( 'items.homebranch' => { in => \@branch } ) : () ),
+ ( @branchcodes ? ( 'items.homebranch' => { in => \@branchcodes } ) : () ),
( $itemtype
?
C4::Context->preference('item-level_itypes')
);
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
}
$template->param(
- branchloop => \@branchloop,
+ libraries => $libraries,
itemtypeloop => \@itemtypesloop,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
use C4::Auth;
use C4::Output;
-use C4::Branch; # GetBranches
use C4::Calendar;
use Koha::DateUtils;
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);
DAY_MONTH_HOLIDAYS_LOOP => \@day_month_holidays,
calendardate => $calendardate,
keydate => $keydate,
- branchcodes => $branchcodes,
branch => $branch,
);
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;
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;
}
}
-my $branches = GetBranches;
-
$template->param( lang_list => \@lang_list,
- branch_list => $branches,
branchcode => $branchcode );
my $op = $cgi->param('op') // '';
use C4::Auth;
use C4::Context;
use C4::Output;
-use C4::Branch; # GetBranches
use C4::Letters;
use C4::Members::Attributes;
}
if($allbranches) {
- my $branch;
- my @branchcodes = split(/\|/, $input->param('branchCodes'));
- foreach $branch (@branchcodes) {
- add_holiday($newoperation, $branch, $weekday, $day, $month, $year, $title, $description);
- }
+ my $libraries = Koha::Libraries->search;
+ while ( my $library = $libraries->next ) {
+ add_holiday($newoperation, $library->branchcode, $weekday, $day, $month, $year, $title, $description);
+ }
} else {
- add_holiday($newoperation, $branchcode, $weekday, $day, $month, $year, $title, $description);
+ add_holiday($newoperation, $branchcode, $weekday, $day, $month, $year, $title, $description);
}
print $input->redirect("/cgi-bin/koha/tools/holidays.pl?branch=$originalbranchcode&calendardate=$calendardate");