Skip to content

Commit

Permalink
Fix: Bad check on mandatory parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 12, 2013
1 parent df6c796 commit 4fc1fe7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions htdocs/adherents/fiche.php
Expand Up @@ -246,9 +246,22 @@
{
$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
if ($result > 0)
if ($result > 0 && ! $error)
{
$object->oldcopy=dol_clone($object);

Expand Down Expand Up @@ -389,6 +402,10 @@
$action='';
}
}
else
{
$action='edit';
}
}

if ($action == 'add' && $user->rights->adherent->creer)
Expand Down Expand Up @@ -489,7 +506,7 @@
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."<br>\n";
}
}
if (empty($lastname)) {
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
Expand Down

0 comments on commit 4fc1fe7

Please sign in to comment.