From 574e815a62cfab49084ea043533acf94a44c95e3 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 25 Nov 2003 12:31:13 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20lien=20lors=20de=20la=20cr=E9ation=20d'?= =?UTF-8?q?une=20facture=20depuis=20une=20commande?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/facture.class.php | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index e0201c2a205..017685a217b 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -136,6 +136,13 @@ class Facture $sql = "INSERT INTO llx_fa_pr (fk_facture, fk_propal) VALUES (".$this->id.",".$this->propalid.")"; $this->db->query($sql); } + + if ($this->id && $this->commandeid) + { + $sql = "INSERT INTO llx_co_fa (fk_facture, fk_commande) VALUES (".$this->id.",".$this->commandeid.")"; + $this->db->query($sql); + } + /* * Produits * @@ -367,38 +374,50 @@ class Facture if ($this->db->query( $sql) ) { - $sql = "DELETE FROM llx_facturedet WHERE fk_facture = $rowid;"; + + $sql = "DELETE FROM llx_co_fa WHERE fk_facture = $rowid;"; if ($this->db->query( $sql) ) { - $sql = "DELETE FROM llx_facture WHERE rowid = $rowid AND fk_statut = 0;"; - + $sql = "DELETE FROM llx_facturedet WHERE fk_facture = $rowid;"; + if ($this->db->query( $sql) ) { - return 1; + $sql = "DELETE FROM llx_facture WHERE rowid = $rowid AND fk_statut = 0;"; + + if ($this->db->query( $sql) ) + { + return 1; + } + else + { + print "Err : ".$this->db->error(); + return -1; + } + } else { print "Err : ".$this->db->error(); - return -1; + return -2; } } else { print "Err : ".$this->db->error(); - return -2; + return -3; } } else { print "Err : ".$this->db->error(); - return -3; + return -4; } } else { print "Err : ".$this->db->error(); - return -4; + return -5; } } /**