Fix error management

This commit is contained in:
Laurent Destailleur 2019-05-31 11:53:30 +02:00
parent 12c1531b3b
commit f2088a084f
2 changed files with 24 additions and 23 deletions

View File

@ -377,21 +377,24 @@ if (empty($reshook))
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
$result = $object->update($contactid, $user);
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
if (! $error)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
$result = $object->update($contactid, $user);
if ($result > 0) {
// Categories association
$categories = GETPOST('contcats', 'array');
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit';
}
}
}
@ -500,8 +503,8 @@ else
$linkback='';
print load_fiche_titre($title,$linkback,'title_companies.png');
// Affiche les erreurs
dol_htmloutput_errors(is_numeric($error)?'':$error,$errors);
// Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax)
{
@ -775,8 +778,8 @@ else
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
// Affiche les erreurs
dol_htmloutput_errors($error,$errors);
// Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
if ($conf->use_javascript_ajax)
{
@ -1073,11 +1076,10 @@ else
{
$objsoc = new Societe($db);
/*
* Fiche en mode visualisation
*/
// View mode
dol_htmloutput_errors($error,$errors);
// Show errors
dol_htmloutput_errors(is_numeric($error)?'':$error, $errors);
dol_fiche_head($head, 'card', $title, -1, 'contact');

View File

@ -1901,7 +1901,6 @@ class ExtraFields
$error_field_required[] = $langs->transnoentitiesnoconv($value);
}
}
if (in_array($key_type,array('date')))
{
// Clean parameters