* Copyright (C) 2004-2005 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$ */ /** \file htdocs/admin/index.php \brief Page d'accueil de l'espace administration/configuration \version $Revision$ */ require("./pre.inc.php"); $langs->load("admin"); $langs->load("companies"); if (!$user->admin) accessforbidden(); if ( (isset($_POST["action"]) && $_POST["action"] == 'update') || (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) { 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_PAYS",$_POST["pays_id"]); dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"]); 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"]); if ($_POST['action'] != 'updateedit') { Header("Location: index.php"); } } llxHeader(); $form = new Form($db); $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; print_titre($langs->trans("GlobalSetup")); print "
\n"; if ((isset($_GET["action"]) && $_GET["action"] == 'edit') || (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) { /* * Edition des paramètres */ print ' '; print '
'; print ''; $var=true; print ''; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; print '
'.$langs->trans("CompanyAddress").''; print '
'.$langs->trans("Country").''; $form->select_pays($conf->global->MAIN_INFO_SOCIETE_PAYS,'pays_id',' onChange="save_refresh()"'); print '
'.$langs->trans("CompanyCurrency").''; $form->select_currency($conf->global->MAIN_MONNAIE,"currency"); print '
'; print '
'; // Identifiants de la société (propre au pays) print ''; print ''; $var=true; $langs->load("companies"); // 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 ''; // Forme juridique $var=!$var; print ''; // ProfID1 $var=!$var; print ''; // ProfId2 $var=!$var; print ''; // ProfId3 $var=!$var; print ''; // ProfId4 $var=!$var; print ''; // TVA Intra $var=!$var; print ''; print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("Capital").''; print '
'.$langs->trans("JuridicalStatus").''; if ($conf->global->MAIN_INFO_SOCIETE_PAYS) { $form->select_forme_juridique($conf->global->MAIN_INFO_FORME_JURIDIQUE,$code_pays); } else { print $countrynotdefined; } print '
'.$langs->transcountry("ProfId1",$code_pays).''; if ($conf->global->MAIN_INFO_SOCIETE_PAYS) { if ($langs->transcountry("ProfId1",$code_pays) != '-') { print ''; } } else { print $countrynotdefined; } print '
'.$langs->transcountry("ProfId2",$code_pays).''; if ($conf->global->MAIN_INFO_SOCIETE_PAYS) { if ($langs->transcountry("ProfId2",$code_pays) != '-') { print ''; } } else { print $countrynotdefined; } print '
'.$langs->transcountry("ProfId3",$code_pays).''; if ($conf->global->MAIN_INFO_SOCIETE_PAYS) { if ($langs->transcountry("ProfId3",$code_pays) != '-') { print ''; } } else { print $countrynotdefined; } print '
'.$langs->transcountry("ProfId4",$code_pays).''; if ($conf->global->MAIN_INFO_SOCIETE_PAYS) { if ($langs->transcountry("ProfId4",$code_pays) != '-') { print ''; } } else { print $countrynotdefined; } print '
'.$langs->trans("TVAIntra").''; print '
'; print '
'; print '
'; } else { /* * Affichage des paramètres */ print ''; print ''; $var=true; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").'' . $conf->global->MAIN_INFO_SOCIETE_NOM . '
'.$langs->trans("CompanyAddress").'' . nl2br($conf->global->MAIN_INFO_SOCIETE_ADRESSE) . '
'.$langs->trans("Country").''; print $form->pays_name($conf->global->MAIN_INFO_SOCIETE_PAYS,1); print '
'.$langs->trans("CompanyCurrency").''; print $form->currency_name($conf->global->MAIN_MONNAIE,1); print '
'; print '
'; // Identifiants de la société (propre au pays) print ''; print ''; $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 ''; // Forme juridique $var=!$var; print ''; // ProfId1 $var=!$var; print ''; // ProfId2 $var=!$var; print ''; // ProfId3 $var=!$var; print ''; // ProfId4 $var=!$var; print ''; // TVA Intracommunautaire $var=!$var; print ''; print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("Capital").''; print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; print $form->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1); print '
'.$langs->transcountry("ProfId1",$code_pays).''; if ($langs->transcountry("ProfId1",$code_pays) != '-') { print $conf->global->MAIN_INFO_SIREN; } print '
'.$langs->transcountry("ProfId2",$code_pays).''; if ($langs->transcountry("ProfId2",$code_pays) != '-') { print $conf->global->MAIN_INFO_SIRET; } print '
'.$langs->transcountry("ProfId3",$code_pays).''; if ($langs->transcountry("ProfId3",$code_pays) != '-') { print $conf->global->MAIN_INFO_APE; } print '
'.$langs->transcountry("ProfId4",$code_pays).''; if ($langs->transcountry("ProfId4",$code_pays) != '-') { print $conf->global->MAIN_INFO_RCS; } print '
'.$langs->trans("TVAIntra").'' . $conf->global->MAIN_INFO_TVAINTRA . '

'; // Boutons d'action print '
'; print ''.$langs->trans("Edit").''; print '
'; } llxFooter('$Date$ - $Revision$'); ?>