* Copyright (C) 2003 Brian Fraval * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ * */ require("pre.inc.php"); /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } if ($HTTP_POST_VARS["action"] == 'add' or $HTTP_POST_VARS["action"] == 'update') { $soc = new Societe($db); $soc->nom = $HTTP_POST_VARS["nom"]; $soc->adresse = $HTTP_POST_VARS["adresse"]; $soc->cp = $HTTP_POST_VARS["cp"]; $soc->ville = $HTTP_POST_VARS["ville"]; $soc->pays_id = $HTTP_POST_VARS["pays_id"]; $soc->departement_id = $HTTP_POST_VARS["departement_id"]; $soc->tel = $HTTP_POST_VARS["tel"]; $soc->fax = $HTTP_POST_VARS["fax"]; $soc->url = ereg_replace( "http://", "", $HTTP_POST_VARS["url"] ); $soc->siren = $HTTP_POST_VARS["siren"]; $soc->siret = $HTTP_POST_VARS["siret"]; $soc->ape = $HTTP_POST_VARS["ape"]; $soc->capital = $HTTP_POST_VARS["capital"]; $soc->tva_intra = $HTTP_POST_VARS["tva_intra_code"] . $HTTP_POST_VARS["tva_intra_num"]; $soc->forme_juridique_id = $HTTP_POST_VARS["forme_juridique_id"]; $soc->effectif_id = $HTTP_POST_VARS["effectif_id"]; $soc->client = $HTTP_POST_VARS["client"]; $soc->fournisseur = $HTTP_POST_VARS["fournisseur"]; if ($HTTP_POST_VARS["action"] == 'update') { $soc->update($socid); } if ($HTTP_POST_VARS["action"] == 'add') { $socid = $soc->create(); } } /* * * */ llxHeader(); $form = new Form($db); if ($action == 'create') { $soc = new Societe($db); print '
Nouvelle société (prospect, client, fournisseur)

'; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Nom
Adresse
CP '; print 'Ville Département'; print $form->select_departement(0); print '
Pays'; print $form->select_pays($soc->pays_id); print '
TéléphoneFax
Webhttp://
SirenSiret
ApeCapital '.MAIN_MONNAIE.'
Forme juridique'; print $form->select_array("forme_juridique_id",$soc->forme_juridique_array(), $soc->forme_juridique, 0, 1); print '
Effectif'; print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id); print '
Numéro de TVA Intracommunautaire'; print ''; print ''; print '
Vous pouvez vérifier ce numéro sur le site de la commission européenne'; print '
Prospect / ClientFournisseur
'; print '
'; } elseif ($action == 'edit') { print_titre("Edition de la société"); if ($socid) { $soc = new Societe($db); $soc->id = $socid; $soc->fetch($socid); print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Nom
Adresse
CP '; print 'Ville Département'; print $form->select_departement($soc->departement_id); print '
Pays'; print $form->select_pays($soc->pays_id); print '
TéléphoneFax
Webhttp://
SirenSiret
ApeCapital '.MAIN_MONNAIE.'
Forme juridique'; $html = new Form($db); print $html->select_array("forme_juridique_id",$soc->forme_juridique_array(), $soc->forme_juridique_id,0,1); print '
Effectif'; print $html->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 = $socid; $soc->fetch($socid); $head[0][0] = 'soc.php?socid='.$soc->id; $head[0][1] = "Fiche société"; $h = 1; if ($soc->client==1) { $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; $head[$h][1] = 'Fiche client'; $h++; } if ($soc->client==2) { $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; $head[$h][1] = 'Fiche prospect'; $h++; } if ($soc->fournisseur) { $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; $head[$h][1] = 'Fiche fournisseur'; $h++; } $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; $head[$h][1] = 'Note'; $h++; if ($user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; $head[$h][1] = 'Documents'; $h++; } $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; $head[$h][1] = 'Notifications'; dolibarr_fiche_head($head, 0); /* * */ print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Nom'.$soc->nom.'
Adresse'.nl2br($soc->adresse).' '; print '
'.$soc->cp.' '.$soc->ville.'
'.$soc->pays.'
Téléphone'.dolibarr_print_phone($soc->tel).'Fax'.dolibarr_print_phone($soc->fax).'
Web'; if ($soc->url) { print 'http://'.$soc->url.''; } print '
Siren'.$soc->siren.' Siret'.$soc->siret.'
Ape'.$soc->ape.'Capital'.$soc->capital.' '.MAIN_MONNAIE.'
Forme juridique'.$soc->forme_juridique.'
Effectif'.$soc->effectif.'
Numéro de TVA Intracommunautaire'; print $soc->tva_intra; print '
'; print '
'; /* * */ print '
'; print 'Editer'; print 'Ajouter un contact'; print 'Notifications'; print '
'; /* * */ } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>