Bug 15758: [QA Follow-up] Remove onlymine from Plugin/Branches.pm

Hard to miss that one:
Template process failed: plugin error - Bareword "C4::Branch::onlymine" not allowed while "strict subs" in use at Koha/Template/Plugin/Branches.pm line 59.
Compilation failed in require at /usr/lib/perl5/Template/Plugins.pm line 206.

Removed OnlyMine from Plugin/Branches. Replaced by a template var in
cleanborrowers; it was used only once.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2016-08-26 08:01:07 +02:00 committed by Kyle M Hall
parent f1e5d61b46
commit f435d83c0c
4 changed files with 13 additions and 7 deletions

View File

@ -1035,6 +1035,16 @@ sub mybranch {
C4::Context->userenv or return '';
return C4::Context->userenv->{branch} || '';
}
=head2 only_my_library
my $test = C4::Context->only_my_library;
Returns true if you enabled IndependentBranches and the current user
does not have superlibrarian permissions.
=cut
sub only_my_library {
return
C4::Context->preference('IndependentBranches')
@ -1043,9 +1053,8 @@ sub only_my_library {
&& C4::Context->userenv->{branch};
}
1;
__END__
=head1 ENVIRONMENT

View File

@ -55,10 +55,6 @@ sub GetURL {
return $b->{branchurl};
}
sub OnlyMine {
return C4::Branch::onlymine;
}
sub all {
my ( $self, $params ) = @_;
my $selected = $params->{selected};

View File

@ -60,7 +60,7 @@
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF !Branches.OnlyMine %]
[% IF !OnlyMine %]
<form method="get" action="/cgi-bin/koha/tools/cleanborrowers.pl" id="selectlibrary">
Select a library :
<select name="branch" id="branch" style="width:20em;">

View File

@ -80,6 +80,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $branch = $params->{ branch } || '*';
$template->param( current_branch => $branch );
$template->param( OnlyMine => C4::Context->only_my_library );
if ( $step == 2 ) {