diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0a41969afd3..d1e0b9020b7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -162,7 +162,7 @@ function societe_prepare_head(Societe $object) $head[$h][2] = 'rib'; $h++; } - + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab @@ -217,7 +217,7 @@ function societe_prepare_head(Societe $object) $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ; $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); - + $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; @@ -234,7 +234,7 @@ function societe_prepare_head(Societe $object) } $head[$h][2] = 'agenda'; $h++; - + // Log /*$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id; $head[$h][1] = $langs->trans("Info"); @@ -334,7 +334,7 @@ function getCountry($searchkey,$withcode='',$dbtouse=0,$outputlangs='',$entconv= global $db,$langs; $result=''; - + // Check parameters if (empty($searchkey) && empty($searchlabel)) { @@ -421,23 +421,26 @@ function getState($id,$withcode='',$dbtouse=0) } /** - * Retourne le nom traduit ou code+nom d'une devise + * Return label of currency or code+label * - * @param string $code_iso Code iso de la devise - * @param int $withcode '1'=affiche code + nom - * @return string Nom traduit de la devise + * @param string $code_iso Code iso of currency + * @param int $withcode '1'=show code + label + * @param Translate $outputlangs Output language + * @return string Label translated of currency */ -function currency_name($code_iso,$withcode='') +function currency_name($code_iso, $withcode='', $outputlangs=null) { global $langs,$db; - // Si il existe une traduction, on peut renvoyer de suite le libelle - if ($langs->trans("Currency".$code_iso)!="Currency".$code_iso) + if (empty($outputlangs)) $outputlangs=$langs; + + // If there is a translation, we can send immediatly the label + if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso) { - return $langs->trans("Currency".$code_iso); + return ($withcode?$code_iso.' - ':'').$outputlangs->trans("Currency".$code_iso); } - // Si pas de traduction, on consulte le libelle par defaut en table + // If no translation, we read table to get label by default $sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies"; $sql.= " WHERE code_iso='".$code_iso."'"; @@ -457,8 +460,8 @@ function currency_name($code_iso,$withcode='') { return $code_iso; } - } + return 'ErrorWhenReadingCurrencyLabel'; } /** @@ -499,7 +502,7 @@ function getFormeJuridiqueLabel($code) /** * Return if a country is inside the EEC (European Economic Community) * TODO Add a field into country dictionary. - * + * * @param Object $object Object * @return boolean true = country inside EEC, false = country outside EEC */ @@ -649,7 +652,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin // Opp percent print '
| '; print ''; print ' | '; - + // Position print ''; print ' | '; - + // Address - Phone - Email print ''; - + // Status print ' | '; print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); print ' | '; - + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print ''; } - + // Edit print ' | '; print ''; print ' | '; - + print "|
| ';
if ($obj->poste) print $obj->poste;
@@ -1036,7 +1039,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
global $form;
global $param;
-
+
// Check parameters
if (! is_object($filterobj)) dol_print_error('','BadParameter');
@@ -1068,7 +1071,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " AND a.entity IN (".getEntity('agenda').")";
if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
- if (get_class($filterobj) == 'Adherent')
+ if (get_class($filterobj) == 'Adherent')
{
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
@@ -1086,7 +1089,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
{
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
- else
+ else
{
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
@@ -1114,7 +1117,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
while ($i < $num)
{
$obj = $db->fetch_object($resql);
-
+
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone='';
@@ -1128,7 +1131,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'percent'=>$obj->percent,
-
+
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
@@ -1146,7 +1149,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto
);
-
+
$numaction++;
$i++;
}
@@ -1191,7 +1194,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
'note'=>$obj->note,
'percent'=>$obj->percentage,
'acode'=>$obj->acode,
-
+
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
@@ -1213,7 +1216,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email)))
{
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
-
+
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@@ -1222,7 +1225,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
-
+
$actionstatic=new ActionComm($db);
$userstatic=new User($db);
$contactstatic = new Contact($db);
@@ -1243,9 +1246,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.='';
}
if (get_class($filterobj) == 'Societe') $out.='';
-
+
$out.="\n";
-
+
$out.=' ';
$out.='
|