diff --git a/htdocs/includes/modules/export/export_excel.modules.php b/htdocs/includes/modules/export/export_excel.modules.php index aecd5ffbf94a9e87d701de730912b1fae815c8d5..cc06e749f1df742270ba165927f56918b344a205 100644 --- a/htdocs/includes/modules/export/export_excel.modules.php +++ b/htdocs/includes/modules/export/export_excel.modules.php @@ -149,7 +149,10 @@ class ExportExcel extends ModeleExports /** - * + * Output title line into file + * @param array_export_fields_label Array with list of label of fields + * @param array_selected_sorted Array with list of field to export + * @param outputlangs Object lang to translate values */ function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs) { @@ -168,7 +171,7 @@ class ExportExcel extends ModeleExports $this->col=0; foreach($array_selected_sorted as $code => $value) { - $alias=$array_export_fields_label[$code]; + $alias=$array_export_fields_label[$code]; //print "dd".$alias; if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.'); $this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader); @@ -179,9 +182,12 @@ class ExportExcel extends ModeleExports } /** - * + * Output record line into file + * @param array_selected_sorted Array with list of field to export + * @param objp A record from a fetch with all fields from select + * @param outputlangs Object lang to translate values */ - function write_record($array_alias,$array_selected_sorted,$objp,$outputlangs) + function write_record($array_selected_sorted,$objp,$outputlangs) { $outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO @@ -197,8 +203,9 @@ class ExportExcel extends ModeleExports $this->col=0; foreach($array_selected_sorted as $code => $value) { - $alias=$array_alias[$code]; - $newvalue=$objp->$alias; + $alias=str_replace(array('.','-'),'_',$code); + if (empty($alias)) dol_print_error('','Bad value for field with code='.$code.'. Try to redefine export.'); + $newvalue=$objp->$alias; $newvalue=$this->excel_clean($newvalue); diff --git a/htdocs/includes/modules/export/modules_export.php b/htdocs/includes/modules/export/modules_export.php index 8c5d62a7e3b26aa7592d7bddfcb4067b220bd0ad..b0dbf3dcddeaef3747a4c4e908999721b062b471 100644 --- a/htdocs/includes/modules/export/modules_export.php +++ b/htdocs/includes/modules/export/modules_export.php @@ -150,10 +150,10 @@ class ModeleExports /** * \brief Lance la generation du fichier - * \remarks Les tableaux array_export_xxx sont d�j� charg�es pour le bon datatoexport - * aussi le parametre datatoexport est inutilis� + * \remarks Les tableaux array_export_xxx sont deja chargees pour le bon datatoexport + * aussi le parametre datatoexport est inutilise */ - function build_file($model, $datatoexport, $array_selected) + /*function build_file($model, $datatoexport, $array_selected) { global $langs; @@ -180,7 +180,7 @@ class ModeleExports while ($objp = $this->db->fetch_object($resql)) { $var=!$var; - $obj->write_record($objp,$array_selected); + $obj->write_record($array_selected,$objp); } // Genere en-tete @@ -192,7 +192,7 @@ class ModeleExports dol_syslog("Error: sql=$sql ".$this->error, LOG_ERR); return -1; } - } + }*/ }