diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 3bf3bcb07c2..a2ce199faee 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -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), diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 826c89cf2de..aea07802fdf 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -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), diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 54d3a950a79..1830dcd5c7a 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -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; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index dd1ea179553..78925c74b9f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -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 .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5, $this->alreadypaid); - } $ref = $this->ref; if (empty($ref)) { @@ -2567,8 +2568,6 @@ class FactureFournisseur extends CommonInvoice $result .= ''; $result .= img_picto('', 'note'); $result .= ''; - //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); - //$result.=''; $result .= ''; } }