Bug 34601: Fix edit/delete links on suggestion.tt

1. Make a suggestion
2. Try to edit, delete the suggestion.
3. Error:
4. Apply patch and restart_all
5. Try again and you should not get the error anymore.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-08-23 18:18:57 +00:00 committed by Tomas Cohen Arazi
parent bee56606a6
commit b630dfcb08
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 12 additions and 4 deletions

View file

@ -845,9 +845,9 @@
</td>
<td class="actions">
<div class="btn-group dropup">
<a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=[% s.suggestionid | html %]&amp;op=edit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" id="more_actions_[% s.suggestionid | html %]" role="button" data-toggle="dropdown" href="#"><b class="caret"></b></a>
<a class="btn btn-default btn-xs" role="button" href="suggestion.pl?suggestionid=[% s.suggestionid | html %]&amp;csrf_token=[% csrf_token | html %]&amp;op=edit"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a><a class="btn btn-default btn-xs dropdown-toggle" id="more_actions_[% s.suggestionid | html %]" role="button" data-toggle="dropdown" href="#"><b class="caret"></b></a>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="more_actions_[% s.suggestionid | html %]">
<li><a class="deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% s.suggestionid | html %]"><i class="fa fa-trash-can"></i> Delete</a></li>
<li><a class="deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% s.suggestionid | html %]"&amp;csrf_token=[% csrf_token | html %]><i class="fa fa-trash-can"></i> Delete</a></li>
[% UNLESS s.archived %]
<li><a class="archivesuggestion" href="suggestion.pl?op=archive&amp;suggestionid=[% s.suggestionid | html %]"><i class="fa fa-archive"></i> Archive</a></li>
[% ELSE %]

View file

@ -33,6 +33,7 @@ use Koha::Acquisition::Currencies;
use Koha::Libraries;
use Koha::Patrons;
use Koha::Suggestions;
use Koha::Token;
use URI::Escape qw( uri_escape );
@ -531,10 +532,17 @@ foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) {
$hashlists{ lc($field) . "_loop" } = \@codes_list;
}
my $csrf_token = Koha::Token->new->generate_csrf(
{
session_id => scalar $input->cookie('CGISESSID'),
}
);
$template->param(
%hashlists,
borrowernumber => ($input->param('borrowernumber') // undef),
SuggestionStatuses => GetAuthorisedValues('SUGGEST_STATUS'),
borrowernumber => ( $input->param('borrowernumber') // undef ),
SuggestionStatuses => GetAuthorisedValues('SUGGEST_STATUS'),
csrf_token => $csrf_token,
);
output_html_with_http_headers $input, $cookie, $template->output;