From 8a6453f7e88c5055114c097f4a3c657868718d30 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 10 Jun 2022 09:42:41 +0000 Subject: [PATCH] Bug 25498: Show transfer button for shared lists on OPAC Test plan: Pick or create a shared list. Verify that OPAC only shows the Transfer button when you are the owner of a shared list. Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 9 +++++++++ opac/opac-shelves.pl | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index 195b817e7a..0fd48bca39 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -713,6 +713,15 @@ [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %] Share [% END %] + [% IF s.is_shared AND s.can_be_managed( loggedinusernumber ) %] +
+ + + + + +
+ [% END %] [% IF s.is_shared_with( loggedinusernumber ) %]
diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 42a889869d..5bd342f514 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -89,6 +89,7 @@ $public = 1 if $query->param('public') && $query->param('public') == 1; my ( $shelf, $shelfnumber, @messages ); +# PART 1: Perform a few actions if ( $op eq 'add_form' ) { # Only pass default $shelf = { allow_change_from_owner => 1 }; @@ -255,8 +256,11 @@ if ( $op eq 'add_form' ) { push @messages, { type => 'error', code => 'does_not_exist' }; } $op = 'view'; +} elsif( $op eq 'transfer' ) { + $op = 'list'; # TODO } +# PART 2: After a possible action, view one list or show a number of lists if ( $op eq 'view' ) { $shelfnumber ||= $query->param('shelfnumber'); $shelf = Koha::Virtualshelves->find($shelfnumber); @@ -424,9 +428,7 @@ if ( $op eq 'view' ) { } else { push @messages, { type => 'error', code => 'does_not_exist' }; } -} - -if ( $op eq 'list' ) { +} elsif ( $op eq 'list' ) { my $shelves; my ( $page, $rows ) = ( $query->param('page') || 1, 20 ); if ( !$public ) { @@ -444,6 +446,7 @@ if ( $op eq 'list' ) { ), ); } + my $staffuser; $staffuser = Koha::Patrons->find( $loggedinuser )->can_patron_change_staff_only_lists if $loggedinuser; $template->param( -- 2.30.2