diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 01d48c1..050bab4 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -1455,18 +1455,16 @@ class Bdd { if(in_array($table, $this->whiteTable) && in_array($column, $this->whiteColumn)){ if(strcmp($table, "facture")==0 && strcmp($column, "date_paiement")==0) { - $facture = $this->getFactureByFactureId($id); if($facture['date_paiement'] != $data){ $facturationDatetime = Datetime::createFromFormat('Y-m-d',$data); $factureNumber = $this->getFactureNumberByDate($facturationDatetime); $fullFactureNumber = DateHelpers::GetFullFactureOrDevisNumberByDate($facturationDatetime,$factureNumber,"FAC"); + $sql = "UPDATE ".$this->tableprefix.$table." SET `facture_number`= ? WHERE `id` = ?"; + $this->execSQLNoData($sql, array($factureNumber, $id)); + $sql = "UPDATE ".$this->tableprefix.$table." SET $column = ?, `num`= ? WHERE `id` = ?"; + $this->execSQLNoData($sql, array($data, $fullFactureNumber, $id)); } - else{ - $fullFactureNumber = $facture["num"]; - } - $sql = "UPDATE ".$this->tableprefix.$table." SET $column = ?, `num`= ? WHERE `id` = ?"; - $this->execSQLNoData($sql, array($data, $fullFactureNumber, $id)); } else if(strcmp($table, "facture")==0 && strcmp($column, "id_devis")==0) {