Fix GETPOST instead of POST

This commit is contained in:
Laurent Destailleur 2021-02-24 11:37:20 +01:00
parent d4a78bf7c6
commit 4f1f17fedc

View File

@ -200,11 +200,11 @@ if (empty($reshook) && $action == 'add') {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
} }
if (empty($_POST["lastname"])) { if (!GETPOST("lastname")) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
} }
if (empty($_POST["firstname"])) { if (GETPOST("firstname")) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
} }
@ -213,8 +213,8 @@ if (empty($reshook) && $action == 'add') {
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n"; $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
} }
$birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST("birthmin", 'int'), GETPOST("birthsec", 'int'), GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
if ($_POST["birthmonth"] && empty($birthday)) { if (GETPOSTISSET("birthmonth") && empty($birthday)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n"; $errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
@ -226,7 +226,7 @@ if (empty($reshook) && $action == 'add') {
} }
} }
if (isset($public)) $public = 1; if (GETPOSTISSET('public')) $public = 1;
else $public = 0; else $public = 0;
if (!$error) { if (!$error) {
@ -234,25 +234,25 @@ if (empty($reshook) && $action == 'add') {
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->statut = -1; $adh->statut = -1;
$adh->public = $public; $adh->public = $public;
$adh->firstname = $_POST["firstname"]; $adh->firstname = GETPOST("firstname");
$adh->lastname = $_POST["lastname"]; $adh->lastname = GETPOST("lastname");
$adh->gender = $_POST["gender"]; $adh->gender = GETPOST("gender");
$adh->civility_id = $_POST["civility_id"]; $adh->civility_id = GETPOST("civility_id");
$adh->societe = $_POST["societe"]; $adh->societe = GETPOST("societe");
$adh->address = $_POST["address"]; $adh->address = GETPOST("address");
$adh->zip = $_POST["zipcode"]; $adh->zip = GETPOST("zipcode");
$adh->town = $_POST["town"]; $adh->town = GETPOST("town");
$adh->email = $_POST["email"]; $adh->email = GETPOST("email");
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
$adh->login = $_POST["login"]; $adh->login = GETPOST("login");
$adh->pass = $_POST["pass1"]; $adh->pass = GETPOST("pass1");
} }
$adh->photo = $_POST["photo"]; $adh->photo = GETPOST("photo");
$adh->country_id = $_POST["country_id"]; $adh->country_id = GETPOST("country_id", 'int');
$adh->state_id = $_POST["state_id"]; $adh->state_id = GETPOST("state_id", 'int');
$adh->typeid = $_POST["type"]; $adh->typeid = GETPOST("type", 'int');
$adh->note_private = $_POST["note_private"]; $adh->note_private = GETPOST("note_private");
$adh->morphy = $_POST["morphy"]; $adh->morphy = GETPOST("morphy");
$adh->birth = $birthday; $adh->birth = $birthday;