$langs->load("propal");
// Access control
if (!$user->admin) {
    accessforbidden();
}
// Parameters
$action = GETPOST('action', 'alpha');
$object = new TGrappeFruit();
/*
 * Actions
 */
if (preg_match('/set_(.*)/', $action, $reg)) {
    $code = $reg[1];
    if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0) {
        if ($code == 'GRAPEFRUIT_MANAGE_DOWNLOAD_OWN_DOC_USERS') {
            $result = $object->setupUserDownloadRights(GETPOST($code));
            if ($result < 0) {
                setEventMessage($object->error, 'errors');
            }
        }
        setEventMessage("ValuesUpdated");
        header("Location: " . $_SERVER["PHP_SELF"]);
        exit;
    } else {
        dol_print_error($db);
    }
}
if (preg_match('/del_(.*)/', $action, $reg)) {
    $code = $reg[1];
    if (dolibarr_del_const($db, $code, 0) > 0) {
        Header("Location: " . $_SERVER["PHP_SELF"]);