Export modules support UTF8
This commit is contained in:
parent
0aa9cca4e1
commit
2ced5a0d32
@ -36,13 +36,13 @@ class Export
|
|||||||
|
|
||||||
var $array_export_code=array(); // Tableau de "idmodule_numlot"
|
var $array_export_code=array(); // Tableau de "idmodule_numlot"
|
||||||
var $array_export_module=array(); // Tableau de "nom de modules"
|
var $array_export_module=array(); // Tableau de "nom de modules"
|
||||||
var $array_export_label=array(); // Tableau de "libellé de lots"
|
var $array_export_label=array(); // Tableau de "libelle de lots"
|
||||||
var $array_export_sql=array(); // Tableau des "requetes sql"
|
var $array_export_sql=array(); // Tableau des "requetes sql"
|
||||||
var $array_export_fields=array(); // Tableau des listes de champ+libellé à exporter
|
var $array_export_fields=array(); // Tableau des listes de champ+libell<EFBFBD> <20> exporter
|
||||||
var $array_export_alias=array(); // Tableau des listes de champ+alias à exporter
|
var $array_export_alias=array(); // Tableau des listes de champ+alias <EFBFBD> exporter
|
||||||
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
var $array_export_special=array(); // Tableau des operations speciales sur champ
|
||||||
|
|
||||||
// Création des modéles d'export
|
// To store export modules
|
||||||
var $hexa;
|
var $hexa;
|
||||||
var $datatoexport;
|
var $datatoexport;
|
||||||
var $model_name;
|
var $model_name;
|
||||||
@ -50,7 +50,7 @@ class Export
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* \brief Constructeur de la classe
|
||||||
* \param DB Handler accès base de données
|
* \param DB Handler acces base de donnees
|
||||||
*/
|
*/
|
||||||
function Export($DB)
|
function Export($DB)
|
||||||
{
|
{
|
||||||
@ -59,9 +59,9 @@ class Export
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les lots de données exportables
|
* \brief Charge les lots de donn<EFBFBD>es exportables
|
||||||
* \param user Objet utilisateur qui exporte
|
* \param user Objet utilisateur qui exporte
|
||||||
* \param filter Code export pour charger un lot de données particulier
|
* \param filter Code export pour charger un lot de donn<EFBFBD>es particulier
|
||||||
*/
|
*/
|
||||||
function load_arrays($user,$filter='')
|
function load_arrays($user,$filter='')
|
||||||
{
|
{
|
||||||
@ -124,13 +124,13 @@ class Export
|
|||||||
$this->array_export_module[$i]=$module;
|
$this->array_export_module[$i]=$module;
|
||||||
// Code du dataset export
|
// Code du dataset export
|
||||||
$this->array_export_code[$i]=$module->export_code[$r];
|
$this->array_export_code[$i]=$module->export_code[$r];
|
||||||
// Libellé du dataset export
|
// Libell<EFBFBD> du dataset export
|
||||||
$this->array_export_label[$i]=$module->getDatasetLabel($r);
|
$this->array_export_label[$i]=$module->getDatasetLabel($r);
|
||||||
// Tableau des champ à exporter (clé=champ, valeur=libellé)
|
// Tableau des champ <EFBFBD> exporter (cl<63>=champ, valeur=libell<6C>)
|
||||||
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
||||||
// Tableau des entites à exporter (clé=champ, valeur=entite)
|
// Tableau des entites <EFBFBD> exporter (cl<63>=champ, valeur=entite)
|
||||||
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
||||||
// Tableau des alias à exporter (clé=champ, valeur=alias)
|
// Tableau des alias <EFBFBD> exporter (cl<63>=champ, valeur=alias)
|
||||||
$this->array_export_alias[$i]=$module->export_alias_array[$r];
|
$this->array_export_alias[$i]=$module->export_alias_array[$r];
|
||||||
// Tableau des operations speciales sur champ
|
// Tableau des operations speciales sur champ
|
||||||
$this->array_export_special[$i]=$module->export_special_array[$r];
|
$this->array_export_special[$i]=$module->export_special_array[$r];
|
||||||
@ -154,10 +154,10 @@ class Export
|
|||||||
* \brief Lance la generation du fichier
|
* \brief Lance la generation du fichier
|
||||||
* \param user User qui exporte
|
* \param user User qui exporte
|
||||||
* \param model Modele d'export
|
* \param model Modele d'export
|
||||||
* \param datatoexport Lot de donnée à exporter
|
* \param datatoexport Lot de donn<EFBFBD>e <EFBFBD> exporter
|
||||||
* \param array_selected Tableau des champs à exporter
|
* \param array_selected Tableau des champs <EFBFBD> exporter
|
||||||
* \remarks Les tableaux array_export_xxx sont déjà chargées pour le bon datatoexport
|
* \remarks Les tableaux array_export_xxx sont d<EFBFBD>j<EFBFBD> charg<EFBFBD>es pour le bon datatoexport
|
||||||
* aussi le parametre datatoexport est inutilisé
|
* aussi le parametre datatoexport est inutilis<EFBFBD>
|
||||||
*/
|
*/
|
||||||
function build_file($user, $model, $datatoexport, $array_selected)
|
function build_file($user, $model, $datatoexport, $array_selected)
|
||||||
{
|
{
|
||||||
@ -201,17 +201,19 @@ class Export
|
|||||||
$filename.='.'.$objmodel->getDriverExtension();
|
$filename.='.'.$objmodel->getDriverExtension();
|
||||||
$dirname=$conf->export->dir_temp.'/'.$user->id;
|
$dirname=$conf->export->dir_temp.'/'.$user->id;
|
||||||
|
|
||||||
|
$outputlangs=$langs; // Lang for output
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
create_exdir($dirname);
|
create_exdir($dirname);
|
||||||
$result=$objmodel->open_file($dirname."/".$filename);
|
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
$objmodel->write_header($langs);
|
$objmodel->write_header($outputlangs);
|
||||||
|
|
||||||
// Genere ligne de titre
|
// Genere ligne de titre
|
||||||
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$langs);
|
$objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs);
|
||||||
|
|
||||||
while ($objp = $this->db->fetch_object($resql))
|
while ($objp = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
@ -239,11 +241,11 @@ class Export
|
|||||||
}
|
}
|
||||||
// end of special operation processing
|
// end of special operation processing
|
||||||
|
|
||||||
$objmodel->write_record($this->array_export_alias[$indice],$array_selected,$objp);
|
$objmodel->write_record($this->array_export_alias[$indice],$array_selected,$objp,$outputlangs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genere en-tete
|
// Genere en-tete
|
||||||
$objmodel->write_footer($langs);
|
$objmodel->write_footer($outputlangs);
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
$objmodel->close_file();
|
$objmodel->close_file();
|
||||||
@ -264,8 +266,8 @@ class Export
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Créé un modéle d'export
|
* \brief Cr<EFBFBD><EFBFBD> un mod<EFBFBD>le d'export
|
||||||
* \param user Objet utilisateur qui crée
|
* \param user Objet utilisateur qui cr<EFBFBD>e
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
@ -296,8 +298,8 @@ class Export
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Recupère de la base les caractéristiques d'un modele d'export
|
* \brief Recup<EFBFBD>re de la base les caract<EFBFBD>ristiques d'un modele d'export
|
||||||
* \param rowid id du modéle à récupérer
|
* \param rowid id du mod<EFBFBD>le <EFBFBD> r<EFBFBD>cup<EFBFBD>rer
|
||||||
*/
|
*/
|
||||||
function fetch($id)
|
function fetch($id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -111,7 +111,11 @@ if (sizeof($export->array_export_code))
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="total"><td class="total" colspan="2" align="center"><form action="'.DOL_URL_ROOT.'/exports/export.php?leftmenu=export"><input type="submit" class="button" value="'.$langs->trans("NewExport").'"></form></td></tr>';
|
print '<tr class="total"><td class="total" colspan="2" align="center">';
|
||||||
|
print '<form action="'.DOL_URL_ROOT.'/exports/export.php?leftmenu=export"><input type="submit" class="button" value="'.$langs->trans("NewExport").'"';
|
||||||
|
print ($user->rights->export->creer?'':' disabled="true"');
|
||||||
|
print '></form>';
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -804,6 +804,7 @@ class MenuLeft {
|
|||||||
$langs->load("exports");
|
$langs->load("exports");
|
||||||
$newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0, $user->rights->export->lire);
|
$newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0, $user->rights->export->lire);
|
||||||
$newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1, $user->rights->export->creer);
|
$newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1, $user->rights->export->creer);
|
||||||
|
//$newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->MAIN_MODULE_IMPORT)
|
if ($conf->global->MAIN_MODULE_IMPORT)
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/includes/modules/export/export_csv.modules.php
|
* \file htdocs/includes/modules/export/export_csv.modules.php
|
||||||
* \ingroup export
|
* \ingroup export
|
||||||
* \brief Fichier de la classe permettant de générer les export au format CSV
|
* \brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les export au format CSV
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/export/modules_export.php");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ExportCsv
|
* \class ExportCsv
|
||||||
* \brief Classe permettant de générer les factures au modèle Crabe
|
* \brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>le Crabe
|
||||||
*/
|
*/
|
||||||
class ExportCsv extends ModeleExports
|
class ExportCsv extends ModeleExports
|
||||||
{
|
{
|
||||||
@ -49,11 +49,11 @@ class ExportCsv extends ModeleExports
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Constructeur
|
\brief Constructeur
|
||||||
\param db Handler accès base de donnée
|
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e
|
||||||
*/
|
*/
|
||||||
function ExportCsv($db)
|
function ExportCsv($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->id='csv'; // Same value then xxx in file name export_xxx.modules.php
|
$this->id='csv'; // Same value then xxx in file name export_xxx.modules.php
|
||||||
@ -103,14 +103,15 @@ class ExportCsv extends ModeleExports
|
|||||||
* \param file Path of filename
|
* \param file Path of filename
|
||||||
* \return int <0 if KO, >=0 if OK
|
* \return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function open_file($file)
|
function open_file($file,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
dolibarr_syslog("ExportCsv::open_file file=".$file);
|
dolibarr_syslog("ExportCsv::open_file file=".$file);
|
||||||
|
|
||||||
$ret=1;
|
$ret=1;
|
||||||
|
|
||||||
$langs->load("exports");
|
$outputlangs->load("exports");
|
||||||
$this->handle = fopen($file, "wt");
|
$this->handle = fopen($file, "wt");
|
||||||
if (! $this->handle)
|
if (! $this->handle)
|
||||||
{
|
{
|
||||||
@ -126,7 +127,7 @@ class ExportCsv extends ModeleExports
|
|||||||
* \brief Output header into file
|
* \brief Output header into file
|
||||||
* \param langs Output language
|
* \param langs Output language
|
||||||
*/
|
*/
|
||||||
function write_header($langs)
|
function write_header($outputlangs)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -136,11 +137,11 @@ class ExportCsv extends ModeleExports
|
|||||||
* \brief Output title line into file
|
* \brief Output title line into file
|
||||||
* \param langs Output language
|
* \param langs Output language
|
||||||
*/
|
*/
|
||||||
function write_title($array_export_fields_label,$array_selected_sorted,$langs)
|
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
|
||||||
{
|
{
|
||||||
foreach($array_selected_sorted as $code => $value)
|
foreach($array_selected_sorted as $code => $value)
|
||||||
{
|
{
|
||||||
$newvalue=$langs->transnoentities($array_export_fields_label[$code]);
|
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);
|
||||||
$newvalue=$this->csv_clean($newvalue);
|
$newvalue=$this->csv_clean($newvalue);
|
||||||
|
|
||||||
fwrite($this->handle,$newvalue.$this->separator);
|
fwrite($this->handle,$newvalue.$this->separator);
|
||||||
@ -153,10 +154,8 @@ class ExportCsv extends ModeleExports
|
|||||||
/**
|
/**
|
||||||
* \brief Output record line into file
|
* \brief Output record line into file
|
||||||
*/
|
*/
|
||||||
function write_record($array_alias,$array_selected_sorted,$objp)
|
function write_record($array_alias,$array_selected_sorted,$objp,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
|
||||||
|
|
||||||
$this->col=0;
|
$this->col=0;
|
||||||
foreach($array_selected_sorted as $code => $value)
|
foreach($array_selected_sorted as $code => $value)
|
||||||
{
|
{
|
||||||
@ -167,7 +166,7 @@ class ExportCsv extends ModeleExports
|
|||||||
// Translation newvalue
|
// Translation newvalue
|
||||||
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
||||||
{
|
{
|
||||||
$newvalue=$langs->transnoentities($reg[1]);
|
$newvalue=$outputlangs->transnoentities($reg[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newvalue=$this->csv_clean($newvalue);
|
$newvalue=$this->csv_clean($newvalue);
|
||||||
@ -181,9 +180,9 @@ class ExportCsv extends ModeleExports
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output footer into file
|
* \brief Output footer into file
|
||||||
* \param langs Output language
|
* \param outputlangs Output language
|
||||||
*/
|
*/
|
||||||
function write_footer($langs)
|
function write_footer($outputlangs)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
\file htdocs/includes/modules/export/export_excel.modules.php
|
\file htdocs/includes/modules/export/export_excel.modules.php
|
||||||
\ingroup export
|
\ingroup export
|
||||||
\brief Fichier de la classe permettant de générer les export au format Excel
|
\brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les export au format Excel
|
||||||
\author Laurent Destailleur
|
\author Laurent Destailleur
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
@ -33,7 +33,7 @@ require_once(PHP_WRITEEXCEL_PATH."/functions.writeexcel_utility.inc.php");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\class ExportExcel
|
\class ExportExcel
|
||||||
\brief Classe permettant de générer les export au format Excel
|
\brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les export au format Excel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ExportExcel extends ModeleExports
|
class ExportExcel extends ModeleExports
|
||||||
@ -54,11 +54,11 @@ class ExportExcel extends ModeleExports
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Constructeur
|
\brief Constructeur
|
||||||
\param db Handler accès base de donnée
|
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e
|
||||||
*/
|
*/
|
||||||
function ExportExcel($db)
|
function ExportExcel($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->id='excel'; // Same value then xxx in file name export_xxx.modules.php
|
$this->id='excel'; // Same value then xxx in file name export_xxx.modules.php
|
||||||
@ -110,16 +110,19 @@ class ExportExcel extends ModeleExports
|
|||||||
* \param file Path of filename
|
* \param file Path of filename
|
||||||
* \return int <0 if KO, >=0 if OK
|
* \return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function open_file($file)
|
function open_file($file,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
|
||||||
|
|
||||||
dolibarr_syslog("ExportExcel::open_file file=".$file);
|
dolibarr_syslog("ExportExcel::open_file file=".$file);
|
||||||
|
|
||||||
$ret=1;
|
$ret=1;
|
||||||
|
|
||||||
$langs->load("exports");
|
$outputlangs->load("exports");
|
||||||
$this->workbook = &new writeexcel_workbookbig($file);
|
$this->workbook = &new writeexcel_workbookbig($file);
|
||||||
$this->workbook->set_sheetname($langs->trans("Sheet"));
|
$this->workbook->set_sheetname($outputlangs->trans("Sheet"));
|
||||||
$this->worksheet = &$this->workbook->addworksheet();
|
$this->worksheet = &$this->workbook->addworksheet();
|
||||||
|
|
||||||
// $this->worksheet->set_column(0, 50, 18);
|
// $this->worksheet->set_column(0, 50, 18);
|
||||||
@ -127,16 +130,23 @@ class ExportExcel extends ModeleExports
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
function write_header($langs)
|
*
|
||||||
|
*/
|
||||||
|
function write_header($outputlangs)
|
||||||
{
|
{
|
||||||
|
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function write_title($array_export_fields_label,$array_selected_sorted,$langs)
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
|
||||||
|
|
||||||
// Create a format for the column headings
|
// Create a format for the column headings
|
||||||
$formatheader =$this->workbook->addformat();
|
$formatheader =$this->workbook->addformat();
|
||||||
@ -154,17 +164,19 @@ class ExportExcel extends ModeleExports
|
|||||||
$alias=$array_export_fields_label[$code];
|
$alias=$array_export_fields_label[$code];
|
||||||
//print "dd".$alias;
|
//print "dd".$alias;
|
||||||
if (empty($alias)) dolibarr_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
|
if (empty($alias)) dolibarr_print_error('','Bad value for field with code='.$code.'. Try to redefine export.');
|
||||||
$this->worksheet->write($this->row, $this->col, $langs->transnoentities($alias), $formatheader);
|
$this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader);
|
||||||
$this->col++;
|
$this->col++;
|
||||||
}
|
}
|
||||||
$this->row++;
|
$this->row++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
function write_record($array_alias,$array_selected_sorted,$objp)
|
*
|
||||||
|
*/
|
||||||
|
function write_record($array_alias,$array_selected_sorted,$objp,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO
|
||||||
|
|
||||||
$formatdate=$this->workbook->addformat();
|
$formatdate=$this->workbook->addformat();
|
||||||
$formatdate->set_num_format('yyyy-mm-dd');
|
$formatdate->set_num_format('yyyy-mm-dd');
|
||||||
@ -185,7 +197,11 @@ class ExportExcel extends ModeleExports
|
|||||||
// Traduction newvalue
|
// Traduction newvalue
|
||||||
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
||||||
{
|
{
|
||||||
$newvalue=$langs->transnoentities($reg[1]);
|
$newvalue=$outputlangs->transnoentities($reg[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$newvalue=$outputlangs->convToOuptutCharset($newvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eregi('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',$newvalue))
|
if (eregi('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',$newvalue))
|
||||||
@ -213,7 +229,7 @@ class ExportExcel extends ModeleExports
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function write_footer($langs)
|
function write_footer($outputlangs)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/includes/modules/export/export_csv.modules.php
|
* \file htdocs/includes/modules/export/export_csv.modules.php
|
||||||
* \ingroup export
|
* \ingroup export
|
||||||
* \brief Fichier de la classe permettant de générer les export au format CSV
|
* \brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les export au format CSV
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/export/modules_export.php");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \class ExportCsv
|
* \class ExportCsv
|
||||||
* \brief Classe permettant de générer les factures au modèle Crabe
|
* \brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les factures au mod<EFBFBD>le Crabe
|
||||||
*/
|
*/
|
||||||
class ExportTsv extends ModeleExports
|
class ExportTsv extends ModeleExports
|
||||||
{
|
{
|
||||||
@ -49,11 +49,11 @@ class ExportTsv extends ModeleExports
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Constructeur
|
\brief Constructeur
|
||||||
\param db Handler accès base de donnée
|
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e
|
||||||
*/
|
*/
|
||||||
function ExportTsv($db)
|
function ExportTsv($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->id='tsv'; // Same value then xxx in file name export_xxx.modules.php
|
$this->id='tsv'; // Same value then xxx in file name export_xxx.modules.php
|
||||||
@ -103,14 +103,15 @@ class ExportTsv extends ModeleExports
|
|||||||
* \param file Path of filename
|
* \param file Path of filename
|
||||||
* \return int <0 if KO, >=0 if OK
|
* \return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
function open_file($file)
|
function open_file($file,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
dolibarr_syslog("ExportTsv::open_file file=".$file);
|
dolibarr_syslog("ExportTsv::open_file file=".$file);
|
||||||
|
|
||||||
$ret=1;
|
$ret=1;
|
||||||
|
|
||||||
$langs->load("exports");
|
$outputlangs->load("exports");
|
||||||
$this->handle = fopen($file, "wt");
|
$this->handle = fopen($file, "wt");
|
||||||
if (! $this->handle)
|
if (! $this->handle)
|
||||||
{
|
{
|
||||||
@ -126,7 +127,7 @@ class ExportTsv extends ModeleExports
|
|||||||
* \brief Output header into file
|
* \brief Output header into file
|
||||||
* \param langs Output language
|
* \param langs Output language
|
||||||
*/
|
*/
|
||||||
function write_header($langs)
|
function write_header($outputlangs)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -136,11 +137,11 @@ class ExportTsv extends ModeleExports
|
|||||||
* \brief Output title line into file
|
* \brief Output title line into file
|
||||||
* \param langs Output language
|
* \param langs Output language
|
||||||
*/
|
*/
|
||||||
function write_title($array_export_fields_label,$array_selected_sorted,$langs)
|
function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs)
|
||||||
{
|
{
|
||||||
foreach($array_selected_sorted as $code => $value)
|
foreach($array_selected_sorted as $code => $value)
|
||||||
{
|
{
|
||||||
$newvalue=$langs->transnoentities($array_export_fields_label[$code]);
|
$newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]);
|
||||||
$newvalue=$this->tsv_clean($newvalue);
|
$newvalue=$this->tsv_clean($newvalue);
|
||||||
|
|
||||||
fwrite($this->handle,$newvalue.$this->separator);
|
fwrite($this->handle,$newvalue.$this->separator);
|
||||||
@ -153,10 +154,8 @@ class ExportTsv extends ModeleExports
|
|||||||
/**
|
/**
|
||||||
* \brief Output record line into file
|
* \brief Output record line into file
|
||||||
*/
|
*/
|
||||||
function write_record($array_alias,$array_selected_sorted,$objp)
|
function write_record($array_alias,$array_selected_sorted,$objp,$outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
|
||||||
|
|
||||||
$this->col=0;
|
$this->col=0;
|
||||||
foreach($array_selected_sorted as $code => $value)
|
foreach($array_selected_sorted as $code => $value)
|
||||||
{
|
{
|
||||||
@ -167,7 +166,7 @@ class ExportTsv extends ModeleExports
|
|||||||
// Translation newvalue
|
// Translation newvalue
|
||||||
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
if (eregi('^\((.*)\)$',$newvalue,$reg))
|
||||||
{
|
{
|
||||||
$newvalue=$langs->transnoentities($reg[1]);
|
$newvalue=$outputlangs->transnoentities($reg[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newvalue=$this->tsv_clean($newvalue);
|
$newvalue=$this->tsv_clean($newvalue);
|
||||||
@ -181,9 +180,9 @@ class ExportTsv extends ModeleExports
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Output footer into file
|
* \brief Output footer into file
|
||||||
* \param langs Output language
|
* \param outputlangs Output language
|
||||||
*/
|
*/
|
||||||
function write_footer($langs)
|
function write_footer($outputlangs)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user