} if ($user->societe_id > 0) { unset($_GET["action"]); $action = ''; } $result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); $object = new ActionComm($db); /* * Actions */ // Add new contact if ($action == 'addcontact' && $user->rights->action->creer) { $result = $object->fetch($id); 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"); setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); } else { setEventMessage($object->error, 'errors'); } } } // modification d'un contact. On enregistre le type if ($action == 'updateline') {