} } } } } } } } } } if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) { if ($action == 'addcontact') { $result = $object->fetch($id); if ($result > 0 && $id > 0) { $contactid = GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'); $result = $object->add_contact($contactid, GETPOST('type'), GETPOST('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"); $mesg = '<div class="error">' . $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType") . '</div>'; } else { $mesg = '<div class="error">' . $object->error . '</div>'; } } } else { if ($action == 'swapstatut') { if ($object->fetch($id)) {