*/ if (GETPOST('action', 'alpha') == 'add') { $error = 0; // Create account $place = new place($db); $place->description = trim(GETPOST('description', 'alpha')); $place->name = trim(GETPOST('name', 'alpha')); $place->status = GETPOST('status', 'int'); if (empty($place->name)) { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("LabelName")), "errors"); $action = 'create'; // Force chargement page en mode creation $error++; } if (!$error) { $id = $place->create($user); if ($id == 0) { $url = dol_buildpath("/pos/backend/place/place.php", 1); Header("Location: " . $url); } else { setEventMessage($place->errorsToString(), "errors"); $action = 'create'; // Force chargement page en mode creation } } } if (GETPOST('action', 'alpha') == 'update' && !GETPOST('cancel', 'alpha')) { $error = 0; // Update account $place = new place($db); $place->fetch(GETPOST('id', 'int'));