Bugzilla – Attachment 173657 Details for
Bug 37392
Edit item permission by library group is broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37392: (follow-up)
Bug-37392-follow-up.patch (text/plain), 6.18 KB, created by
Nick Clemens (kidclamp)
on 2024-10-29 14:24:11 UTC
(
hide
)
Description:
Bug 37392: (follow-up)
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-10-29 14:24:11 UTC
Size:
6.18 KB
patch
obsolete
>From 7c05bdc122ebad518b7473b0c1e1c777fd50dfca Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 29 Oct 2024 12:57:38 +0000 >Subject: [PATCH] Bug 37392: (follow-up) > >Tidy and improve the description of patron limits in staff interface >--- > Koha/Patron.pm | 4 +-- > .../prog/en/modules/admin/library_groups.tt | 4 +-- > t/db_dependent/Koha/Patrons.t | 31 ++++++++----------- > 3 files changed, 17 insertions(+), 22 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 6440939573a..229f603921e 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1818,8 +1818,8 @@ sub can_see_patrons_from { > > return $self->can_see_things_from( > { >- branchcode => $branchcode, >- permission => 'borrowers', >+ branchcode => $branchcode, >+ permission => 'borrowers', > subpermission => 'view_borrower_infos_from_any_libraries', > group_feature => 'ft_hide_patron_info', > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt >index 4853eec450a..8120dd647a2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt >@@ -440,10 +440,10 @@ > [% UNLESS group.branchcode %] > <ul> > [% IF group.ft_hide_patron_info %] >- <li>Hide patron's info for librarians outside of this group.</li> >+ <li>Limit patron visibility to libraries within this group for members.</li> > [% END %] > [% IF group.ft_limit_item_editing %] >- <li>Limit item editing to librarians inside of this group.</li> >+ <li>Limit item editing to items owned inside of this group.</li> > [% END %] > [% IF group.ft_search_groups_opac %] > <li>Use for OPAC search groups</li> >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 2e5115a67cd..8f94ab29454 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -83,8 +83,6 @@ is( Koha::Patrons->search->count, $nb_of_patrons + 2, 'The 2 patrons should have > my $retrieved_patron_1 = Koha::Patrons->find( $new_patron_1->borrowernumber ); > is( $retrieved_patron_1->cardnumber, $new_patron_1->cardnumber, 'Find a patron by borrowernumber should return the correct patron' ); > >- >- > subtest 'library' => sub { > plan tests => 2; > is( $retrieved_patron_1->library->branchcode, $library->{branchcode}, 'Koha::Patron->library should return the correct library' ); >@@ -1319,12 +1317,8 @@ subtest > # group2 > # + library21 > $nb_of_patrons = Koha::Patrons->search->count; >- my $group_1 = >- Koha::Library::Group->new( { title => 'TEST Group 1', ft_hide_patron_info => 1 } ) >- ->store; >- my $group_2 = >- Koha::Library::Group->new( { title => 'TEST Group 2', ft_hide_patron_info => 1 } ) >- ->store; >+ my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1', ft_hide_patron_info => 1 } )->store; >+ my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2', ft_hide_patron_info => 1 } )->store; > my $library_11 = $builder->build( { source => 'Branch' } ); > my $library_12 = $builder->build( { source => 'Branch' } ); > my $library_21 = $builder->build( { source => 'Branch' } ); >@@ -1336,16 +1330,16 @@ subtest > Koha::Library::Group->new( { branchcode => $library_21->branchcode, parent_id => $group_2->id } )->store; > > my $sth = >- C4::Context->dbh->prepare(q|INSERT INTO user_permissions( borrowernumber, module_bit, code ) VALUES (?, ?, ?)|) >- ; >- # 2 patrons from library_11 (group1) >- # patron_11_1 see patron's infos from outside its group >- # Setting flags => undef to not be considered as superlibrarian >+ C4::Context->dbh->prepare(q|INSERT INTO user_permissions( borrowernumber, module_bit, code ) VALUES (?, ?, ?)|); >+ >+ # 2 patrons from library_11 (group1) >+ # patron_11_1 see patron's infos from outside its group >+ # Setting flags => undef to not be considered as superlibrarian > my $patron_11_1 = $builder->build( > { source => 'Borrower', value => { branchcode => $library_11->branchcode, flags => undef, } } ); > $patron_11_1 = Koha::Patrons->find( $patron_11_1->{borrowernumber} ); > $sth->execute( $patron_11_1->borrowernumber, 4, 'edit_borrowers' ); >- $sth->execute( $patron_11_1->borrowernumber, 4,'view_borrower_infos_from_any_libraries' ); >+ $sth->execute( $patron_11_1->borrowernumber, 4, 'view_borrower_infos_from_any_libraries' ); > > # patron_11_2 can only see patron's info from its group > my $patron_11_2 = $builder->build( >@@ -1376,12 +1370,12 @@ subtest > }; > my @branchcodes = $patron_11_1->libraries_where_can_see_things($params); > is_deeply( >- \@branchcodes, [ ], >+ \@branchcodes, [], > q|patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| > ); > @branchcodes = $patron_11_1->libraries_where_can_see_things($params); > is_deeply( >- \@branchcodes, [ ], >+ \@branchcodes, [], > q|confirming second/cached request is the same patron_11_1 has view_borrower_infos_from_any_libraries => No restriction| > ); > >@@ -1415,7 +1409,8 @@ subtest > ); > $group_1->ft_limit_item_editing(1)->store(); > >- $patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); >+ $patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); >+ > #FIXME We refetch the patron because library lists are cached in an extra hash key > # in libraries_where_can_see_things > >@@ -1425,7 +1420,7 @@ subtest > ); > > $sth->execute( $patron_11_2->borrowernumber, 9, 'edit_any_item' ); >- $patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); >+ $patron_11_2 = Koha::Patrons->find( $patron_11_2->borrowernumber ); > > ok( > $patron_11_2->can_edit_items_from( $library_21->branchcode ), >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37392
:
169433
|
169434
|
169515
|
169516
|
169517
|
170392
|
170393
|
170394
|
172698
|
172699
|
172700
|
173654
|
173655
|
173656
|
173657
|
173699
|
173700
|
173701
|
173702
|
173703
|
173871
|
173889
|
175413