mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 00:53:00 +01:00
Removed a TODO by moving detection of line of records of a file to
import into the import driver.
This commit is contained in:
@@ -49,6 +49,7 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
var $separator;
|
||||
|
||||
var $file; // Path of file
|
||||
var $handle; // Handle fichier
|
||||
|
||||
var $cacheconvert=array(); // Array to cache list of value found after a convertion
|
||||
@@ -236,6 +237,18 @@ class ImportCsv extends ModeleImports
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return nb of records. File must be closed.
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function import_get_nb_of_lines($file)
|
||||
{
|
||||
return dol_count_nb_of_line($file);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Input header line from file
|
||||
*
|
||||
|
||||
@@ -49,6 +49,7 @@ class Importxlsx extends ModeleImports
|
||||
|
||||
var $separator;
|
||||
|
||||
var $file; // Path of file
|
||||
var $handle; // Handle fichier
|
||||
|
||||
var $cacheconvert=array(); // Array to cache list of value found after a convertion
|
||||
@@ -276,9 +277,31 @@ class Importxlsx extends ModeleImports
|
||||
$reader = new PHPExcel_Reader_Excel2007();
|
||||
$this->workbook = $reader->load($file);
|
||||
$this->record = 1;
|
||||
$this->file = $file;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return nb of records. File must be closed.
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function import_get_nb_of_lines($file)
|
||||
{
|
||||
$reader = new PHPExcel_Reader_Excel2007();
|
||||
$this->workbook = $reader->load($file);
|
||||
|
||||
$rowcount = $this->workbook->getActiveSheet()->getHighestDataRow();
|
||||
|
||||
$this->workbook->disconnectWorksheets();
|
||||
unset($this->workbook);
|
||||
|
||||
return $rowcount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Input header line from file
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user