Use dolGetStatus
This commit is contained in:
parent
6855f588b5
commit
b4eb14ee44
@ -1082,38 +1082,27 @@ class Account extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return label of given object status
|
* Return label of given object status
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id status
|
||||||
* @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
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('banks');
|
$langs->load('banks');
|
||||||
|
|
||||||
if ($statut == self::STATUS_OPEN) {
|
if ($status == self::STATUS_OPEN) {
|
||||||
$label = $langs->trans("StatusAccountOpened");
|
$label = $langs->trans("StatusAccountOpened");
|
||||||
$picto = img_picto($label, 'statut4');
|
$labelshort = $langs->trans("StatusAccountOpened");
|
||||||
|
$statusType = 'status4';
|
||||||
} else {
|
} else {
|
||||||
$label = $langs->trans("StatusAccountClosed");
|
$label = $langs->trans("StatusAccountClosed");
|
||||||
$picto = img_picto($label, 'statut5');
|
$labelshort = $langs->trans("StatusAccountClosed");
|
||||||
|
$statusType = 'status5';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 2) {
|
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
|
||||||
return $picto.' '.$label;
|
|
||||||
} elseif ($mode == 3) {
|
|
||||||
return $picto;
|
|
||||||
} elseif ($mode == 4) {
|
|
||||||
return $picto.' '.$label;
|
|
||||||
} elseif ($mode == 5) {
|
|
||||||
return $label.' '.$picto;
|
|
||||||
} elseif ($mode == 6) {
|
|
||||||
return $label.' '.$picto;
|
|
||||||
}
|
|
||||||
|
|
||||||
//There is no short mode for this label
|
|
||||||
return $label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2318,11 +2307,11 @@ class AccountLine extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut 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=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Libelle du statut
|
* @return string Libelle du statut
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
@ -2330,33 +2319,33 @@ class AccountLine extends CommonObject
|
|||||||
/*
|
/*
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans("ActivityCeased");
|
if ($status==0) return $langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return $langs->trans("InActivity");
|
if ($status==1) return $langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans("ActivityCeased");
|
if ($status==0) return $langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return $langs->trans("InActivity");
|
if ($status==1) return $langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
||||||
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
if ($status==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
||||||
if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
if ($status==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -655,7 +655,7 @@ class MyObject extends CommonObject
|
|||||||
public function LibStatut($status, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
if (empty($this->labelstatus))
|
if (empty($this->labelstatus) || empty($this->labelstatusshort))
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
//$langs->load("mymodule");
|
//$langs->load("mymodule");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user