From b4e7dc933df6d9236456aecdced5f29ded490bf6 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 7 Jun 2018 12:16:18 +0000 Subject: [PATCH] Bug 19524: Share patron lists between staff Content-Type: text/plain; charset=utf-8 Some libraries would like to allow arbitrary lists to be used by all librarians with the 'manage_patron_lists' permission. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Create or find two patrons with the manage_patron_lists permission 4) Using the first patron, create two new lists, mark one of them as shared 5) Log in as the second patron, browse to the patron lists page 6) Note the second patron can view, add and remove patrons from the shared list owned by the first patron Signed-off-by: George Williams Signed-off-by: Marcel de Rooy --- Koha/List/Patron.pm | 10 ++++++- .../prog/en/modules/patron_lists/add-modify.tt | 9 +++++++ .../prog/en/modules/patron_lists/lists.tt | 17 ++++++++++-- patron_lists/add-modify.pl | 5 ++-- patron_lists/lists.pl | 5 +++- t/db_dependent/PatronLists.t | 31 ++++++++++++++-------- 6 files changed, 60 insertions(+), 17 deletions(-) diff --git a/Koha/List/Patron.pm b/Koha/List/Patron.pm index 1847973..c6f4384 100644 --- a/Koha/List/Patron.pm +++ b/Koha/List/Patron.pm @@ -63,7 +63,15 @@ sub GetPatronLists { return; } - delete( $params->{owner} ) if ( C4::Context->IsSuperLibrarian() ); + delete $params->{owner} if C4::Context->IsSuperLibrarian(); + + if ( my $owner = $params->{owner} ) { + delete $params->{owner}; + $params->{'-or'} = [ + owner => $owner, + shared => 1, + ]; + } my $schema = Koha::Database->new()->schema(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt index bf89a4d..62612f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt @@ -51,6 +51,15 @@
  • + + [% IF list.shared %] + + [% ELSE %] + + [% END %] +
  • + +
  • Owner: [% loggedinusername %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt index f2cd32d..dcf3ca5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt @@ -32,24 +32,37 @@ Name Patrons in list + Shared   [% FOREACH l IN lists %] + [% SET shared_by_other = l.owner.id != logged_in_user %] [% l.name |html%] [% l.patron_list_patrons_rs.count || 0 %] + [% IF l.shared %] + [% IF shared_by_other %] + by [% INCLUDE 'patron-title.inc' patron=l.owner %] + [% ELSE %] + by you + [% END %] + [% END %] + +