diff --git a/htdocs/soc.php b/htdocs/soc.php
index 22a8fe43095..5a049ed5a10 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -45,7 +45,15 @@ if ($user->societe_id > 0)
$soc = new Societe($db);
-if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
+$step=$_POST["step"];
+if ($_POST["createnextstep"]) { $step++; $_GET["action"]="create"; }
+if ($_POST["createpreviousstep"]) { $step--; $_GET["action"]="create"; }
+if (! $step) $step++;
+
+/*
+ * Actions
+ */
+if (($_POST["action"] == 'add' && (! defined(COMPANY_CREATE_TWO_STEPS) || $step == 2)) or $_POST["action"] == 'update')
{
$soc->nom = stripslashes($_POST["nom"]);
$soc->adresse = stripslashes($_POST["adresse"]);
@@ -77,7 +85,7 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
$soc->id = $_GET["socid"];
// doublon sur le prefix comm
$no_reload = 1;
- $mesg = $soc->error;//"Erreur, le prefix '".$soc->prefix_comm."' existe déjà vous devez en choisir un autre";
+ $mesg = $soc->error; //"Erreur, le prefix '".$soc->prefix_comm."' existe déjà vous devez en choisir un autre";
$_GET["action"]= "edit";
}
else
@@ -124,8 +132,6 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user-
}
/**
- *
- *
*
*
*/
@@ -134,21 +140,22 @@ llxHeader();
$form = new Form($db);
-if ($_GET["action"] == 'create')
+if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
{
if ($user->rights->societe->creer)
{
/*
- * Fiche societe en mode création
+ * Fiche societe en mode création (Creation en 1 ou 2 temps selon COMPANY_CREATE_TWO_STEPS)
*/
$soc->fournisseur=0;
if ($_GET["type"]=='f') { $soc->fournisseur=1; }
if ($_GET["type"]=='c') { $soc->client=1; }
if ($_GET["type"]=='p') { $soc->client=2; }
+ if ($_POST["nom"]) { $soc->nom=$_POST["nom"]; }
print_titre($langs->trans("NewCompany"));
print "
\n";
-
+
if ($soc->error)
{
print '