Optimize some widgets

This commit is contained in:
Laurent Destailleur 2021-05-10 20:16:51 +02:00
parent f8581a1a01
commit d7a5e342ab
4 changed files with 14 additions and 11 deletions

View File

@ -142,6 +142,10 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->status = $objp->status;
$facturestatic->ref_supplier = $objp->ref_supplier;
$alreadypaid = $facturestatic->getSommePaiement();
$facturestatic->alreadypaid = $alreadypaid ? $alreadypaid : 0;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->name_alias = $objp->name_alias;
@ -188,9 +192,6 @@ class box_factures_fourn extends ModeleBoxes
'text' => dol_print_date($date, 'day'),
);
$fac = new FactureFournisseur($this->db);
$fac->fetch($objp->facid);
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),

View File

@ -134,6 +134,10 @@ class box_factures_fourn_imp extends ModeleBoxes
$facturestatic->statut = $objp->status;
$facturestatic->status = $objp->status;
$alreadypaid = $facturestatic->getSommePaiement();
$facturestatic->alreadypaid = $alreadypaid ? $alreadypaid : 0;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->name_alias = $objp->name_alias;
@ -174,9 +178,6 @@ class box_factures_fourn_imp extends ModeleBoxes
'text' => dol_print_date($datelimite, 'day'),
);
$fac = new FactureFournisseur($this->db);
$fac->fetch($objp->facid);
$alreadypaid = $fac->getSommePaiement();
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type),

View File

@ -132,7 +132,9 @@ class box_factures_imp extends ModeleBoxes
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$datelimite = $this->db->jdate($objp->datelimite);
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->ref;
$facturestatic->type = $objp->type;

View File

@ -2501,6 +2501,10 @@ class FactureFournisseur extends CommonInvoice
}
if (isset($this->status)) {
$alreadypaid = -1;
if (isset($this->alreadypaid)) {
$alreadypaid = $this->alreadypaid;
}
$label .= ' '.$this->getLibStatut(5, $alreadypaid);
}
if (!empty($this->ref)) {
@ -2527,9 +2531,6 @@ class FactureFournisseur extends CommonInvoice
if ($moretitle) {
$label .= ' - '.$moretitle;
}
if (isset($this->statut) && isset($this->alreadypaid)) {
$label .= '<br><b>'.$langs->trans("Status").":</b> ".$this->getLibStatut(5, $this->alreadypaid);
}
$ref = $this->ref;
if (empty($ref)) {
@ -2567,8 +2568,6 @@ class FactureFournisseur extends CommonInvoice
$result .= '<a href="'.DOL_URL_ROOT.'/fourn/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
$result .= img_picto('', 'note');
$result .= '</a>';
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
//$result.='</a>';
$result .= '</span>';
}
}