Пример #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");
            setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
        } else {
            setEventMessage($object->error, 'errors');
        }
    }
} else {
    if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer) {
        if ($object->fetch($id)) {
            $result = $object->swapContactStatus(GETPOST('ligne'));
        } else {
            dol_print_error($db);
        }
    } else {
        if ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer) {
            $object->fetch($id);
            $result = $object->delete_contact($_GET["lineid"]);
            if ($result >= 0) {
                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
                exit;
            } else {
                dol_print_error($db);
            }
        }
    }