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

(-)a/Koha/Patron.pm (-20 / +54 lines)
Lines 1819-1827 sub can_see_patrons_from { Link Here
1819
1819
1820
    return $self->can_see_things_from(
1820
    return $self->can_see_things_from(
1821
        {
1821
        {
1822
            branchcode => $branchcode,
1822
            branchcode    => $branchcode,
1823
            permission => 'borrowers',
1823
            permission    => 'borrowers',
1824
            subpermission => 'view_borrower_infos_from_any_libraries',
1824
            subpermission => 'view_borrower_infos_from_any_libraries',
1825
            group_feature => 'ft_hide_patron_info',
1825
        }
1826
        }
1826
    );
1827
    );
1827
}
1828
}
Lines 1849-1854 sub can_edit_items_from { Link Here
1849
            branchcode    => $branchcode,
1850
            branchcode    => $branchcode,
1850
            permission    => 'editcatalogue',
1851
            permission    => 'editcatalogue',
1851
            subpermission => 'edit_any_item',
1852
            subpermission => 'edit_any_item',
1853
            group_feature => 'ft_limit_item_editing',
1852
        }
1854
        }
1853
    );
1855
    );
1854
}
1856
}
Lines 1859-1865 sub can_edit_items_from { Link Here
1859
1861
1860
Return the list of branchcodes(!) of libraries the patron is allowed to items for.
1862
Return the list of branchcodes(!) of libraries the patron is allowed to items for.
1861
The branchcodes are arbitrarily returned sorted.
1863
The branchcodes are arbitrarily returned sorted.
1862
We are supposing here that the object is related to the logged in patron (use of C4::Context::only_my_library)
1864
We are supposing here that the object is related to the logged in patron (use of
1865
C4::Context::only_my_library)
1863
1866
1864
An empty array means no restriction, the user can edit any item.
1867
An empty array means no restriction, the user can edit any item.
1865
1868
Lines 1879-1891 sub libraries_where_can_edit_items { Link Here
1879
1882
1880
=head3 libraries_where_can_see_patrons
1883
=head3 libraries_where_can_see_patrons
1881
1884
1882
my $libraries = $patron->libraries_where_can_see_patrons;
1885
  my $libraries = $patron->libraries_where_can_see_patrons;
1886
1887
Return the list of branchcodes(!) of libraries the patron is allowed to see other
1888
patron's infos.
1883
1889
1884
Return the list of branchcodes(!) of libraries the patron is allowed to see other patron's infos.
1885
The branchcodes are arbitrarily returned sorted.
1890
The branchcodes are arbitrarily returned sorted.
1886
We are supposing here that the object is related to the logged in patron (use of C4::Context::only_my_library)
1887
1891
1888
An empty array means no restriction, the patron can see patron's infos from any libraries.
1892
We are supposing here that the object is related to the logged in patron (use of
1893
C4::Context::only_my_library)
1894
1895
An empty array means no restriction, the patron can see patron's infos from any
1896
libraries.
1889
1897
1890
=cut
1898
=cut
1891
1899
Lines 1903-1911 sub libraries_where_can_see_patrons { Link Here
1903
1911
1904
=head3 can_see_things_from
1912
=head3 can_see_things_from
1905
1913
1906
my $can_see = $patron->can_see_things_from( $branchcode );
1914
    my $can_see = $patron->can_see_things_from(
1915
        {
1916
            branchcode    => $branchcode,
1917
            permission    => $permission,
1918
            subpermission => $subpermission,
1919
            group_feature => $group_feature
1920
        }
1921
    );
1907
1922
1908
Return true if the I<Koha::Patron> can perform some action on the given thing
1923
Return true if the I<Koha::Patron> can perform some action, as described by a
1924
permission, subpermission, group_feature combination, at the passed library.
1909
1925
1910
=cut
1926
=cut
1911
1927
Lines 1923-1930 sub can_see_things_from { Link Here
1923
        $can = 1;
1939
        $can = 1;
1924
    } elsif ( $self->has_permission( { $permission => $subpermission } ) ) {
1940
    } elsif ( $self->has_permission( { $permission => $subpermission } ) ) {
1925
        $can = 1;
1941
        $can = 1;
1926
    } elsif ( my @branches = $self->libraries_where_can_see_patrons ) {
1942
    } elsif ( my @branches = $self->libraries_where_can_see_things($params) ) {
1927
        $can = ( any { $_ eq $branchcode } @branches ) ? 1 : 0;
1943
        $can = ( any { $_ eq $branchcode } @branches ) ? 1 : 0;
1944
    } else {
1945
        # This should be the case of not finding any limits above, so we can
1946
        $can = 1;
1928
    }
1947
    }
1929
    return $can;
1948
    return $can;
1930
}
1949
}
Lines 1958-1971 sub can_log_into { Link Here
1958
1977
1959
=head3 libraries_where_can_see_things
1978
=head3 libraries_where_can_see_things
1960
1979
1961
    my $libraries = $patron->libraries_where_can_see_things;
1980
    my $libraries = $patron->libraries_where_can_see_things(
1981
        {
1982
            permission    => $permission,
1983
            subpermission => $subpermission,
1984
            group_feature => $group_feature
1985
        }
1986
    );
1987
1988
Returns a list of libraries where this user is allowed to perform an action, as
1989
defined by a permission, subpermission, group_feature combination.
1962
1990
1963
Returns a list of libraries where an aribitarary action is allowed to be taken by the logged in librarian
1991
We account for `IndependentBranches` and permission/subpermission assignments
1964
against an object based on some branchcode related to the object ( patron branchcode, item homebranch, etc ).
1992
before looking into library group allowances.
1965
1993
1966
We are supposing here that the object is related to the logged in librarian (use of C4::Context::only_my_library)
1994
We are assuming here that the object is related to the logged in librarian (use
1995
of C4::Context::only_my_library)
1967
1996
1968
An empty array means no restriction, the thing can see thing's infos from any libraries.
1997
An empty array means no restriction, the thing can see thing's infos from any
1998
libraries.
1969
1999
1970
=cut
2000
=cut
1971
2001
Lines 1993-2010 sub libraries_where_can_see_things { Link Here
1993
            )
2023
            )
