diff --git a/ChangeLog b/ChangeLog index 2c85b48924f..7113b325833 100644 --- a/ChangeLog +++ b/ChangeLog @@ -239,6 +239,7 @@ FIX: Not showing task extrafields when creating from left menu FIX [ bug #3288 ] Tasks box is not properly drawn FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights +FIX [ bug #3426 ] Unable to create an invoice from a contract with extrafields NEW: Created new ContratLigne::insert function diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 999c3ff2fa1..bd3b8cd2753 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -309,7 +309,7 @@ if ($modecompta == 'CREANCES-DETTES') } else { - $sql = "SELECT s.nom, s.rowid as socid, sum(pf.amount) as amount_ttc"; + $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; $sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 073cd510f8c..ed80a152665 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3588,6 +3588,11 @@ abstract class CommonObject { if (empty($rowid)) $rowid=$this->id; + //To avoid SQL errors. Probably not the better solution though + if (!$this->table_element) { + return 0; + } + if (! is_array($optionsArray)) { // optionsArray not already loaded, so we load it