From 24d8b2bbef08c824d2e8aada7799d6e2e5c0b8e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Apr 2005 18:08:31 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Quand=20on=20cr=E9e=20une=20soci=E9t=E9,?= =?UTF-8?q?=20on=20saut=20=E0=20l'affiche=20de=20page=20de=20la=20soci=E9t?= =?UTF-8?q?=E9=20directement=20sans=20passer=20par=20code=20non=20appropri?= =?UTF-8?q?=E9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/soc.php | 107 +++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/htdocs/soc.php b/htdocs/soc.php index 2f7d7ccf1b6..44e67fc8868 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -22,7 +22,8 @@ * */ -/** \file htdocs/soc.php +/** + \file htdocs/soc.php \ingroup societe \brief Onglet societe d'une societe \version $Revision$ @@ -55,60 +56,62 @@ if (! $step) $step++; */ 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"]); - $soc->cp = stripslashes($_POST["cp"]); - $soc->ville = stripslashes($_POST["ville"]); - $soc->pays_id = stripslashes($_POST["pays_id"]); - $soc->departement_id = stripslashes($_POST["departement_id"]); - $soc->tel = stripslashes($_POST["tel"]); - $soc->fax = stripslashes($_POST["fax"]); - $soc->url = ereg_replace( "http://", "", $_POST["url"] ); - $soc->siren = stripslashes($_POST["siren"]); - $soc->siret = stripslashes($_POST["siret"]); - $soc->ape = stripslashes($_POST["ape"]); - $soc->prefix_comm = stripslashes($_POST["prefix_comm"]); - $soc->code_client = stripslashes($_POST["code_client"]); - $soc->codeclient_modifiable = stripslashes($_POST["codeclient_modifiable"]); - $soc->capital = stripslashes($_POST["capital"]); - $soc->tva_intra = stripslashes($_POST["tva_intra_code"] . $_POST["tva_intra_num"]); - $soc->forme_juridique_code = stripslashes($_POST["forme_juridique_code"]); - $soc->effectif_id = stripslashes($_POST["effectif_id"]); - $soc->typent_id = stripslashes($_POST["typent_id"]); - $soc->client = stripslashes($_POST["client"]); - $soc->fournisseur = stripslashes($_POST["fournisseur"]); - - if ($_POST["action"] == 'update') + $soc->nom = stripslashes($_POST["nom"]); + $soc->adresse = stripslashes($_POST["adresse"]); + $soc->cp = stripslashes($_POST["cp"]); + $soc->ville = stripslashes($_POST["ville"]); + $soc->pays_id = stripslashes($_POST["pays_id"]); + $soc->departement_id = stripslashes($_POST["departement_id"]); + $soc->tel = stripslashes($_POST["tel"]); + $soc->fax = stripslashes($_POST["fax"]); + $soc->url = ereg_replace( "http://", "", $_POST["url"] ); + $soc->siren = stripslashes($_POST["siren"]); + $soc->siret = stripslashes($_POST["siret"]); + $soc->ape = stripslashes($_POST["ape"]); + $soc->prefix_comm = stripslashes($_POST["prefix_comm"]); + $soc->code_client = stripslashes($_POST["code_client"]); + $soc->codeclient_modifiable = stripslashes($_POST["codeclient_modifiable"]); + $soc->capital = stripslashes($_POST["capital"]); + $soc->tva_intra = stripslashes($_POST["tva_intra_code"] . $_POST["tva_intra_num"]); + $soc->forme_juridique_code = stripslashes($_POST["forme_juridique_code"]); + $soc->effectif_id = stripslashes($_POST["effectif_id"]); + $soc->typent_id = stripslashes($_POST["typent_id"]); + $soc->client = stripslashes($_POST["client"]); + $soc->fournisseur = stripslashes($_POST["fournisseur"]); + + if ($_POST["action"] == 'update') { - $result = $soc->update($_GET["socid"],$user); - if ($result <> 0) - { - $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"; - $_GET["action"]= "edit"; - } - else - { - Header("Location: soc.php?socid=".$_GET["socid"]); - } - + $result = $soc->update($_GET["socid"],$user); + if ($result <> 0) + { + $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"; + $_GET["action"]= "edit"; + } + else + { + Header("Location: soc.php?socid=".$_GET["socid"]); + exit; + } + } - - if ($_POST["action"] == 'add') + + if ($_POST["action"] == 'add') { - $result = $soc->create($user); - - if ($result == 0) - { - Header("Location: soc.php?socid=".$soc->id); - } - else - { - $_GET["action"]='create'; - //dolibarr_print_error($db); - } + $result = $soc->create($user); + + if ($result == 0) + { + Header("Location: soc.php?socid=".$soc->id); + exit; + } + else + { + $_GET["action"]='create'; + //dolibarr_print_error($db); + } } }