1994
          )
2024
          )
1995
        {
2025
        {
1996
            my $library_groups = $self->library->library_groups({ $group_feature => 1 });
2026
            my $library_groups = $self->library->library_groups();
1997
            if ( $library_groups->count )
2027
            if ( $library_groups->count )
1998
            {
2028
            {
1999
                while ( my $library_group = $library_groups->next ) {
2029
                while ( my $library_group = $library_groups->next ) {
2030
                    my $root = Koha::Library::Groups->get_root_ancestor({ id => $library_group->id });
2031
                    next unless $root->$group_feature;
2000
                    my $parent = $library_group->parent;
2032
                    my $parent = $library_group->parent;
2001
                    if ( $parent->has_child( $self->branchcode ) ) {
2033
                    my @children = $parent->all_libraries;
2002
                        push @restricted_branchcodes, $parent->children->get_column('branchcode');
2034
                    foreach my $child (@children){
2035
                        push @restricted_branchcodes, $child->branchcode;
2036
2003
                    }
2037
                    }
2004
                }
2038
                }
2039
            } else {
2040
                push @restricted_branchcodes, $self->branchcode;
2005
            }
2041
            }
2006
2007
            @restricted_branchcodes = ( $self->branchcode ) unless @restricted_branchcodes;
2008
        }
2042
        }
2009
    }
2043
    }
2010
2044
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt (-2 / +2 lines)
Lines 437-446 Link Here
437
            [% UNLESS group.branchcode %]
437
            [% UNLESS group.branchcode %]
438
              <ul>
438
              <ul>
439
                [% IF group.ft_hide_patron_info %]
439
                [% IF group.ft_hide_patron_info %]
440
                    <li>Hide patron's info for librarians outside of this group.</li>
440
                    <li>Limit patron visibility to libraries within this group for members.</li>
441
                [% END %]
441
                [% END %]
442
                [% IF group.ft_limit_item_editing %]
442
                [% IF group.ft_limit_item_editing %]
443
                    <li>Limit item editing to librarians inside of this group.</li>
443
                    <li>Limit item editing to items owned inside of this group.</li>
444
                [% END %]
444
                [% END %]
445
                [% IF group.ft_search_groups_opac %]
445
                [% IF group.ft_search_groups_opac %]
446
                    <li>Use for OPAC search groups</li>
446
                    <li>Use for OPAC search groups</li>
