} } } if (!$error) { $object->fetch_thirdparty(); } else { header('Location: list.php'); exit; } /* * Ajout d'un nouveau contact */ if ($action == 'addcontact' && $user->rights->lead->write) { if ($object->id > 0) { $contactid = GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'); $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); } if ($result >= 0) { header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); exit; } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } else { setEventMessages(null, $object->errors, 'errors'); } } } else { if ($action == 'swapstatut' && $user->rights->lead->write) { if ($object->id > 0) {