From 32627039bea74388226c30a1a4a327d94764bd59 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 30 Aug 2005 16:17:19 +0000 Subject: [PATCH] Ajout fonction AddPerms --- htdocs/societe.class.php | 58 +++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index b055b856b07..219482b0835 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -1393,29 +1393,43 @@ class Societe { } } - /** - * \brief Indique si la société a des projets - * \return bool true si la société a des projets, false sinon - */ - function has_projects() - { - $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; - $resql = $this->db->query($sql); - if ($resql) - { - $nump = $this->db->num_rows($resql); - $obj = $this->db->fetch_object(); - $count = $obj->numproj; - } - else - { - $count = 0; - print $this->db->error(); - } - $this->db->free($resql); - return ($count > 0); - } + /** + * \brief Indique si la société a des projets + * \return bool true si la société a des projets, false sinon + */ + function has_projects() + { + $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; + $resql = $this->db->query($sql); + if ($resql) + { + $nump = $this->db->num_rows($resql); + $obj = $this->db->fetch_object(); + $count = $obj->numproj; + } + else + { + $count = 0; + print $this->db->error(); + } + $this->db->free($resql); + return ($count > 0); + } + + function AddPerms($user_id, $read, $write, $perms) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_perms"; + $sql .= " (fk_soc, fk_user, pread, pwrite, pperms) "; + $sql .= " VALUES (".$this->id.",".$user_id.",".$read.",".$write.",".$perms.");"; + + $resql=$this->db->query($sql); + + if ($resql) + { + + } + } } ?>