2
0
forked from Wavyzz/dolibarr

Enhance widget

This commit is contained in:
Laurent Destailleur
2020-12-12 12:45:43 +01:00
parent bfa8383bed
commit 0968c68cf9
4 changed files with 20 additions and 13 deletions

View File

@@ -79,12 +79,13 @@ class box_scheduled_jobs extends ModeleBoxes
if ($user->rights->cron->read) { if ($user->rights->cron->read) {
include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php'; include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php';
$cronstatic = new Cronjob($this->db); $cronstatic = new Cronjob($this->db);
$nomUrlArray; $resultarray = array();
$result = 0; $result = 0;
$sql = "SELECT t.rowid, t.datelastrun, t.datenextrun"; $sql = "SELECT t.rowid, t.datelastrun, t.datenextrun,";
$sql .= ", t.label, t.status, t.lastresult"; $sql .= " t.label, t.status, t.lastresult";
$sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t";
$sql .= " WHERE status <> ".$cronstatic::STATUS_DISABLED;
$sql .= $this->db->order("t.datelastrun", "DESC"); $sql .= $this->db->order("t.datelastrun", "DESC");
$result = $this->db->query($sql); $result = $this->db->query($sql);
@@ -98,6 +99,7 @@ class box_scheduled_jobs extends ModeleBoxes
if ($line == 0 || $objp->datenextrun < $cronstatic->datenextrun) { if ($line == 0 || $objp->datenextrun < $cronstatic->datenextrun) {
$cronstatic->id = $objp->rowid; $cronstatic->id = $objp->rowid;
$cronstatic->ref = $objp->rowid; $cronstatic->ref = $objp->rowid;
$cronstatic->label = $langs->trans($objp->label);
$cronstatic->status = $objp->status; $cronstatic->status = $objp->status;
$cronstatic->datenextrun = $objp->datenextrun; $cronstatic->datenextrun = $objp->datenextrun;
$cronstatic->datelastrun = $objp->datelastrun; $cronstatic->datelastrun = $objp->datelastrun;
@@ -107,7 +109,8 @@ class box_scheduled_jobs extends ModeleBoxes
$langs->trans("LastExecutedScheduledJob"), $langs->trans("LastExecutedScheduledJob"),
$cronstatic->getNomUrl(1), $cronstatic->getNomUrl(1),
$this->db->jdate($cronstatic->datelastrun), $this->db->jdate($cronstatic->datelastrun),
$cronstatic->status $cronstatic->status,
$cronstatic->getLibStatut(2)
); );
$line++; $line++;
} }
@@ -120,7 +123,8 @@ class box_scheduled_jobs extends ModeleBoxes
$langs->trans("NextScheduledJobExecute"), $langs->trans("NextScheduledJobExecute"),
$cronstatic->getNomUrl(1), $cronstatic->getNomUrl(1),
$this->db->jdate($cronstatic->datenextrun), $this->db->jdate($cronstatic->datenextrun),
$cronstatic->status $cronstatic->status,
$cronstatic->getLibStatut(2)
); );
$line = 0; $line = 0;
while ($line < 2) { while ($line < 2) {
@@ -139,7 +143,7 @@ class box_scheduled_jobs extends ModeleBoxes
); );
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right" ', 'td' => 'class="right" ',
'textnoformat' => empty($resultarray[$line][3]) ? $langs->trans("Disabled") : $langs->trans("Scheduled") 'textnoformat' => $resultarray[$line][4]
); );
$line++; $line++;
} }

View File

@@ -3206,7 +3206,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (empty($srconly) && in_array($pictowithouttext, array( if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building', 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cubes', 'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cron', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt', 'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'help', 'holiday', 'help', 'holiday',

View File

@@ -820,9 +820,12 @@ class Cronjob extends CommonObject
$result = ''; $result = '';
$label = '<u>'.$langs->trans("CronJob").'</u>'; $label = img_picto('', 'object_'.$this->picto).' <u>'.$langs->trans("CronTask").'</u>';
$label .= '<br>'; if (isset($this->status)) {
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= ' '.$this->getLibStatut(5);
}
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('Title').':</b> '.$this->label;
$url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/cron/card.php?id='.$this->id;

View File

@@ -744,11 +744,11 @@ class MyObject extends CommonObject
$result = ''; $result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("MyObject").'</u>'; $label = img_picto('', $this->picto).' <u>'.$langs->trans("MyObject").'</u>';
if (isset($this->status)) {
$label .= ' '.$this->getLibStatut(5);
}
$label .= '<br>'; $label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->status)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id;