2006-08-12 17:32:57 +02:00
< ? php
2007-01-05 16:56:38 +01:00
/* Copyright ( C ) 2001 - 2007 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2008-02-16 15:39:42 +01:00
* Copyright ( C ) 2004 - 2008 Laurent Destailleur < eldy @ users . sourceforge . net >
2006-08-12 17:32:57 +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 .
*/
/**
2008-02-16 15:39:42 +01:00
\file htdocs / admin / company . php
\ingroup company
\brief Page d 'accueil de l' espace administration / configuration
\version $Id $
2006-08-12 17:32:57 +02:00
*/
require ( " ./pre.inc.php " );
2008-02-01 01:09:23 +01:00
require_once ( DOL_DOCUMENT_ROOT . " /lib/admin.lib.php " );
2008-01-11 18:16:46 +01:00
require_once ( DOL_DOCUMENT_ROOT . " /lib/company.lib.php " );
2008-04-05 16:18:13 +02:00
require_once ( DOL_DOCUMENT_ROOT . " /lib/images.lib.php " );
2006-08-12 17:32:57 +02:00
$langs -> load ( " admin " );
$langs -> load ( " companies " );
if ( ! $user -> admin )
accessforbidden ();
2008-04-05 16:18:13 +02:00
2006-08-12 17:32:57 +02:00
if ( ( isset ( $_POST [ " action " ]) && $_POST [ " action " ] == 'update' )
|| ( isset ( $_POST [ " action " ]) && $_POST [ " action " ] == 'updateedit' ) )
{
2007-08-08 02:51:26 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_NOM " , $_POST [ " nom " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_ADRESSE " , $_POST [ " address " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_VILLE " , $_POST [ " ville " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_CP " , $_POST [ " cp " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_PAYS " , $_POST [ " pays_id " ]);
dolibarr_set_const ( $db , " MAIN_MONNAIE " , $_POST [ " currency " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_TEL " , $_POST [ " tel " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_FAX " , $_POST [ " fax " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_MAIL " , $_POST [ " mail " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_WEB " , $_POST [ " web " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_NOTE " , $_POST [ " note " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_GENCOD " , $_POST [ " gencod " ]);
if ( $_FILES [ " logo " ][ " tmp_name " ])
{
if ( eregi ( '([^\\\/:]+)$' , $_FILES [ " logo " ][ " name " ], $reg ))
{
$original_file = $reg [ 1 ];
2007-08-27 13:24:14 +02:00
$isimage = image_format_supported ( $original_file );
if ( $isimage >= 0 )
2007-08-08 02:51:26 +02:00
{
dolibarr_syslog ( " Move file " . $_FILES [ " logo " ][ " tmp_name " ] . " to " . $conf -> societe -> dir_logos . '/' . $original_file );
if ( ! is_dir ( $conf -> societe -> dir_logos ))
{
create_exdir ( $conf -> societe -> dir_logos );
}
2008-10-06 23:31:05 +02:00
if ( dol_move_uploaded_file ( $_FILES [ " logo " ][ " tmp_name " ], $conf -> societe -> dir_logos . '/' . $original_file , 1 ) > 0 )
2007-08-08 02:51:26 +02:00
{
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_LOGO " , $original_file );
2007-08-09 20:22:39 +02:00
2007-08-27 13:24:14 +02:00
// Create thumbs of logo
if ( $isimage > 0 )
2007-08-09 20:22:39 +02:00
{
2007-10-07 23:09:55 +02:00
$quality = 80 ;
$imgThumbSmall = vignette ( $conf -> societe -> dir_logos . '/' . $original_file , 200 , 100 , '_small' , $quality );
2007-08-27 13:24:14 +02:00
if ( eregi ( '([^\\\/:]+)$' , $imgThumbSmall , $reg ))
{
$imgThumbSmall = $reg [ 1 ];
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_LOGO_SMALL " , $imgThumbSmall );
}
else dolibarr_syslog ( $imgThumbSmall );
// Cr<43> ation de la vignette de la page "Soci<63> t<EFBFBD> /Institution"
2007-10-07 23:09:55 +02:00
$imgThumbMini = vignette ( $conf -> societe -> dir_logos . '/' . $original_file , 100 , 30 , '_mini' , $quality );
2007-08-27 13:24:14 +02:00
if ( eregi ( '([^\\\/:]+)$' , $imgThumbMini , $reg ))
{
$imgThumbMini = $reg [ 1 ];
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_LOGO_MINI " , $imgThumbMini );
}
else dolibarr_syslog ( $imgThumbMini );
2007-08-09 20:22:39 +02:00
}
2007-08-27 13:24:14 +02:00
else dolibarr_syslog ( $langs -> trans ( " ErrorImageFormatNotSupported " ), LOG_WARNING );
2007-08-08 02:51:26 +02:00
}
else
{
$message .= '<div class="error">' . $langs -> trans ( " ErrorFailedToSaveFile " ) . '</div>' ;
}
}
else
{
$message .= '<div class="error">' . $langs -> trans ( " ErrorOnlyPngJpgSupported " ) . '</div>' ;
}
}
}
dolibarr_set_const ( $db , " MAIN_INFO_CAPITAL " , $_POST [ " capital " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_FORME_JURIDIQUE " , $_POST [ " forme_juridique_code " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SIREN " , $_POST [ " siren " ]);
dolibarr_set_const ( $db , " MAIN_INFO_SIRET " , $_POST [ " siret " ]);
dolibarr_set_const ( $db , " MAIN_INFO_APE " , $_POST [ " ape " ]);
dolibarr_set_const ( $db , " MAIN_INFO_RCS " , $_POST [ " rcs " ]);
dolibarr_set_const ( $db , " MAIN_INFO_TVAINTRA " , $_POST [ " tva " ]);
2007-11-22 18:21:31 +01:00
dolibarr_set_const ( $db , " SOCIETE_FISCAL_MONTH_START " , $_POST [ " fiscalmonthstart " ]);
2007-08-08 02:51:26 +02:00
dolibarr_set_const ( $db , " FACTURE_TVAOPTION " , $_POST [ " optiontva " ]);
if ( $_POST [ 'action' ] != 'updateedit' && ! $message )
{
Header ( " Location: " . $_SERVER [ " PHP_SELF " ]);
exit ;
}
2006-08-12 17:32:57 +02:00
}
2007-08-09 20:22:39 +02:00
if ( $_GET [ " action " ] == 'addthumb' )
{
if ( file_exists ( $conf -> societe -> dir_logos . '/' . $_GET [ " file " ]))
2007-09-07 00:07:34 +02:00
{
$isimage = image_format_supported ( $_GET [ " file " ]);
2007-08-27 13:24:14 +02:00
// Create thumbs of logo
if ( $isimage > 0 )
2007-08-09 20:22:39 +02:00
{
2007-08-27 13:24:14 +02:00
// Cr<43> ation de la vignette de la page login
$imgThumbSmall = vignette ( $conf -> societe -> dir_logos . '/' . $_GET [ " file " ], 200 , 100 , '_small' , 80 );
2007-09-08 12:40:28 +02:00
if ( image_format_supported ( $imgThumbSmall ) >= 0 && eregi ( '([^\\\/:]+)$' , $imgThumbSmall , $reg ))
2007-08-27 13:24:14 +02:00
{
$imgThumbSmall = $reg [ 1 ];
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_LOGO_SMALL " , $imgThumbSmall );
}
else dolibarr_syslog ( $imgThumbSmall );
// Cr<43> ation de la vignette de la page "Soci<63> t<EFBFBD> /Institution"
$imgThumbMini = vignette ( $conf -> societe -> dir_logos . '/' . $_GET [ " file " ], 100 , 30 , '_mini' , 80 );
2007-09-08 12:40:28 +02:00
if ( image_format_supported ( $imgThumbSmall ) >= 0 && eregi ( '([^\\\/:]+)$' , $imgThumbMini , $reg ))
2007-08-27 13:24:14 +02:00
{
2007-09-08 12:40:28 +02:00
$imgThumbMini = $reg [ 1 ];
2007-08-27 13:24:14 +02:00
dolibarr_set_const ( $db , " MAIN_INFO_SOCIETE_LOGO_MINI " , $imgThumbMini );
}
else dolibarr_syslog ( $imgThumbMini );
Header ( " Location: " . $_SERVER [ " PHP_SELF " ]);
exit ;
2007-08-09 20:22:39 +02:00
}
2007-08-27 13:24:14 +02:00
else
2007-08-09 20:22:39 +02:00
{
2007-08-27 13:24:14 +02:00
$message .= '<div class="error">' . $langs -> trans ( " ErrorImageFormatNotSupported " ) . '</div>' ;
dolibarr_syslog ( $langs -> transnoentities ( " ErrorImageFormatNotSupported " ), LOG_WARNING );
2007-08-09 20:22:39 +02:00
}
2007-08-27 13:24:14 +02:00
}
else
{
$message .= '<div class="error">' . $langs -> trans ( " ErrorFileDoesNotExists " , $_GET [ " file " ]) . '</div>' ;
dolibarr_syslog ( $langs -> transnoentities ( " ErrorFileDoesNotExists " , $_GET [ " file " ]), LOG_WARNING );
}
2007-08-09 20:22:39 +02:00
}
2006-08-12 17:32:57 +02:00
if ( $_GET [ " action " ] == 'removelogo' )
{
2007-08-08 02:51:26 +02:00
$logofile = $conf -> societe -> dir_logos . '/' . $mysoc -> logo ;
2007-08-27 13:24:14 +02:00
dol_delete_file ( $logofile );
2007-08-08 02:51:26 +02:00
dolibarr_del_const ( $db , " MAIN_INFO_SOCIETE_LOGO " );
$mysoc -> logo = '' ;
2007-08-09 20:22:39 +02:00
$logosmallfile = $conf -> societe -> dir_logos . '/thumbs/' . $mysoc -> logo_small ;
2007-08-27 13:24:14 +02:00
dol_delete_file ( $logosmallfile );
2007-08-09 20:22:39 +02:00
dolibarr_del_const ( $db , " MAIN_INFO_SOCIETE_LOGO_SMALL " );
$mysoc -> logo_small = '' ;
$logominifile = $conf -> societe -> dir_logos . '/thumbs/' . $mysoc -> logo_mini ;
2007-08-27 13:24:14 +02:00
dol_delete_file ( $logominifile );
2007-08-09 20:22:39 +02:00
dolibarr_del_const ( $db , " MAIN_INFO_SOCIETE_LOGO_MINI " );
$mysoc -> logo_mini = '' ;
2006-08-12 17:32:57 +02:00
}
/*
* Affichage page
*/
llxHeader ();
$form = new Form ( $db );
$countrynotdefined = '<font class="error">' . $langs -> trans ( " ErrorSetACountryFirst " ) . ' (' . $langs -> trans ( " SeeAbove " ) . ')</font>' ;
print_fiche_titre ( $langs -> trans ( " CompanyFundation " ), '' , 'setup' );
2006-08-12 19:53:18 +02:00
print $langs -> trans ( " CompanyFundationDesc " ) . " <br> \n " ;
print " <br> \n " ;
2006-08-12 17:32:57 +02:00
if (( isset ( $_GET [ " action " ]) && $_GET [ " action " ] == 'edit' )
|| ( isset ( $_POST [ " action " ]) && $_POST [ " action " ] == 'updateedit' ) )
{
2007-01-05 16:56:38 +01:00
/**
* Edition des param<EFBFBD> tres
*/
2006-08-12 17:32:57 +02:00
2007-01-05 16:56:38 +01:00
print '<form enctype="multipart/form-data" method="post" action="' . $_SERVER [ " PHP_SELF " ] . '" name="form_index">' ;
print '<input type="hidden" name="action" value="update">' ;
$var = true ;
print '<table class="noborder" width="100%">' ;
2008-03-16 15:52:31 +01:00
print '<tr class="liste_titre"><td width="35%">' . $langs -> trans ( " CompanyInfo " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " CompanyName " ) . '</td><td>' ;
2008-03-16 15:52:31 +01:00
print '<input name="nom" size="30" value="' . $conf -> global -> MAIN_INFO_SOCIETE_NOM . '"></td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " CompanyAddress " ) . '</td><td>' ;
2008-03-16 15:52:31 +01:00
print '<textarea name="address" cols="60" rows="' . ROWS_3 . '">' . $conf -> global -> MAIN_INFO_SOCIETE_ADRESSE . '</textarea></td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " CompanyZip " ) . '</td><td>' ;
2008-03-16 15:52:31 +01:00
print '<input name="cp" value="' . $conf -> global -> MAIN_INFO_SOCIETE_CP . '" size="10"></td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " CompanyTown " ) . '</td><td>' ;
2008-03-16 15:52:31 +01:00
print '<input name="ville" size="30" value="' . $conf -> global -> MAIN_INFO_SOCIETE_VILLE . '"></td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Country " ) . '</td><td>' ;
2008-01-06 16:24:23 +01:00
$form -> select_pays ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS , 'pays_id' ,( $conf -> use_javascript_ajax ? ' onChange="company_save_refresh()"' : '' ));
2008-04-17 13:30:04 +02:00
if ( $user -> admin ) print info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionnarySetup " ), 1 );
2008-03-16 15:52:31 +01:00
print '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " CompanyCurrency " ) . '</td><td>' ;
$form -> select_currency ( $conf -> global -> MAIN_MONNAIE , " currency " );
2008-03-16 15:52:31 +01:00
print '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Tel " ) . '</td><td>' ;
print '<input name="tel" value="' . $conf -> global -> MAIN_INFO_SOCIETE_TEL . '"></td></tr>' ;
2008-03-16 15:52:31 +01:00
print '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Fax " ) . '</td><td>' ;
print '<input name="fax" value="' . $conf -> global -> MAIN_INFO_SOCIETE_FAX . '"></td></tr>' ;
2008-03-16 15:52:31 +01:00
print '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Mail " ) . '</td><td>' ;
print '<input name="mail" size="60" value="' . $conf -> global -> MAIN_INFO_SOCIETE_MAIL . '"></td></tr>' ;
2008-03-16 15:52:31 +01:00
print '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Web " ) . '</td><td>' ;
print '<input name="web" size="60" value="' . $conf -> global -> MAIN_INFO_SOCIETE_WEB . '"></td></tr>' ;
2008-03-16 15:52:31 +01:00
print '</td></tr>' . " \n " ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Gencod " ) . '</td><td>' ;
print '<input name="gencod" size="40" value="' . $conf -> global -> MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>' ;
print '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " Logo " ) . ' (png,jpg)</td><td>' ;
print '<table width="100%" class="notopnoleftnoright"><tr><td valign="center">' ;
print '<input type="file" class="flat" name="logo" size="50">' ;
print '</td><td valign="middle" align="right">' ;
2007-08-09 20:22:39 +02:00
if ( $mysoc -> logo_mini && file_exists ( $conf -> societe -> dir_logos . '/thumbs/' . $mysoc -> logo_mini ))
{
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=removelogo">' . img_delete ( $langs -> trans ( " Delete " )) . '</a>' ;
print ' ' ;
2007-08-27 13:24:14 +02:00
print '<img src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=companylogo&file=' . urlencode ( '/thumbs/' . $mysoc -> logo_mini ) . '">' ;
2007-08-09 20:22:39 +02:00
}
2007-01-05 16:56:38 +01:00
else
2007-08-09 20:22:39 +02:00
{
print '<img height="30" src="' . DOL_URL_ROOT . '/theme/common/nophoto.jpg">' ;
}
2007-01-05 16:56:38 +01:00
print '</td></tr></table>' ;
print '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td valign="top">' . $langs -> trans ( " Note " ) . '</td><td>' ;
print '<textarea class="flat" name="note" cols="60" rows="' . ROWS_4 . '">' . $conf -> global -> MAIN_INFO_SOCIETE_NOTE . '</textarea></td></tr>' ;
print '</td></tr>' ;
print '</table>' ;
print '<br>' ;
2006-08-12 17:32:57 +02:00
// Identifiants de la soci<63> t<EFBFBD> (propre au pays)
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre"><td>' . $langs -> trans ( " CompanyIds " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td></tr>' ;
$var = true ;
$langs -> load ( " companies " );
2007-01-05 16:56:38 +01:00
2006-08-12 17:32:57 +02:00
// Recupere code pays
$code_pays = substr ( $langs -> defaultlang , - 2 ); // Par defaut, pays de la localisation
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
$sql = " SELECT code from " . MAIN_DB_PREFIX . " c_pays " ;
$sql .= " WHERE rowid = " . $conf -> global -> MAIN_INFO_SOCIETE_PAYS ;
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
if ( $obj -> code ) $code_pays = $obj -> code ;
}
else {
dolibarr_print_error ( $db );
}
}
// Capital
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Capital " ) . '</td><td>' ;
print '<input name="capital" size="20" value="' . $conf -> global -> MAIN_INFO_CAPITAL . '"></td></tr>' ;
// Forme juridique
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " JuridicalStatus " ) . '</td><td>' ;
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
$form -> select_forme_juridique ( $conf -> global -> MAIN_INFO_SOCIETE_FORME_JURIDIQUE , $code_pays );
}
else
{
print $countrynotdefined ;
}
print '</td></tr>' ;
// ProfID1
if ( $langs -> transcountry ( " ProfId1 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId1 " , $code_pays ) . '</td><td>' ;
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
print '<input name="siren" size="20" value="' . $conf -> global -> MAIN_INFO_SIREN . '">' ;
}
else
{
print $countrynotdefined ;
}
print '</td></tr>' ;
}
// ProfId2
if ( $langs -> transcountry ( " ProfId2 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId2 " , $code_pays ) . '</td><td>' ;
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
print '<input name="siret" size="20" value="' . $conf -> global -> MAIN_INFO_SIRET . '">' ;
}
else
{
print $countrynotdefined ;
}
print '</td></tr>' ;
}
// ProfId3
if ( $langs -> transcountry ( " ProfId3 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId3 " , $code_pays ) . '</td><td>' ;
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
print '<input name="ape" size="20" value="' . $conf -> global -> MAIN_INFO_APE . '">' ;
}
else
{
print $countrynotdefined ;
}
print '</td></tr>' ;
}
// ProfId4
if ( $langs -> transcountry ( " ProfId4 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId4 " , $code_pays ) . '</td><td>' ;
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
print '<input name="rcs" size="20" value="' . $conf -> global -> MAIN_INFO_RCS . '">' ;
}
else
{
print $countrynotdefined ;
}
print '</td></tr>' ;
}
// TVA Intra
$var =! $var ;
2007-10-06 21:13:12 +02:00
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " VATIntra " ) . '</td><td>' ;
print '<input name="tva" size="20" value="' . $conf -> global -> MAIN_INFO_TVAINTRA . '">' ;
2007-11-22 18:21:31 +01:00
print '</td></tr>' ;
2006-08-12 17:32:57 +02:00
print '</table>' ;
2007-11-22 18:21:31 +01:00
/*
* D<EFBFBD> but d ' ann<EFBFBD> e fiscale
*/
print '<br>' ;
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " FiscalYearInformation " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td>' ;
print " </tr> \n " ;
$var = true ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " FiscalMonthStart " ) . '</td><td>' ;
print $form -> select_month ( $conf -> global -> SOCIETE_FISCAL_MONTH_START , 'fiscalmonthstart' , 1 ) . '</td></tr>' ;
print " </table> " ;
2006-08-12 17:32:57 +02:00
/*
* Options fiscale
*/
print '<br>' ;
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " VATManagement " ) . '</td><td>' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td align="right"> </td>' ;
print " </tr> \n " ;
$var = true ;
$var =! $var ;
print " <tr " . $bc [ $var ] . " ><td width= \" 140 \" ><label><input type= \" radio \" name= \" optiontva \" value= \" reel \" " . ( $conf -> global -> FACTURE_TVAOPTION != " franchise " ? " checked " : " " ) . " > " . $langs -> trans ( " VATIsUsed " ) . " </label></td> " ;
print '<td colspan="2">' ;
print " <table> " ;
print " <tr><td> " . $langs -> trans ( " VATIsUsedDesc " ) . " </td></tr> " ;
print " <tr><td><i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> trans ( " VATIsUsedExampleFR " ) . " </i></td></tr> \n " ;
print " </table> " ;
print " </td></tr> \n " ;
/* Je d<EFBFBD> sactive cette option " facturation " car ce statut fiscal n ' existe pas . Seul le r<EFBFBD> el et franchise existe .
Cette option ne doit donc pas etre en " exclusif " avec l ' option fiscale de gestion de tva . Peut etre faut - il
une option a part qui n ' entre pas en conflit avec les choix " assuj<EFBFBD> ti TVA " ou " non " .
$var =! $var ;
print " <tr " . $bc [ $var ] . " ><td width= \" 140 \" ><label><input type= \" radio \" name= \" optiontva \" value= \" facturation \" " . ( $conf -> global -> FACTURE_TVAOPTION == " facturation " ? " checked " : " " ) . " > Option facturation</label></td> " ;
print " <td colspan= \" 2 \" >L'option 'facturation' est utilis<69> e par les entreprises qui payent la TVA <20> facturation (vente de mat<61> riel).</td></tr> \n " ;
*/
$var =! $var ;
print " <tr " . $bc [ $var ] . " ><td width= \" 140 \" ><label><input type= \" radio \" name= \" optiontva \" value= \" franchise \" " . ( $conf -> global -> FACTURE_TVAOPTION == " franchise " ? " checked " : " " ) . " > " . $langs -> trans ( " VATIsNotUsed " ) . " </label></td> " ;
print '<td colspan="2">' ;
print " <table> " ;
print " <tr><td> " . $langs -> trans ( " VATIsNotUsedDesc " ) . " </td></tr> " ;
print " <tr><td><i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> trans ( " VATIsNotUsedExampleFR " ) . " </i></td></tr> \n " ;
print " </table> " ;
print " </td></tr> \n " ;
print " </table> " ;
print '<br><center><input type="submit" class="button" value="' . $langs -> trans ( " Save " ) . '"></center>' ;
print '<br>' ;
print '</form>' ;
}
else
{
/*
* Affichage des param<EFBFBD> tres
*/
if ( $message ) print $message . '<br>' ;
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre"><td>' . $langs -> trans ( " CompanyInfo " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td></tr>' ;
$var = true ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " CompanyName " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_NOM . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " CompanyAddress " ) . '</td><td>' . nl2br ( $conf -> global -> MAIN_INFO_SOCIETE_ADRESSE ) . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " CompanyZip " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_CP . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " CompanyTown " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_VILLE . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " CompanyCountry " ) . '</td><td>' ;
2008-01-11 11:25:26 +01:00
print getCountryLabel ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS , 1 );
2006-08-12 17:32:57 +02:00
print '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " CompanyCurrency " ) . '</td><td>' ;
2008-01-10 18:12:07 +01:00
print currency_name ( $conf -> global -> MAIN_MONNAIE , 1 );
2007-10-10 00:47:42 +02:00
print ' (' . $conf -> global -> MAIN_MONNAIE . ')' ;
2006-08-12 17:32:57 +02:00
print '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Tel " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_TEL . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Fax " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_FAX . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Mail " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_MAIL . '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Web " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_WEB . '</td></tr>' ;
2007-01-05 16:56:38 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Gencod " ) . '</td><td>' . $conf -> global -> MAIN_INFO_SOCIETE_GENCOD . '</td></tr>' ;
2006-08-12 17:32:57 +02:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Logo " ) . '</td><td>' ;
print '<table width="100%" class="notopnoleftnoright"><tr><td valign="center">' ;
print $mysoc -> logo ;
print '</td><td valign="center" align="right">' ;
2007-08-09 20:22:39 +02:00
// On propose la g<> n<EFBFBD> ration de la vignette si elle n'existe pas
2007-09-07 00:31:38 +02:00
if ( ! is_file ( $conf -> societe -> dir_logos . '/thumbs/' . $mysoc -> logo_mini ) && eregi ( '(\.jpg|\.jpeg|\.png)$' , $mysoc -> logo ))
2007-08-09 20:22:39 +02:00
{
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=addthumb&file=' . urlencode ( $mysoc -> logo ) . '">' . img_refresh ( $langs -> trans ( 'GenerateThumb' )) . ' </a>' ;
}
2007-09-07 00:31:38 +02:00
else if ( $mysoc -> logo_mini && is_file ( $conf -> societe -> dir_logos . '/thumbs/' . $mysoc -> logo_mini ))
2006-08-12 17:32:57 +02:00
{
2007-08-27 13:24:14 +02:00
print '<img src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=companylogo&file=' . urlencode ( '/thumbs/' . $mysoc -> logo_mini ) . '">' ;
2006-08-12 17:32:57 +02:00
}
else
{
2006-08-20 04:17:52 +02:00
print '<img height="30" src="' . DOL_URL_ROOT . '/theme/common/nophoto.jpg">' ;
2006-08-12 17:32:57 +02:00
}
print '</td></tr></table>' ;
print '</td></tr>' ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%" valign="top">' . $langs -> trans ( " Note " ) . '</td><td>' . nl2br ( $conf -> global -> MAIN_INFO_SOCIETE_NOTE ) . '</td></tr>' ;
print '</table>' ;
2007-10-06 21:13:12 +02:00
2006-08-12 17:32:57 +02:00
print '<br>' ;
2007-10-06 21:13:12 +02:00
2006-08-12 17:32:57 +02:00
// Identifiants de la soci<63> t<EFBFBD> (propre au pays)
2007-10-06 21:13:12 +02:00
print '<form name="formsoc" method="post">' ;
2006-08-12 17:32:57 +02:00
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre"><td>' . $langs -> trans ( " CompanyIds " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td></tr>' ;
$var = true ;
// Recupere code pays
$code_pays = substr ( $langs -> defaultlang , - 2 ); // Par defaut, pays de la localisation
if ( $conf -> global -> MAIN_INFO_SOCIETE_PAYS )
{
$sql = " SELECT code from " . MAIN_DB_PREFIX . " c_pays " ;
$sql .= " WHERE rowid = " . $conf -> global -> MAIN_INFO_SOCIETE_PAYS ;
$result = $db -> query ( $sql );
if ( $result )
{
$obj = $db -> fetch_object ();
if ( $obj -> code ) $code_pays = $obj -> code ;
}
else {
dolibarr_print_error ( $db );
}
}
// Capital
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " Capital " ) . '</td><td>' ;
print $conf -> global -> MAIN_INFO_CAPITAL . '</td></tr>' ;
// Forme juridique
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " JuridicalStatus " ) . '</td><td>' ;
2008-01-11 18:16:46 +01:00
print getFormeJuridiqueLabel ( $conf -> global -> MAIN_INFO_SOCIETE_FORME_JURIDIQUE , 1 );
2006-08-12 17:32:57 +02:00
print '</td></tr>' ;
// ProfId1
if ( $langs -> transcountry ( " ProfId1 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId1 " , $code_pays ) . '</td><td>' ;
if ( $langs -> transcountry ( " ProfId1 " , $code_pays ) != '-' )
{
print $conf -> global -> MAIN_INFO_SIREN ;
}
print '</td></tr>' ;
}
// ProfId2
if ( $langs -> transcountry ( " ProfId2 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId2 " , $code_pays ) . '</td><td>' ;
if ( $langs -> transcountry ( " ProfId2 " , $code_pays ) != '-' )
{
print $conf -> global -> MAIN_INFO_SIRET ;
}
print '</td></tr>' ;
}
// ProfId3
if ( $langs -> transcountry ( " ProfId3 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId3 " , $code_pays ) . '</td><td>' ;
if ( $langs -> transcountry ( " ProfId3 " , $code_pays ) != '-' )
{
print $conf -> global -> MAIN_INFO_APE ;
}
print '</td></tr>' ;
}
// ProfId4
if ( $langs -> transcountry ( " ProfId4 " , $code_pays ) != '-' )
{
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> transcountry ( " ProfId4 " , $code_pays ) . '</td><td>' ;
if ( $langs -> transcountry ( " ProfId4 " , $code_pays ) != '-' )
{
print $conf -> global -> MAIN_INFO_RCS ;
}
print '</td></tr>' ;
}
2007-10-06 21:13:12 +02:00
// TVA
2008-01-06 16:24:23 +01:00
if ( $conf -> use_javascript_ajax )
2007-10-06 21:13:12 +02:00
{
print " \n " ;
print '<script language="JavaScript" type="text/javascript">' ;
print " function CheckVAT(a,b) { \n " ;
print " newpopup(' " . DOL_URL_ROOT . " /societe/checkvat/checkVatPopup.php?countryCode='+a+'&vatNumber='+b,' " . $langs -> trans ( " VATIntraCheckableOnEUSite " ) . " ',500,260); \n " ;
print " } \n " ;
print '</script>' ;
print " \n " ;
}
2006-08-12 17:32:57 +02:00
$var =! $var ;
2007-10-06 21:13:12 +02:00
print '<tr ' . $bc [ $var ] . '><td>' . $langs -> trans ( " VATIntra " ) . '</td>' ;
print '<td>' ;
if ( $conf -> global -> MAIN_INFO_TVAINTRA )
{
$s = '' ;
$code = substr ( $conf -> global -> MAIN_INFO_TVAINTRA , 0 , 2 );
$num = substr ( $conf -> global -> MAIN_INFO_TVAINTRA , 2 );
$s .= $conf -> global -> MAIN_INFO_TVAINTRA ;
$s .= '<input type="hidden" name="tva_intra_code" size="1" maxlength="2" value="' . $code . '">' ;
$s .= '<input type="hidden" name="tva_intra_num" size="12" maxlength="18" value="' . $num . '">' ;
$s .= ' ' ;
2008-01-06 16:24:23 +01:00
if ( $conf -> use_javascript_ajax )
2007-10-06 21:13:12 +02:00
{
2008-10-06 23:31:05 +02:00
$s .= '<a href="#" onClick="javascript: CheckVAT(document.formsoc.tva_intra_code.value,document.formsoc.tva_intra_num.value);" alt="' . $langs -> trans ( " VATIntraCheckableOnEUSite " ) . '">' . $langs -> trans ( " VATIntraCheck " ) . '</a>' ;
2007-10-06 21:13:12 +02:00
print $form -> textwithhelp ( $s , $langs -> trans ( " VATIntraCheckDesc " , $langs -> trans ( " VATIntraCheck " )), 1 );
}
else
{
print $s . '<a href="' . $langs -> transcountry ( " VATIntraCheckURL " , $soc -> id_pays ) . '" target="_blank" alt="' . $langs -> trans ( " VATIntraCheckableOnEUSite " ) . '">' . img_picto ( $langs -> trans ( " VATIntraCheckableOnEUSite " ), 'help' ) . '</a>' ;
}
}
else
{
print ' ' ;
}
print '</td>' ;
print '</tr>' ;
2006-08-12 17:32:57 +02:00
print '</table>' ;
2007-10-06 21:13:12 +02:00
print '</form>' ;
2007-11-22 18:21:31 +01:00
2008-02-16 15:39:42 +01:00
/*
2007-11-22 18:21:31 +01:00
* D<EFBFBD> but d ' ann<EFBFBD> e fiscale
*/
print '<br>' ;
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " FiscalYearInformation " ) . '</td><td>' . $langs -> trans ( " Value " ) . '</td>' ;
print " </tr> \n " ;
$var = true ;
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="35%">' . $langs -> trans ( " FiscalMonthStart " ) . '</td><td>' ;
2008-02-16 18:50:25 +01:00
$monthstart = ( ! empty ( $conf -> global -> SOCIETE_FISCAL_MONTH_START )) ? $conf -> global -> SOCIETE_FISCAL_MONTH_START : 1 ;
2008-02-16 15:39:42 +01:00
print monthArrayOrSelected ( $monthstart ) . '</td></tr>' ;
2007-11-22 18:21:31 +01:00
print " </table> " ;
2006-08-12 17:32:57 +02:00
/*
* Options fiscale
*/
print '<br>' ;
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " VATManagement " ) . '</td><td>' . $langs -> trans ( " Description " ) . '</td>' ;
print '<td align="right"> </td>' ;
print " </tr> \n " ;
$var = true ;
$var =! $var ;
print " <tr " . $bc [ $var ] . " ><td width= \" 140 \" ><label><input " . $bc [ $var ] . " type= \" radio \" name= \" optiontva \" disabled value= \" reel \" " . ( $conf -> global -> FACTURE_TVAOPTION != " franchise " ? " checked " : " " ) . " > " . $langs -> trans ( " VATIsUsed " ) . " </label></td> " ;
print '<td colspan="2">' ;
print " <table> " ;
print " <tr><td> " . $langs -> trans ( " VATIsUsedDesc " ) . " </td></tr> " ;
print " <tr><td><i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> trans ( " VATIsUsedExampleFR " ) . " </i></td></tr> \n " ;
print " </table> " ;
print " </td></tr> \n " ;
$var =! $var ;
print " <tr " . $bc [ $var ] . " ><td width= \" 140 \" ><label><input " . $bc [ $var ] . " type= \" radio \" name= \" optiontva \" disabled value= \" franchise \" " . ( $conf -> global -> FACTURE_TVAOPTION == " franchise " ? " checked " : " " ) . " > " . $langs -> trans ( " VATIsNotUsed " ) . " </label></td> " ;
print '<td colspan="2">' ;
print " <table> " ;
print " <tr><td> " . $langs -> trans ( " VATIsNotUsedDesc " ) . " </td></tr> " ;
print " <tr><td><i> " . $langs -> trans ( " Example " ) . ': ' . $langs -> trans ( " VATIsNotUsedExampleFR " ) . " </i></td></tr> \n " ;
print " </table> " ;
print " </td></tr> \n " ;
print " </table> " ;
// Boutons d'action
print '<div class="tabsAction">' ;
2008-01-11 00:59:58 +01:00
print '<a class="butAction" href="' . $_SERVER [ " PHP_SELF " ] . '?action=edit">' . $langs -> trans ( " Modify " ) . '</a>' ;
2006-08-12 17:32:57 +02:00
print '</div>' ;
print '<br>' ;
}
2006-08-12 19:53:18 +02:00
$db -> close ();
2006-08-12 17:32:57 +02:00
llxFooter ( '$Date$ - $Revision$' );
2008-01-10 18:12:07 +01:00
/**
* \brief Retourne le nom traduit ou code + nom d ' une devise
* \param code_iso Code iso de la devise
* \param withcode 1 = affiche code + nom
* \return string Nom traduit de la devise
*/
function currency_name ( $code_iso , $withcode = 0 )
{
2008-02-02 19:11:00 +01:00
global $langs , $db ;
2008-01-10 18:12:07 +01:00
// Si il existe une traduction, on peut renvoyer de suite le libell<6C>
if ( $langs -> trans ( " Currency " . $code_iso ) != " Currency " . $code_iso )
{
return $langs -> trans ( " Currency " . $code_iso );
}
2008-02-02 19:11:00 +01:00
// Si pas de traduction, on consulte le libell<6C> par d<> faut en table
2008-01-10 18:12:07 +01:00
$sql = " SELECT label FROM " . MAIN_DB_PREFIX . " c_currencies " ;
2008-02-02 19:11:00 +01:00
$sql .= " WHERE code_iso=' " . $code_iso . " ' " ;
2008-01-10 18:12:07 +01:00
2008-02-02 19:11:00 +01:00
$resql = $db -> query ( $sql );
if ( $resql )
2008-01-10 18:12:07 +01:00
{
2008-02-02 19:11:00 +01:00
$num = $db -> num_rows ( $resql );
2008-01-10 18:12:07 +01:00
if ( $num )
{
2008-02-02 19:11:00 +01:00
$obj = $db -> fetch_object ( $resql );
2008-01-10 18:12:07 +01:00
$label = ( $obj -> label != '-' ? $obj -> label : '' );
2008-02-02 19:11:00 +01:00
if ( $withcode ) return ( $label == $code_iso ) ? " $code_iso " : " $code_iso - $label " ;
2008-01-10 18:12:07 +01:00
else return $label ;
}
else
{
return $code_iso ;
}
}
}
2006-08-12 17:32:57 +02:00
?>