Merge pull request #10770 from atm-john/theme_badge_status

Add badge status css part1
This commit is contained in:
Laurent Destailleur 2019-03-11 20:49:31 +01:00 committed by GitHub
commit 3559d600e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 145 additions and 252 deletions

View File

@ -3193,20 +3193,14 @@ class Propal extends CommonObject
$this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort");
}
$statuttrans='';
if ($statut==self::STATUS_DRAFT) $statuttrans='statut0';
elseif ($statut==self::STATUS_VALIDATED) $statuttrans='statut1';
elseif ($statut==self::STATUS_SIGNED) $statuttrans='statut3';
elseif ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5';
elseif ($statut==self::STATUS_BILLED) $statuttrans='statut6';
if ($mode == 0) return $this->labelstatut[$statut];
elseif ($mode == 1) return $this->labelstatut_short[$statut];
elseif ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut];
elseif ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans);
elseif ($mode == 4) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut[$statut];
elseif ($mode == 5) return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut[$statut], $statuttrans);
elseif ($mode == 6) return '<span class="hideonsmartphone">'.$this->labelstatut[$statut].' </span>'.img_picto($this->labelstatut[$statut], $statuttrans);
$statusType='';
if ($statut==self::STATUS_DRAFT) $statusType='status0';
elseif ($statut==self::STATUS_VALIDATED) $statusType='status1';
elseif ($statut==self::STATUS_SIGNED) $statusType='status3';
elseif ($statut==self::STATUS_NOTSIGNED) $statusType='status5';
elseif ($statut==self::STATUS_BILLED) $statusType='status6';
return dolGetStatus($this->labelstatut[$statut], $this->labelstatut_short[$statut], '', $statusType, $mode);
}

View File

@ -3425,77 +3425,49 @@ class Commande extends CommonOrder
$billedtext = '';
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
//print 'x'.$statut.'-'.$billed;
if ($mode == 0)
{
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceled');
elseif ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraft');
elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
if ($statut==self::STATUS_CANCELED){
$labelstatut = $langs->trans('StatusOrderCanceled');
$labelstatutShort = $langs->trans('StatusOrderCanceledShort');
$statusType='status5';
}
elseif ($mode == 1)
{
if ($statut==self::STATUS_CANCELED) return $langs->trans('StatusOrderCanceledShort');
elseif ($statut==self::STATUS_DRAFT) return $langs->trans('StatusOrderDraftShort');
elseif ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return $langs->trans('StatusOrderSentShort').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderDelivered');
elseif ($statut==self::STATUS_DRAFT){
$labelstatut = $langs->trans('StatusOrderDraft');
$labelstatutShort = $langs->trans('StatusOrderDraftShort');
$statusType='status0';
}
elseif ($mode == 2)
{
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceledShort');
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraftShort');
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'), 'statut1').' '.$langs->trans('StatusOrderValidatedShort').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSent'), 'statut3').' '.$langs->trans('StatusOrderSentShort').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBillShort');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDeliveredShort');
elseif ($statut==self::STATUS_VALIDATED){
$labelstatut = $langs->trans('StatusOrderValidated').$billedtext;
$labelstatutShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
$statusType='status1';
}
elseif ($mode == 3)
{
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0');
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS){
$labelstatut = $langs->trans('StatusOrderSentShort').$billedtext;
$labelstatutShort = $langs->trans('StatusOrderSentShort').$billedtext;
$statusType='status3';
}
elseif ($mode == 4)
{
if ($statut==self::STATUS_CANCELED) return img_picto($langs->trans('StatusOrderCanceled'), 'statut5').' '.$langs->trans('StatusOrderCanceled');
elseif ($statut==self::STATUS_DRAFT) return img_picto($langs->trans('StatusOrderDraft'), 'statut0').' '.$langs->trans('StatusOrderDraft');
elseif ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1').' '.$langs->trans('StatusOrderValidated').$billedtext;
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return img_picto($langs->trans('StatusOrderSentShort').$billedtext, 'statut3').' '.$langs->trans('StatusOrderSent').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'), 'statut4').' '.$langs->trans('StatusOrderToBill');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessedShort').$billedtext, 'statut6').' '.$langs->trans('StatusOrderProcessed').$billedtext;
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderDelivered'), 'statut6').' '.$langs->trans('StatusOrderDelivered');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
$labelstatut = $langs->trans('StatusOrderToBill');
$labelstatutShort = $langs->trans('StatusOrderToBillShort');
$statusType='status4';
}
elseif ($mode == 5)
{
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceledShort').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
elseif ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraftShort').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDeliveredShort').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
$labelstatut = $langs->trans('StatusOrderProcessed').$billedtext;
$labelstatutShort = $langs->trans('StatusOrderProcessed').$billedtext;
$statusType='status6';
}
elseif ($mode == 6)
{
if ($statut==self::STATUS_CANCELED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderCanceled').' </span>'.img_picto($langs->trans('StatusOrderCanceled'), 'statut5');
elseif ($statut==self::STATUS_DRAFT) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDraft').' </span>'.img_picto($langs->trans('StatusOrderDraft'), 'statut0');
elseif ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidated').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderValidated').$billedtext, 'statut1');
elseif ($statut==self::STATUS_SHIPMENTONPROCESS) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSent').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderSent').$billedtext, 'statut3');
elseif ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBill').' </span>'.img_picto($langs->trans('StatusOrderToBill'), 'statut4');
elseif ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessed').$billedtext.' </span>'.img_picto($langs->trans('StatusOrderProcessed').$billedtext, 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderDelivered').' </span>'.img_picto($langs->trans('StatusOrderDelivered'), 'statut6');
elseif ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))){
$labelstatut = $langs->trans('StatusOrderDelivered');
$labelstatutShort = $langs->trans('StatusOrderDelivered');
$statusType='status6';
}
else{
$labelstatut = $langs->trans('Unknown');
$labelstatutShort = '';
$statusType='';
$mode = 0;
}
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
}

