diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php
index cd610543e47..915884d6f43 100644
--- a/htdocs/core/boxes/box_scheduled_jobs.php
+++ b/htdocs/core/boxes/box_scheduled_jobs.php
@@ -86,7 +86,7 @@ class box_scheduled_jobs extends ModeleBoxes
$result = 0;
$sql = "SELECT t.rowid, t.datelastrun, t.datenextrun, t.datestart,";
- $sql .= " t.label, t.status, t.test, t.lastresult";
+ $sql .= " t.label, t.status, t.test, t.lastresult, t.processing";
$sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t";
$sql .= " WHERE status <> ".$cronstatic::STATUS_DISABLED;
$sql .= " AND entity IN (0, ".$conf->entity.")";
@@ -95,6 +95,7 @@ class box_scheduled_jobs extends ModeleBoxes
$result = $this->db->query($sql);
$line = 0;
$nbjobsinerror = 0;
+ $nbjobsnotfinished = 0;
if ($result) {
$num = $this->db->num_rows($result);
@@ -109,6 +110,7 @@ class box_scheduled_jobs extends ModeleBoxes
}
if ($line == 0 || ($nextrun < $cronstatic->datenextrun && (empty($objp->nbrun) || empty($objp->maxrun) || $objp->nbrun < $objp->maxrun))) {
+ // Save in cronstatic the job if it is a job to run in future
$cronstatic->id = $objp->rowid;
$cronstatic->ref = $objp->rowid;
$cronstatic->label = $langs->trans($objp->label);
@@ -117,6 +119,7 @@ class box_scheduled_jobs extends ModeleBoxes
$cronstatic->datelastrun = $this->db->jdate($objp->datelastrun);
}
if ($line == 0) {
+ // Save the first line in loop that is the most recent executed job (due to the sort on datelastrun DESC)
$resultarray[$line] = array(
$langs->trans("LastExecutedScheduledJob"),
$cronstatic->getNomUrl(1),
@@ -127,6 +130,9 @@ class box_scheduled_jobs extends ModeleBoxes
$line++;
}
+ if ($objp->processing && $this->db->jdate($objp->datelastrun) < (dol_now() - 3600 * 24)) {
+ $nbjobsnotfinished++;
+ }
if (!empty($objp->lastresult)) {
$nbjobsinerror++;
}
@@ -168,9 +174,19 @@ class box_scheduled_jobs extends ModeleBoxes
'td' => 'class="tdoverflowmax300" colspan="3"',
'text' => $langs->trans("NumberScheduledJobError")
);
+ $textnoformat = '';
+ if ($nbjobsnotfinished) {
+ $textnoformat .= ' '.$nbjobsnotfinished.'
';
+ }
+ if ($nbjobsinerror) {
+ $textnoformat .= ' '.$nbjobsinerror.'
';
+ }
+ if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) {
+ $textnoformat .= '0
';
+ }
$this->info_box_contents[$line][] = array(
'td' => 'class="center"',
- 'textnoformat' => ($nbjobsinerror ? ' '.$nbjobsinerror.'
' : '0
')
+ 'textnoformat' => $textnoformat
);
} else {
$this->info_box_contents[0][0] = array(
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 53193db176c..0ea8b49d04a 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -151,18 +151,18 @@ function versiondolibarrarray()
* Install process however does not use it.
* Note that Sql files must have all comments at start of line. Also this function take ';' as the char to detect end of sql request
*
- * @param string $sqlfile Full path to sql file
- * @param int $silent 1=Do not output anything, 0=Output line for update page
- * @param int $entity Entity targeted for multicompany module
- * @param int $usesavepoint 1=Run a savepoint before each request and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
- * @param string $handler Handler targeted for menu (replace __HANDLER__ with this value)
- * @param string $okerror Family of errors we accept ('default', 'none')
- * @param int $linelengthlimit Limit for length of each line (Use 0 if unknown, may be faster if defined)
- * @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0)
+ * @param string $sqlfile Full path to sql file
+ * @param int $silent 1=Do not output anything, 0=Output line for update page
+ * @param int $entity Entity targeted for multicompany module
+ * @param int $usesavepoint 1=Run a savepoint before each request and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
+ * @param string $handler Handler targeted for menu (replace __HANDLER__ with this value)
+ * @param string $okerror Family of errors we accept ('default', 'none')
+ * @param int $linelengthlimit Limit for length of each line (Use 0 if unknown, may be faster if defined)
+ * @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0)
* @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value
- * @param int $colspan 2=Add a colspan=2 on td
+ * @param int $colspan 2=Add a colspan=2 on td
* @param int $onlysqltoimportwebsite Only sql resquests used to import a website template is allowed
- * @return int <=0 if KO, >0 if OK
+ * @return int <=0 if KO, >0 if OK
*/
function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0)
{
@@ -523,7 +523,11 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
});
});
';
- print ' - '.$langs->trans("ShowHideDetails").'';
+ if (count($arraysql)) {
+ print ' - '.$langs->trans("ShowHideDetails").'';
+ } else {
+ print ' - '.$langs->trans("ScriptIsEmpty").'';
+ }
//}
print ''."\n";
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index 2732e41dc14..41082fa79cd 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -64,6 +64,7 @@ $search_status = (GETPOSTISSET('search_status') ?GETPOST('search_status', 'int')
$search_label = GETPOST("search_label", 'alpha');
$search_module_name = GETPOST("search_module_name", 'alpha');
$search_lastresult = GETPOST("search_lastresult", "alphawithlgt");
+$search_processing = GETPOST("search_processing", "int");
$securitykey = GETPOST('securitykey', 'alpha');
$outputdir = $conf->cron->dir_output;
@@ -277,6 +278,9 @@ if ($search_status >= 0 && $search_status < 2 && $search_status != '') {
if ($search_lastresult != '') {
$sql .= natural_search("t.lastresult", $search_lastresult, 1);
}
+if (GETPOSTISSET('search_processing')) {
+ $sql .= " AND t.processing = ".((int) $search_processing);
+}
//Manage filter
if (is_array($filter) && count($filter) > 0) {
foreach ($filter as $key => $value) {
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index cc3e1252b31..cbec6cfc5ea 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2307,4 +2307,6 @@ MAIN_MAIL_SMTPS_AUTH_TYPE=Authentification method
UsePassword=Use a password
UseOauth=Use a OAUTH token
Images=Images
-MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form
\ No newline at end of file
+MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form
+ScriptIsEmpty=The script is empty
+ShowHideTheNRequests=Show/hide the %s SQL request(s)
\ No newline at end of file
diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang
index d5f784248be..d9bdd2691eb 100644
--- a/htdocs/langs/en_US/cron.lang
+++ b/htdocs/langs/en_US/cron.lang
@@ -93,3 +93,4 @@ JobXMustBeEnabled=Job %s must be enabled
LastExecutedScheduledJob=Last executed scheduled job
NextScheduledJobExecute=Next scheduled job to execute
NumberScheduledJobError=Number of scheduled jobs in error
+NumberScheduledJobNeverFinished=Number of scheduled jobs never finished
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 51599816c37..dcff3c4b7a1 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -821,6 +821,9 @@ textarea.centpercent {
.nounderline {
text-decoration: none;
}
+.nounderlineimp {
+ text-decoration: none !important;
+}
.nopadding {
padding: 0;
}
@@ -1532,6 +1535,7 @@ table[summary="list_of_modules"] .fa-cog {
.clearboth { clear:both; }
.hideobject { display: none; }
+.minwidth25 { min-width: 25px; }
.minwidth50 { min-width: 50px; }
.minwidth75 { min-width: 75px; }
/* rule for not too small screen only */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index db65e797f95..1eb0fa7d71f 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -973,6 +973,9 @@ textarea.centpercent {
.nounderline {
text-decoration: none;
}
+.nounderlineimp {
+ text-decoration: none !important;
+}
.nopadding {
padding: 0;
}
@@ -1623,6 +1626,7 @@ tr.nobottom td {
.clearboth { clear:both; }
.hideobject { display: none; }
+.minwidth25 { min-width: 25px; }
.minwidth50 { min-width: 50px; }
.minwidth75 { min-width: 75px; }
/* rule for not too small screen only */