Fix adherent type v11

This commit is contained in:
ptibogxiv 2019-11-14 16:36:07 +01:00 committed by GitHub
parent 4fc7b8c3b1
commit ae2ddb1f1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -507,6 +507,7 @@ class AdherentType extends CommonObject
$this->label = $obj->label;
$this->morphy = $obj->morphy;
$this->statut = $obj->statut;
$this->status = $obj->statut;
$this->duration = $obj->duration;
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
$this->duration_unit = substr($obj->duration, -1);
@ -668,14 +669,42 @@ class AdherentType extends CommonObject
return $result;
}
/**
* getLibStatut
*
* @return string Return status of a type of member
*/
public function getLibStatut()
{
return '';
/**
* Return label of status (activity, closed)
*
* @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
*/
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
/**
* Return the label of a given status
*
* @param int $status Status id
* @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 Status label
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load('companies');
$statusType = 'status4';
if ($status == 0) $statusType = 'status5';
if (empty($this->labelStatus) || empty($this->labelStatusShort))
{
$this->labelStatus[0] = $langs->trans("ActivityCeased");
$this->labelStatus[1] = $langs->trans("InActivity");
$this->labelStatusShort[0] = $langs->trans("ActivityCeased");
$this->labelStatusShort[1] = $langs->trans("InActivity");
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps