=cut
-sub onlymine {
- return
- C4::Context->preference('IndependentBranches')
- && C4::Context->userenv
- && !C4::Context->IsSuperLibrarian()
- && C4::Context->userenv->{branch};
-}
-
=head2 GetBranch
$branch = GetBranch( $query, $branches );
C4::Context->userenv or return '';
return C4::Context->userenv->{branch} || '';
}
+sub only_my_library {
+ return
+ C4::Context->preference('IndependentBranches')
+ && C4::Context->userenv
+ && !C4::Context->IsSuperLibrarian()
+ && C4::Context->userenv->{branch};
+}
+
+
1;
__END__
# If branches are independent and user is not superlibrarian
# The search has to be only on the user branch
- if ( C4::Branch::onlymine ) {
+ if ( C4::Context::only_my_library ) {
my $userenv = C4::Context->userenv;
$branchcode = $userenv->{'branch'};
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}
- ) {
+ if ( C4::Context::only_my_library ) {
$params->{branchcode} = C4::Context->userenv->{branch};
}
$branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
}
else {
- $branch = C4::Branch::onlymine() ? ( C4::Context::mybranch() || '*' ) : '*';
+ $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
}
}
$branch = '*' if $branch eq 'NO_LIBRARY_SET';
itemtypename => $description,
};
}
-my $onlymine =
- C4::Context->preference('IndependentBranches')
- && C4::Context->userenv
- && !C4::Context->IsSuperLibrarian()
- && C4::Context->userenv->{branch};
-
-$branchfilter = C4::Context->userenv->{'branch'} if ($onlymine && !$branchfilter);
# Filtering by Patron Attributes
# @patron_attr_filter_loop is non empty if there are any patron attribute filters
if ( $quicksearch and $searchmember ) {
my $branchcode;
- if ( C4::Branch::onlymine ) {
+ if ( C4::Context::only_my_library ) {
my $userenv = C4::Context->userenv;
$branchcode = $userenv->{'branch'};
}