mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-02 15:12:29 +01:00
Qual: Export descriptor in modules are simpler
This commit is contained in:
@@ -280,7 +280,7 @@ class Export
|
||||
}
|
||||
// end of special operation processing
|
||||
|
||||
$objmodel->write_record($this->array_export_fields[$indice],$array_selected,$objp,$outputlangs);
|
||||
$objmodel->write_record($array_selected,$objp,$outputlangs);
|
||||
}
|
||||
|
||||
// Genere en-tete
|
||||
|
||||
@@ -147,8 +147,10 @@ class ExportCsv extends ModeleExports
|
||||
|
||||
|
||||
/**
|
||||
* \brief Output title line into file
|
||||
* \param langs Output language
|
||||
* 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)
|
||||
{
|
||||
@@ -176,9 +178,12 @@ class ExportCsv extends ModeleExports
|
||||
|
||||
|
||||
/**
|
||||
* \brief Output record line into file
|
||||
* 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)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/includes/modules/export/export_excel.modules.php
|
||||
* \ingroup export
|
||||
* \brief Fichier de la classe permettant de g<>n<EFBFBD>rer les export au format Excel
|
||||
* \brief File of class to generate export file with Excel format
|
||||
* \author Laurent Destailleur
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
@@ -48,9 +48,9 @@ class ExportTsv extends ModeleExports
|
||||
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler acc<63>s base de donn<6E>e
|
||||
*/
|
||||
* \brief Constructeur
|
||||
* \param db Database handler
|
||||
*/
|
||||
function ExportTsv($db)
|
||||
{
|
||||
global $conf;
|
||||
@@ -141,8 +141,10 @@ class ExportTsv extends ModeleExports
|
||||
|
||||
|
||||
/**
|
||||
* \brief Output title line into file
|
||||
* \param langs Output language
|
||||
* 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)
|
||||
{
|
||||
@@ -159,14 +161,17 @@ class ExportTsv extends ModeleExports
|
||||
|
||||
|
||||
/**
|
||||
* \brief Output record line into file
|
||||
* 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)
|
||||
{
|
||||
$this->col=0;
|
||||
foreach($array_selected_sorted as $code => $value)
|
||||
{
|
||||
$alias=$array_alias[$code];
|
||||
$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;
|
||||
|
||||
|
||||
@@ -146,54 +146,6 @@ class ModeleExports
|
||||
return $this->libversion[$key];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Lance la generation du fichier
|
||||
* \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)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dol_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
||||
|
||||
// Creation de la classe d'export du model ExportXXX
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
||||
$file = "export_".$model.".modules.php";
|
||||
$classname = "Export".$model;
|
||||
require_once($dir.$file);
|
||||
$obj = new $classname($db);
|
||||
|
||||
// Execute requete export
|
||||
$sql=$this->array_export_sql[0];
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Genere en-tete
|
||||
$obj->write_header();
|
||||
|
||||
// Genere ligne de titre
|
||||
$obj->write_title();
|
||||
|
||||
while ($objp = $this->db->fetch_object($resql))
|
||||
{
|
||||
$var=!$var;
|
||||
$obj->write_record($array_selected,$objp);
|
||||
}
|
||||
|
||||
// Genere en-tete
|
||||
$obj->write_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Error: sql=$sql ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user