From 7e175380f9444ad25ce7323be8cb8c5dc0bad281 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 6 Mar 2024 15:58:06 +0000 Subject: [PATCH] Bug 36249: Fix generic_confirm op Test plan, k-t-d: 1) Install FreeForm, enable ILL module, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) You'll have to switch the FreeForm branch to the one compatible with this work, i.e.: cd /kohadevbox/koha/Koha/Illbackends/FreeForm git checkout b_36243 3) Restart plack: koha-plack --restart kohadev 4) Start by adding an e-mail address to the patron of category "Inter-library Loan", visit: /cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=16 5) Add an e-mail address to "Primary e-mail" 6) Create a new FreeForm request, visit: /cgi-bin/koha/ill/ill-requests.pl?method=create&backend=FreeForm 7) Set 'type' enter '42' in cardnumber and pick a library. Click 'Create'. 8) Click "Place request with partners" 9) Pick a partner library (will be the same patron from step 4) 10) Click "Send email". Notice the CSRF error. 11) Apply patch and restart plack koha-plack --restart kohadev 12) Repeat 8-10. Notice error no longer shows. 13) Notice the request's status is now 'Requested from partners' Signed-off-by: Martin Renvoize --- Koha/Illrequest.pm | 1 + ill/ill-requests.pl | 3 ++- koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 11cfb0f784c..95f61b3de46 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -2055,6 +2055,7 @@ sub get_op_param_deprecation { $op = $params->{op} // $params->{method} // 'illlist'; $op = 'cud-create' if $op eq 'create'; $op = 'cud-edit_action' if $op eq 'edit_action'; + $op = 'cud-generic_confirm' if $op eq 'generic_confirm'; $op = 'cud-cancel' if $op eq 'cancel'; $op = 'cud-delete' if $op eq 'delete'; } diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 74e37dac853..4a68552767a 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -307,7 +307,8 @@ if ( $backends_available ) { # handle special commit rules & update type handle_commit_maybe($backend_result, $request); - } elsif ( $op eq 'generic_confirm' ) { + } elsif ( $op eq 'cud-generic_confirm' ) { + $op =~ s/^cud-//; my $backend_result; my $request; try { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index 8be24b166b7..cc510fc16a6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -357,7 +357,7 @@ - + -- 2.44.0