diff --git a/htdocs/soc.php b/htdocs/soc.php index 1668b0eae82..be39e912813 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -27,15 +27,14 @@ require("pre.inc.php"); $langs->load("soc"); - /* * Sécurité accés client */ if ($user->societe_id > 0) { - $_POST["action"] = ''; $_GET["action"] = ''; - $socid = $user->societe_id; + $_POST["action"] = ''; + $_GET["socid"] = $user->societe_id; } if ($_POST["action"] == 'add' or $_POST["action"] == 'update') @@ -60,6 +59,179 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update') $soc->client = $_POST["client"]; $soc->fournisseur = $_POST["fournisseur"]; + if ($_POST["action"] == 'update') + { + $soc->update($socid); + } + if ($_POST["action"] == 'add') + { + $socid = $soc->create(); + Header("Location: soc.php?socid=$socid"); + } +} + +/* + * + * + */ +llxHeader(); +$form = new Form($db); + +if ($_GET["action"] == 'create') +{ + if ($user->rights->societe->creer) { + /* + * Fiche societe en mode création + */ + $soc = new Societe($db); + if ($_GET["type"]=='f') { $soc->fournisseur=1; } + if ($_GET["type"]=='c') { $soc->client=1; } + if ($_GET["type"]=='p') { $soc->client=2; } + + print '
'.$langs->trans("NewCompany").'

'; + print '
'; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + print '
'.$langs->trans('Name').'
'.$langs->trans('Address').'
'.$langs->trans('Zip').' '; + print $langs->trans('Town').' '.$langs->trans('State').''; + print $form->select_departement($soc->departement_id); + print '
'.$langs->trans('Country').''; + print $form->select_pays($soc->pays_id); + print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('Web').'http://
'.$langs->trans('ProfIdSiren').''.$langs->trans('ProfIdSiret').'
'.$langs->trans('Ape').'Capital '.MAIN_MONNAIE.'
Forme juridique'; + print $form->select_forme_juridique($soc->forme_juridique_code); + print '
Effectif'; + print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); + print '
'.$langs->trans('TVAIntra').''; + + print ''; + print ''; + print '
Vous pouvez vérifier ce numéro sur le site de la commission européenne'; + print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('Supplier').'
'; + print '
'; + } +} +elseif ($_GET["action"] == 'edit') +{ + /* + * Fiche societe en mode edition + */ + + print_titre("Edition de la société"); + + if ($_GET["socid"]) + { + $soc = new Societe($db); + $soc->id = $_GET["socid"]; + $soc->fetch($_GET["socid"]); + + print '
'; + print ''; + + print ''; + print ''; + print ''; + + print ''; + print ''; + + print ''; + + print ''; + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + print '
Nom
'.$langs->trans('Adresse').'
CP '; + print 'Ville Département/Province/Canton'; + print $form->select_departement($soc->departement_id); + print '
Pays'; + print $form->select_pays($soc->pays_id); + print '
'.$langs->trans('Téléphone').''.$langs->trans('Fax').'
Webhttp://
SirenSiret
ApeCapital '.MAIN_MONNAIE.'
Forme juridique'; + print $form->select_forme_juridique($soc->forme_juridique_code); + print '
Effectif'; + print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); + print '
Numéro de TVA Intracommunautaire'; + + print ''; + print ''; + + print '
Prospect / ClientFournisseur'; + + print '
'; + print '
'; + + print 'Astuce : Vous pouvez vérifier le numéro de TVA intra communautaire sur le site de la commission européenne'; + + } +} +else +{ + $soc = new Societe($db); + $soc->id = $_GET["socid"]; $soc->fetch($_GET["socid"]); $head[0][0] = 'soc.php?socid='.$soc->id; @@ -143,7 +315,7 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update') */ print '
'; - print 'Editer'; + print 'Editer'; print 'Ajouter un contact'; @@ -157,3 +329,4 @@ $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?> +