mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Show also shceduled task never finished in scheduled task widget
This commit is contained in:
parent
9a4a740d4b
commit
33ad0de37e
|
|
@ -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 .= '<a class="inline-block paddingleft paddingright marginleftonly marginrightonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php" title="'.$langs->trans("NumberScheduledJobNeverFinished").'"><div class="center badge badge-warning nounderlineimp"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsnotfinished.'</div></a>';
|
||||
}
|
||||
if ($nbjobsinerror) {
|
||||
$textnoformat .= '<a class="inline-block paddingleft paddingright marginleftonly marginrightonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'" title="'.$langs->trans("NumberScheduledJobError").'"><div class="badge badge-danger nounderlineimp"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>';
|
||||
}
|
||||
if (empty($nbjobsnotfinished) && empty($nbjobsinerror)) {
|
||||
$textnoformat .= '<a class="inline-block paddingleft paddingright marginleftonly marginrightonly minwidth25 nounderlineimp" href="'.DOL_URL_ROOT.'/cron/list.php"><div class="center badge badge-status4 nounderline">0</div></a>';
|
||||
}
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center"',
|
||||
'textnoformat' => ($nbjobsinerror ? '<a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'"><div class="badge badge-danger"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>' : '<a href="'.DOL_URL_ROOT.'/cron/list.php"><div class="center badge-status4">0</div></a>')
|
||||
'textnoformat' => $textnoformat
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
|
|
|
|||
|
|
@ -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
|
|||
});
|
||||
});
|
||||
</script>';
|
||||
print ' - <a class="trforrunsqlshowhide'.$keyforsql.'" href="#">'.$langs->trans("ShowHideDetails").'</a>';
|
||||
if (count($arraysql)) {
|
||||
print ' - <a class="trforrunsqlshowhide'.$keyforsql.'" href="#" title="'.($langs->trans("ShowHideTheNRequests", count($arraysql))).'">'.$langs->trans("ShowHideDetails").'</a>';
|
||||
} else {
|
||||
print ' - <span class="opacitymedium">'.$langs->trans("ScriptIsEmpty").'</span>';
|
||||
}
|
||||
//}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user