Debug status of accounting account

This commit is contained in:
Laurent Destailleur 2021-12-18 23:02:31 +01:00
parent 5fed6de5b8
commit 80a7b83956
2 changed files with 21 additions and 43 deletions

View File

@ -417,13 +417,13 @@ if ($action == 'create') {
print '<div class="tabsAction">';
if (!empty($user->rights->accounting->chartofaccount)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
if (!empty($user->rights->accounting->chartofaccount)) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}

View File

@ -153,6 +153,11 @@ class AccountingAccount extends CommonObject
*/
private $accountingaccount_codetotid_cache = array();
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
/**
* Constructor
*
@ -691,49 +696,22 @@ class AccountingAccount extends CommonObject
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->loadLangs(array("users"));
if ($mode == 0) {
if ($status == 1) {
return $langs->trans('Enabled');
} elseif ($status == 0) {
return $langs->trans('Disabled');
}
} elseif ($mode == 1) {
if ($status == 1) {
return $langs->trans('Enabled');
} elseif ($status == 0) {
return $langs->trans('Disabled');
}
} 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');
}
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
$langs->load("users");
$this->labelStatus[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
$this->labelStatus[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
$statusType = 'status4';
if ($status == self::STATUS_DISABLED) {
$statusType = 'status5';
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/**
* Return Suggest accounting accounts to bind