Fix: Quand on crée un tiers de type personne individu, on avait plus accès à des champs qui peuvent exister meme pour un individu physique (ex indépendant en EURL).
Fix: Le champ type de tiers n'était pas renseigné à particulier qd on créé un particulier. De plus, un particulier doit rester appelé "tiers" pour mieux comprendre la compta. Je modifie donc la "présentation" de la fonctionnalité du mode de création des triers de type particulier pour etre moins perturbante et gérer le champ type et j'ajoute le texte "Créera automatiquement un contact physique avec info identiques".
This commit is contained in:
parent
d4569d10e6
commit
64c8da5a73
@ -180,7 +180,7 @@ class MenuLeft {
|
|||||||
if ($user->rights->societe->creer)
|
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", $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"))
|
if(is_dir("societe/groupe"))
|
||||||
|
|||||||
@ -29,6 +29,10 @@ ThirdPartyProspects=Prospects
|
|||||||
ThirdPartyCustomers=Customers
|
ThirdPartyCustomers=Customers
|
||||||
ThirdPartyCustomersWithIdProf12=Customers with %s or %s
|
ThirdPartyCustomersWithIdProf12=Customers with %s or %s
|
||||||
ThirdPartySuppliers=Suppliers
|
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
|
ParentCompany=Parent company
|
||||||
ReportByCustomers=Report by customers
|
ReportByCustomers=Report by customers
|
||||||
ReportByQuarter=Report by quarter
|
ReportByQuarter=Report by quarter
|
||||||
|
|||||||
@ -29,6 +29,10 @@ ThirdPartyProspects=Prospets
|
|||||||
ThirdPartyCustomers=Clients
|
ThirdPartyCustomers=Clients
|
||||||
ThirdPartyCustomersWithIdProf12=Clients avec %s ou %s
|
ThirdPartyCustomersWithIdProf12=Clients avec %s ou %s
|
||||||
ThirdPartySuppliers=Fournisseurs
|
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
|
ReportByCustomers=Rapport par client
|
||||||
ReportByQuarter=Rapport par trimestre
|
ReportByQuarter=Rapport par trimestre
|
||||||
ParentCompany=Maison mère
|
ParentCompany=Maison mère
|
||||||
|
|||||||
@ -7,6 +7,13 @@
|
|||||||
// \version $Revision$
|
// \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
|
Purpose: Pour la fonction de saisie auto des villes
|
||||||
|
|||||||
@ -92,12 +92,12 @@ if ($_POST["getsuppliercode"])
|
|||||||
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
||||||
&& ($_POST["action"] == 'add' || $_POST["action"] == 'update') && $user->rights->societe->creer)
|
&& ($_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 = $_POST["nom"].' '.$_POST["prenom"];
|
||||||
$soc->nom_particulier = $_POST["nom"];
|
$soc->nom_particulier = $_POST["nom"];
|
||||||
$soc->prenom = $_POST["prenom"];
|
$soc->prenom = $_POST["prenom"];
|
||||||
$soc->particulier = $_POST["private"];
|
$soc->particulier = $_REQUEST["private"];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -128,7 +128,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
|||||||
|
|
||||||
$soc->forme_juridique_code = $_POST["forme_juridique_code"];
|
$soc->forme_juridique_code = $_POST["forme_juridique_code"];
|
||||||
$soc->effectif_id = $_POST["effectif_id"];
|
$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
|
$soc->typent_id = 8; //todo prévoir autre méthode si le champs "particulier" change de rowid
|
||||||
}
|
}
|
||||||
@ -266,12 +266,11 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
if ($_GET["type"]=='f') { $soc->fournisseur=1; }
|
if ($_GET["type"]=='f') { $soc->fournisseur=1; }
|
||||||
if ($_GET["type"]=='c') { $soc->client=1; }
|
if ($_GET["type"]=='c') { $soc->client=1; }
|
||||||
if ($_GET["type"]=='p') { $soc->client=2; }
|
if ($_GET["type"]=='p') { $soc->client=2; }
|
||||||
if ($_GET["private"]==1) { $soc->particulier=1; }
|
if ($_REQUEST["private"]==1) { $soc->particulier=1; }
|
||||||
if ($_POST["nom"])
|
|
||||||
{
|
|
||||||
$soc->nom=$_POST["nom"];
|
$soc->nom=$_POST["nom"];
|
||||||
$soc->prenom=$_POST["prenom"];
|
$soc->prenom=$_POST["prenom"];
|
||||||
$soc->particulier=$_POST["private"];
|
$soc->particulier=$_REQUEST["private"];
|
||||||
$soc->prefix_comm=$_POST["prefix_comm"];
|
$soc->prefix_comm=$_POST["prefix_comm"];
|
||||||
$soc->client=$_POST["client"];
|
$soc->client=$_POST["client"];
|
||||||
$soc->code_client=$_POST["code_client"];
|
$soc->code_client=$_POST["code_client"];
|
||||||
@ -290,15 +289,14 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
$soc->siret=$_POST["idprof2"];
|
$soc->siret=$_POST["idprof2"];
|
||||||
$soc->ape=$_POST["idprof3"];
|
$soc->ape=$_POST["idprof3"];
|
||||||
$soc->idprof4=$_POST["idprof4"];
|
$soc->idprof4=$_POST["idprof4"];
|
||||||
$soc->typent_id=$_POST["typent_id"];
|
$soc->typent_id=($_POST["typent_id"]&&!$_POST["cleartype"])?$_POST["typent_id"]:($_REQUEST["private"]?'TE_PRIVATE':'');
|
||||||
$soc->effectif_id=$_POST["effectif_id"];
|
$soc->effectif_id=($_POST["effectif_id"]&&!$_POST["cleartype"])?$_POST["effectif_id_id"]:($_REQUEST["private"]?'EF1-5':'');
|
||||||
|
|
||||||
$soc->tva_assuj = $_POST["assujtva_value"];
|
$soc->tva_assuj = $_POST["assujtva_value"];
|
||||||
$soc->tva_intra_code=$_POST["tva_intra_code"];
|
$soc->tva_intra_code=$_POST["tva_intra_code"];
|
||||||
$soc->tva_intra_num=$_POST["tva_intra_num"];
|
$soc->tva_intra_num=$_POST["tva_intra_num"];
|
||||||
|
|
||||||
$soc->commercial_id=$_POST["commercial_id"];
|
$soc->commercial_id=$_POST["commercial_id"];
|
||||||
}
|
|
||||||
|
|
||||||
// On positionne pays_id, pays_code et libelle du pays choisi
|
// 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;
|
$soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||||
@ -318,15 +316,24 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
$soc->pays=$obj->libelle;
|
$soc->pays=$obj->libelle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$soc->particulier)
|
|
||||||
{
|
|
||||||
print_titre($langs->trans("NewCompany"));
|
print_titre($langs->trans("NewCompany"));
|
||||||
}
|
|
||||||
else
|
//$conf->use_javascript=0;
|
||||||
|
if ($conf->use_javascript)
|
||||||
{
|
{
|
||||||
print_titre($langs->trans("NewPrivateIndividual"));
|
|
||||||
}
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
print $langs->trans("ThirdPartyType").': ';
|
||||||
|
print '<input type="radio" class="flat" name="private" value="0"'.(! $_REQUEST["private"]?' checked="true"':'');
|
||||||
|
print 'onclick="dolibarr_type_reload(0)"';
|
||||||
|
print '> '.$langs->trans("Company/Fundation");
|
||||||
|
print ' ';
|
||||||
|
print '<input type="radio" class="flat" name="private" value="1"'.(! $_REQUEST["private"]?'':' checked="true"');
|
||||||
|
print 'onclick="dolibarr_type_reload(1)"';
|
||||||
|
print '> '.$langs->trans("Individual");
|
||||||
|
print ' ('.$langs->trans("ToCreateContactWithSameName").')';
|
||||||
|
print "<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if ($soc->error)
|
if ($soc->error)
|
||||||
{
|
{
|
||||||
@ -338,6 +345,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
print '<form action="soc.php" method="post" name="formsoc">';
|
print '<form action="soc.php" method="post" name="formsoc">';
|
||||||
|
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
print '<input type="hidden" name="cleartype" value="0">';
|
||||||
print '<input type="hidden" name="private" value='.$soc->particulier.'>';
|
print '<input type="hidden" name="private" value='.$soc->particulier.'>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -438,8 +446,6 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
print '<tr><td>'.$langs->trans('EMail').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>';
|
print '<tr><td>'.$langs->trans('EMail').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>';
|
||||||
print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>';
|
print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>';
|
||||||
|
|
||||||
if (!$soc->particulier)
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||||
|
|
||||||
if ($soc->pays_code == 'FR')
|
if ($soc->pays_code == 'FR')
|
||||||
@ -449,6 +455,8 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
$maxlength3=4;
|
$maxlength3=4;
|
||||||
$maxlength4=12;
|
$maxlength4=12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Id prof
|
||||||
print '<tr><td>'.($langs->transcountry("ProfId1",$soc->pays_code) != '-'?$langs->transcountry('ProfId1',$soc->pays_code):'').'</td><td>';
|
print '<tr><td>'.($langs->transcountry("ProfId1",$soc->pays_code) != '-'?$langs->transcountry('ProfId1',$soc->pays_code):'').'</td><td>';
|
||||||
if ($soc->pays_id)
|
if ($soc->pays_id)
|
||||||
{
|
{
|
||||||
@ -509,30 +517,20 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>'."\n";
|
print '<tr><td>'.$langs->trans("Type").'</td><td>'."\n";
|
||||||
$form->select_array("typent_id",$soc->typent_array(), $soc->typent_id);
|
$form->select_array("typent_id",$soc->typent_array(1), $soc->typent_id);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
print '<td>'.$langs->trans("Staff").'</td><td>';
|
||||||
$form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
$form->select_array("effectif_id",$soc->effectif_array(1), $soc->effectif_id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
|
||||||
|
|
||||||
// Assujeti TVA
|
// Assujeti TVA
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
print '<tr><td>'.$langs->trans('VATIsUsed').'</td>';
|
print '<tr><td>'.$langs->trans('VATIsUsed').'</td>';
|
||||||
if ($soc->particulier)
|
|
||||||
{
|
|
||||||
print '<td colspan="3">';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
}
|
|
||||||
$html->select_YesNo("1",'assujtva_value'); // Assujeti par défaut en creation
|
$html->select_YesNo("1",'assujtva_value'); // Assujeti par défaut en creation
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Code TVA intra
|
// Code TVA intra
|
||||||
if (!$soc->particulier)
|
|
||||||
{
|
|
||||||
if ($conf->use_javascript)
|
if ($conf->use_javascript)
|
||||||
{
|
{
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -558,7 +556,7 @@ if ($_POST["getcustomercode"] || $_POST["getsuppliercode"] ||
|
|||||||
print $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
print $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank" alt="'.$langs->trans("VATIntraCheckableOnEUSite").'">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if ($user->rights->commercial->client->voir)
|
if ($user->rights->commercial->client->voir)
|
||||||
|
|||||||
@ -1309,9 +1309,10 @@ class Societe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la liste des libellés traduits des types actifs de sociétés
|
* \brief Renvoie la liste des libellés traduits des types actifs de sociétés
|
||||||
* \return array tableau des types
|
* \param mode 0=renvoi id+libelle, 1=renvoi code+libelle
|
||||||
|
* \return array tableau des typesl
|
||||||
*/
|
*/
|
||||||
function typent_array()
|
function typent_array($mode=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -1330,10 +1331,13 @@ class Societe
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
if (! $mode) $key=$objp->id;
|
||||||
|
else $key=$objp->code;
|
||||||
|
|
||||||
if ($langs->trans($objp->code) != $objp->code)
|
if ($langs->trans($objp->code) != $objp->code)
|
||||||
$effs[$objp->id] = $langs->trans($objp->code);
|
$effs[$key] = $langs->trans($objp->code);
|
||||||
else
|
else
|
||||||
$effs[$objp->id] = $objp->libelle!='-'?$objp->libelle:'';
|
$effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
@ -1345,13 +1349,14 @@ class Societe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre)
|
* \brief Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre)
|
||||||
|
* \param mode 0=renvoi id+libelle, 1=renvoi code+libelle
|
||||||
* \return array tableau des types d'effectifs
|
* \return array tableau des types d'effectifs
|
||||||
*/
|
*/
|
||||||
function effectif_array()
|
function effectif_array($mode=0)
|
||||||
{
|
{
|
||||||
$effs = array();
|
$effs = array();
|
||||||
|
|
||||||
$sql = "SELECT id, libelle";
|
$sql = "SELECT id, code, libelle";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||||
$sql .= " ORDER BY id ASC";
|
$sql .= " ORDER BY id ASC";
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
@ -1362,7 +1367,10 @@ class Societe
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object();
|
$objp = $this->db->fetch_object();
|
||||||
$effs[$objp->id] = $objp->libelle!='-'?$objp->libelle:'';
|
if (! $mode) $key=$objp->id;
|
||||||
|
else $key=$objp->code;
|
||||||
|
|
||||||
|
$effs[$key] = $objp->libelle!='-'?$objp->libelle:'';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user