Work on multicompany module with smarty integration
This commit is contained in:
parent
b6e1285b81
commit
fe0a35b29e
@ -763,47 +763,4 @@ $db->close();
|
|||||||
|
|
||||||
llxFooter('$Date$ - $Revision$');
|
llxFooter('$Date$ - $Revision$');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \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
|
|
||||||
* TODO deplacer dans une classe
|
|
||||||
*/
|
|
||||||
function currency_name($code_iso,$withcode=0)
|
|
||||||
{
|
|
||||||
global $langs,$db;
|
|
||||||
|
|
||||||
// Si il existe une traduction, on peut renvoyer de suite le libelle
|
|
||||||
if ($langs->trans("Currency".$code_iso)!="Currency".$code_iso)
|
|
||||||
{
|
|
||||||
return $langs->trans("Currency".$code_iso);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si pas de traduction, on consulte le libelle par defaut en table
|
|
||||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies";
|
|
||||||
$sql.= " WHERE code_iso='".$code_iso."'";
|
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
$label=($obj->label!='-'?$obj->label:'');
|
|
||||||
if ($withcode) return ($label==$code_iso)?"$code_iso":"$code_iso - $label";
|
|
||||||
else return $label;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $code_iso;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php');
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|||||||
@ -210,6 +210,45 @@ function getCountryLabel($id,$withcode=0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \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)
|
||||||
|
{
|
||||||
|
global $langs,$db;
|
||||||
|
|
||||||
|
// Si il existe une traduction, on peut renvoyer de suite le libelle
|
||||||
|
if ($langs->trans("Currency".$code_iso)!="Currency".$code_iso)
|
||||||
|
{
|
||||||
|
return $langs->trans("Currency".$code_iso);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si pas de traduction, on consulte le libelle par defaut en table
|
||||||
|
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||||
|
$sql.= " WHERE code_iso='".$code_iso."'";
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$label=($obj->label!='-'?$obj->label:'');
|
||||||
|
if ($withcode) return ($label==$code_iso)?"$code_iso":"$code_iso - $label";
|
||||||
|
else return $label;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $code_iso;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne le nom traduit de la forme juridique
|
* \brief Retourne le nom traduit de la forme juridique
|
||||||
|
|||||||
@ -114,7 +114,18 @@ class Multicompany
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$entityDetails[$obj->name] = $obj->value;
|
if (preg_match('/^MAIN_INFO_SOCIETE_PAYS$/i',$obj->name))
|
||||||
|
{
|
||||||
|
$entityDetails[$obj->name] = getCountryLabel($obj->value);
|
||||||
|
}
|
||||||
|
else if (preg_match('/^MAIN_MONNAIE$/i',$obj->name))
|
||||||
|
{
|
||||||
|
$entityDetails[$obj->name] = currency_name($obj->value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$entityDetails[$obj->name] = $obj->value;
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user