View | Details | Raw Unified | Return to bug 36665
Collapse All | Expand All

(-)a/C4/Auth.pm (-1 / +7 lines)
Lines 1235-1245 sub checkauth { Link Here
1235
                        }
1235
                        }
1236
1236
1237
                        if (
1237
                        if (
1238
                            # If StaffLoginBranchBasedOnIP is enabled we will try to find a branch
1239
                            # matching your ip, regardless of the choice you have passed in
1238
                            (
1240
                            (
1239
                                  !C4::Context->preference('AutoLocation')
1241
                                  !C4::Context->preference('AutoLocation')
1240
                                && C4::Context->preference('StaffLoginBranchBasedOnIP')
1242
                                && C4::Context->preference('StaffLoginBranchBasedOnIP')
1241
                            )
1243
                            )
1242
                            || ( C4::Context->preference('AutoLocation') && $auth_state ne 'failed' )
1244
                            # When AutoLocation is enabled we will not choose a branch matching IP
1245
                            # if your selected branch has no IP set
1246
                            || (   C4::Context->preference('AutoLocation')
1247
                                && $auth_state ne 'failed'
1248
                                && $branches->{$branchcode}->{'branchip'} )
1243
                            )
1249
                            )
1244
                        {
1250
                        {
1245
                            foreach my $br ( uniq( $branchcode, keys %$branches ) ) {
1251
                            foreach my $br ( uniq( $branchcode, keys %$branches ) ) {
(-)a/t/db_dependent/Auth.t (-2 / +8 lines)
Lines 1344-1350 subtest 'StaffLoginBranchBasedOnIP' => sub { Link Here
1344
1344
1345
subtest 'AutoLocation' => sub {
1345
subtest 'AutoLocation' => sub {
1346
1346
1347
    plan tests => 7;
1347
    plan tests => 8;
1348
1348
1349
    $schema->storage->txn_begin;
1349
    $schema->storage->txn_begin;
1350
1350
Lines 1396-1401 subtest 'AutoLocation' => sub { Link Here
1396
    my $session = C4::Auth::get_session($sessionID);
1396
    my $session = C4::Auth::get_session($sessionID);
1397
    is( $session->param('branch'), $patron->branchcode );
1397
    is( $session->param('branch'), $patron->branchcode );
1398
1398
1399
    my $noip_library = $builder->build_object( { class => 'Koha::Libraries', value => { branchip => '' } } );
1400
    $cgi->param( 'branch', $noip_library->branchcode );
1401
    ( $userid, $cookie, $sessionID, $flags, $template ) =
1402
        C4::Auth::checkauth( $cgi, 0, { catalogue => 1 }, 'intranet' );
1403
    $session = C4::Auth::get_session($sessionID);
1404
    is( $session->param('branch'), $noip_library->branchcode );
1405
1399
    $schema->storage->txn_rollback;
1406
    $schema->storage->txn_rollback;
1400
1407
1401
};
1408
};
1402
- 

Return to bug 36665