Bug 36940: Resolve two warnings on undefined branchip

If you enabled AutoLocation and have a branch without ip, this
triggers warnings.

Test plan:
Check logs in this situation with/without this patch by logging out
and in again on staff.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2024-05-23 08:47:50 +00:00 committed by Martin Renvoize
parent 865ca8b1fc
commit 2f1ffbc6ec
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -1218,10 +1218,10 @@ sub checkauth {
my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list }; my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
if ( C4::Context->preference('StaffLoginRestrictLibraryByIP') ) { if ( C4::Context->preference('StaffLoginRestrictLibraryByIP') ) {
# we have to check they are coming from the right ip range # we have to check they are coming from the right ip range
my $domain = $branches->{$branchcode}->{'branchip'}; my $domain = $branches->{$branchcode}->{'branchip'} // q{};
$domain =~ s|\.\*||g; $domain =~ s|\.\*||g;
$domain =~ s/\s+//g; $domain =~ s/\s+//g;
if ( $ip !~ /^$domain/ ) { if ( $domain && $ip !~ /^$domain/ ) {
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( $cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie(
-name => 'CGISESSID', -name => 'CGISESSID',
-value => '', -value => '',