diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 793b0cc8c79..53cf5c79571 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -85,7 +85,7 @@ class box_scheduled_jobs extends ModeleBoxes $resultarray = array(); $result = 0; - $sql = "SELECT t.rowid, t.datelastrun, t.datenextrun,"; + $sql = "SELECT t.rowid, t.datelastrun, t.datenextrun, t.datestart,"; $sql .= " t.label, t.status, t.test, t.lastresult"; $sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t"; $sql .= " WHERE status <> ".$cronstatic::STATUS_DISABLED; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index b1819e24ab0..17dcdd557a4 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -596,7 +596,7 @@ class DolGraph // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Get max value + * Get max value among all values of all series * * @return int Max value */ @@ -607,25 +607,26 @@ class DolGraph return 0; } - $k = 0; - $vals = array(); + $max = null; - $nblines = count($this->data); - $nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1); + $nbseries = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1); - for ($j = 0; $j < $nblines; $j++) { - for ($i = 0; $i < $nbvalues; $i++) { - $vals[$k] = $this->data[$j][$i + 1]; - $k++; + foreach($this->data as $x) { // Loop on each x + for ($i = 0; $i < $nbseries; $i++) { // Loop on each serie + if (is_null($max)) { + $max = $x[$i + 1]; // $i+1 because the index 0 is the legend + } elseif ($max < $x[$i + 1]) { + $max = $x[$i + 1]; + } } } - rsort($vals); - return $vals[0]; + + return $max; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return min value of all data + * Return min value of all values of all series * * @return int Min value of all data */ @@ -636,20 +637,21 @@ class DolGraph return 0; } - $k = 0; - $vals = array(); + $min = null; - $nblines = count($this->data); - $nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1); + $nbseries = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1); - for ($j = 0; $j < $nblines; $j++) { - for ($i = 0; $i < $nbvalues; $i++) { - $vals[$k] = $this->data[$j][$i + 1]; - $k++; + foreach($this->data as $x) { // Loop on each x + for ($i = 0; $i < $nbseries; $i++) { // Loop on each serie + if (is_null($min)) { + $min = $x[$i + 1]; // $i+1 because the index 0 is the legend + } elseif ($min > $x[$i + 1]) { + $min = $x[$i + 1]; + } } } - sort($vals); - return $vals[0]; + + return $min; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9e5d27c26ff..cbc3a2246cf 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1854,7 +1854,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') { $qs = dol_escape_htmltag($_SERVER["QUERY_STRING"]); - if (is_array($_POST)) { + if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { if ($key !== 'action' && $key !== 'password' && !is_array($value)) { $qs .= '&'.$key.'='.urlencode($value);