diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 59ef610588a..6a942f67f5f 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -1725,11 +1725,18 @@ class Facture extends CommonObject function getSommePaiement() { $table='paiement_facture'; - if ($element == 'facture_fourn') $table='paiementfourn_facturefourn'; + $field='fk_facture'; + if ($this->element == 'facture_fourn') + { + $table='paiementfourn_facturefourn'; + $field='fk_facturefourn'; + } $sql = 'SELECT sum(amount) as amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.$table; - $sql.= ' WHERE fk_facture = '.$this->id; + $sql.= ' WHERE '.$field.' = '.$this->id; + + dolibarr_syslog("Facture::getSommePaiement sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b34a9b2fbb5..0ff94262eca 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -849,10 +849,9 @@ else /* * Boutons actions */ - print '