Fix look and feel v11

This commit is contained in:
Laurent Destailleur 2020-01-25 11:50:16 +01:00
parent c494e3029b
commit cc6b9269f9
5 changed files with 15 additions and 8 deletions

View File

@ -1287,12 +1287,12 @@ class Cronjob extends CommonObject
/** /**
* Return label of status of user (active, inactive) * Return label of status of user (active, inactive)
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->status, $mode, $this->processing); return $this->LibStatut($this->status, $mode, $this->processing, $this->lastresult);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -1300,13 +1300,17 @@ class Cronjob extends CommonObject
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
* @param int $status Id statut * @param int $status Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @param int $processing 0=Not running, 1=Running * @param int $processing 0=Not running, 1=Running
* @param int $lastresult Value of last result (0=no error, error otherwise)
* @return string Label of status * @return string Label of status
*/ */
public function LibStatut($status, $mode = 0, $processing = 0) public function LibStatut($status, $mode = 0, $processing = 0, $lastresult = 0)
{ {
// phpcs:enable // phpcs:enable
$this->labelStatus = array(); // Force reset o array because label depends on other fields
$this->labelStatusShort = array();
if (empty($this->labelStatus) || empty($this->labelStatusShort)) if (empty($this->labelStatus) || empty($this->labelStatusShort))
{ {
global $langs; global $langs;
@ -1314,6 +1318,7 @@ class Cronjob extends CommonObject
$moretext = ''; $moretext = '';
if ($processing) $moretext = ' ('.$langs->trans("Running").')'; if ($processing) $moretext = ' ('.$langs->trans("Running").')';
elseif ($lastresult) $moretext .= ' ('.$langs->trans("Error").')';
$this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Draft').$moretext; $this->labelStatus[self::STATUS_DISABLED] = $langs->trans('Draft').$moretext;
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled').$moretext; $this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled').$moretext;
@ -1324,6 +1329,7 @@ class Cronjob extends CommonObject
$statusType = 'status4'; $statusType = 'status4';
if ($status == 1 && $processing) $statusType = 'status1'; if ($status == 1 && $processing) $statusType = 'status1';
if ($status == 0) $statusType = 'status5'; if ($status == 0) $statusType = 'status5';
if ($this->lastresult) $statusType = 'status8';
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
} }

View File

@ -425,6 +425,7 @@ if ($num > 0)
$object->status = $obj->status; $object->status = $obj->status;
$object->priority = $obj->priority; $object->priority = $obj->priority;
$object->processing = $obj->processing; $object->processing = $obj->processing;
$object->lastresult = $obj->lastresult;
$datelastrun = $db->jdate($obj->datelastrun); $datelastrun = $db->jdate($obj->datelastrun);
$datelastresult = $db->jdate($obj->datelastresult); $datelastresult = $db->jdate($obj->datelastresult);
@ -541,7 +542,7 @@ if ($num > 0)
// Status // Status
print '<td class="center">'; print '<td class="center">';
print $object->getLibStatut(3); print $object->getLibStatut(5);
print '</td>'; print '</td>';
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';

View File

@ -3499,7 +3499,7 @@ img.boxhandle, img.boxclose {
.ok { color: #114466; } .ok { color: #114466; }
.warning { color: #887711 !important; } .warning { color: #887711 !important; }
.error { color: #550000 !important; font-weight: bold; } .error { color: #660000 !important; font-weight: bold; }
.green { color: #118822; } .green { color: #118822; }
div.ok { div.ok {

View File

@ -112,7 +112,7 @@ $badgeStatus4 = '#55a580'; // Color ok
$badgeStatus5 = '#cad2d2'; $badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2'; $badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b'; $badgeStatus7 = '#baa32b';
$badgeStatus8 = '#be3013'; $badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0'; $badgeStatus9 = '#e7f0f0';
// status color ajustement for color blind // status color ajustement for color blind

View File

@ -99,5 +99,5 @@ $badgeStatus4 = '#277d1e';
$badgeStatus5 = '#cad2d2'; $badgeStatus5 = '#cad2d2';
$badgeStatus6 = '#cad2d2'; $badgeStatus6 = '#cad2d2';
$badgeStatus7 = '#baa32b'; $badgeStatus7 = '#baa32b';
$badgeStatus8 = '#be3013'; $badgeStatus8 = '#993013';
$badgeStatus9 = '#e7f0f0'; $badgeStatus9 = '#e7f0f0';