Example #1
0
    }
    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 = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
        } else {
            $mesg = $object->error;
        }
        setEventMessage($mesg, 'errors');
    }
} else {
    if ($action == 'swapstatut' && $user->rights->ficheinter->creer) {
        $result = $object->swapContactStatus(GETPOST('ligne', 'int'));
    } else {
        if ($action == 'deletecontact' && $user->rights->ficheinter->creer) {
            $result = $object->delete_contact(GETPOST('lineid', 'int'));
            if ($result >= 0) {
                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                dol_print_error($db);
            }
        }
    }
}
/*
 * View
 */