diff --git a/htdocs/projet/project.class.php b/htdocs/projet/project.class.php index ff520d088e6..08ddfe4cb7b 100644 --- a/htdocs/projet/project.class.php +++ b/htdocs/projet/project.class.php @@ -75,10 +75,10 @@ class Project { if ($this->db->query($sql) ) { - $sql = "UPDATE llx_propal SET fk_projet = 0 "; + $sql = "UPDATE llx_propal SET fk_projet = 0 WHERE fk_projet = $this->id"; if ($this->db->query($sql) ) { - $sql = "UPDATE llx_facture SET fk_projet = 0 "; + $sql = "UPDATE llx_facture SET fk_projet = 0 WHERE fk_projet = $this->id"; if ($this->db->query($sql) ) { @@ -106,6 +106,7 @@ class Project { $this->id = $rowid; $this->ref = $obj->ref; $this->title = $obj->title; + $this->titre = $obj->title; $this->societe->id = $obj->fk_soc; $this->db->free(); } @@ -151,5 +152,41 @@ class Project { print $this->db->error() . '
' .$sql; } } + /* + * + * + * + */ + Function get_facture_list() + { + $factures = array(); + $sql = "SELECT rowid FROM llx_facture WHERE fk_projet=$this->id;"; + + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($i); + + $factures[$i] = $obj->rowid; + + $i++; + } + $this->db->free(); + /* + * Retourne un tableau contenant la liste des factures associees + */ + return $factures; + } + } + else + { + print $this->db->error() . '
' .$sql; + } + } } ?>