Fix translation of graph

This commit is contained in:
Laurent Destailleur 2020-03-06 01:42:42 +01:00
parent 7b5f9e1b11
commit 0ba2c53b02
3 changed files with 6 additions and 3 deletions

View File

@ -225,7 +225,6 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
@ -239,6 +238,7 @@ class Contrat extends CommonObject
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed'))
);
// END MODULEBUILDER PROPERTIES

View File

@ -976,6 +976,7 @@ class DolGraph
$values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x (with x=0,1,2,...)
$serie[$i] = "";
//var_dump($this->data);exit;
// Fill array $values
$x = 0;
foreach ($this->data as $valarray) // Loop on each x

View File

@ -603,7 +603,7 @@ if ($sql) {
$xi = 0; $oldlabeltouse = '';
while ($obj = $db->fetch_object($resql)) {
if (is_array($search_groupby) && count($search_groupby)) {
$xval = 'x_0';
$xval = $search_xaxis[0];
$fieldforxkey = 'x_0';
$xlabel = $obj->$fieldforxkey;
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
@ -647,13 +647,15 @@ if ($sql) {
}
}
} else { // No group by
$xval = 'x_0';
$xval = $search_xaxis[0];
$fieldforxkey = 'x_0';
$xlabel = $obj->$fieldforxkey;
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
if (!empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
}
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined")));
$xarrayforallseries = array('label' => $labeltouse);
foreach ($search_measures as $key => $val) {