Bug 31245: Do not call report for job detail view if job not started
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 27 Jul 2022 08:35:08 +0000 (10:35 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 16 Aug 2022 12:09:12 +0000 (09:09 -0300)
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>
admin/background_jobs.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt

index 8a27c00..a4b7b90 100755 (executable)
@@ -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';
index 4da24fe..ab1cd65 100644 (file)
                 [% job.ended_on | $KohaDates with_hours = 1 %]
             </li>
             <li><label for="job_data">Report: </label>
-                [% PROCESS 'report' %]
+                [% IF job.status != 'new' %][% PROCESS 'report' %][% END %]
             </li>
             <li><label for="job_data">Detailed messages: </label>
-                [% PROCESS 'detail' %]
+                [% IF job.status != 'new' %][% PROCESS 'detail' %][% END %]
             </li>
         </ol>
     </fieldset>