939 |
|
|
940 |
if ($fk_socpeople <= 0) return -1; |
if ($fk_socpeople <= 0) return -1; |
941 |
|
|
942 |
// \todo si type_contact = texte, aller chercher code dans table llx_c_type_contact |
// Si type_contact = texte, aller chercher code dans table llx_c_type_contact |
943 |
if ($type_contact == 'SALESREPSIGN') $type_contact=11; |
if ($type_contact == 'SALESREPSIGN' || $type_contact == 'SALESREPFOLL') |
944 |
if ($type_contact == 'SALESREPFOLL') $type_contact=12; |
{ |
945 |
|
$sql.="SELECT rowid from ".MAIN_DB_PREFIX."c_type_contact"; |
946 |
|
$sql.=" WHERE element='contrat' AND source='internal'"; |
947 |
|
$sql.=" AND code='".$type_contact."'"; |
948 |
|
if ( $this->db->query($sql) ) |
949 |
|
{ |
950 |
|
$obj = $this->db->fetch_object($resql); |
951 |
|
if ($obj) $type_contact=$obj->rowid; |
952 |
|
} |
953 |
|
else |
954 |
|
{ |
955 |
|
dolibarr_print_error($this->db); |
956 |
|
$this->error=$this->db->error()." - $sql"; |
957 |
|
return -2; |
958 |
|
} |
959 |
|
} |
960 |
|
|
961 |
|
// Verifie type_contact |
962 |
|
if (! $type_contact) |
963 |
|
{ |
964 |
|
$this->error="Valeur pour type_contact incorrect"; |
965 |
|
return -3; |
966 |
|
} |
967 |
|
|
968 |
$datecreate = time(); |
$datecreate = time(); |
969 |
|
|