From 1249e597d425b1acddc3c145ba3cf2f0b07f3167 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Sep 2018 11:56:05 +0200 Subject: [PATCH] Fix test param $id --- htdocs/public/cron/cron_run_jobs.php | 7 +++---- scripts/cron/cron_run_jobs.php | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index b11bf4cc42f..4edcbbf14ee 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -111,15 +111,14 @@ if (! empty($id)) dol_syslog("cron_run_jobs.php Bad value for parameter job id", LOG_WARNING); exit; } - $filter=array(); $filter['t.rowid']=$id; } -$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter, 0); +$result = $object->fetch_all('ASC,ASC,ASC','t.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0); if ($result<0) { - echo "Error: ".$cronjob->error; - dol_syslog("cron_run_jobs.php fetch Error".$cronjob->error, LOG_WARNING); + echo "Error: ".$object->error; + dol_syslog("cron_run_jobs.php fetch Error".$object->error, LOG_WARNING); exit; } diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index c690d7b63ef..4e3cefce5af 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -143,6 +143,12 @@ $object = new Cronjob($db); $filter=array(); if (! empty($id)) { + if (! is_numeric($id)) + { + echo "Error: Bad value for parameter job id"; + dol_syslog("cron_run_jobs.php Bad value for parameter job id", LOG_WARNING); + exit; + } $filter['t.rowid']=$id; } @@ -162,7 +168,7 @@ foreach($object->lines as $val) $qualifiedjobs[] = $val; } -// TODO This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. +// TODO Duplicate. This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. $nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0;