if (!$cancel) { $error = 0; $object->name = GETPOST('name', 'alpha'); if (empty($object->name)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); $error++; } if (empty($error)) { $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); $object->country_id = $_POST["country_id"]; $object->status = GETPOST('status', 'int'); $object->fk_user_author = $user->id; $object->datec = dol_now(); $id = $object->create($user); if ($id > 0) { header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); } } else { $action = 'create'; } } else { header("Location: ../admin/admin_establishment.php"); exit; } } else { if ($action == 'update') {