Bugzilla – Attachment 135889 Details for
Bug 25498
Allow to change owner of public or shared list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25498: Add transfer button on intranet
Bug-25498-Add-transfer-button-on-intranet.patch (text/plain), 6.20 KB, created by
Marcel de Rooy
on 2022-06-09 14:27:09 UTC
(
hide
)
Description:
Bug 25498: Add transfer button on intranet
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-06-09 14:27:09 UTC
Size:
6.20 KB
patch
obsolete
>From ad9b13a02cd6d12cda8fcd8bc020decf86e4b104 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 9 Jun 2022 12:59:43 +0000 >Subject: [PATCH] Bug 25498: Add transfer button on intranet >Content-Type: text/plain; charset=utf-8 > >Note: Adjusting shelves_results template too for not allowing delete >when you do not have delete_public_lists (or higher). If you are the >owner, you are allowed to edit or delete. But transfer specifically >needs edit_public_lists (or higher). > >Test plan: >Check if you see the transfer button on public lists only when having >permission edit_public_lists (or higher). And never on private lists. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/virtualshelves/shelves.tt | 3 +++ > .../modules/virtualshelves/tables/shelves_results.tt | 12 +++++++++++- > svc/virtualshelves/search | 5 ++++- > virtualshelves/shelves.pl | 8 ++++++-- > 4 files changed, 24 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 98a0c03cda..e0e8754c03 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -531,6 +531,9 @@ > },{ > 'name': 'template_path', > 'value': 'virtualshelves/tables/shelves_results.tt', >+ },{ >+ 'name': 'allow_transfer', >+ 'value': '[% allow_transfer | html %]', > },{ > 'name': 'shelfname_sorton', > 'value': 'vs.shelfname', >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt >index fa89225653..8e5a4c24d6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt >@@ -46,7 +46,7 @@ > [%~ action_block = action_block _ '<button class="editshelf btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</button>' ~%] > [%~ action_block = action_block _ '</form> ' ~%] > [%~ END ~%] >- [%~ IF can_manage_shelf OR can_delete_shelf ~%] >+ [%~ IF can_delete_shelf ~%] > [%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%] > [%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%] > [%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%] >@@ -56,6 +56,16 @@ > [%~ action_block = action_block _ '<button type="submit" class="deleteshelf btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>' ~%] > [%~ action_block = action_block _ '</form>' ~%] > [%~ END ~%] >+ [%~ IF public AND allow_transfer ~%] >+ [%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%] >+ [%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%] >+ [%~ action_block = action_block _ '<input type="hidden" name="op" value="transfer" />' ~%] >+ [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber _ '" />' ~%] >+ [%~ action_block = action_block _ '<input type="hidden" name="public" value="1" />' ~%] >+ [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%] >+ [%~ action_block = action_block _ '<button type="submit" class="btn btn-default btn-xs"><i class="fa"></i> Transfer</button>' ~%] >+ [%~ action_block = action_block _ '</form>' ~%] >+ [%~ END ~%] > [%~ ELSE ~%] > [%~ SET action_block = 'None' ~%] > [%~ END ~%] >diff --git a/svc/virtualshelves/search b/svc/virtualshelves/search >index d2b0cb5a76..e77da28062 100755 >--- a/svc/virtualshelves/search >+++ b/svc/virtualshelves/search >@@ -24,6 +24,7 @@ my $count = $input->param('count'); > my $owner = $input->param('owner'); > my $public = $input->param('public'); > my $sortby = $input->param('sortby'); >+my $allow_transfer = $input->param('allow_transfer'); > > # variable information for DataTables (id) > my $sEcho = $input->param('sEcho'); >@@ -48,7 +49,9 @@ $template->param( > sEcho => $sEcho, > iTotalRecords => $results->{iTotalRecords}, > iTotalDisplayRecords => $results->{iTotalDisplayRecords}, >- aaData => $results->{shelves} >+ aaData => $results->{shelves}, >+ public => $public, >+ allow_transfer => $allow_transfer, > ); > > output_with_http_headers $input, $cookie, $template->output, 'json'; >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index a722326ad0..44706800c7 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -19,8 +19,9 @@ > > use Modern::Perl; > use CGI qw ( -utf8 ); >-use C4::Auth qw( get_template_and_user ); >+use C4::Auth qw( get_template_and_user haspermission ); > use C4::Biblio qw( GetMarcBiblio ); >+use C4::Context; > use C4::Koha qw( > GetNormalizedEAN > GetNormalizedISBN >@@ -56,7 +57,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $op = $query->param('op') || 'list'; > my $referer = $query->param('referer') || $op; > my $public = $query->param('public') ? 1 : 0; >-my ( $shelf, $shelfnumber, @messages ); >+my ( $shelf, $shelfnumber, @messages, $allow_transfer ); > > if ( $op eq 'add_form' ) { > # Only pass default >@@ -352,6 +353,8 @@ if ( $op eq 'view' ) { > } else { > push @messages, { type => 'alert', code => 'does_not_exist' }; > } >+} elsif( $op eq 'list' ) { >+ $allow_transfer = haspermission( C4::Context->userenv->{id}, { lists => 'edit_public_lists' } ) ? 1 : 0; > } > > $template->param( >@@ -362,6 +365,7 @@ $template->param( > public => $public, > print => scalar $query->param('print') || 0, > csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' })->as_list ], >+ allow_transfer => $allow_transfer, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >2.20.1
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 25498
:
135889
|
135921
|
136008
|
136009
|
136010
|
136011
|
136033
|
136034
|
136035
|
136036
|
136166
|
136167
|
136168
|
136169
|
136220
|
136221
|
137862
|
137863
|
137864
|
137865
|
137866
|
137867
|
137871
|
137908