Look and feel v11

This commit is contained in:
Laurent Destailleur 2019-10-31 23:29:17 +01:00
parent 036c1410c7
commit 68a4ddceed
6 changed files with 42 additions and 54 deletions

View File

@ -4380,10 +4380,10 @@ class Product extends CommonObject
/**
* Return label of a given status
*
* @param int $status Statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
* @return string Label of status
* @param int $status Statut
* @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 $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
* @return string Label of status
*/
public function LibStatut($status, $mode = 0, $type = 0)
{
@ -4420,42 +4420,41 @@ class Product extends CommonObject
$statuttrans=empty($status)?'status5':'status4';
if($status == 0){
if ($status == 0) {
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
if($type==0){
if($type==0) {
$labelstatut = $langs->trans('ProductStatusNotOnSellShort');
$labelstatutShort = $langs->trans('ProductStatusNotOnSell');
}
elseif($type == 1){
elseif($type == 1) {
$labelstatut = $langs->trans('ProductStatusNotOnBuyShort');
$labelstatutShort = $langs->trans('ProductStatusNotOnBuy');
}
elseif($type == 2){
elseif($type == 2) {
$labelstatut = $langs->trans('ProductStatusNotOnBatch');
$labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort');
}
}
elseif($status == 1){
elseif ($status == 1) {
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
if($type==0){
if ($type==0) {
$labelstatut = $langs->trans('ProductStatusOnSellShort');
$labelstatutShort = $langs->trans('ProductStatusOnSell');
}
elseif($type == 1){
elseif ($type == 1) {
$labelstatut = $langs->trans('ProductStatusOnBuyShort');
$labelstatutShort = $langs->trans('ProductStatusOnBuy');
}
elseif($type == 2){
elseif ($type == 2) {
$labelstatut = $langs->trans('ProductStatusOnBatch');
$labelstatutShort = $langs->trans('ProductStatusOnBatchShort');
}
}
if($mode>6){
if ($mode > 6) {
return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0);
}
else{
} else {
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
}
}

View File

@ -360,10 +360,10 @@ if ($result)
print '</td>';
}
print '<td class="right nowrap"><span class="statusrefsell">';
print $product_static->LibStatut($objp->tosell, 3, 0);
print $product_static->LibStatut($objp->tosell, 5, 0);
print "</span></td>";
print '<td class="right nowrap"><span class="statusrefbuy">';
print $product_static->LibStatut($objp->tobuy, 3, 1);
print $product_static->LibStatut($objp->tobuy, 5, 1);
print "</span></td>";
print "</tr>\n";
$i++;

View File

@ -2258,8 +2258,8 @@ class Societe extends CommonObject
/**
* Return label of status (activity, closed)
*
* @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
* @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)
{

View File

@ -316,7 +316,7 @@ if ($result)
print dol_print_date($thirdparty_static->datem, 'day');
print "</td>";
print '<td class="right nowrap">';
print $thirdparty_static->getLibStatut(3);
print $thirdparty_static->getLibStatut(5);
print "</td>";
print "</tr>\n";
$i++;

View File

@ -201,6 +201,12 @@ class User extends CommonObject
'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
);
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
/**
* Constructor of the class
*
@ -2478,48 +2484,31 @@ class User extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
* Return label of a status of user (active, inactive)
*
* @param int $statut 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 $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
* @return string Label of status
*/
public function LibStatut($statut, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
global $langs;
$langs->load('users');
if ($mode == 0)
if (empty($this->labelstatus) || empty($this->labelstatusshort))
{
if ($statut == 1) return $langs->trans('Enabled');
elseif ($statut == 0) return $langs->trans('Disabled');
}
elseif ($mode == 1)
{
if ($statut == 1) return $langs->trans('Enabled');
elseif ($statut == 0) return $langs->trans('Disabled');
}
elseif ($mode == 2)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
}
elseif ($mode == 4)
{
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
global $langs;
//$langs->load("mymodule");
$this->labelstatus[self::STATUS_ENABLED] = $langs->trans('Enabled');
$this->labelstatus[self::STATUS_DISABLED] = $langs->trans('Disabled');
$this->labelstatusshort[self::STATUS_ENABLED] = $langs->trans('Enabled');
$this->labelstatusshort[self::STATUS_DISABLED] = $langs->trans('Disabled');
}
$statusType = 'status5';
if ($status == self::STATUS_ENABLED) $statusType = 'status4';
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
}

View File

@ -677,7 +677,7 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['u.statut']['checked']))
{
$userstatic->statut=$obj->statut;
print '<td class="center">'.$userstatic->getLibStatut(3).'</td>';
print '<td class="center">'.$userstatic->getLibStatut(5).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column