diff --git a/htdocs/soc.php b/htdocs/soc.php index 7a43c6f8221..85a36f9422b 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -75,12 +75,12 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update') if ($_POST["action"] == 'update') { $result = $soc->update($_GET["socid"],$user); - if ($result == -1) + if ($result <> 0) { $soc->id = $_GET["socid"]; // doublon sur le prefix comm $no_reload = 1; - $mesg = "Erreur, le prefix '".$soc->prefix_comm."' existe déjà vous devez en choisir un autre"; + $mesg = $soc->error_message;//"Erreur, le prefix '".$soc->prefix_comm."' existe déjà vous devez en choisir un autre"; $_GET["action"]= "edit"; } else @@ -89,6 +89,7 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update') } } + if ($_POST["action"] == 'add') { $socid = $soc->create($user); @@ -202,12 +203,18 @@ elseif ($_GET["action"] == 'edit') $soc->id = $_GET["socid"]; $soc->fetch($_GET["socid"]); } - print $mesg; + if ($soc->error_message) + { + print '
'; + print $soc->error_message; + print '
'; + } + print '
'; print ''; print ''; - print ''; + print ''; print '';
'.$langs->trans('Name').'
'.$langs->trans('Name').''.$langs->trans('Prefix').'