Look and feel v11

This commit is contained in:
Laurent Destailleur 2020-01-02 20:36:35 +01:00
parent d93de4b931
commit 298f6d0683

View File

@ -58,6 +58,10 @@ class CompanyPaymentMode extends CommonObject
public $picto = 'generic'; public $picto = 'generic';
const STATUS_ENABLED = 1;
const STATUS_CANCELED = 0;
/** /**
* 'type' if the field format. * 'type' if the field format.
* 'label' the translation key. * 'label' the translation key.
@ -475,9 +479,9 @@ class CompanyPaymentMode extends CommonObject
} }
/** /**
* Retourne le libelle du status d'un user (actif, inactif) * Return label of the status
* *
* @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)
@ -493,47 +497,29 @@ class CompanyPaymentMode extends CommonObject
* @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 $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 static function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
global $langs; global $langs;
//$langs->load("mymodule");
$this->labelStatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->trans('Enabled');
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
if ($mode == 0 || $mode == 1) $statusType = 'status5';
{ if ($status == self::STATUS_ENABLED) $statusType = 'status4';
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled'); return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
elseif ($mode == 2)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 4)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 6)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
}
} }
/** /**
* Charge les informations d'ordre info dans l'objet commande * Load the info information in the object
* *
* @param int $id Id of order * @param int $id Id of object
* @return void * @return void
*/ */
public function info($id) public function info($id)