Ejemplo n.º 1
0
}
if (GETPOST('action', 'alpha') == 'update' && !GETPOST('cancel', 'alpha')) {
    $error = 0;
    // Update account
    $place = new place($db);
    $place->fetch(GETPOST('id', 'int'));
    $place->description = trim(GETPOST('description', 'alpha'));
    $place->name = trim(GETPOST('name', 'alpha'));
    if (empty($place->name)) {
        setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("LabelName")), "errors");
        $action = 'update';
        // Force chargement page en mode creation
        $error++;
    }
    if (!$error) {
        $result = $place->update($user);
        if ($result < 0) {
            setEventMessage($place->errorsToString(), "errors");
            $action = 'edit';
            // Force chargement page edition
        }
    }
}
if (GETPOST('action', 'alpha') == 'confirm_delete' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->pos->backend) {
    // Modification
    $place = new place($db);
    $place->delete(GETPOST('id', 'int'));
    header("Location: " . dol_buildpath("/pos/backend/place/place.php", 1));
    exit;
}
/*