From 931f4bd79776215b8cb1e656d58abf80b7aad8db Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 27 Jul 2022 10:35:08 +0200 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- admin/background_jobs.pl | 6 ++++-- .../intranet-tmpl/prog/en/modules/admin/background_jobs.tt | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/background_jobs.pl b/admin/background_jobs.pl index 8a27c00a27..a4b7b90c0a 100755 --- a/admin/background_jobs.pl +++ b/admin/background_jobs.pl @@ -52,8 +52,10 @@ if ( $op eq 'view' ) { } else { $template->param( job => $job, ); - my $report = $job->additional_report() || {}; - $template->param( %$report ); + if ( $job->status ne 'new' ) { + my $report = $job->additional_report() || {}; + $template->param( %$report ); + } } } else { $op = 'list'; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt index 4da24feed3..ab1cd65cba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt @@ -137,10 +137,10 @@ [% job.ended_on | $KohaDates with_hours = 1 %]
  • - [% PROCESS 'report' %] + [% IF job.status != 'new' %][% PROCESS 'report' %][% END %]
  • - [% PROCESS 'detail' %] + [% IF job.status != 'new' %][% PROCESS 'detail' %][% END %]
  • -- 2.39.5