clean code

This commit is contained in:
Frédéric FRANCE 2023-02-06 21:59:32 +01:00
parent f3b5990d2b
commit 4a74e7d875
2 changed files with 26 additions and 57 deletions

View File

@ -1890,57 +1890,22 @@ class Facture extends CommonInvoice
if ($this->type == self::TYPE_DEPOSIT) {
$picto .= 'd'; // Deposit invoice
}
$label = '';
if ($user->hasRight("facture", "read")) {
$label = img_picto('', $picto).' <u class="paddingrightonly">'.$langs->trans("Invoice").'</u>';
if (isset($this->statut) && isset($this->alreadypaid)) {
$label .= ' '.$this->getLibStatut(5, $this->alreadypaid);
}
$label .= ' &nbsp; '.$this->getLibType(1);
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}
if (!empty($this->ref_client)) {
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
}
if (!empty($this->date)) {
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'day');
}
if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('AmountVAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) { // We keep test != 0 because $this->total_localtax1 can be '0.00000000'
$label .= '<br><b>'.$langs->transcountry('AmountLT1', $mysoc->country_code).':</b> '.price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_localtax2) && $this->total_localtax2 != 0) {
$label .= '<br><b>'.$langs->transcountry('AmountLT2', $mysoc->country_code).':</b> '.price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
if ($moretitle) {
$label .= ' - '.$moretitle;
}
}
$linkclose = ($target ? ' target="'.$target.'"' : '');
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'moretitle' => $moretitle,
'option' => $option,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'moretitle' => $moretitle,
'option' => $option,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
// $label = $langs->trans('Loading');
}
$label = implode($this->getTooltipContentArray($params));
$linkclose = ($target ? ' target="'.$target.'"' : '');
if (empty($notooltip) && $user->hasRight("facture", "read")) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("Invoice");

View File

@ -108,6 +108,11 @@ class Delivery extends CommonObject
public $commande_id;
/**
* @var array statuts labels
*/
public $statuts;
public $lines = array();
@ -751,8 +756,18 @@ class Delivery extends CommonObject
$result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("ShowReceiving").'</u>:<br>';
$label .= '<b>'.$langs->trans("Status").'</b>: '.$this->ref;
$params = [
'id' => $this->id,
'objecttype' => $this->element,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
// $label = $langs->trans('Loading');
}
$label = implode($this->getTooltipContentArray($params));
$url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id;
@ -768,17 +783,6 @@ class Delivery extends CommonObject
}
//}
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
// $label = $langs->trans('Loading');
}
$linkstart = '<a href="'.$url.'"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">';
$linkend = '</a>';