';
diff --git a/htdocs/includes/modules/export/export_csv.modules.php b/htdocs/includes/modules/export/export_csv.modules.php
new file mode 100644
index 00000000000..9122b0afbeb
--- /dev/null
+++ b/htdocs/includes/modules/export/export_csv.modules.php
@@ -0,0 +1,102 @@
+
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+* or see http://www.gnu.org/
+*
+* $Id$
+* $Source$
+*/
+
+/**
+ \file htdocs/includes/modules/export/export_csv.modules.php
+ \ingroup export
+ \brief Fichier de la classe permettant de générer les export au format CSV
+ \author Laurent Destailleur
+ \version $Revision$
+*/
+
+require_once(DOL_DOCUMENT_ROOT ."/includes/modules/export/modules_export.php");
+
+
+/**
+ \class ExportCsv
+ \brief Classe permettant de générer les factures au modèle Crabe
+*/
+
+class ExportCsv extends ModeleExports
+{
+ var $extension;
+ var $handle; // Handle fichier
+
+
+ /**
+ \brief Constructeur
+ \param db Handler accès base de donnée
+ */
+ function ExportCsv($db)
+ {
+ global $conf,$langs;
+ $this->db = $db;
+
+ $this->extension='csv';
+ }
+
+
+ function get_extension()
+ {
+ return $this->extension;
+ }
+
+
+ function open_file($file)
+ {
+ dolibarr_syslog("ExportCsv::open_file file=$file");
+ $this->handle = fopen($file, "wt");
+ }
+
+
+ function write_header()
+ {
+
+ }
+
+
+ function write_title()
+ {
+
+ }
+
+
+ function write_record()
+ {
+
+ }
+
+
+ function write_footer()
+ {
+
+ }
+
+
+ function close_file()
+ {
+ fclose($this->handle);
+ }
+
+}
+
+?>
diff --git a/htdocs/includes/modules/export/modules_export.php b/htdocs/includes/modules/export/modules_export.php
index 051baed8b6e..d732436995a 100644
--- a/htdocs/includes/modules/export/modules_export.php
+++ b/htdocs/includes/modules/export/modules_export.php
@@ -29,8 +29,8 @@
/**
- \class ModelePDFFactures
- \brief Classe mère des modèles de facture
+ \class ModeleExport
+ \brief Classe mère des modèles de format d'export
*/
class ModeleExports
@@ -88,6 +88,54 @@ class ModeleExports
return $this->driverversion[$key];
}
+
+
+ /**
+ * \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é
+ */
+ function build_file($model, $datatoexport, $array_selected)
+ {
+ global $langs;
+
+ dolibarr_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($objp,$array_selected);
+ }
+
+ // Genere en-tete
+ $obj->write_footer();
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ dolibarr_syslog("Error: sql=$sql ".$this->error);
+ return -1;
+ }
+ }
+
}