Skip to content
Snippets Groups Projects
Commit 4fc1fe79 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Bad check on mandatory parameters

parent df6c7964
No related branches found
No related tags found
No related merge requests found
...@@ -246,9 +246,22 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) ...@@ -246,9 +246,22 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
{ {
$birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
} }
$lastname=$_POST["lastname"];
$firstname=$_POST["firstname"];
$morphy=$morphy=$_POST["morphy"];;
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
}
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n";
}
// Create new object // Create new object
if ($result > 0) if ($result > 0 && ! $error)
{ {
$object->oldcopy=dol_clone($object); $object->oldcopy=dol_clone($object);
...@@ -389,6 +402,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) ...@@ -389,6 +402,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$action=''; $action='';
} }
} }
else
{
$action='edit';
}
} }
if ($action == 'add' && $user->rights->adherent->creer) if ($action == 'add' && $user->rights->adherent->creer)
...@@ -489,7 +506,7 @@ if ($action == 'add' && $user->rights->adherent->creer) ...@@ -489,7 +506,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."<br>\n";
} }
} }
if (empty($lastname)) { if ($morphy != 'mor' && empty($lastname)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment