From 62c09b57c69504c552d04ffdb52a6162c3d3c656 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Sep 2005 01:10:17 +0000 Subject: [PATCH] =?UTF-8?q?Fin=20dev=20sur=20gestion=20g=E9n=E9rique=20des?= =?UTF-8?q?=20contacts=20de=20contrats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/contrat/contrat.class.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 576eb72d326..d385ae6f34c 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -939,9 +939,31 @@ class Contrat if ($fk_socpeople <= 0) return -1; - // \todo si type_contact = texte, aller chercher code dans table llx_c_type_contact - if ($type_contact == 'SALESREPSIGN') $type_contact=11; - if ($type_contact == 'SALESREPFOLL') $type_contact=12; + // Si type_contact = texte, aller chercher code dans table llx_c_type_contact + if ($type_contact == 'SALESREPSIGN' || $type_contact == 'SALESREPFOLL') + { + $sql.="SELECT rowid from ".MAIN_DB_PREFIX."c_type_contact"; + $sql.=" WHERE element='contrat' AND source='internal'"; + $sql.=" AND code='".$type_contact."'"; + if ( $this->db->query($sql) ) + { + $obj = $this->db->fetch_object($resql); + if ($obj) $type_contact=$obj->rowid; + } + else + { + dolibarr_print_error($this->db); + $this->error=$this->db->error()." - $sql"; + return -2; + } + } + + // Verifie type_contact + if (! $type_contact) + { + $this->error="Valeur pour type_contact incorrect"; + return -3; + } $datecreate = time();