From 56e8d3a5f10a57048c89cadc8e82d5d6c206ca8f 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 (cherry picked from commit 931f4bd79776215b8cb1e656d58abf80b7aad8db) Signed-off-by: Lucas Gass (cherry picked from commit 714d73d7e1a30cdd9a772489887f6ffeae56f799) Signed-off-by: Arthur Suzuki --- 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 861325d7ac..0ee13d742f 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 @@ -133,10 +133,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