Bug 34478: Add 'op' to opac-user.tt

Bug 34478: [TO SQUASH] Add 'op' to opac-user.tt

Bug 34478: [TO SQUASH] Add 'op' to opac-user.tt

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2023-08-04 11:06:16 +02:00
parent a3c0c92508
commit bb69578db0
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
3 changed files with 10 additions and 3 deletions

View File

@ -216,6 +216,7 @@
[% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
<form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Auto-renewal</legend>
<label for="yes-autorenew_checkouts">
Allow auto-renewal:
@ -240,8 +241,7 @@
<input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
</label>
[% END %]
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="update_arc" value="1" />
<input type="hidden" name="op" value="cud-update_arc" />
<input type="submit" value="Update auto-renewal preference" />
</form>
[% END %]
@ -544,6 +544,7 @@
</table>
[% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
<input type="submit" class="btn btn-primary" value="Renew selected" />
<input type="hidden" name="op" value="cud-renew" />
<button type="button" id="renewall_js" class="btn btn-primary">Renew all</button>
[% END %]
</form>
@ -553,6 +554,7 @@
[% INCLUDE 'csrf-token.inc' %]
<legend class="sr-only">Renew</legend>
<input type="hidden" name="from" value="opac_user" />
<input type="hidden" name="op" value="renew" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
[% FOREACH ISSUE IN ISSUES %]
[% IF ISSUE.status %]

View File

@ -31,6 +31,9 @@ use C4::Members;
use Koha::Items;
use Koha::Patrons;
my $query = CGI->new;
my $op = $query->param('op') || q{};
die "op must be set" unless $op eq 'renew';
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{

View File

@ -57,6 +57,8 @@ use Date::Calc qw( Date_to_Days Today );
my $query = CGI->new;
my $op = $query->param('op') || q{};
# CAS single logout handling
# Will print header and exit
if ( C4::Context->preference('casAuthentication') ) {
@ -87,7 +89,7 @@ $template->param( shibbolethAuthentication => C4::Context->config('useshibboleth
# get borrower information ....
my $patron = Koha::Patrons->find( $borrowernumber );
if( $query->param('update_arc') && C4::Context->preference("AllowPatronToControlAutorenewal") ){
if( $op eq 'cud-update_arc' && C4::Context->preference("AllowPatronToControlAutorenewal") ){
die "Wrong CSRF token"
unless Koha::Token->new->check_csrf({
session_id => scalar $query->cookie('CGISESSID'),