Fix asset module
This commit is contained in:
parent
9a831e3249
commit
72e9e1b387
@ -55,6 +55,10 @@ class Asset extends CommonObject
|
||||
public $picto = 'asset';
|
||||
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format.
|
||||
* 'label' the translation key.
|
||||
@ -390,31 +394,16 @@ class Asset extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0 || $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');
|
||||
} 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');
|
||||
}
|
||||
$langs->load("contracts");
|
||||
$labelStatus[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Disabled');
|
||||
$labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
|
||||
$statusType = 'status0';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
|
||||
return dolGetStatus($labelStatus[$status], $labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -80,7 +80,7 @@ if ($user->socid > 0) // Protection if external user
|
||||
accessforbidden();
|
||||
}
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'asset', $id, '');
|
||||
$result = restrictedArea($user, 'asset', $id);
|
||||
|
||||
|
||||
// Initialize array of search criterias
|
||||
|
||||
@ -1911,7 +1911,6 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status6';
|
||||
|
||||
if ($mode == 4 || $mode == 6 || $mode == 7)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user