diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index c71bce53602..407e4459834 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -151,7 +151,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes if ($num == 0 || $nboutstandingbillreachedcustomers == 0) $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', - 'text'=> ''.$langs->trans("NoRecordedCustomers").'' + 'text'=> ''.$langs->trans("None").'' ); $this->db->free($result); diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index afe71f09043..17c62ab7c7d 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -72,7 +72,7 @@ class box_scheduled_jobs extends ModeleBoxes public function loadBox($max = 5) { global $user, $langs, $conf; - $this->max = $max; + $langs->load("cron"); $this->info_box_head = array('text' => $langs->trans("BoxScheduledJobs", $max)); @@ -83,9 +83,10 @@ class box_scheduled_jobs extends ModeleBoxes $result = 0; $sql = "SELECT t.rowid, t.datelastrun, t.datenextrun,"; - $sql .= " t.label, t.status, t.lastresult"; + $sql .= " t.label, t.status, t.test, t.lastresult"; $sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t"; $sql .= " WHERE status <> ".$cronstatic::STATUS_DISABLED; + $sql .= " AND entity IN (0, ".$conf->entity.")"; $sql .= $this->db->order("t.datelastrun", "DESC"); $result = $this->db->query($sql); @@ -93,41 +94,53 @@ class box_scheduled_jobs extends ModeleBoxes $nbjobsinerror = 0; if ($result) { $num = $this->db->num_rows($result); + $i = 0; while ($i < $num) { $objp = $this->db->fetch_object($result); - if ($line == 0 || $objp->datenextrun < $cronstatic->datenextrun) { - $cronstatic->id = $objp->rowid; - $cronstatic->ref = $objp->rowid; - $cronstatic->label = $langs->trans($objp->label); - $cronstatic->status = $objp->status; - $cronstatic->datenextrun = $objp->datenextrun; - $cronstatic->datelastrun = $objp->datelastrun; - } - if ($line == 0) { - $resultarray[$line] = array( - $langs->trans("LastExecutedScheduledJob"), - $cronstatic->getNomUrl(1), - $this->db->jdate($cronstatic->datelastrun), - $cronstatic->status, - $cronstatic->getLibStatut(2) - ); - $line++; - } - if (!empty($objp->lastresult)) { - $nbjobsinerror++; + + if (dol_eval($objp->test, 1, 1)) { + + $nextrun = $this->db->jdate($objp->datenextrun); + if (empty($nextrun)) $nextrun = $this->db->jdate($objp->datestart); + + if ($line == 0 || ($nextrun < $cronstatic->datenextrun && (empty($objp->nbrun) || empty($objp->maxrun) || $objp->nbrun < $obj->maxrun))) { + $cronstatic->id = $objp->rowid; + $cronstatic->ref = $objp->rowid; + $cronstatic->label = $langs->trans($objp->label); + $cronstatic->status = $objp->status; + $cronstatic->datenextrun = $this->db->jdate($objp->datenextrun); + $cronstatic->datelastrun = $this->db->jdate($objp->datelastrun); + } + if ($line == 0) { + $resultarray[$line] = array( + $langs->trans("LastExecutedScheduledJob"), + $cronstatic->getNomUrl(1), + $cronstatic->datelastrun, + $cronstatic->status, + $cronstatic->getLibStatut(2) + ); + $line++; + } + + if (!empty($objp->lastresult)) { + $nbjobsinerror++; + } } $i++; } - $resultarray[$line] = array( - $langs->trans("NextScheduledJobExecute"), - $cronstatic->getNomUrl(1), - $this->db->jdate($cronstatic->datenextrun), - $cronstatic->status, - $cronstatic->getLibStatut(2) - ); - $line = 0; - while ($line < 2) { + + if ($line) { + $resultarray[$line] = array( + $langs->trans("NextScheduledJobExecute"), + $cronstatic->getNomUrl(1), + $cronstatic->datenextrun, + $cronstatic->status, + $cronstatic->getLibStatut(2) + ); + } + + foreach($resultarray as $line => $value) { $this->info_box_contents[$line][] = array( 'td' => 'class="left"', 'text' => $resultarray[$line][0] @@ -153,13 +166,13 @@ class box_scheduled_jobs extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"colspan="2"', - 'text' => $nbjobsinerror + 'textnoformat' => $nbjobsinerror ? ''.$nbjobsinerror.''.img_error() : '0' ); } else { $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength' => 500, - 'text' => ($this->db->error() . ' sql=' . $sql) + 'text' => ($this->db->lasterror() . ' sql=' . $sql) ); } } else { diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index d3f84de6bd2..587bd1b28d1 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -60,7 +60,7 @@ $mode = GETPOST('mode', 'aZ09'); $search_status = (GETPOSTISSET('search_status') ?GETPOST('search_status', 'int') : GETPOST('status', 'int')); $search_label = GETPOST("search_label", 'alpha'); $search_module_name = GETPOST("search_module_name", 'alpha'); - +$search_lastresult = GETPOST("search_lastresult", "alpha"); $securitykey = GETPOST('securitykey', 'alpha'); $diroutputmassaction = $conf->cronjob->dir_output.'/temp/massgeneration/'.$user->id; @@ -99,6 +99,7 @@ if (empty($reshook)) { $search_label = ''; $search_status = -1; + $search_lastresult = ''; $toselect = ''; $search_array_options = array(); } @@ -248,6 +249,7 @@ $sql .= " t.test"; $sql .= " FROM ".MAIN_DB_PREFIX."cronjob as t"; $sql .= " WHERE entity IN (0,".$conf->entity.")"; if ($search_status >= 0 && $search_status < 2 && $search_status != '') $sql .= " AND t.status = ".(empty($search_status) ? '0' : '1'); +if ($search_lastresult != '') $sql .= natural_search("t.lastresult", $search_lastresult, 1); //Manage filter if (is_array($filter) && count($filter) > 0) { foreach ($filter as $key => $value) { @@ -298,6 +300,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($l if ($search_status) $param .= '&search_status='.urlencode($search_status); if ($search_label) $param .= '&search_label='.urlencode($search_label); if ($search_module_name) $param .= '&search_module_name='.urlencode($search_module_name); +if ($search_lastresult) $param .= '&search_lastresult='.urlencode($search_lastresult); if ($mode) $param .= '&mode='.urlencode($mode); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields @@ -384,7 +387,7 @@ print ' '; print ' '; print ' '; print ' '; -print ' '; +print ''; print ' '; print ' '; print ''; @@ -589,7 +592,7 @@ if ($num > 0) $i++; } } else { - print ''.$langs->trans('CronNoJobs').''; + print ''.$langs->trans('CronNoJobs').''; } print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4ff10708001..a0203c24cf1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1882,7 +1882,7 @@ span.widthpictotitle.pictotitle { vertical-align: middle; margin-top: -3px } -.pictowarning, .pictopreview { +.pictowarning, .pictoerror, .pictopreview { padding-: 3px; } .pictowarning { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c16d0df2351..4f85b78a872 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1816,7 +1816,7 @@ div.nopadding { vertical-align: middle; margin-top: -3px } -.pictowarning, .pictopreview { +.pictowarning, .pictoerror, .pictopreview { padding-: 3px; } .pictowarning {