Browse Source

Fix test param $id

Laurent Destailleur 7 years ago
parent
commit
1249e597d4
2 changed files with 10 additions and 5 deletions
  1. 3 4
      htdocs/public/cron/cron_run_jobs.php
  2. 7 1
      scripts/cron/cron_run_jobs.php

+ 3 - 4
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;
 }
 

+ 7 - 1
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;