From 7ea09a30e5b7933db41d0f851c75257978a63e57 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 25 Jan 2005 12:25:49 +0000 Subject: [PATCH] Ajout fonction d'affectation des societes aux commerciaux --- htdocs/societe.class.php | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 29914d77b26..77836d3d301 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -739,7 +739,50 @@ class Societe { } } + /** + * + * + * + */ + function add_commercial($user, $commid) + { + if ($this->id > 0 && $commid > 0) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux "; + $sql .= " WHERE fk_soc = " . $this->id ." AND fk_user =".$commid; + + $this->db->query($sql); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_commerciaux "; + $sql .= " ( fk_soc, fk_user )"; + $sql .= " VALUES (".$this->id.",".$commid.")"; + + if (! $this->db->query($sql) ) + { + dolibarr_syslog("Societe::add_commercial Erreur"); + } + + } + } + /** + * + * + * + */ + function del_commercial($user, $commid) + { + if ($this->id > 0 && $commid > 0) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux "; + $sql .= " WHERE fk_soc = " . $this->id ." AND fk_user =".$commid; + + if (! $this->db->query($sql) ) + { + dolibarr_syslog("Societe::del_commercial Erreur"); + } + + } + } /** * \brief Renvoie le nom d'une societe a partir d'un id * \param id id de la société recherchée