Bug 34478: Convert patron file delete link to a posted form

This patch modifies the patron file template to convert the "Delete"
link to a form which includes the CSRF token. The script has already
been modified to check for the "op" value updated in the template.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2024-02-20 15:49:41 +00:00 committed by Jonathan Druart
parent 7947f7872b
commit 78bcbf52f7
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
1 changed files with 11 additions and 1 deletions

View File

@ -70,7 +70,17 @@
<td>[% f.file_type | html %]</td>
<td>[% f.file_description | html %]</td>
<td>[% f.date_uploaded | $KohaDates %]</td>
[% IF CAN_user_borrowers_edit_borrowers %]<td><a class="btn btn-default btn-xs confirmdelete" href="?borrowernumber=[% patron.borrowernumber | html %]&amp;op=delete&amp;file_id=[% f.file_id | html %]"><i class="fa fa-trash-can"></i> Delete</a></td>[% END %]
[% IF CAN_user_borrowers_edit_borrowers %]
<td>
<form action="files.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-delete" />
<input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
<input type="hidden" name="file_id" value="[% f.file_id | html %]" />
<button class="btn btn-default btn-xs confirmdelete"><i class="fa fa-trash-can"></i> Delete</button>
</form>
</td>
[% END %]
</tr>
[% END %]
</tbody>