Bug 35685: Fix after creation actions

Test plan:

1) Install FreeForm and enable ILLModule, run:
  bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh)
2) Configure ILLModuleDisclaimerByType, visit:
  /cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ILLModuleDisclaimerByType
  Click "edit" and paste the example code into the sys pref value
3) Create a new OPAC ILL request, visit:
  /cgi-bin/koha/opac-illrequests.pl?method=create&backend=FreeForm
4) Dont put a type or branch, click 'Create', on the next screen click 'Submit'
5) Notice it explodes
6) Apply patch and repeat. It no longer explodes and now shows an error message.

7) (After FQA): Create a normal request, input type and library, submit the type disclaimer
8) Run:
echo "select * from illrequestattributes;" | koha-mysql kohadev
9) Notice type_disclaimer_date and type_disclaimer_value are correctly saved

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 34aa31b22d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Pedro Amorim 2024-01-03 12:01:36 +00:00 committed by Fridolin Somers
parent 8607c04099
commit edbb8896f0

View file

@ -150,13 +150,6 @@ if ( $op eq 'list' ) {
$params->{opac} = 1;
my $backend_result = $request->backend_create($params);
# After creation actions
if ( $params->{type_disclaimer_submitted} ) {
$type_disclaimer->after_request_created( $params, $request );
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2');
exit;
}
if ($backend_result->{stage} eq 'copyrightclearance') {
$template->param(
stage => $backend_result->{stage},
@ -170,6 +163,10 @@ if ( $op eq 'list' ) {
request => $request
);
if ($backend_result->{stage} eq 'commit') {
# After creation actions
if ( $params->{type_disclaimer_submitted} ) {
$type_disclaimer->after_request_created( $params, $request );
}
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2');
exit;
}