2004-10-20 23:06:45 +02:00
< ? php
2004-02-08 12:53:42 +01:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2004-02-02 04:23:46 +01:00
* Copyright ( C ) 2003 Brian Fraval < brian @ fraval . org >
2005-01-18 19:47:04 +01:00
* Copyright ( C ) 2004 - 2005 Laurent Destailleur < eldy @ users . sourceforge . net >
2003-10-08 16:57:09 +02:00
*
2002-04-30 12:51:35 +02:00
* 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 .
*
2002-05-29 17:18:01 +02:00
* $Id $
* $Source $
*
2002-04-30 12:51:35 +02:00
*/
2005-01-18 19:47:04 +01:00
/** \file htdocs / soc . php
2004-11-12 01:50:14 +01:00
\ingroup societe
\brief Onglet societe d ' une societe
\version $Revision $
*/
2003-09-11 22:18:51 +02:00
require ( " pre.inc.php " );
2004-12-15 11:34:58 +01:00
$user -> getrights ( 'societe' );
2004-07-25 18:19:33 +02:00
$langs -> load ( " companies " );
2004-07-13 23:25:53 +02:00
2003-06-30 17:55:14 +02:00
/*
* S<EFBFBD> curit<EFBFBD> acc<EFBFBD> s client
*/
if ( $user -> societe_id > 0 )
{
2004-07-14 11:54:44 +02:00
$_GET [ " action " ] = '' ;
2004-07-14 12:03:01 +02:00
$_POST [ " action " ] = '' ;
$_GET [ " socid " ] = $user -> societe_id ;
2003-06-30 17:55:14 +02:00
}
2004-08-08 23:46:14 +02:00
$soc = new Societe ( $db );
2005-02-13 18:27:02 +01:00
$step = $_POST [ " step " ];
if ( $_POST [ " createnextstep " ]) { $step ++ ; $_GET [ " action " ] = " create " ; }
if ( $_POST [ " createpreviousstep " ]) { $step -- ; $_GET [ " action " ] = " create " ; }
if ( ! $step ) $step ++ ;
/*
* Actions
*/
if (( $_POST [ " action " ] == 'add' && ( ! defined ( COMPANY_CREATE_TWO_STEPS ) || $step == 2 )) or $_POST [ " action " ] == 'update' )
2002-12-12 22:04:06 +01:00
{
2005-01-30 00:49:07 +01:00
$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 " ]);
2004-12-09 13:09:14 +01:00
$soc -> url = ereg_replace ( " http:// " , " " , $_POST [ " url " ] );
2005-01-30 00:49:07 +01:00
$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 -> client = stripslashes ( $_POST [ " client " ]);
$soc -> fournisseur = stripslashes ( $_POST [ " fournisseur " ]);
2004-05-20 13:27:54 +02:00
2004-07-14 12:03:01 +02:00
if ( $_POST [ " action " ] == 'update' )
{
2004-08-08 23:57:43 +02:00
$result = $soc -> update ( $_GET [ " socid " ], $user );
2004-12-08 14:23:14 +01:00
if ( $result <> 0 )
2004-07-27 16:53:14 +02:00
{
$soc -> id = $_GET [ " socid " ];
// doublon sur le prefix comm
$no_reload = 1 ;
2005-02-13 18:27:02 +01:00
$mesg = $soc -> error ; //"Erreur, le prefix '".$soc->prefix_comm."' existe d<> j<EFBFBD> vous devez en choisir un autre";
2004-07-27 16:53:14 +02:00
$_GET [ " action " ] = " edit " ;
}
2004-11-23 10:50:00 +01:00
else
{
Header ( " Location: soc.php?socid= " . $_GET [ " socid " ]);
}
2004-07-27 16:53:14 +02:00
2004-07-14 12:03:01 +02:00
}
2004-12-08 14:23:14 +01:00
2004-07-14 12:03:01 +02:00
if ( $_POST [ " action " ] == 'add' )
{
2004-12-08 14:34:05 +01:00
$result = $soc -> create ( $user );
if ( $result == 0 )
{
Header ( " Location: soc.php?socid= " . $soc -> id );
}
else
{
$_GET [ " action " ] = 'create' ;
//dolibarr_print_error($db);
}
2004-07-14 12:03:01 +02:00
}
}
2004-12-15 11:34:58 +01:00
if ( $_POST [ " action " ] == 'confirm_delete' && $_POST [ " confirm " ] == 'yes' && $user -> rights -> societe -> creer )
{
$soc = new Societe ( $db );
$soc -> fetch ( $_GET [ " socid " ]);
$result = $soc -> delete ( $_GET [ " socid " ]);
if ( $result == 0 )
{
llxHeader ();
2005-01-30 01:07:13 +01:00
print '<div class="ok">' . $langs -> trans ( " CompanyDeleted " , $soc -> nom ) . '</div>' ;
2004-12-15 11:34:58 +01:00
llxFooter ();
exit ;
}
else
{
$no_reload = 1 ;
$_GET [ " action " ] = '' ;
}
}
/**
*
*
*/
2004-08-08 23:46:14 +02:00
2004-07-14 12:03:01 +02:00
llxHeader ();
2004-08-08 23:46:14 +02:00
2004-07-14 12:03:01 +02:00
$form = new Form ( $db );
2005-02-13 18:27:02 +01:00
if ( $_GET [ " action " ] == 'create' || $_POST [ " action " ] == 'create' )
2004-07-14 12:03:01 +02:00
{
2004-07-21 10:46:32 +02:00
if ( $user -> rights -> societe -> creer )
{
/*
2005-02-13 18:27:02 +01:00
* Fiche societe en mode cr<EFBFBD> ation ( Creation en 1 ou 2 temps selon COMPANY_CREATE_TWO_STEPS )
2004-07-21 10:46:32 +02:00
*/
2004-11-24 12:16:40 +01:00
$soc -> fournisseur = 0 ;
2004-07-21 10:46:32 +02:00
if ( $_GET [ " type " ] == 'f' ) { $soc -> fournisseur = 1 ; }
if ( $_GET [ " type " ] == 'c' ) { $soc -> client = 1 ; }
if ( $_GET [ " type " ] == 'p' ) { $soc -> client = 2 ; }
2005-02-13 18:27:02 +01:00
if ( $_POST [ " nom " ]) { $soc -> nom = $_POST [ " nom " ]; }
2004-07-21 10:46:32 +02:00
2004-08-07 02:24:39 +02:00
print_titre ( $langs -> trans ( " NewCompany " ));
print " <br> \n " ;
2005-02-13 18:27:02 +01:00
2005-01-30 00:49:07 +01:00
if ( $soc -> error )
2004-12-08 14:34:05 +01:00
{
2005-01-30 01:07:13 +01:00
print '<div class="error">' ;
2005-01-30 00:49:07 +01:00
print nl2br ( $soc -> error );
2004-12-08 14:34:05 +01:00
print '</div>' ;
}
2004-07-21 10:46:32 +02:00
print '<form action="soc.php" method="post">' ;
2004-12-09 14:16:58 +01:00
print '<input type="hidden" name="codeclient_modifiable" value="1">' ;
2004-07-21 10:46:32 +02:00
2004-11-12 01:50:14 +01:00
print '<table class="border" width="100%">' ;
2004-12-18 19:57:24 +01:00
2005-02-13 18:27:02 +01:00
print '<tr><td>' . $langs -> trans ( 'Name' ) . '</td><td colspan="3"><input type="text" size="30" name="nom" value="' . $soc -> nom . '"></td></tr>' ;
// On positionne pays_id, pays_code et libelle du pays choisi
$soc -> pays_id = $_POST [ " pays_id " ] ? $_POST [ " pays_id " ] : ( defined ( MAIN_INFO_SOCIETE_PAYS ) ? MAIN_INFO_SOCIETE_PAYS : '' );
if ( $soc -> pays_id ) {
$sql = " SELECT code, libelle from " . MAIN_DB_PREFIX . " c_pays where rowid = " . $soc -> pays_id ;
$result = $db -> query ( $sql );
if ( $result )
{
$obj = $db -> fetch_object ( $result );
}
else {
dolibarr_print_error ( $db );
}
$soc -> pays_code = $obj -> code ;
$soc -> pays = $obj -> libelle ;
}
if ( $step == 1 && defined ( COMPANY_CREATE_TWO_STEPS )) {
print '<tr><td width="140">' . $langs -> trans ( 'Country' ) . '</td><td colspan="3">' ;
$form -> select_pays ( $soc -> pays_id );
print '</td></tr>' ;
print '<input type="hidden" name="step" value="' . $step . '">' ;
print '<input type="hidden" name="action" value="create">' ;
print '<tr><td colspan="4" align="center"><input type="submit" name="createnextstep" value="' . $langs -> trans ( 'NextStep' ) . '"></td></tr>' . " \n " ;
}
if ( $step == 2 || ! defined ( COMPANY_CREATE_TWO_STEPS )) {
if ( defined ( COMPANY_CREATE_TWO_STEPS )) {
print '<tr><td width="140">' . $langs -> trans ( 'Country' ) . '</td><td colspan="3">' ;
print $soc -> pays ;
print '<input type="hidden" name="pays_id" value="' . $soc -> pays_id . '">' ;
print '</td></tr>' ;
} else {
print '<tr><td>' . $langs -> trans ( 'Country' ) . '</td><td colspan="3">' ;
$form -> select_pays ( $soc -> pays_id );
print '</td></tr>' ;
}
print '<input type="hidden" name="step" value="' . $step . '">' ;
print '<input type="hidden" name="action" value="add">' ;
print '<tr><td>' . $langs -> trans ( 'Address' ) . '</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">' ;
print $soc -> adresse ;
print '</textarea></td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'Zip' ) . '</td><td><input size="6" type="text" name="cp" value="' . $soc -> cp . '"></td>' ;
print '<td>' . $langs -> trans ( 'Town' ) . '</td><td><input type="text" name="ville" value="' . $soc -> ville . '"></td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'State' ) . '</td><td colspan="3">' ;
2005-02-13 19:16:02 +01:00
$form -> select_departement ( $soc -> departement_id ,( defined ( COMPANY_CREATE_TWO_STEPS ) ? $soc -> pays_code : 0 ));
2005-02-13 18:27:02 +01:00
print '</td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'Phone' ) . '</td><td><input type="text" name="tel"></td>' ;
print '<td>' . $langs -> trans ( 'Fax' ) . '</td><td><input type="text" name="fax"></td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'CustomerCode' ) . '</td><td colspan="3"><input size="16" type="text" name="code_client" maxlength="15" value="' . $soc -> code_client . '"></td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'Web' ) . '</td><td colspan="3"><input type="text" name="url" size="40" value="' . $soc -> url . '"></td></tr>' ;
print '<tr><td>' . $langs -> transcountry ( 'ProfId1' , $soc -> pays_code ) . '</td><td><input type="text" name="siren" size="15" maxlength="9" value="' . $soc -> siren . '"></td>' ;
print '<td>' . $langs -> transcountry ( 'ProfId2' , $soc -> pays_code ) . '</td><td><input type="text" name="siret" size="15" maxlength="14" value="' . $soc -> siret . '"></td></tr>' ;
print '<tr><td>' . $langs -> transcountry ( 'ProfId3' , $soc -> pays_code ) . '</td><td><input type="text" name="ape" size="5" maxlength="4" value="' . $soc -> ape . '"></td><td colspan="2"> </td></tr>' ;
2004-07-21 10:46:32 +02:00
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> trans ( 'Capital' ) . '</td><td colspan="3"><input type="text" name="capital" size="10" value="' . $soc -> capital . '"> ' . $conf -> monnaie . '</td></tr>' ;
2005-02-13 18:27:02 +01:00
print '<tr><td>Forme juridique</td><td colspan="3">' ;
2005-02-13 19:16:02 +01:00
$form -> select_forme_juridique ( $soc -> forme_juridique_code ,( defined ( COMPANY_CREATE_TWO_STEPS ) ? $soc -> pays_code : 0 ));
2005-02-13 18:27:02 +01:00
print '</td></tr>' ;
print '<tr><td>Effectif</td><td colspan="3">' ;
$form -> select_array ( " effectif_id " , $soc -> effectif_array (), $soc -> effectif_id );
print '</td></tr>' ;
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> trans ( 'TVAIntra' ) . '</td><td colspan="3">' ;
2005-02-13 18:27:02 +01:00
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="' . $soc -> tva_intra_code . '">' ;
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="' . $soc -> tva_intra_num . '">' ;
print '<br>Vous pouvez v<> rifier ce num<75> ro sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission europ<6F> enne' ;
print '</td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'ProspectCustomer' ) . '</td><td><select name="client">' ;
print '<option value="2"' . ( $soc -> client == 2 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Prospect' ) . '</option>' ;
print '<option value="1"' . ( $soc -> client == 1 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Customer' ) . '</option>' ;
print '<option value="0"' . ( $soc -> client == 0 ? ' selected' : '' ) . '>Ni client, ni prospect</option>' ;
print '</select></td>' . " \n " ;
print '<td>' . $langs -> trans ( 'Supplier' ) . '</td><td>' . " \n " ;
$form -> selectyesnonum ( " fournisseur " , $soc -> fournisseur );
print '</td></tr>' . " \n " ;
print '<tr><td colspan="4" align="center">' ;
if ( defined ( COMPANY_CREATE_TWO_STEPS )) {
print '<input type="submit" name="createpreviousstep" value="' . $langs -> trans ( 'PreviousStep' ) . '"> ' ;
}
print '<input type="submit" value="' . $langs -> trans ( 'AddCompany' ) . '"></td></tr>' . " \n " ;
}
2004-07-21 10:46:32 +02:00
2004-11-24 11:49:04 +01:00
print '</table>' . " \n " ;
print '</form>' . " \n " ;
2005-02-13 18:27:02 +01:00
2004-07-21 10:46:32 +02:00
}
2004-07-14 12:03:01 +02:00
}
elseif ( $_GET [ " action " ] == 'edit' )
{
/*
* Fiche societe en mode edition
*/
2005-02-10 23:09:20 +01:00
print_titre ( $langs -> trans ( " EditCompany " ));
2004-07-14 12:03:01 +02:00
if ( $_GET [ " socid " ])
{
2004-07-27 16:53:14 +02:00
if ( $no_reload <> 1 )
{
$soc = new Societe ( $db );
$soc -> id = $_GET [ " socid " ];
$soc -> fetch ( $_GET [ " socid " ]);
}
2004-12-09 13:09:14 +01:00
2005-01-30 00:49:07 +01:00
if ( $soc -> error )
2004-12-08 14:23:14 +01:00
{
2005-01-30 00:49:07 +01:00
print '<div class="error">' ;
print $soc -> error ;
2004-12-08 14:23:14 +01:00
print '</div>' ;
}
2004-07-14 12:03:01 +02:00
print '<form action="soc.php?socid=' . $soc -> id . '" method="post">' ;
print '<input type="hidden" name="action" value="update">' ;
2004-12-09 13:09:14 +01:00
print '<input type="hidden" name="codeclient_modifiable" value="' . $soc -> codeclient_modifiable . '">' ;
2004-07-14 12:03:01 +02:00
2004-10-10 16:15:00 +02:00
print '<table class="border" width="100%">' ;
2004-07-27 16:53:14 +02:00
2005-01-30 00:49:07 +01:00
print '<tr><td>' . $langs -> trans ( 'Name' ) . '</td><td><input type="text" size="40" name="nom" value="' . $soc -> nom . '"></td>' ;
2004-12-18 19:57:24 +01:00
print '<td>' . $langs -> trans ( 'Prefix' ) . '</td><td><input type="text" size="5" name="prefix_comm" value="' . $soc -> prefix_comm . '"></td></tr>' ;
2004-07-27 16:53:14 +02:00
2004-12-18 19:57:24 +01:00
print '<tr><td valign="top">' . $langs -> trans ( 'Address' ) . '</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">' ;
2004-07-14 12:03:01 +02:00
print $soc -> adresse ;
print '</textarea></td></tr>' ;
2004-12-18 19:57:24 +01:00
print '<tr><td>' . $langs -> trans ( 'Zip' ) . '</td><td><input size="6" type="text" name="cp" value="' . $soc -> cp . '"></td>' ;
print '<td>' . $langs -> trans ( 'Town' ) . '</td><td><input type="text" name="ville" value="' . $soc -> ville . '"></td></tr>' ;
print '<tr><td>' . $langs -> trans ( 'State' ) . '</td><td colspan="3">' ;
2005-02-13 19:16:02 +01:00
$form -> select_departement ( $soc -> departement_id , 0 );
2004-07-14 12:03:01 +02:00
print '</td></tr>' ;
2004-09-07 12:58:40 +02:00
print '<tr><td>' . $langs -> trans ( 'Country' ) . '</td><td colspan="3">' ;
2004-09-18 18:36:33 +02:00
$form -> select_pays ( $soc -> pays_id );
2004-07-14 12:03:01 +02:00
print '</td></tr>' ;
2004-09-18 18:36:33 +02:00
print '<tr><td>' . $langs -> trans ( 'Phone' ) . '</td><td><input type="text" name="tel" value="' . $soc -> tel . '"></td>' ;
2004-07-14 12:03:01 +02:00
print '<td>' . $langs -> trans ( 'Fax' ) . '</td><td><input type="text" name="fax" value="' . $soc -> fax . '"></td></tr>' ;
2004-11-23 10:50:00 +01:00
2005-01-17 15:38:24 +01:00
print '<tr><td>' . $langs -> trans ( 'CustomerCode' ) . '</td><td>' ;
2004-12-09 13:09:14 +01:00
if ( $soc -> codeclient_modifiable == 1 )
2004-12-01 16:57:28 +01:00
{
2004-12-09 13:09:14 +01:00
print '<input type="text" name="code_client" size="16" value="' . $soc -> code_client . '" maxlength="15">' ;
2004-12-01 16:57:28 +01:00
}
else
{
2004-12-09 13:09:14 +01:00
print $soc -> code_client ;
2004-12-01 16:57:28 +01:00
}
2005-01-17 15:38:24 +01:00
2005-02-10 23:09:20 +01:00
print '<td>' . $langs -> trans ( " Type " ) . '</td><td>' ;
2005-01-17 15:38:24 +01:00
$form -> select_array ( " typent_id " , $soc -> typent_array (), $soc -> typent_id );
2004-12-01 16:57:28 +01:00
print '</td></tr>' ;
2004-11-23 10:50:00 +01:00
2004-09-18 18:36:33 +02:00
print '<tr><td>' . $langs -> trans ( 'Web' ) . '</td><td colspan="3"><input type="text" name="url" size="40" value="' . $soc -> url . '"></td></tr>' ;
2004-07-14 12:03:01 +02:00
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> transcountry ( 'ProfId1' , $soc -> pays_code ) . '</td><td><input type="text" name="siren" size="10" maxlength="9" value="' . $soc -> siren . '"></td>' ;
print '<td>' . $langs -> transcountry ( 'ProfId2' , $soc -> pays_code ) . '</td><td><input type="text" name="siret" size="15" maxlength="14" value="' . $soc -> siret . '"></td></tr>' ;
2004-07-14 12:03:01 +02:00
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> transcountry ( 'ProfId3' , $soc -> pays_code ) . '</td><td><input type="text" name="ape" size="5" maxlength="4" value="' . $soc -> ape . '"></td><td colspan="2"> </td></tr>' ;
print '<tr><td>' . $langs -> trans ( " Capital " ) . '</td><td colspan="3"><input type="text" name="capital" size="10" value="' . $soc -> capital . '"> ' . $conf -> monnaie . '</td></tr>' ;
2004-07-14 12:03:01 +02:00
print '<tr><td>Forme juridique</td><td colspan="3">' ;
2005-02-13 19:16:02 +01:00
$form -> select_forme_juridique ( $soc -> forme_juridique_code , 0 );
2004-07-14 12:03:01 +02:00
print '</td></tr>' ;
print '<tr><td>Effectif</td><td colspan="3">' ;
2004-09-18 18:36:33 +02:00
$form -> select_array ( " effectif_id " , $soc -> effectif_array (), $soc -> effectif_id );
2004-07-14 12:03:01 +02:00
print '</td></tr>' ;
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> trans ( 'TVAIntra' ) . '</td><td colspan="3">' ;
2004-07-14 12:03:01 +02:00
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="' . $soc -> tva_intra_code . '">' ;
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="' . $soc -> tva_intra_num . '">' ;
print '</td></tr>' ;
2004-09-07 12:58:40 +02:00
print '<tr><td>' . $langs -> trans ( 'ProspectCustomer' ) . '</td><td><select name="client">' ;
2004-12-09 13:09:14 +01:00
print '<option value="2"' . ( $soc -> client == 2 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Prospect' ) . '</option>' ;
print '<option value="1"' . ( $soc -> client == 1 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Customer' ) . '</option>' ;
print '<option value="0"' . ( $soc -> client == 0 ? ' selected' : '' ) . '>Ni client, ni prospect</option>' ;
2004-07-14 12:03:01 +02:00
print '</select></td>' ;
2004-08-05 04:20:03 +02:00
print '<td>' . $langs -> trans ( 'Supplier' ) . '</td><td>' ;
2004-09-18 18:36:33 +02:00
$form -> selectyesnonum ( " fournisseur " , $soc -> fournisseur );
2004-07-14 12:03:01 +02:00
print '</td></tr>' ;
2004-10-10 16:15:00 +02:00
print '<tr><td align="center" colspan="4"><input type="submit" value="' . $langs -> trans ( " Save " ) . '"></td></tr>' ;
2004-12-18 19:57:24 +01:00
2004-07-14 12:03:01 +02:00
print '</table>' ;
print '</form>' ;
print 'Astuce : Vous pouvez v<> rifier le num<75> ro de TVA intra communautaire sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission europ<6F> enne' ;
}
}
else
{
2004-12-15 11:34:58 +01:00
if ( $no_reload <> 1 )
{
$soc = new Societe ( $db );
$soc -> id = $_GET [ " socid " ];
$soc -> fetch ( $_GET [ " socid " ]);
}
2004-02-05 16:10:03 +01:00
2004-02-08 12:53:42 +01:00
$head [ 0 ][ 0 ] = 'soc.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ 0 ][ 1 ] = $langs -> trans ( " Company " );
2004-02-08 12:53:42 +01:00
$h = 1 ;
2004-05-20 13:27:54 +02:00
2004-02-07 19:48:33 +01:00
if ( $soc -> client == 1 )
{
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/fiche.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Customer " );
2004-02-08 12:53:42 +01:00
$h ++ ;
2004-02-07 19:48:33 +01:00
}
if ( $soc -> client == 2 )
2004-02-05 16:10:03 +01:00
{
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/prospect/fiche.php?id=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Prospect " );
2004-02-08 12:53:42 +01:00
$h ++ ;
2004-02-05 16:10:03 +01:00
}
if ( $soc -> fournisseur )
{
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Supplier " );;
2004-02-08 12:53:42 +01:00
$h ++ ;
}
2004-05-20 13:27:54 +02:00
if ( $conf -> compta -> enabled ) {
2004-11-12 01:50:14 +01:00
$langs -> load ( " compta " );
2004-05-20 13:27:54 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/compta/fiche.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Accountancy " );
2004-05-20 13:27:54 +02:00
$h ++ ;
}
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/socnote.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Note " );
2004-02-08 12:53:42 +01:00
$h ++ ;
if ( $user -> societe_id == 0 )
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/docsoc.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Documents " );
2004-02-08 12:53:42 +01:00
$h ++ ;
2004-02-05 16:10:03 +01:00
}
2004-02-07 19:48:33 +01:00
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/notify/fiche.php?socid=' . $soc -> id ;
2004-11-12 01:50:14 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Notifications " );
2004-02-07 19:48:33 +01:00
2004-07-13 18:14:18 +02:00
dolibarr_fiche_head ( $head , 0 , $soc -> nom );
2004-02-08 12:53:42 +01:00
/*
2004-06-11 01:38:00 +02:00
* Fiche soci<EFBFBD> t<EFBFBD> en mode visu
2004-02-08 12:53:42 +01:00
*/
2005-01-30 01:07:13 +01:00
// Confirmation de la suppression de la facture
2004-12-15 11:34:58 +01:00
if ( $_GET [ " action " ] == 'delete' )
{
2005-01-30 01:07:13 +01:00
$html = new Form ( $db );
$html -> form_confirm ( " soc.php?socid= " . $soc -> id , $langs -> trans ( " DeleteACompany " ), $langs -> trans ( " ConfirmDeleteCompany " ), " confirm_delete " );
2004-12-15 11:34:58 +01:00
print " <br /> \n " ;
}
2004-02-08 12:53:42 +01:00
2004-12-15 11:34:58 +01:00
2005-01-30 00:49:07 +01:00
if ( $soc -> error )
2004-12-15 11:34:58 +01:00
{
2005-01-30 01:07:13 +01:00
print '<div class="error">' ;
2005-01-30 00:49:07 +01:00
print $soc -> error ;
2004-12-15 11:34:58 +01:00
print '</div>' ;
}
2004-11-12 01:50:14 +01:00
print '<table class="border" width="100%">' ;
2005-01-25 13:27:30 +01:00
2004-09-18 18:36:33 +02:00
print '<tr><td width="20%">' . $langs -> trans ( 'Name' ) . '</td><td>' . $soc -> nom . '</td><td>' . $langs -> trans ( 'Prefix' ) . '</td><td>' . $soc -> prefix_comm . '</td></tr>' ;
2004-02-17 10:59:06 +01:00
2004-12-18 19:57:24 +01:00
print " <tr><td valign= \" top \" > " . $langs -> trans ( 'Address' ) . " </td><td colspan= \" 3 \" > " . nl2br ( $soc -> adresse ) . " </td></tr> " ;
print '<tr><td>' . $langs -> trans ( 'Zip' ) . '</td><td>' . $soc -> cp . " </td> " ;
print '<td>' . $langs -> trans ( 'Town' ) . '</td><td>' . $soc -> ville . " </td></tr> " ;
print '<tr><td>' . $langs -> trans ( 'Country' ) . '</td><td colspan="3">' . $soc -> pays . '</td>' ;
2004-05-20 13:27:54 +02:00
2004-09-18 18:36:33 +02:00
print '<tr><td>' . $langs -> trans ( 'Phone' ) . '</td><td>' . dolibarr_print_phone ( $soc -> tel ) . '</td>' ;
2004-06-11 01:38:00 +02:00
print '<td>' . $langs -> trans ( 'Fax' ) . '</td><td>' . dolibarr_print_phone ( $soc -> fax ) . '</td></tr>' ;
2004-11-23 10:50:00 +01:00
print '<tr><td>' ;
2005-01-18 23:12:37 +01:00
print $langs -> trans ( 'CustomerCode' ) . '</td><td colspan="3">' ;
2004-11-23 10:50:00 +01:00
print $soc -> code_client ;
2004-12-01 18:04:26 +01:00
if ( $soc -> check_codeclient () <> 0 )
{
print " Code incorrect " ;
}
2004-11-23 10:50:00 +01:00
print '</td></tr>' ;
2004-09-18 18:36:33 +02:00
print '<tr><td>' . $langs -> trans ( 'Web' ) . '</td><td colspan="3">' ;
2004-02-14 18:08:57 +01:00
if ( $soc -> url ) { print '<a href="http://' . $soc -> url . '">http://' . $soc -> url . '</a>' ; }
print '</td></tr>' ;
2003-09-12 02:20:56 +02:00
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> transcountry ( 'ProfId1' , $soc -> pays_code ) . '</td><td>' ;
// Si soci<63> t<EFBFBD> FR et siren fourni, on le v<> rifie
if ( $soc -> pays_code == " FR " && $soc -> siren ) {
2005-02-13 18:27:02 +01:00
if ( $soc -> check_siren () == 0 )
{
print '<a target="_blank" href="http://www.societe.com/cgi-bin/recherche?rncs=' . $soc -> siren . '">' . $soc -> siren . '</a> ' ;
}
else
{
print '<a class="error">' . $soc -> siren ;
// Siren invalide
print " Code Siren Invalide !</a> " ;
}
2005-02-10 23:09:20 +01:00
}
else {
print $soc -> siren ;
}
2005-02-10 15:33:22 +01:00
print '</td>' ;
2003-10-12 16:55:30 +02:00
2005-02-10 23:09:20 +01:00
print '<td>' . $langs -> transcountry ( 'ProfId2' , $soc -> pays_code ) . '</td><td>' . $soc -> siret . '</td></tr>' ;
print '<tr><td>' . $langs -> transcountry ( 'ProfId3' , $soc -> pays_code ) . '</td><td>' . $soc -> ape . '</td><td colspan="2"> </td></tr>' ;
2004-02-09 10:21:43 +01:00
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> trans ( 'Capital' ) . '</td><td colspan="3">' . $soc -> capital . ' ' . $conf -> monnaie . '</td></tr>' ;
2004-02-04 20:15:31 +01:00
2004-02-09 10:21:43 +01:00
print '<tr><td>Forme juridique</td><td colspan="3">' . $soc -> forme_juridique . '</td></tr>' ;
print '<tr><td>Effectif</td><td colspan="3">' . $soc -> effectif . '</td></tr>' ;
2005-02-10 23:09:20 +01:00
print '<tr><td>' . $langs -> trans ( 'TVAIntra' ) . '</td><td colspan="3">' ;
2004-02-04 20:15:31 +01:00
print $soc -> tva_intra ;
print '</td></tr>' ;
2004-09-13 10:15:55 +02:00
print '<tr><td><a href="' . DOL_URL_ROOT . '/societe/rib.php?socid=' . $soc -> id . '">' . img_edit () . " </a> " ;
print $langs -> trans ( 'RIB' ) . '</td><td colspan="3">' ;
print $soc -> display_rib ();
print '</td></tr>' ;
2002-04-30 12:51:35 +02:00
print '</table>' ;
2004-05-20 14:21:24 +02:00
print " <br></div> \n " ;
2003-06-10 14:18:29 +02:00
/*
*
2004-02-09 10:21:43 +01:00
*/
2004-12-15 11:34:58 +01:00
if ( $_GET [ " action " ] == '' )
{
2004-02-05 16:10:03 +01:00
2004-12-15 11:34:58 +01:00
print '<div class="tabsAction">' ;
2005-01-26 22:40:40 +01:00
print '<a class="tabAction" href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $soc -> id . '">' . $langs -> trans ( " SalesRepresentative " ) . '</a>' ;
2005-01-25 13:27:30 +01:00
2005-01-26 22:40:40 +01:00
print '<a class="tabAction" href="' . DOL_URL_ROOT . '/societe/lien.php?socid=' . $soc -> id . '">' . $langs -> trans ( " ParentCompany " ) . '</a>' ;
2005-01-17 15:38:24 +01:00
2004-12-15 11:34:58 +01:00
print '<a class="tabAction" href="' . DOL_URL_ROOT . '/soc.php?socid=' . $soc -> id . '&action=edit">' . $langs -> trans ( " Edit " ) . '</a>' ;
print '<a class="tabAction" href="' . DOL_URL_ROOT . '/contact/fiche.php?socid=' . $soc -> id . '&action=create">' . $langs -> trans ( " AddContact " ) . '</a>' ;
2003-06-10 14:18:29 +02:00
2004-12-22 22:30:23 +01:00
if ( $user -> rights -> societe -> supprimer )
2004-12-15 11:34:58 +01:00
{
2005-01-18 19:47:04 +01:00
print '<a class="butDelete" href="' . DOL_URL_ROOT . '/soc.php?socid=' . $soc -> id . '&action=delete">' . $langs -> trans ( " Delete " ) . '</a>' ;
2005-01-17 15:38:24 +01:00
2004-12-15 11:34:58 +01:00
}
print '</div>' ;
}
2003-06-10 14:18:29 +02:00
/*
*
*/
2002-04-30 12:51:35 +02:00
}
$db -> close ();
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>
2004-07-14 12:03:01 +02:00