Bug 31245: Do not call report for job detail view if job not started

We should not generate the report if the job hasn't started yet

Test plan:
Stop the koha-worker processes, modify a new item using the batch mod
tool, then see the detail page of the job

Without this patch an error is generated:
Can't use an undefined value as an ARRAY reference at /kohadevbox/koha/Koha/BackgroundJob/BatchUpdateItem.pm line 175

Signed-off-by: Andrew <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-07-27 10:35:08 +02:00 committed by Tomas Cohen Arazi
parent 1f098a8c86
commit 931f4bd797
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 6 additions and 4 deletions

View file

@ -52,8 +52,10 @@ if ( $op eq 'view' ) {
} }
else { else {
$template->param( job => $job, ); $template->param( job => $job, );
my $report = $job->additional_report() || {}; if ( $job->status ne 'new' ) {
$template->param( %$report ); my $report = $job->additional_report() || {};
$template->param( %$report );
}
} }
} else { } else {
$op = 'list'; $op = 'list';

View file

@ -137,10 +137,10 @@
[% job.ended_on | $KohaDates with_hours = 1 %] [% job.ended_on | $KohaDates with_hours = 1 %]
</li> </li>
<li><label for="job_data">Report: </label> <li><label for="job_data">Report: </label>
[% PROCESS 'report' %] [% IF job.status != 'new' %][% PROCESS 'report' %][% END %]
</li> </li>
<li><label for="job_data">Detailed messages: </label> <li><label for="job_data">Detailed messages: </label>
[% PROCESS 'detail' %] [% IF job.status != 'new' %][% PROCESS 'detail' %][% END %]
</li> </li>
</ol> </ol>
</fieldset> </fieldset>