diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 37928f33147..0aee2ed876d 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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 diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index ccdd5931366..98c0bcde90c 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -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 diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 4d18429010b..d46a9a1b412 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -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) {