diff --git a/htdocs/telephonie/lignetel.class.php b/htdocs/telephonie/lignetel.class.php index f72d2345ae6eff718709780d040996829e763959..ef2977d0865ba800c78aadc7b46147a754d2bb19 100644 --- a/htdocs/telephonie/lignetel.class.php +++ b/htdocs/telephonie/lignetel.class.php @@ -215,6 +215,8 @@ class LigneTel { $this->SetRemise($user, $this->remise, 'Remise initiale'); + $this->DefineClientOption(); + return 0; } else @@ -243,6 +245,50 @@ class LigneTel { return -2; } } + /* + * + * + */ + function DefineClientOption() + { + + $sql = "SELECT propriete, valeur"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_options"; + $sql .= " WHERE type= 'ligne'"; + $sql .= " AND fk_client_comm = '".$this->client_comm."'"; + + $resql = $this->db->query($sql); + + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + + $sqlu = "UPDATE ".MAIN_DB_PREFIX."telephonie_societe_ligne"; + $sqlu .= " SET ".$obj->propriete." = '".$obj->valeur."'"; + $sqlu .= " WHERE rowid = '".$this->id."'"; + + $resqlu = $this->db->query($sqlu); + + if (!$resqlu) + { + dolibarr_syslog("LigneTel::DefineClientOption Error"); + dolibarr_syslog("LigneTel::DefineClientOption $sqlu"); + } + + + $i++; + } + } + else + { + dolibarr_syslog("LigneTel::DefineClientOption Error"); + } + } /* * *