diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 8c859132c25..7ca3f123ab1 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -881,7 +881,7 @@ if ($action == 'create')
$adh->fk_departement = $_POST["departement_id"];
// We set pays_id, pays_code and label for the selected country
- $adh->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
+ $adh->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
if ($adh->pays_id)
{
$sql = "SELECT rowid, code, libelle";
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 2e51597bf91..02c1c272bd0 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -51,171 +51,177 @@ $quality = 80;
if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["cancel"]))
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
{
- require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
+ require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_VILLE",$_POST["ville"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_CP",$_POST["cp"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS",$_POST["pays_id"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_DEPARTEMENT",$_POST["departement_id"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity);
- if ($_FILES["logo"]["tmp_name"])
- {
- if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
- {
- $original_file=$reg[1];
+ $new_pays_id=$_POST["pays_id"];
+ $new_pays_code=getCountry($new_pays_id,2);
+ $new_pays_label=getCountry($new_pays_id,0);
+ //dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $new_pays_id,'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $new_pays_id.':'.$new_pays_code.':'.$new_pays_label,'chaine',0,'',$conf->entity);
- $isimage=image_format_supported($original_file);
- if ($isimage >= 0)
- {
- dol_syslog("Move file ".$_FILES["logo"]["tmp_name"]." to ".$conf->mycompany->dir_output.'/logos/'.$original_file);
- if (! is_dir($conf->mycompany->dir_output.'/logos/'))
- {
- create_exdir($conf->mycompany->dir_output.'/logos/');
- }
- $result=dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->mycompany->dir_output.'/logos/'.$original_file,1,0,$_FILES['logo']['error']);
- if ($result > 0)
- {
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADRESSE",$_POST["address"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_VILLE",$_POST["ville"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_CP",$_POST["cp"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_DEPARTEMENT",$_POST["departement_id"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["gencod"],'chaine',0,'',$conf->entity);
+ if ($_FILES["logo"]["tmp_name"])
+ {
+ if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg))
+ {
+ $original_file=$reg[1];
- // Create thumbs of logo (Note that PDF use original file and not thumbs)
- if ($isimage > 0)
- {
- // Create small thumbs for company (Ratio is near 16/9)
- // Used on logon for example
- $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
- if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
- {
- $imgThumbSmall = $reg[1];
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
- }
- else dol_syslog($imgThumbSmall);
+ $isimage=image_format_supported($original_file);
+ if ($isimage >= 0)
+ {
+ dol_syslog("Move file ".$_FILES["logo"]["tmp_name"]." to ".$conf->mycompany->dir_output.'/logos/'.$original_file);
+ if (! is_dir($conf->mycompany->dir_output.'/logos/'))
+ {
+ create_exdir($conf->mycompany->dir_output.'/logos/');
+ }
+ $result=dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->mycompany->dir_output.'/logos/'.$original_file,1,0,$_FILES['logo']['error']);
+ if ($result > 0)
+ {
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity);
- // Create mini thumbs for company (Ratio is near 16/9)
- // Used on menu or for setup page for example
- $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
- if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
- {
- $imgThumbMini = $reg[1];
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
- }
- else dol_syslog($imgThumbMini);
- }
- else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING);
- }
- else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
- {
- $langs->load("errors");
- $tmparray=explode(':',$result);
- $message .= '
'.$langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]).'
';
- }
- else
- {
- $message .= ''.$langs->trans("ErrorFailedToSaveFile").'
';
- }
- }
- else
- {
- $message .= ''.$langs->trans("ErrorOnlyPngJpgSupported").'
';
- }
- }
- }
+ // Create thumbs of logo (Note that PDF use original file and not thumbs)
+ if ($isimage > 0)
+ {
+ // Create small thumbs for company (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
+ if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
+ {
+ $imgThumbSmall = $reg[1];
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
+ }
+ else dol_syslog($imgThumbSmall);
- dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
+ // Create mini thumbs for company (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
+ if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
+ {
+ $imgThumbMini = $reg[1];
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
+ }
+ else dol_syslog($imgThumbMini);
+ }
+ else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING);
+ }
+ else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
+ {
+ $langs->load("errors");
+ $tmparray=explode(':',$result);
+ $message .= ''.$langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]).'
';
+ }
+ else
+ {
+ $message .= ''.$langs->trans("ErrorFailedToSaveFile").'
';
+ }
+ }
+ else
+ {
+ $message .= ''.$langs->trans("ErrorOnlyPngJpgSupported").'
';
+ }
+ }
+ }
- dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
- // Local taxes
- dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity);
- if ($_POST['action'] != 'updateedit' && ! $message)
- {
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
+ // Local taxes
+ dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
+
+ if ($_POST['action'] != 'updateedit' && ! $message)
+ {
+ Header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
}
if ($_GET["action"] == 'addthumb')
{
- if (file_exists($conf->societe->dir_output.'/logos/'.$_GET["file"]))
- {
- $isimage=image_format_supported($_GET["file"]);
+ if (file_exists($conf->societe->dir_output.'/logos/'.$_GET["file"]))
+ {
+ $isimage=image_format_supported($_GET["file"]);
- // Create thumbs of logo
- if ($isimage > 0)
- {
- // Create small thumbs for company (Ratio is near 16/9)
- // Used on logon for example
- $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
- if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
- {
- $imgThumbSmall = $reg[1];
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
- }
- else dol_syslog($imgThumbSmall);
+ // Create thumbs of logo
+ if ($isimage > 0)
+ {
+ // Create small thumbs for company (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
+ if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
+ {
+ $imgThumbSmall = $reg[1];
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
+ }
+ else dol_syslog($imgThumbSmall);
- // Create mini thumbs for company (Ratio is near 16/9)
- // Used on menu or for setup page for example
- $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
- if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
- {
- $imgThumbMini = $reg[1];
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
- }
- else dol_syslog($imgThumbMini);
+ // Create mini thumbs for company (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
+ if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
+ {
+ $imgThumbMini = $reg[1];
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
+ }
+ else dol_syslog($imgThumbMini);
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
- else
- {
- $message .= ''.$langs->trans("ErrorImageFormatNotSupported").'
';
- dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING);
- }
- }
- else
- {
- $message .= ''.$langs->trans("ErrorFileDoesNotExists",$_GET["file"]).'
';
- dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
- }
+ Header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
+ else
+ {
+ $message .= ''.$langs->trans("ErrorImageFormatNotSupported").'
';
+ dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING);
+ }
+ }
+ else
+ {
+ $message .= ''.$langs->trans("ErrorFileDoesNotExists",$_GET["file"]).'
';
+ dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
+ }
}
if ($_GET["action"] == 'removelogo')
{
- $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
- dol_delete_file($logofile);
- dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity);
- $mysoc->logo='';
+ $logofile=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
+ dol_delete_file($logofile);
+ dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO",$conf->entity);
+ $mysoc->logo='';
- $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
- dol_delete_file($logosmallfile);
- dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
- $mysoc->logo_small='';
+ $logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
+ dol_delete_file($logosmallfile);
+ dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
+ $mysoc->logo_small='';
- $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
- dol_delete_file($logominifile);
- dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
- $mysoc->logo_mini='';
+ $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
+ dol_delete_file($logominifile);
+ dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
+ $mysoc->logo_mini='';
}
+
/*
- * Affichage page
+ * View
*/
$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
@@ -226,6 +232,30 @@ $formcompany = new FormCompany($db);
$countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").') ';
+// We define pays_id, pays_code and pays_label
+if (! empty($conf->global->MAIN_INFO_SOCIETE_PAYS))
+{
+ $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS);
+ $pays_id=$tmp[0];
+ if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label"
+ {
+ $pays_code=$tmp[1];
+ $pays_label=$tmp[2];
+ }
+ else
+ {
+ $pays_code=getCountry($pays_id,2);
+ $pays_label=getCountry($pays_id,0);
+ }
+}
+else
+{
+ $pays_id=0;
+ $pays_code='';
+ $pays_label='';
+}
+
+
print_fiche_titre($langs->trans("CompanyFoundation"),'','setup');
print $langs->trans("CompanyFundationDesc")." \n";
@@ -234,711 +264,678 @@ print " \n";
if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
{
- /**
- * Edition des parametres
- */
+ /**
+ * Edition des parametres
+ */
- print '';
+ print '';
}
else
{
- /*
- * Show parameters
- */
+ /*
+ * Show parameters
+ */
- if ($message) print $message.' ';
+ if ($message) print $message.' ';
- // Actions buttons
- //print ' ';
+ // Actions buttons
+ //print ' ';
- print '';
- print ''.$langs->trans("CompanyInfo").' '.$langs->trans("Value").' ';
- $var=true;
+ print '';
+ print ''.$langs->trans("CompanyInfo").' '.$langs->trans("Value").' ';
+ $var=true;
- $var=!$var;
- print ''.$langs->trans("CompanyName").' ' . $conf->global->MAIN_INFO_SOCIETE_NOM . ' ';
+ $var=!$var;
+ print ''.$langs->trans("CompanyName").' ' . $conf->global->MAIN_INFO_SOCIETE_NOM . ' ';
- $var=!$var;
- print ''.$langs->trans("CompanyAddress").' ' . nl2br($conf->global->MAIN_INFO_SOCIETE_ADRESSE) . ' ';
+ $var=!$var;
+ print ''.$langs->trans("CompanyAddress").' ' . nl2br($conf->global->MAIN_INFO_SOCIETE_ADRESSE) . ' ';
- $var=!$var;
- print ''.$langs->trans("CompanyZip").' ' . $conf->global->MAIN_INFO_SOCIETE_CP . ' ';
+ $var=!$var;
+ print ''.$langs->trans("CompanyZip").' ' . $conf->global->MAIN_INFO_SOCIETE_CP . ' ';
- $var=!$var;
- print ''.$langs->trans("CompanyTown").' ' . $conf->global->MAIN_INFO_SOCIETE_VILLE . ' ';
+ $var=!$var;
+ print ''.$langs->trans("CompanyTown").' ' . $conf->global->MAIN_INFO_SOCIETE_VILLE . ' ';
- $var=!$var;
- print ''.$langs->trans("CompanyCountry").' ';
- if ($conf->global->MAIN_INFO_SOCIETE_PAYS)
- {
- $img=picto_from_langcode(getCountry($conf->global->MAIN_INFO_SOCIETE_PAYS,2));
- print $img?$img.' ':'';
- print getCountry($conf->global->MAIN_INFO_SOCIETE_PAYS,1);
- }
- print ' ';
+ $var=!$var;
+ print ''.$langs->trans("CompanyCountry").' ';
+ if ($pays_code)
+ {
+ $img=picto_from_langcode($pays_code);
+ print $img?$img.' ':'';
+ print getCountry($pays_code,1);
+ }
+ print ' ';
- $var=!$var;
- print ''.$langs->trans("State").' ';
- if ($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT)
- {
- $sql = "SELECT code_departement as code, nom as label from ".MAIN_DB_PREFIX."c_departements where rowid = '".$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT."'";
- $resql=$db->query($sql);
- if ($resql)
- {
- $obj = $db->fetch_object($resql);
- }
- else
- {
- dol_print_error($db);
- }
- $state=$obj->label;
- print $state;
- }
- print ' ';
+ $var=!$var;
+ print ''.$langs->trans("State").' ';
+ if ($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT)
+ {
+ $sql = "SELECT code_departement as code, nom as label from ".MAIN_DB_PREFIX."c_departements where rowid = '".$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT."'";
+ $resql=$db->query($sql);
+ if ($resql)
+ {
+ $obj = $db->fetch_object($resql);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+ $state=$obj->label;
+ print $state;
+ }
+ print ' ';
- $var=!$var;
- print ''.$langs->trans("CompanyCurrency").' ';
- print currency_name($conf->global->MAIN_MONNAIE,1);
- print ' ('.$conf->global->MAIN_MONNAIE.')';
- print ' ';
+ $var=!$var;
+ print ''.$langs->trans("CompanyCurrency").' ';
+ print currency_name($conf->global->MAIN_MONNAIE,1);
+ print ' ('.$conf->global->MAIN_MONNAIE.')';
+ print ' ';
- $var=!$var;
- print ''.$langs->trans("Tel").' ' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->pays_code) . ' ';
+ $var=!$var;
+ print ''.$langs->trans("Tel").' ' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->pays_code) . ' ';
- $var=!$var;
- print ''.$langs->trans("Fax").' ' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->pays_code) . ' ';
+ $var=!$var;
+ print ''.$langs->trans("Fax").' ' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->pays_code) . ' ';
- $var=!$var;
- print ''.$langs->trans("Mail").' ' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . ' ';
+ $var=!$var;
+ print ''.$langs->trans("Mail").' ' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . ' ';
- // Web
- $var=!$var;
- print ''.$langs->trans("Web").' ' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . ' ';
+ // Web
+ $var=!$var;
+ print ''.$langs->trans("Web").' ' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . ' ';
- // Barcode
- if ($conf->barcode->enabled)
- {
- $var=!$var;
- print ''.$langs->trans("Gencod").' ' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . ' ';
- }
+ // Barcode
+ if ($conf->barcode->enabled)
+ {
+ $var=!$var;
+ print ''.$langs->trans("Gencod").' ' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . ' ';
+ }
- // Logo
- $var=!$var;
- print ''.$langs->trans("Logo").' ';
+ // Logo
+ $var=!$var;
+ print ' '.$langs->trans("Logo").' ';
- print '';
- print $mysoc->logo;
- print ' ';
+ print '';
+ print $mysoc->logo;
+ print ' ';
- // On propose la generation de la vignette si elle n'existe pas
- if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
- {
- print 'logo).'">'.img_refresh($langs->trans('GenerateThumb')).' ';
- }
- else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
- {
- print ' ';
- }
- else
- {
- print ' ';
- }
- print '
';
+ // On propose la generation de la vignette si elle n'existe pas
+ if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
+ {
+ print 'logo).'">'.img_refresh($langs->trans('GenerateThumb')).' ';
+ }
+ else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
+ {
+ print ' ';
+ }
+ else
+ {
+ print ' ';
+ }
+ print '
';
- print ' ';
+ print '';
- $var=!$var;
- print ''.$langs->trans("Note").' ' . nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) . ' ';
+ $var=!$var;
+ print ''.$langs->trans("Note").' ' . nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) . ' ';
- print '
';
+ print '
';
- print ' ';
+ print ' ';
- // Identifiants de la societe (propre au pays)
- print '';
- print ' ';
- print '';
- print ''.$langs->trans("CompanyIds").' '.$langs->trans("Value").' ';
- $var=true;
+ // Identifiants de la societe (propre au pays)
+ print '';
+ print ' ';
+ print '';
+ print ''.$langs->trans("CompanyIds").' '.$langs->trans("Value").' ';
+ $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($result);
- if ($obj->code) $code_pays=$obj->code;
- }
- else {
- dol_print_error($db);
- }
- }
+ // Capital
+ $var=!$var;
+ print ''.$langs->trans("Capital").' ';
+ print $conf->global->MAIN_INFO_CAPITAL . ' ';
- // Capital
- $var=!$var;
- print ''.$langs->trans("Capital").' ';
- print $conf->global->MAIN_INFO_CAPITAL . ' ';
+ // Forme juridique
+ $var=!$var;
+ print ''.$langs->trans("JuridicalStatus").' ';
+ print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1);
+ print ' ';
- // Forme juridique
- $var=!$var;
- print ''.$langs->trans("JuridicalStatus").' ';
- print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1);
- print ' ';
+ // ProfId1
+ if ($langs->transcountry("ProfId1",$pays_code) != '-')
+ {
+ $var=!$var;
+ print ''.$langs->transcountry("ProfId1",$pays_code).' ';
+ if ($langs->transcountry("ProfId1",$pays_code) != '-')
+ {
+ print $conf->global->MAIN_INFO_SIREN;
+ if ($conf->global->MAIN_INFO_SIREN && $pays_code == 'FR') print ' '.$langs->trans("Check").' ';
+ }
+ print ' ';
+ }
- // ProfId1
- if ($langs->transcountry("ProfId1",$code_pays) != '-')
- {
- $var=!$var;
- print ''.$langs->transcountry("ProfId1",$code_pays).' ';
- if ($langs->transcountry("ProfId1",$code_pays) != '-')
- {
- print $conf->global->MAIN_INFO_SIREN;
- if ($conf->global->MAIN_INFO_SIREN && $code_pays == 'FR') print ' '.$langs->trans("Check").' ';
- }
- print ' ';
- }
+ // ProfId2
+ if ($langs->transcountry("ProfId2",$pays_code) != '-')
+ {
+ $var=!$var;
+ print ''.$langs->transcountry("ProfId2",$pays_code).' ';
+ if ($langs->transcountry("ProfId2",$pays_code) != '-')
+ {
+ print $conf->global->MAIN_INFO_SIRET;
+ }
+ print ' ';
+ }
- // ProfId2
- if ($langs->transcountry("ProfId2",$code_pays) != '-')
- {
- $var=!$var;
- print ''.$langs->transcountry("ProfId2",$code_pays).' ';
- if ($langs->transcountry("ProfId2",$code_pays) != '-')
- {
- print $conf->global->MAIN_INFO_SIRET;
- }
- print ' ';
- }
+ // ProfId3
+ if ($langs->transcountry("ProfId3",$pays_code) != '-')
+ {
+ $var=!$var;
+ print ''.$langs->transcountry("ProfId3",$pays_code).' ';
+ if ($langs->transcountry("ProfId3",$pays_code) != '-')
+ {
+ print $conf->global->MAIN_INFO_APE;
+ }
+ print ' ';
+ }
- // ProfId3
- if ($langs->transcountry("ProfId3",$code_pays) != '-')
- {
- $var=!$var;
- print ''.$langs->transcountry("ProfId3",$code_pays).' ';
- if ($langs->transcountry("ProfId3",$code_pays) != '-')
- {
- print $conf->global->MAIN_INFO_APE;
- }
- print ' ';
- }
+ // ProfId4
+ if ($langs->transcountry("ProfId4",$pays_code) != '-')
+ {
+ $var=!$var;
+ print ''.$langs->transcountry("ProfId4",$pays_code).' ';
+ if ($langs->transcountry("ProfId4",$pays_code) != '-')
+ {
+ print $conf->global->MAIN_INFO_RCS;
+ }
+ print ' ';
+ }
- // ProfId4
- if ($langs->transcountry("ProfId4",$code_pays) != '-')
- {
- $var=!$var;
- print ''.$langs->transcountry("ProfId4",$code_pays).' ';
- if ($langs->transcountry("ProfId4",$code_pays) != '-')
- {
- print $conf->global->MAIN_INFO_RCS;
- }
- print ' ';
- }
+ // TVA
+ if ($conf->use_javascript_ajax)
+ {
+ print "\n";
+ print '';
+ print "\n";
+ }
+ $var=!$var;
+ print ''.$langs->trans("VATIntra").' ';
+ print '';
+ if ($conf->global->MAIN_INFO_TVAINTRA)
+ {
+ $s='';
+ $s.=$conf->global->MAIN_INFO_TVAINTRA;
+ $s.=' ';
+ $s.=' ';
+ if ($conf->use_javascript_ajax)
+ {
+ $s.=''.$langs->trans("VATIntraCheck").' ';
+ print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
+ }
+ else
+ {
+ print $s.'id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').' ';
+ }
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' ';
+ print ' ';
- // TVA
- if ($conf->use_javascript_ajax)
- {
- print "\n";
- print '';
- print "\n";
- }
- $var=!$var;
- print ''.$langs->trans("VATIntra").' ';
- print '';
- if ($conf->global->MAIN_INFO_TVAINTRA)
- {
- $s='';
- $s.=$conf->global->MAIN_INFO_TVAINTRA;
- $s.=' ';
- $s.=' ';
- if ($conf->use_javascript_ajax)
- {
- $s.=''.$langs->trans("VATIntraCheck").' ';
- print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
- }
- else
- {
- print $s.'id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').' ';
- }
- }
- else
- {
- print ' ';
- }
- print ' ';
- print ' ';
+ print '
';
+ print ' ';
- print '
';
- print ' ';
+ /*
+ * Debut d'annee fiscale
+ */
+ print ' ';
+ print '';
+ print '';
+ print ''.$langs->trans("FiscalYearInformation").' '.$langs->trans("Value").' ';
+ print " \n";
+ $var=true;
- /*
- * Debut d'annee fiscale
- */
- print ' ';
- print '';
- print '';
- print ''.$langs->trans("FiscalYearInformation").' '.$langs->trans("Value").' ';
- print " \n";
- $var=true;
+ $var=!$var;
+ print ''.$langs->trans("FiscalMonthStart").' ';
+ $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
+ print monthArrayOrSelected($monthstart) . ' ';
- $var=!$var;
- print ''.$langs->trans("FiscalMonthStart").' ';
- $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
- print monthArrayOrSelected($monthstart) . ' ';
+ print "
";
- print "
";
+ /*
+ * Options fiscale
+ */
+ print ' ';
+ print '';
+ print '';
+ print ''.$langs->trans("VATManagement").' '.$langs->trans("Description").' ';
+ print ' ';
+ print " \n";
+ $var=true;
- /*
- * Options fiscale
- */
- print ' ';
- print '";
+ print "
";
- /*
- * Local Taxes
- */
- if ($code_pays=='ES')
- {
- // Local Tax 1
- print ' ';
- print '';
- print '';
- print ''.$langs->transcountry("LocalTax1Management",$code_pays).' '.$langs->trans("Description").' ';
- print ' ';
- print " \n";
- $var=true;
+ /*
+ * Local Taxes
+ */
+ if ($pays_code=='ES')
+ {
+ // Local Tax 1
+ print ' ';
+ print '';
+ print '';
+ print ''.$langs->transcountry("LocalTax1Management",$pays_code).' '.$langs->trans("Description").' ';
+ print ' ';
+ print " \n";
+ $var=true;
- $var=!$var;
- print " global->FACTURE_LOCAL_TAX1_OPTION != "localtax1off"?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$code_pays)." ";
- print '';
- print "";
- print "".$langs->transcountry("LocalTax1IsUsedDesc",$code_pays)." ";
- print "".$langs->trans("Example",$code_pays).': '.$langs->transcountry("LocalTax1IsUsedExample",$code_pays)." \n";
- print "
";
- print " \n";
+ $var=!$var;
+ print " global->FACTURE_LOCAL_TAX1_OPTION != "localtax1off"?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$pays_code)." ";
+ print '';
+ print "";
+ print "".$langs->transcountry("LocalTax1IsUsedDesc",$pays_code)." ";
+ print "".$langs->trans("Example",$pays_code).': '.$langs->transcountry("LocalTax1IsUsedExample",$pays_code)." \n";
+ print "
";
+ print " \n";
- $var=!$var;
- print " global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off"?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$code_pays)." ";
- print '';
- print "";
- print "".$langs->transcountry("LocalTax1IsNotUsedDesc",$code_pays)." ";
- print "".$langs->trans("Example",$code_pays).': '.$langs->transcountry("LocalTax1IsNotUsedExample",$code_pays)." \n";
- print "
";
- print " \n";
+ $var=!$var;
+ print " global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off"?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$pays_code)." ";
+ print '';
+ print "";
+ print "".$langs->transcountry("LocalTax1IsNotUsedDesc",$pays_code)." ";
+ print "".$langs->trans("Example",$pays_code).': '.$langs->transcountry("LocalTax1IsNotUsedExample",$pays_code)." \n";
+ print "
";
+ print " \n";
- print "
";
+ print "
";
- // Local Tax 2
- print ' ';
- print '';
- print '';
- print ''.$langs->transcountry("LocalTax2Management",$code_pays).' '.$langs->trans("Description").' ';
- print ' ';
- print " \n";
- $var=true;
+ // Local Tax 2
+ print ' ';
+ print '';
+ print '';
+ print ''.$langs->transcountry("LocalTax2Management",$pays_code).' '.$langs->trans("Description").' ';
+ print ' ';
+ print " \n";
+ $var=true;
- $var=!$var;
- print " global->FACTURE_LOCAL_TAX2_OPTION != "localtax2off"?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$code_pays)." ";
- print '';
- print "";
- print "".$langs->transcountry("LocalTax2IsUsedDesc",$code_pays)." ";
- print "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$code_pays)." \n";
- print "
";
- print " \n";
+ $var=!$var;
+ print " global->FACTURE_LOCAL_TAX2_OPTION != "localtax2off"?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$pays_code)." ";
+ print '';
+ print "";
+ print "".$langs->transcountry("LocalTax2IsUsedDesc",$pays_code)." ";
+ print "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample",$pays_code)." \n";
+ print "
";
+ print " \n";
- $var=!$var;
- print " global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off"?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$code_pays)." ";
- print '';
- print "";
- print "".$langs->transcountry("LocalTax2IsNotUsedDesc",$code_pays)." ";
- print "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$code_pays)." \n";
- print "
";
- print " \n";
+ $var=!$var;
+ print " global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off"?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$pays_code)." ";
+ print '';
+ print "";
+ print "".$langs->transcountry("LocalTax2IsNotUsedDesc",$pays_code)." ";
+ print "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsNotUsedExample",$pays_code)." \n";
+ print "
";
+ print " \n";
- print "
";
- }
+ print "
";
+ }
- // Actions buttons
- print '';
+ // Actions buttons
+ print '';
- print ' ';
+ print ' ';
}
$db->close();
diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php
index 1617535fb88..099ac5939f3 100644
--- a/htdocs/comm/address.php
+++ b/htdocs/comm/address.php
@@ -193,7 +193,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
}
// On positionne pays_id, pays_code et libelle du pays choisi
- $address->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
+ $address->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
if ($address->pays_id)
{
$sql = "SELECT code, libelle";
@@ -296,7 +296,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
$address->address = $_POST["address"];
$address->zip = $_POST["zip"];
$address->ville = $_POST["ville"];
- $address->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
+ $address->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$address->tel = $_POST["tel"];
$address->fax = $_POST["fax"];
$address->note = $_POST["note"];
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 4a7bac3b2f6..f8b1628b105 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -276,7 +276,7 @@ if ($user->rights->societe->contact->creer)
$contact->fk_departement = $_POST["departement_id"];
// We set pays_id, pays_code and label for the selected country
- $contact->fk_pays=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
+ $contact->fk_pays=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
if ($contact->fk_pays)
{
$sql = "SELECT code, libelle";
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index bccb6a89b14..23ca735993f 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -228,7 +228,7 @@ class FormCompany
// Affiche la rupture si on est en mode liste multipays
if (! $pays_code && $obj->code_pays)
{
- print '----- '.$obj->libelle_pays." ----- \n";
+ print '----- '.$obj->libelle_pays." ----- \n";
$pays=$obj->libelle_pays;
}
}
diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php
index 17a970e40d5..cf60ffa0494 100644
--- a/htdocs/lib/company.lib.php
+++ b/htdocs/lib/company.lib.php
@@ -189,7 +189,6 @@ function getCountry($id,$withcode=0)
{
global $db,$langs;
- // TODO Optimize: Try to translate and make SQL request only if it fails
$sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays";
if (is_numeric($id)) $sql.= " WHERE rowid=".$id;
else $sql.= " WHERE code='".$id."'";
diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php
index 1a0a8955f78..da2ded5cefa 100644
--- a/htdocs/lib/files.lib.php
+++ b/htdocs/lib/files.lib.php
@@ -244,6 +244,19 @@ function dol_mimetype($file,$default='application/octet-stream',$shortmime=0)
}
+/**
+ * \brief Test if filename is a directory
+ * \param folder Name of folder
+ * \return boolean True if it's a directory, False if not found
+ */
+function dol_is_dir($folder)
+{
+ $newfolder=dol_osencode($folder);
+ if (is_dir($newfolder)) return true;
+ else return false;
+}
+
+
/**
* \brief Test if a folder is empty
* \param folder Name of folder
diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js
index 2ab991f00ef..32abd7e4a52 100644
--- a/htdocs/lib/lib_head.js
+++ b/htdocs/lib/lib_head.js
@@ -569,6 +569,17 @@ function getIntegerInString(str,i,minlength,maxlength)
}
+/*=================================================================
+Purpose: Clean string to have it url encoded
+Input: s
+Author: Laurent Destailleur
+Licence: GPL
+==================================================================*/
+function urlencode(s) {
+ return s.replace(/\+/gi,'%2B');
+}
+
+
/*=================================================================
Purpose: Show a popup HTML page.
Input: url,title
@@ -767,3 +778,5 @@ function uncheckBox(boxId) {
elementId.checked = false;
}
}
+
+
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 04519c88c8d..e08eb0b50b4 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -669,9 +669,6 @@ dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]);
//Another call for easy debugg
//dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST));
-// For backward compatibility
-if (! defined('MAIN_INFO_SOCIETE_PAYS')) define('MAIN_INFO_SOCIETE_PAYS','1');
-
// Load main languages files
if (! defined('NOREQUIRETRAN'))
{
diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php
index 1ea7d5377ef..ca8fceddfcd 100644
--- a/htdocs/master.inc.php
+++ b/htdocs/master.inc.php
@@ -362,7 +362,7 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
}
else // For backward compatibility
{
- include(DOL_DOCUMENT_ROOT.'/lib/company.lib.php');
+ include_once(DOL_DOCUMENT_ROOT.'/lib/company.lib.php');
$pays_code=getCountry($pays_id,2); // This need a SQL request, but it's the old feature
$pays_label=getCountry($pays_id,0); // This need a SQL request, but it's the old feature
}
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 4afb7bd58c6..d32b2b167f7 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -428,7 +428,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
$soc->default_lang=$_POST["default_lang"];
// We set pays_id, pays_code and label for the selected country
- $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
+ $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
if ($soc->pays_id)
{
$sql = "SELECT code, libelle";
@@ -802,7 +802,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
$soc->address=$_POST["adresse"];
$soc->cp=$_POST["cp"];
$soc->ville=$_POST["ville"];
- $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$conf->global->MAIN_INFO_SOCIETE_PAYS;
+ $soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
$soc->departement_id=$_POST["departement_id"];
$soc->tel=$_POST["tel"];
$soc->fax=$_POST["fax"];