(-)a/t/db_dependent/ArticleRequests.t (-2 / +2 lines)
Lines 174-181 subtest 'search_limited' => sub { Link Here
174
    plan tests => 2;
174
    plan tests => 2;
175
    my $nb_article_requests = Koha::ArticleRequests->count;
175
    my $nb_article_requests = Koha::ArticleRequests->count;
176
176
177
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store;
177
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1', ft_hide_patron_info => 1 } )->store;
178
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store;
178
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2', ft_hide_patron_info => 1 } )->store;
179
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron->branchcode })->store();
179
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron->branchcode })->store();
180
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
180
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
181
    t::lib::Mocks::mock_userenv( { patron => $patron } ); # Is superlibrarian
181
    t::lib::Mocks::mock_userenv( { patron => $patron } ); # Is superlibrarian
(-)a/t/db_dependent/Koha/Patrons.t (-22 / +90 lines)
Lines 1284-1292 subtest 'search_patrons_to_anonymise' => sub { Link Here
1284
    t::lib::Mocks::mock_preference('IndependentBranches', 0);
1284
    t::lib::Mocks::mock_preference('IndependentBranches', 0);
1285
};
1285
};
1286
1286
1287
subtest 'libraries_where_can_see_patrons + libraries_where_can_see_things + can_see_patron_infos + search_limited' =>
1287
subtest
1288
    sub {
1288
    'libraries_where_can_see_patrons + libraries_where_can_see_things + can_see_patron_infos + search_limited+ can_see_patrons_from + can_edit_items_from'
1289
    plan tests => 4;
1289
    => sub {
1290
    plan tests => 6;
1290
1291
1291
    # group1
1292
    # group1
1292
    #   + library_11
1293
    #   + library_11
Lines 1299-1328 subtest 'libraries_where_can_see_patrons + libraries_where_can_see_things + can_ Link Here
1299
    my $library_11 = $builder->build( { source => 'Branch' } );
1300
    my $library_11 = $builder->build( { source => 'Branch' } );
1300
    my $library_12 = $builder->build( { source => 'Branch' } );
1301
    my $library_12 = $builder->build( { source => 'Branch' } );
1301
    my $library_21 = $builder->build( { source => 'Branch' } );
1302
    my $library_21 = $builder->build( { source => 'Branch' } );
1303
    my $library_31 = $builder->build( { source => 'Branch' } );
1302
    $library_11 = Koha::Libraries->find( $library_11->{branchcode} );
1304
    $library_11 = Koha::Libraries->find( $library_11->{branchcode} );
1303
    $library_12 = Koha::Libraries->find( $library_12->{branchcode} );
1305
    $library_12 = Koha::Libraries->find( $library_12->{branchcode} );
1304
    $library_21 = Koha::Libraries->find( $library_21->{branchcode} );
1306
    $library_21 = Koha::Libraries->find( $library_21->{branchcode} );
1307
    $library_31 = Koha::Libraries->find( $library_31->{branchcode} );
1305
    Koha::Library::Group->new( { branchcode => $library_11->branchcode, parent_id => $group_1->id } )->store;
1308
    Koha::Library::Group->new( { branchcode => $library_11->branchcode, parent_id => $group_1->id } )->store;
1306
    Koha::Library::Group->new( { branchcode => $library_12->branchcode, parent_id => $group_1->id } )->store;
1309
    Koha::Library::Group->new( { branchcode => $library_12->branchcode, parent_id => $group_1->id } )->store;
1307
    Koha::Library::Group->new( { branchcode => $library_21->branchcode, parent_id => $group_2->id } )->store;
1310
    Koha::Library::Group->new( { branchcode => $library_21->branchcode, parent_id => $group_2->id } )->store;
1311
    # Library 31, not in any group
1308
1312
1309
    my $sth =
1313
    my $sth =
1310
        C4::Context->dbh->prepare(q|INSERT INTO user_permissions( borrowernumber, module_bit, code ) VALUES (?, 4, ?)|)
1314
        C4::Context->dbh->prepare(q|INSERT INTO user_permissions( borrowernumber, module_bit, code ) VALUES (?, ?, ?)|);
1311
        ;    # 4 for borrowers
1315
1312
             # 2 patrons from library_11 (group1)
1316
    # 2 patrons from library_11 (group1)
1313
             # patron_11_1 see patron's infos from outside its group
1317
    # patron_11_1 see patron's infos from outside its group
1314
             # Setting flags => undef to not be considered as superlibrarian
1318
    # Setting flags => undef to not be considered as superlibrarian
1315
    my $patron_11_1 = $builder->build(
1319
    my $patron_11_1 = $builder->build(
1316
        { source => 'Borrower', value => { branchcode => $library_11->branchcode, flags => undef, } } );
1320
        { source => 'Borrower', value => { branchcode => $library_11->branchcode, flags => undef, } } );
1317
    $patron_11_1 = Koha::Patrons->find( $patron_11_1->{borrowernumber} );
1321
    $patron_11_1 = Koha::Patrons->find( $patron_11_1->{borrowernumber} );
1318
    $sth->execute( $patron_11_1->borrowernumber, 'edit_borrowers' );
1322
    $sth->execute( $patron_11_1->borrowernumber, 4, 'edit_borrowers' );
1319
    $sth->execute( $patron_11_1->borrowernumber, 'view_borrower_infos_from_any_libraries' );
1323
    $sth->execute( $patron_11_1->borrowernumber, 4, 'view_borrower_infos_from_any_libraries' );
1320
1324
1321
    # patron_11_2 can only see patron's info from its group
1325
    # patron_11_2 can only see patron's info from its group
1322
    my $patron_11_2 = $builder->build(
1326
    my $patron_11_2 = $builder->build(
1323
        { source => 'Borrower', value => { branchcode => $library_11->branchcode, flags => undef, } } );
1327
        { source => 'Borrower', value => { branchcode => $library_11->branchcode, flags => undef, } } );
1324
    $patron_11_2 = Koha::Patrons->find( $patron_11_2->{borrowernumber} );
1328
    $patron_11_2 = Koha::Patrons->find( $patron_11_2->{borrowernumber} );
1325
    $sth->execute( $patron_11_2->borrowernumber, 'edit_borrowers' );
1329
    $sth->execute( $patron_11_2->borrowernumber, 4, 'edit_borrowers' );
1330
    $sth->execute( $patron_11_2->borrowernumber, 9, 'edit_items' );
1326
1331
1327
    # 1 patron from library_12 (group1)
1332
    # 1 patron from library_12 (group1)
1328
    my $patron_12 = $builder->build(
1333
    my $patron_12 = $builder->build(
Lines 1333-1363 subtest 'libraries_where_can_see_patrons + libraries_where_can_see_things + can_ Link Here
1333
    my $patron_21 = $builder->build(
1338
    my $patron_21 = $builder->build(
1334
        { source => 'Borrower', value => { branchcode => $library_21->branchcode, flags => undef, } } );
1339
        { source => 'Borrower', value => { branchcode => $library_21->branchcode, flags => undef, } } );
1335
    $patron_21 = Koha::Patrons->find( $patron_21->{borrowernumber} );
1340
    $patron_21 = Koha::Patrons->find( $patron_21->{borrowernumber} );
1336
    $sth->execute( $patron_21->borrowernumber, 'edit_borrowers' );
1341
    $sth->execute( $patron_21->borrowernumber, 4, 'edit_borrowers' );
1342
1343
    # 1 patron from library_31 (no group) can only see patron's info from its library
1344
    my $patron_31 = $builder->build(
1345
        { source => 'Borrower', value => { branchcode => $library_31->branchcode, flags => undef, } } );
1346
    $patron_31 = Koha::Patrons->find( $patron_31->{borrowernumber} );
1347
    $sth->execute( $patron_31->borrowernumber, 4, 'edit_borrowers' );
1337
1348
1338
    # Pfiou, we can start now!
1349
    # Pfiou, we can start now!
1339
    subtest 'libraries_where_can_see_things' => sub {
1350
    subtest 'libraries_where_can_see_things' => sub {
1340
        plan tests => 2;
1351
        plan tests => 4;
1341
        t::lib::Mocks::mock_userenv( { patron => $patron_11_2 } );
1352
        t::lib::Mocks::mock_userenv( { patron => $patron_11_1 } );
1342
        my $params = {
1353
        my $params = {
1343
            permission    => 'editcatalogue',
1354
            permission    => 'borrowers',
1344
            subpermission => 'edit_any_item',
1355
            subpermission => 'view_borrower_infos_from_any_libraries',
1345
            group_feature => 'ft_limit_item_editing',
1356
            group_feature => 'ft_hide_patron_info',
1346
        };
1357
        };
1347
        my @branchcodes = $patron_11_2->libraries_where_can_see_things($params);
1358
        my @branchcodes = $patron_11_1->libraries_where_can_see_things($params);
1348
        is_deeply(
1359
        is_deeply(
1349
            \@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ],
1360
            \@branchcodes, [],
1350
            q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction|
1361
            q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction|
1351
        );
1362
        );
1363
        @branchcodes = $patron_11_1->libraries_where_can_see_things($params);
1364
        is_deeply(
1365
            \@branchcodes, [],
1366
            q|confirming second/cached request is the same patron_11_1 has view_borrower_infos_from_any_libraries => No restriction|
1367
        );
1368
1352
        @branchcodes = $patron_11_2->libraries_where_can_see_things($params);
1369
        @branchcodes = $patron_11_2->libraries_where_can_see_things($params);
1353
        is_deeply(
1370
        is_deeply(
1354
            \@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ],
1371
            \@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ],
1355
            q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction|
1372
            q|patron_11_2 can only view from group|
1373
        );
1374
        @branchcodes = $patron_11_2->libraries_where_can_see_things($params);
1375
        is_deeply(
1376
            \@branchcodes, [ sort ( $library_11->branchcode, $library_12->branchcode ) ],
1377
            q|confirming second/cached request is the same patron_11_2 can only view from group|
1356
        );
1378
        );
1357
    };
1379
    };
1358
1380
1381
    subtest 'can_see_patrons_from' => sub {
1382
        plan tests => 2;
1383
        ok( $patron_11_2->can_see_patrons_from( $library_11->branchcode ), "We can see a patron from in our group" );
1384
        ok(
1385
            !$patron_11_2->can_see_patrons_from( $library_21->branchcode ),
1386
            "We cannot see a patron from outside our group without permissions"
1387
        );
1388
    };
1389
1390
    subtest 'can_edit_items_from' => sub {
1391
        plan tests => 4;
1392
        ok( $patron_11_2->can_edit_items_from( $library_11->branchcode ), "We can edit an item from in our group" );
1393
        ok(
1394
            $patron_11_2->can_edit_items_from( $library_21->branchcode ),
1395
            "We can edit an item from outside our group as the group does not limit item editing"
1396
        );
1397
        $group_1->ft_limit_item_editing(1)->store();
1398
1399
        $patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber );
1400
1401
        #FIXME We refetch the patron because library lists are cached in an extra hash key
1402
        # in libraries_where_can_see_things
1403
1404
        ok(
1405
            !$patron_11_2->can_edit_items_from( $library_21->branchcode ),
1406
            "We can not edit an item from outside our group as the group does limit item editing"
1407
        );
1408
1409
        $sth->execute( $patron_11_2->borrowernumber, 9, 'edit_any_item' );
1410
        $patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber );
