Work on multicompany
This commit is contained in:
parent
f63d43d044
commit
510baa2584
@ -346,7 +346,8 @@ class Conf
|
|||||||
|
|
||||||
// conf->monnaie
|
// conf->monnaie
|
||||||
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
|
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
|
||||||
$this->monnaie=$this->global->MAIN_MONNAIE;
|
$this->monnaie=$this->global->MAIN_MONNAIE; // TODO deprecated
|
||||||
|
$this->currency=$this->global->MAIN_MONNAIE;
|
||||||
|
|
||||||
// $this->compta->mode = Option du module Comptabilite (simple ou expert):
|
// $this->compta->mode = Option du module Comptabilite (simple ou expert):
|
||||||
// Defini le mode de calcul des etats comptables (CA,...)
|
// Defini le mode de calcul des etats comptables (CA,...)
|
||||||
|
|||||||
@ -2282,16 +2282,29 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la liste des devises, dans la langue de l'utilisateur
|
||||||
|
* @param selected code devise pre-selectionne
|
||||||
|
* @param htmlname nom de la liste deroulante
|
||||||
|
* TODO trier liste sur noms apres traduction plutot que avant
|
||||||
|
*/
|
||||||
|
function select_currency($selected='',$htmlname='currency_id')
|
||||||
|
{
|
||||||
|
print $this->selectcurrency($selected,$htmlname);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste des devises, dans la langue de l'utilisateur
|
* \brief Retourne la liste des devises, dans la langue de l'utilisateur
|
||||||
* \param selected code devise pre-selectionne
|
* \param selected code devise pre-selectionne
|
||||||
* \param htmlname nom de la liste deroulante
|
* \param htmlname nom de la liste deroulante
|
||||||
* \todo trier liste sur noms apres traduction plutot que avant
|
* \todo trier liste sur noms apres traduction plutot que avant
|
||||||
*/
|
*/
|
||||||
function select_currency($selected='',$htmlname='currency_id')
|
function selectcurrency($selected='',$htmlname='currency_id')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user;
|
global $conf,$langs,$user;
|
||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
|
|
||||||
|
$out='';
|
||||||
|
|
||||||
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite
|
if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite
|
||||||
|
|
||||||
@ -2303,7 +2316,7 @@ class Form
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
$out.= '<select class="flat" name="'.$htmlname.'">';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($num)
|
if ($num)
|
||||||
@ -2315,26 +2328,26 @@ class Form
|
|||||||
if ($selected && $selected == $obj->code_iso)
|
if ($selected && $selected == $obj->code_iso)
|
||||||
{
|
{
|
||||||
$foundselected=true;
|
$foundselected=true;
|
||||||
print '<option value="'.$obj->code_iso.'" selected="true">';
|
$out.= '<option value="'.$obj->code_iso.'" selected="true">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<option value="'.$obj->code_iso.'">';
|
$out.= '<option value="'.$obj->code_iso.'">';
|
||||||
}
|
}
|
||||||
if ($obj->code_iso) { print $obj->code_iso . ' - '; }
|
if ($obj->code_iso) { $out.= $obj->code_iso . ' - '; }
|
||||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||||
print ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
$out.= ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||||
print '</option>';
|
$out.= '</option>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</select>';
|
$out.= '</select>';
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
return 0;
|
return $out;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -357,39 +357,42 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC'))
|
|||||||
$mysoc=new Societe($db);
|
$mysoc=new Societe($db);
|
||||||
|
|
||||||
$mysoc->id=0;
|
$mysoc->id=0;
|
||||||
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM; // TODO obsolete
|
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM; // TODO deprecated
|
||||||
$mysoc->name=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
$mysoc->name=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
$mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE; // TODO obsolete
|
$mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE; // TODO deprecated
|
||||||
$mysoc->address=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
|
$mysoc->address=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
|
||||||
$mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP; // TODO obsolete
|
$mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP; // TODO deprecated
|
||||||
$mysoc->zip=$conf->global->MAIN_INFO_SOCIETE_CP;
|
$mysoc->zip=$conf->global->MAIN_INFO_SOCIETE_CP;
|
||||||
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE; // TODO obsolete
|
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE; // TODO deprecated
|
||||||
$mysoc->town=$conf->global->MAIN_INFO_SOCIETE_VILLE;
|
$mysoc->town=$conf->global->MAIN_INFO_SOCIETE_VILLE;
|
||||||
$mysoc->departement_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT;
|
$mysoc->state_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT;
|
||||||
|
$mysoc->departement_id=$conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT; // TODO deprecated
|
||||||
$mysoc->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE;
|
$mysoc->note=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE;
|
||||||
|
|
||||||
// We define pays_id, pays_code and pays_label
|
// We define pays_id, pays_code and pays_label
|
||||||
$tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS);
|
$tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_PAYS);
|
||||||
$pays_id=$tmp[0];
|
$country_id=$tmp[0];
|
||||||
if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label"
|
if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_PAYS is "id:code:label"
|
||||||
{
|
{
|
||||||
$pays_code=$tmp[1];
|
$country_code=$tmp[1];
|
||||||
$pays_label=$tmp[2];
|
$country_label=$tmp[2];
|
||||||
}
|
}
|
||||||
else // For backward compatibility
|
else // For backward compatibility
|
||||||
{
|
{
|
||||||
dol_syslog("Your country setup use an old syntax. Reedit it in setup area.", LOG_WARNING);
|
dol_syslog("Your country setup use an old syntax. Reedit it in setup area.", LOG_WARNING);
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/company.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/company.lib.php');
|
||||||
$pays_code=getCountry($pays_id,2,$db); // This need a SQL request, but it's the old feature
|
$country_code=getCountry($country_id,2,$db); // This need a SQL request, but it's the old feature
|
||||||
$pays_label=getCountry($pays_id,0,$db); // This need a SQL request, but it's the old feature
|
$country_label=getCountry($country_id,0,$db); // This need a SQL request, but it's the old feature
|
||||||
}
|
}
|
||||||
$mysoc->pays_id=$pays_id;
|
$mysoc->pays_id=$country_id; // TODO deprecated
|
||||||
$mysoc->pays_code=$pays_code;
|
$mysoc->country_id=$country_id;
|
||||||
$mysoc->country=$pays_label;
|
$mysoc->pays_code=$country_code; // TODO deprecated
|
||||||
if (is_object($langs)) $mysoc->country=($langs->trans('Country'.$pays_code)!='Country'.$pays_code)?$langs->trans('Country'.$pays_code):$pays_label;
|
$mysoc->country_code=$country_code;
|
||||||
$mysoc->pays=$mysoc->country; // deprecated
|
$mysoc->country=$country_label;
|
||||||
|
if (is_object($langs)) $mysoc->country=($langs->trans('Country'.$country_code)!='Country'.$country_code)?$langs->trans('Country'.$country_code):$country_label;
|
||||||
|
$mysoc->pays=$mysoc->country; // TODO deprecated
|
||||||
|
|
||||||
$mysoc->tel=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; // deprecated
|
$mysoc->tel=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; // TODO deprecated
|
||||||
$mysoc->phone=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL;
|
$mysoc->phone=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL;
|
||||||
$mysoc->fax=empty($conf->global->MAIN_INFO_SOCIETE_FAX)?'':$conf->global->MAIN_INFO_SOCIETE_FAX;
|
$mysoc->fax=empty($conf->global->MAIN_INFO_SOCIETE_FAX)?'':$conf->global->MAIN_INFO_SOCIETE_FAX;
|
||||||
$mysoc->url=empty($conf->global->MAIN_INFO_SOCIETE_WEB)?'':$conf->global->MAIN_INFO_SOCIETE_WEB;
|
$mysoc->url=empty($conf->global->MAIN_INFO_SOCIETE_WEB)?'':$conf->global->MAIN_INFO_SOCIETE_WEB;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user