View File

@ -469,118 +469,55 @@ abstract class CommonInvoice extends CommonObject
global $langs;
$langs->load('bills');
//print "$paye,$status,$mode,$alreadypaid,$type";
if ($mode == 0) {
$prefix='';
if (! $paye) {
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
else return $langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
if ($type == self::TYPE_CREDIT_NOTE) return $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
elseif ($type == self::TYPE_DEPOSIT) return $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
else return $langs->trans('Bill'.$prefix.'StatusPaid');
}
$statusType='status0';
$prefix='Short';
if (! $paye){
if ($status == 0){
$labelstatut = $langs->trans('BillStatusDraft');
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusDraft');
}
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0){
$labelstatut = $langs->trans('BillStatusClosedUnpaid');
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
$statusType='status5';
}
elseif (($status == 3 || $status == 2) && $alreadypaid > 0){
$labelstatut = $langs->trans('BillStatusClosedPaidPartially');
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
$statusType='status9';
}
elseif ($alreadypaid <= 0){
$labelstatut = $langs->trans('BillStatusNotPaid');
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusNotPaid');
$statusType='status1';
}
else{
$labelstatut = $langs->trans('BillStatusStarted');
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusStarted');
$statusType='status3';
}
}
elseif ($mode == 1)
else
{
$prefix='Short';
if (! $paye)
{
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
else return $langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
if ($type == self::TYPE_CREDIT_NOTE) return $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted');
elseif ($type == self::TYPE_DEPOSIT) return $langs->trans('Bill'.$prefix.'StatusConverted');
else return $langs->trans('Bill'.$prefix.'StatusPaid');
}
}
elseif ($mode == 2)
{
$prefix='Short';
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'), 'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'), 'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'), 'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'), 'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid');
else return img_picto($langs->trans('BillStatusStarted'), 'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
}
else
{
if ($type == self::TYPE_CREDIT_NOTE) return img_picto($langs->trans('BillStatusPaidBackOrConverted'), 'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted');
elseif ($type == self::TYPE_DEPOSIT) return img_picto($langs->trans('BillStatusConverted'), 'statut6').' '.$langs->trans('Bill'.$prefix.'StatusConverted');
else return img_picto($langs->trans('BillStatusPaid'), 'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPaid');
}
}
elseif ($mode == 3)
{
$prefix='Short';
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'), 'statut0');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'), 'statut5');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'), 'statut9');
elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'), 'statut1');
else return img_picto($langs->trans('BillStatusStarted'), 'statut3');
}
else
{
if ($type == self::TYPE_CREDIT_NOTE) return img_picto($langs->trans('BillStatusPaidBackOrConverted'), 'statut6');
elseif ($type == self::TYPE_DEPOSIT) return img_picto($langs->trans('BillStatusConverted'), 'statut6');
else return img_picto($langs->trans('BillStatusPaid'), 'statut6');
}
}
elseif ($mode == 4)
{
$prefix='';
if (! $paye)
{
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'), 'statut0').' '.$langs->trans('BillStatusDraft');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'), 'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'), 'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'), 'statut1').' '.$langs->trans('BillStatusNotPaid');
else return img_picto($langs->trans('BillStatusStarted'), 'statut3').' '.$langs->trans('BillStatusStarted');
}
else
{
if ($type == self::TYPE_CREDIT_NOTE) return img_picto($langs->trans('BillStatusPaidBackOrConverted'), 'statut6').' '.$langs->trans('BillStatusPaidBackOrConverted');
elseif ($type == self::TYPE_DEPOSIT) return img_picto($langs->trans('BillStatusConverted'), 'statut6').' '.$langs->trans('BillStatusConverted');
else return img_picto($langs->trans('BillStatusPaid'), 'statut6').' '.$langs->trans('BillStatusPaid');
}
}
elseif ($mode == 5 || $mode == 6)
{
$prefix='';
if ($mode == 5) $prefix='Short';
if (! $paye)
{
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'), 'statut0');
elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'), 'statut5');
elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'), 'statut9');
elseif ($alreadypaid <= 0)
{
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'), 'statut1');
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'), 'statut1');
}
else return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'), 'statut3');
}
else
{
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted').' </span>'.img_picto($langs->trans('BillStatusPaidBackOrConverted'), 'statut6');
elseif ($type == self::TYPE_DEPOSIT) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusConverted').' </span>'.img_picto($langs->trans('BillStatusConverted'), 'statut6');
else return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusPaid').' </span>'.img_picto($langs->trans('BillStatusPaid'), 'statut6');
}
$statusType='status6';
if ($type == self::TYPE_CREDIT_NOTE){
$labelstatut = $langs->trans('BillStatusPaidBackOrConverted'); // credit note
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note
}
elseif ($type == self::TYPE_DEPOSIT){
$labelstatut = $langs->trans('BillStatusConverted'); // deposit invoice
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice
}
else{
$labelstatut = $langs->trans('BillStatusPaid');
$labelstatutShort = $langs->trans('Bill'.$prefix.'StatusPaid');
}
}
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -7989,7 +7989,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
if($displayMode==0){
$return = !empty($html)?$html:$statusLabel;
}
elseif($displayMode===1){
elseif($displayMode==1){
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
}
// use status with images

View File

@ -4151,83 +4151,73 @@ class Product extends CommonObject
{
// phpcs:enable
global $conf, $langs;
$langs->load('products');
if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch");
}
if ($type == 2) {
switch ($mode)
{
case 0:
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
case 1:
return ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort'));
case 2:
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2);
case 3:
if ($status == 0) {
return img_picto($langs->trans('ProductStatusNotOnBatch'), 'statut5');
}
return img_picto($langs->trans('ProductStatusOnBatch'), 'statut4');
case 4:
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 0, 2);
case 5:
return $this->LibStatut($status, 1, 2).' '.$this->LibStatut($status, 3, 2);
default:
return $langs->trans('Unknown');
case 0:
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
return dolGetStatus($label);
case 1:
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort'));
return dolGetStatus($label);
case 2:
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2);
case 3:
return dolGetStatus($langs->trans('ProductStatusNotOnBatch'), '','',empty($status)?'status5':'status4',3,'dot');
case 4:
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 0, 2);
case 5:
return $this->LibStatut($status, 1, 2).' '.$this->LibStatut($status, 3, 2);
default:
return dolGetStatus($langs->trans('Unknown'));
}
}
if ($mode == 0) {
if ($status == 0) {
return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort'));
} elseif ($status == 1) {
return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort'));
$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');
}
}
elseif ($mode == 1) {
if ($status == 0) {
return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy'));
} elseif ($status == 1) {
return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy'));
elseif($status == 1){
// $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch"
if($type==0){
$labelstatut = $langs->trans('ProductStatusOnSellShort');
$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 == 2) {
if ($status == 0) {
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'));
}
if($mode>6){
return dolGetStatus($langs->trans('Unknown'),'', '', 'status0', 0);
}
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');
else{
return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode);
}
}