Bug 35434: (follow-up) Added canreservefromotherbranches

When IndependentBranches is enabled, canreservefromotherbranches
set to don't allow is also required to prevent non-superlibrarians
from placing holds in other libraries.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Hammat Wele 2024-07-31 21:28:41 +00:00 committed by Katrin Fischer
parent 15988d1a6a
commit 03fc8b4057
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 9 additions and 1 deletions

View File

@ -1032,7 +1032,15 @@ is not passed.
sub pickup_locations {
my ( $self, $params ) = @_;
return Koha::Libraries->search( { branchcode => $self->holdingbranch } ) if C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian();
if ( C4::Context->preference("IndependentBranches")
and !C4::Context->preference("canreservefromotherbranches") )
{
my $userenv = C4::Context->userenv;
unless ( C4::Context->IsSuperLibrarian ) {
return Koha::Libraries->new()->empty if ( $self->homebranch ne $userenv->{branch} );
return Koha::Libraries->search( { branchcode => $self->homebranch } );
}
}
Koha::Exceptions::MissingParameter->throw( parameter => 'patron' )
unless exists $params->{patron};