add new dolGetStatus to LibStatut in product class
This commit is contained in:
parent
5ea5d51247
commit
ca10b1e403
@ -3460,6 +3460,12 @@ class Commande extends CommonOrder
|
|||||||
$labelstatutShort = $langs->trans('StatusOrderDelivered');
|
$labelstatutShort = $langs->trans('StatusOrderDelivered');
|
||||||
$statuttrans='status6';
|
$statuttrans='status6';
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
$labelstatut = $langs->trans('Unknown');
|
||||||
|
$labelstatutShort = '';
|
||||||
|
$statuttrans='';
|
||||||
|
$mode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
|
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4054,83 +4054,77 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch");
|
if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == 2) {
|
if ($type == 2) {
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
|
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
|
||||||
case 1:
|
return dolGetStatus($label);
|
||||||
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort'));
|
case 1:
|
||||||
case 2:
|
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort'));
|
||||||
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2);
|
return dolGetStatus($label);
|
||||||
case 3:
|
case 2:
|
||||||
if ($status == 0) {
|
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2);
|
||||||
return img_picto($langs->trans('ProductStatusNotOnBatch'), 'statut5');
|
case 3:
|
||||||
}
|
return dolGetStatus($langs->trans('ProductStatusNotOnBatch'), '','',empty($status)?'status5':'status4',3,'dot');
|
||||||
return img_picto($langs->trans('ProductStatusOnBatch'), 'statut4');
|
case 4:
|
||||||
case 4:
|
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 0, 2);
|
||||||
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 0, 2);
|
case 5:
|
||||||
case 5:
|
return $this->LibStatut($status, 1, 2).' '.$this->LibStatut($status, 3, 2);
|
||||||
return $this->LibStatut($status, 1, 2).' '.$this->LibStatut($status, 3, 2);
|
default:
|
||||||
default:
|
return dolGetStatus($langs->trans('Unknown'));
|
||||||
return $langs->trans('Unknown');
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$statuttrans=empty($status)?'status5':'status4';
|
||||||
|
|
||||||
|
if($status == 0){
|
||||||
|
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||||
|
if($type==0){
|
||||||
|
$labelstatut = $langs->trans('ProductStatusNotOnSellShort');
|
||||||
|
$labelstatutShort = $langs->trans('ProductStatusNotOnSell');
|
||||||
|
}
|
||||||
|
elseif($type == 1){
|
||||||
|
$labelstatut = $langs->trans('ProductStatusNotOnBuyShort');
|
||||||
|
$labelstatutShort = $langs->trans('ProductStatusNotOnBuy');
|
||||||
|
}
|
||||||
|
elseif($type == 2){
|
||||||
|
$labelstatut = $langs->trans('ProductStatusNotOnBatch');
|
||||||
|
$labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($mode == 0) {
|
elseif($status == 1){
|
||||||
if ($status == 0) {
|
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
|
||||||
return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
|
if($type==0){
|
||||||
} elseif ($status == 1) {
|
$labelstatut = $langs->trans('ProductStatusOnSellShort');
|
||||||
return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
|
$labelstatutShort = $langs->trans('ProductStatusOnSell');
|
||||||
|
}
|
||||||
|
elseif($type == 1){
|
||||||
|
$labelstatut = $langs->trans('ProductStatusOnBuyShort');
|
||||||
|
$labelstatutShort = $langs->trans('ProductStatusOnBuy');
|
||||||
|
}
|
||||||
|
elseif($type == 2){
|
||||||
|
$labelstatut = $langs->trans('ProductStatusOnBatch');
|
||||||
|
$labelstatutShort = $langs->trans('ProductStatusOnBatchShort');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($mode == 1) {
|
|
||||||
if ($status == 0) {
|
|
||||||
return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
|
if($mode>6){
|
||||||
} elseif ($status == 1) {
|
return dolGetStatus($langs->trans('Unknown'),'', '', 'status0', 0);
|
||||||
return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif ($mode == 2) {
|
else{
|
||||||
if ($status == 0) {
|
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
|
||||||
return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
|
|
||||||
} elseif ($status == 1) {
|
|
||||||
return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif ($mode == 3) {
|
|
||||||
if ($status == 0) {
|
|
||||||
return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
|
|
||||||
} elseif ($status == 1) {
|
|
||||||
return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($mode == 4) {
|
|
||||||
if ($status == 0) {
|
|
||||||
return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
|
|
||||||
} elseif ($status == 1) {
|
|
||||||
return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($mode == 5) {
|
|
||||||
if ($status == 0) {
|
|
||||||
return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
|
|
||||||
} elseif ($status == 1) {
|
|
||||||
return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($mode == 6) {
|
|
||||||
if ($status == 0) {
|
|
||||||
return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
|
|
||||||
} elseif ($status == 1) {
|
|
||||||
return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $langs->trans('Unknown');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user