diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index ef104cab883..b0996ba457d 100755 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index 6afc89e7498..6048bb684ef 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes_type', $langs->trans("Member"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 26bd6c8f5ee..901ddfa2148 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -78,8 +78,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Agenda")); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 9993019775e..26667c83669 100755 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Propal"), 0, 'propal'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index d08d5fe0ba8..57f4be119e6 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 975fa94d308..43b04a83a9a 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -41,7 +41,7 @@ if ($action == 'add') { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + $mesg[]=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $action = 'create'; } @@ -49,21 +49,21 @@ if ($action == 'add') { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); + $mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $action = 'create'; } if (GETPOST('type')=='int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); + $mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $action = 'create'; } if (GETPOST('type')=='select' && !GETPOST('param')) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorNoValueForSelectType"); + $mesg[]=$langs->trans("ErrorNoValueForSelectType"); $action = 'create'; } @@ -84,6 +84,7 @@ if ($action == 'add') $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); if ($result > 0) { + setEventMessage($langs->trans('SetupSaved')); header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -91,6 +92,7 @@ if ($action == 'add') { $error++; $mesg=$extrafields->error; + setEventMessage($mesg,'error'); } } else @@ -98,9 +100,14 @@ if ($action == 'add') $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); + setEventMessage($mesg,'error'); $action = 'create'; } } + else + { + setEventMessage($mesg,'errors'); + } } } @@ -114,21 +121,21 @@ if ($action == 'update') { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); + $mesg[]=$langs->trans("ErrorFieldRequired",$langs->trans("Type")); $action = 'create'; } if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); + $mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring); $action = 'edit'; } if (GETPOST('type')=='int' && $extrasize > $maxsizeint) { $error++; $langs->load("errors"); - $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); + $mesg[]=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $action = 'edit'; } @@ -148,6 +155,7 @@ if ($action == 'update') $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params); if ($result > 0) { + setEventMessage($langs->trans('SetupSaved')); header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -155,6 +163,7 @@ if ($action == 'update') { $error++; $mesg=$extrafields->error; + setEventMessage($mesg,'errors'); } } else @@ -162,8 +171,13 @@ if ($action == 'update') $error++; $langs->load("errors"); $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); + setEventMessage($mesg,'errors'); } } + else + { + setEventMessage($mesg,'errors'); + } } } diff --git a/htdocs/societe/admin/contact_extrafields.php b/htdocs/societe/admin/contact_extrafields.php index 892e6318dca..a2460c6cda4 100755 --- a/htdocs/societe/admin/contact_extrafields.php +++ b/htdocs/societe/admin/contact_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes_contacts', $langs->trans("ThirdParties"), 0, ' print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 4ad507dc468..11cb02e80ae 100755 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -77,8 +77,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("ThirdParties"), 0, 'company') print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype); diff --git a/htdocs/user/admin/user_extrafields.php b/htdocs/user/admin/user_extrafields.php index b9b1cd9811e..8b4bc780cbf 100644 --- a/htdocs/user/admin/user_extrafields.php +++ b/htdocs/user/admin/user_extrafields.php @@ -76,8 +76,6 @@ dol_fiche_head($head, 'attributes', $langs->trans("User"), 0, 'user'); print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; print '
'; -dol_htmloutput_errors($mesg); - // Load attribute_label $extrafields->fetch_name_optionals_label($elementtype);