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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-06-10 09:42:41 +00:00 committed by Tomas Cohen Arazi
parent 92e7bcf751
commit da8f05f7c5
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 15 additions and 3 deletions

View file

@ -713,6 +713,15 @@
[% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
<a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber | uri %]" class="sharelist btn btn-link"><i class="fa fa-share" aria-hidden="true"></i> Share</a>
[% END %]
[% IF s.is_shared AND s.can_be_managed( loggedinusernumber ) %]
<form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="d-inline">
<input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
<input type="hidden" name="public" value="0" />
<input type="hidden" name="op" value="transfer" />
<input type="hidden" name="referer" value="list" />
<button type="submit" class="btn btn-link transfershelf"> Transfer</button>
</form>
[% END %]
[% IF s.is_shared_with( loggedinusernumber ) %]
<form action="opac-shelves.pl" method="post" id="unshare[% s.shelfnumber | html %]" class="d-inline">
<input type="hidden" name="op" value="remove_share" />

View file

@ -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(