Skip to content
Snippets Groups Projects
Commit 5cf59a13 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: uniform code

parent a3e461c2
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,8 @@ $contact = new Contact($db); ...@@ -63,6 +63,8 @@ $contact = new Contact($db);
*/ */
if ($action == 'add_action') if ($action == 'add_action')
{ {
$error=0;
$backtopage=''; $backtopage='';
if (! empty($_POST["backtopage"])) $backtopage=$_POST["backtopage"]; if (! empty($_POST["backtopage"])) $backtopage=$_POST["backtopage"];
if (! $backtopage) if (! $backtopage)
...@@ -104,7 +106,7 @@ if ($action == 'add_action') ...@@ -104,7 +106,7 @@ if ($action == 'add_action')
// Check parameters // Check parameters
if (! $datef && $_POST["percentage"] == 100) if (! $datef && $_POST["percentage"] == 100)
{ {
$error=1; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")).'</div>';
} }
...@@ -112,7 +114,7 @@ if ($action == 'add_action') ...@@ -112,7 +114,7 @@ if ($action == 'add_action')
// Initialisation objet cactioncomm // Initialisation objet cactioncomm
if (! $_POST["actioncode"]) if (! $_POST["actioncode"])
{ {
$error=1; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Type")).'</div>';
} }
...@@ -178,20 +180,20 @@ if ($action == 'add_action') ...@@ -178,20 +180,20 @@ if ($action == 'add_action')
// Check parameters // Check parameters
if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datef == '')) if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datef == ''))
{ {
$error=1; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'</div>';
} }
if ($datea && $_POST["percentage"] == 0) if ($datea && $_POST["percentage"] == 0)
{ {
$error=1; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorStatusCantBeZeroIfStarted").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorStatusCantBeZeroIfStarted").'</div>';
} }
if (! $_POST["apyear"] && ! $_POST["adyear"]) if (! $_POST["apyear"] && ! $_POST["adyear"])
{ {
$error=1; $error++;
$action = 'create'; $action = 'create';
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment