From cfa8ca5c52317bb7091b464aaf065d1875ab339c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Jun 2012 17:44:38 +0200 Subject: [PATCH] Fix: Removed warning --- htdocs/imports/class/import.class.php | 5 +++-- htdocs/imports/emptyexample.php | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index f981847a466..3f8ea381385 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -173,9 +173,10 @@ class Import * @param string $model Name of import engine ('csv', ...) * @param string $headerlinefields Array of values for first line of example file * @param string $contentlinevalues Array of values for content line of example file + * @param string $datatoimport Dataset to import * @return string <0 if KO, >0 if OK */ - function build_example_file($model, $headerlinefields, $contentlinevalues) + function build_example_file($model, $headerlinefields, $contentlinevalues,$datatoimport) { global $conf,$langs; @@ -188,7 +189,7 @@ class Import $file = "import_".$model.".modules.php"; $classname = "Import".$model; require_once($dir.$file); - $objmodel = new $classname($this->db); + $objmodel = new $classname($this->db,$datatoimport); $outputlangs=$langs; // Lang for output $s=''; diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index c65791568da..21ae9d9a80c 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -21,12 +21,6 @@ * \brief Show example of import file */ -// This is to make Dolibarr working with Plesk -set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); - -$datatoimport=isset($_GET["datatoimport"])? $_GET["datatoimport"] : (isset($_POST["datatoimport"])?$_POST["datatoimport"]:''); -$format=isset($_GET["format"])? $_GET["format"] : (isset($_POST["format"])?$_POST["format"]:''); - // This file is a wrapper, so empty header function llxHeader() { print 'Build an import example file'; } // This file is a wrapper, so empty footer @@ -37,6 +31,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/imports/class/import.class.php"); require_once(DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php'); +$datatoimport=GETPOST('datatoimport'); +$format=GETPOST('format'); + $langs->load("exports"); // Check exportkey @@ -86,6 +83,6 @@ foreach($fieldstarget as $code=>$label) //var_dump($headerlinefields); //var_dump($contentlinevalues); -print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues); +print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues,$datatoimport); ?>