1411
1412
        ok(
1413
            $patron_11_2->can_edit_items_from( $library_21->branchcode ),
1414
            "We can edit an item from outside our group as we have permission"
1415
        );
1416
1417
    };
1418
1359
    subtest 'libraries_where_can_see_patrons' => sub {
1419
    subtest 'libraries_where_can_see_patrons' => sub {
1360
        plan tests => 3;
1420
        plan tests => 4;
1361
1421
1362
        my @branchcodes;
1422
        my @branchcodes;
1363
1423
Lines 1378-1383 subtest 'libraries_where_can_see_patrons + libraries_where_can_see_things + can_ Link Here
1378
            \@branchcodes, [ $library_21->branchcode ],
1438
            \@branchcodes, [ $library_21->branchcode ],
1379
            q|patron_21 has not view_borrower_infos_from_any_libraries => Can only see patron's from its group|
1439
            q|patron_21 has not view_borrower_infos_from_any_libraries => Can only see patron's from its group|
1380
        );
1440
        );
1441
1442
        t::lib::Mocks::mock_userenv( { patron => $patron_31 } );
1443
        @branchcodes = $patron_31->libraries_where_can_see_patrons;
1444
        is_deeply(
1445
            \@branchcodes, [ $library_31->branchcode ],
1446
            q|patron_31 has not view_borrower_infos_from_any_libraries => Can only see patron's from its library that is not in a group|
1447
        );
