diff --git a/htdocs/soc.php b/htdocs/soc.php
index 85a36f9422b..679f518f442 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -92,18 +92,17 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
if ($_POST["action"] == 'add')
{
- $socid = $soc->create($user);
+ $result = $soc->create($user);
- if ($socid > 0) {
- Header("Location: soc.php?socid=$socid");
- }
- elseif ($socid == -1) {
- $mesg="Erreur, cette société existe déjà sous ce nom ou pour ce prefix commercial";
- $_GET["action"]='create';
- }
- else {
- dolibarr_print_error($db);
- }
+ if ($result == 0)
+ {
+ Header("Location: soc.php?socid=".$soc->id);
+ }
+ else
+ {
+ $_GET["action"]='create';
+ //dolibarr_print_error($db);
+ }
}
}
@@ -128,12 +127,18 @@ if ($_GET["action"] == 'create')
print_titre($langs->trans("NewCompany"));
print "
\n";
- print $mesg;
+ if ($soc->error_message)
+ {
+ print '