diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php
index a9f6de5d8d5..d656585b518 100644
--- a/htdocs/includes/menus/barre_left/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php
@@ -180,7 +180,7 @@ class MenuLeft {
if ($user->rights->societe->creer)
{
$newmenu->add_submenu(DOL_URL_ROOT."/soc.php?action=create", $langs->trans("MenuNewThirdParty"));
- $newmenu->add_submenu(DOL_URL_ROOT."/soc.php?action=create&private=1",$langs->trans("MenuNewPrivateIndividual"));
+ if (! $conf->use_javascript) $newmenu->add_submenu(DOL_URL_ROOT."/soc.php?action=create&private=1",$langs->trans("MenuNewPrivateIndividual"));
}
if(is_dir("societe/groupe"))
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 9366a341c60..5ce8c908493 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -29,6 +29,10 @@ ThirdPartyProspects=Prospects
ThirdPartyCustomers=Customers
ThirdPartyCustomersWithIdProf12=Customers with %s or %s
ThirdPartySuppliers=Suppliers
+ThirdPartyType=Third party type
+Company/Fundation=Company/Fundation
+Individual=Private individual
+ToCreateContactWithSameName=Will create automatically a physical contact with same informations
ParentCompany=Parent company
ReportByCustomers=Report by customers
ReportByQuarter=Report by quarter
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index df901c77447..20834705f57 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -29,6 +29,10 @@ ThirdPartyProspects=Prospets
ThirdPartyCustomers=Clients
ThirdPartyCustomersWithIdProf12=Clients avec %s ou %s
ThirdPartySuppliers=Fournisseurs
+ThirdPartyType=Type du tiers
+Company/Fundation=Société/Association
+Individual=Individu privé
+ToCreateContactWithSameName=Créera automatiquement un contact physique avec info identiques
ReportByCustomers=Rapport par client
ReportByQuarter=Rapport par trimestre
ParentCompany=Maison mère
diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js
index 3a13eaa2874..90f2d91eb98 100644
--- a/htdocs/lib/lib_head.js
+++ b/htdocs/lib/lib_head.js
@@ -7,6 +7,13 @@
// \version $Revision$
+function dolibarr_type_reload(param)
+{
+ document.formsoc.action.value="create";
+ document.formsoc.private.value=param;
+ document.formsoc.cleartype.value=1;
+ document.formsoc.submit();
+}
/*=================================================================
Purpose: Pour la fonction de saisie auto des villes
diff --git a/htdocs/soc.php b/htdocs/soc.php
index a948209a094..7c97f56d791 100644
--- a/htdocs/soc.php
+++ b/htdocs/soc.php
@@ -92,12 +92,12 @@ if ($_POST["getsuppliercode"])
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer)
{
- if ($_POST["private"] == 1)
+ if ($_REQUEST["private"] == 1)
{
$soc->nom = $_POST["nom"].' '.$_POST["prenom"];
$soc->nom_particulier = $_POST["nom"];
$soc->prenom = $_POST["prenom"];
- $soc->particulier = $_POST["private"];
+ $soc->particulier = $_REQUEST["private"];
}
else
{
@@ -128,7 +128,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$soc->forme_juridique_code = $_POST["forme_juridique_code"];
$soc->effectif_id = $_POST["effectif_id"];
- if ($_POST["private"] == 1)
+ if ($_REQUEST["private"] == 1)
{
$soc->typent_id = 8; //todo prévoir autre méthode si le champs "particulier" change de rowid
}
@@ -240,8 +240,8 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
/*
* Fiche en mode creation
*/
- if ($user->rights->societe->creer)
- {
+ if ($user->rights->societe->creer)
+ {
// Charge objet modCodeTiers
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
@@ -259,327 +259,325 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
}
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
$modCodeFournisseur = new $module;
-
+
/*
- * Fiche societe en mode création
- */
- if ($_GET["type"]=='f') { $soc->fournisseur=1; }
- if ($_GET["type"]=='c') { $soc->client=1; }
- if ($_GET["type"]=='p') { $soc->client=2; }
- if ($_GET["private"]==1) { $soc->particulier=1; }
- if ($_POST["nom"])
- {
- $soc->nom=$_POST["nom"];
- $soc->prenom=$_POST["prenom"];
- $soc->particulier=$_POST["private"];
- $soc->prefix_comm=$_POST["prefix_comm"];
- $soc->client=$_POST["client"];
- $soc->code_client=$_POST["code_client"];
- $soc->fournisseur=$_POST["fournisseur"];
- $soc->code_fournisseur=$_POST["code_fournisseur"];
- $soc->adresse=$_POST["adresse"];
- $soc->cp=$_POST["cp"];
- $soc->ville=$_POST["ville"];
- $soc->departement_id=$_POST["departement_id"];
- $soc->tel=$_POST["tel"];
- $soc->fax=$_POST["fax"];
- $soc->email=$_POST["email"];
- $soc->url=$_POST["url"];
- $soc->capital=$_POST["capital"];
- $soc->siren=$_POST["idprof1"];
- $soc->siret=$_POST["idprof2"];
- $soc->ape=$_POST["idprof3"];
- $soc->idprof4=$_POST["idprof4"];
- $soc->typent_id=$_POST["typent_id"];
- $soc->effectif_id=$_POST["effectif_id"];
-
- $soc->tva_assuj = $_POST["assujtva_value"];
- $soc->tva_intra_code=$_POST["tva_intra_code"];
- $soc->tva_intra_num=$_POST["tva_intra_num"];
-
- $soc->commercial_id=$_POST["commercial_id"];
- }
+ * Fiche societe en mode création
+ */
+ if ($_GET["type"]=='f') { $soc->fournisseur=1; }
+ if ($_GET["type"]=='c') { $soc->client=1; }
+ if ($_GET["type"]=='p') { $soc->client=2; }
+ if ($_REQUEST["private"]==1) { $soc->particulier=1; }
- // On positionne pays_id, pays_code et libelle du pays choisi
- $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
- if ($soc->pays_id)
- {
- $sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$soc->pays_id;
- $resql=$db->query($sql);
- if ($resql)
- {
- $obj = $db->fetch_object($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
- $soc->pays_code=$obj->code;
- $soc->pays=$obj->libelle;
- }
-
- if (!$soc->particulier)
- {
- print_titre($langs->trans("NewCompany"));
- }
- else
- {
- print_titre($langs->trans("NewPrivateIndividual"));
- }
- print "
\n";
-
- if ($soc->error)
- {
- print '