1381
    };
1448
    };
1382
    subtest 'can_see_patron_infos' => sub {
1449
    subtest 'can_see_patron_infos' => sub {
1383
        plan tests => 6;
1450
        plan tests => 6;
Lines 1402-1408 subtest 'libraries_where_can_see_patrons + libraries_where_can_see_things + can_ Link Here
1402
1469
1403
        t::lib::Mocks::mock_userenv( { patron => $patron_11_1 } );
1470
        t::lib::Mocks::mock_userenv( { patron => $patron_11_1 } );
1404
        $patron_11_1 = Koha::Patrons->find( $patron_11_1->borrowernumber );
1471
        $patron_11_1 = Koha::Patrons->find( $patron_11_1->borrowernumber );
1405
        my $total_number_of_patrons = $nb_of_patrons + 4;    #we added four in these tests
1472
        my $total_number_of_patrons = $nb_of_patrons + 5;    #we added five in these tests
1406
        is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons' );
1473
        is( Koha::Patrons->search->count, $total_number_of_patrons, 'Non-limited search should return all patrons' );
1407
        is(
1474
        is(
1408
            Koha::Patrons->search_limited->count, $total_number_of_patrons,
1475
            Koha::Patrons->search_limited->count, $total_number_of_patrons,
Lines 1429-1434 subtest 'libraries_where_can_see_patrons + libraries_where_can_see_things + can_ Link Here
1429
    $patron_11_2->delete;
1496
    $patron_11_2->delete;
1430
    $patron_12->delete;
1497
    $patron_12->delete;
1431
    $patron_21->delete;
1498
    $patron_21->delete;
1499
    $patron_31->delete;
1432
    };
1500
    };
1433
1501
1434
subtest 'account_locked' => sub {
1502
subtest 'account_locked' => sub {
(-)a/t/db_dependent/Koha/REST/Plugin/Objects.t (-1 / +1 lines)
Lines 649-655 subtest 'objects.search helper, search_limited() tests' => sub { Link Here
649
    my $t = Test::Mojo->new;
649
    my $t = Test::Mojo->new;
650
650
651
    my $mocked_patron = Test::MockModule->new('Koha::Patron');
651
    my $mocked_patron = Test::MockModule->new('Koha::Patron');
652
    $mocked_patron->mock( 'libraries_where_can_see_patrons', sub
652
    $mocked_patron->mock( 'libraries_where_can_see_things', sub
653
        {
653
        {
654
            return @libraries_where_can_see_patrons;
654
            return @libraries_where_can_see_patrons;
655
        }
655
        }
(-)a/t/db_dependent/Koha/Reviews.t (-2 / +2 lines)
Lines 71-78 is( $retrieved_review_1_1->review, $new_review_1_1->review, 'Find a review by id Link Here
71
subtest 'search_limited' => sub {
71
subtest 'search_limited' => sub {
72
    plan tests => 2;
72
    plan tests => 2;
73
    C4::Context->_new_userenv('xxx');
73
    C4::Context->_new_userenv('xxx');
74
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store;
74
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1', ft_hide_patron_info => 1 } )->store;
75
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store;
75
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2', ft_hide_patron_info => 1 } )->store;
76
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron_1->branchcode })->store();
76
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron_1->branchcode })->store();
77
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
77
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
78
    t::lib::Mocks::mock_userenv( { patron => $patron_1 } );
78
    t::lib::Mocks::mock_userenv( { patron => $patron_1 } );
(-)a/t/db_dependent/Patron/Borrower_Discharge.t (-3 / +2 lines)
Lines 155-162 is( ref(Koha::Patron::Discharge::request({ borrowernumber => $patron->borrowernu Link Here
155
subtest 'search_limited' => sub {
155
subtest 'search_limited' => sub {
156
    plan tests => 4;
156
    plan tests => 4;
157
    $dbh->do(q|DELETE FROM discharges|);
157
    $dbh->do(q|DELETE FROM discharges|);
158
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store;
158
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1', ft_hide_patron_info => 1 } )->store;
159
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store;
159
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2', ft_hide_patron_info => 1 } )->store;
160
    # $patron and $patron2 are from the same library, $patron3 from another one
160
    # $patron and $patron2 are from the same library, $patron3 from another one
161
    # Logged in user is $patron, superlibrarian
161
    # Logged in user is $patron, superlibrarian
162
    t::lib::Mocks::mock_userenv({ patron => $patron });
162
    t::lib::Mocks::mock_userenv({ patron => $patron });
163
- 

Return to bug 37392