|
dolibarr
x.y.z
|
Class to import CSV files. More...


Public Member Functions | |
| __construct ($db, $datatoimport) | |
| Constructor. More... | |
| write_header_example ($outputlangs) | |
| Output header of an example file for this format. More... | |
| write_title_example ($outputlangs, $headerlinefields) | |
| Output title line of an example file for this format. More... | |
| write_record_example ($outputlangs, $contentlinevalues) | |
| Output record of an example file for this format. More... | |
| write_footer_example ($outputlangs) | |
| Output footer of an example file for this format. More... | |
| import_open_file ($file) | |
| Open input file. More... | |
| import_get_nb_of_lines ($file) | |
| Return nb of records. More... | |
| import_read_header () | |
| Input header line from file. More... | |
| import_read_record () | |
| Return array of next record in input file. More... | |
| import_close_file () | |
| Close file handle. More... | |
| import_insert ($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys) | |
| Insert a record into database. More... | |
Public Member Functions inherited from ModeleImports | |
| __construct () | |
| Constructor. | |
| getDriverId () | |
| getDriverId More... | |
| getDriverLabel () | |
| getDriverLabel More... | |
| getDriverDesc () | |
| getDriverDesc More... | |
| getDriverExtension () | |
| getDriverExtension More... | |
| getDriverVersion () | |
| getDriverVersion More... | |
| getLibLabel () | |
| getDriverLabel More... | |
| getLibVersion () | |
| getLibVersion More... | |
| listOfAvailableImportFormat ($db, $maxfilenamelength=0) | |
| Load into memory list of available import format. More... | |
| getPictoForKey ($key) | |
| Return picto of import driver. More... | |
| getDriverLabelForKey ($key) | |
| Renvoi libelle d'un driver import. More... | |
| getDriverDescForKey ($key) | |
| Renvoi la description d'un driver import. More... | |
| getDriverVersionForKey ($key) | |
| Renvoi version d'un driver import. More... | |
| getLibLabelForKey ($key) | |
| Renvoi libelle de librairie externe du driver. More... | |
| getLibVersionForKey ($key) | |
| Renvoi version de librairie externe du driver. More... | |
Class to import CSV files.
Definition at line 34 of file import_csv.modules.php.
| ImportCsv::__construct | ( | $db, | |
| $datatoimport | |||
| ) |
Constructor.
| DoliDB | $db | Database handler |
| string | $datatoimport | String code describing import set (ex: 'societe_1') |
Definition at line 96 of file import_csv.modules.php.
| ImportCsv::import_close_file | ( | ) |
| ImportCsv::import_get_nb_of_lines | ( | $file | ) |
Return nb of records.
File must be closed.
| string | $file | Path of filename |
Definition at line 217 of file import_csv.modules.php.
References dol_count_nb_of_line().
| ImportCsv::import_insert | ( | $arrayrecord, | |
| $array_match_file_to_database, | |||
| $objimport, | |||
| $maxfields, | |||
| $importid, | |||
| $updatekeys | |||
| ) |
Insert a record into database.
| array | $arrayrecord | Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]... |
| array | $array_match_file_to_database | Array of target fields where to insert data: [fieldpos] => 's.fieldname', [fieldpos+1]... |
| Object | $objimport | Object import (contains objimport->array_import_tables, objimport->array_import_fields, objimport->array_import_convertvalue, ...) |
| int | $maxfields | Max number of fields to use |
| string | $importid | Import key |
| array | $updatekeys | Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. |
Definition at line 312 of file import_csv.modules.php.
| ImportCsv::import_open_file | ( | $file | ) |
Open input file.
| string | $file | Path of filename |
Definition at line 187 of file import_csv.modules.php.
| ImportCsv::import_read_header | ( | ) |
Input header line from file.
Definition at line 230 of file import_csv.modules.php.
| ImportCsv::import_read_record | ( | ) |
Return array of next record in input file.
Definition at line 243 of file import_csv.modules.php.
| ImportCsv::write_footer_example | ( | $outputlangs | ) |
Output footer of an example file for this format.
| Translate | $outputlangs | Output language |
Definition at line 173 of file import_csv.modules.php.
| ImportCsv::write_header_example | ( | $outputlangs | ) |
Output header of an example file for this format.
| Translate | $outputlangs | Output language |
Definition at line 130 of file import_csv.modules.php.
| ImportCsv::write_record_example | ( | $outputlangs, | |
| $contentlinevalues | |||
| ) |
Output record of an example file for this format.
| Translate | $outputlangs | Output language |
| array | $contentlinevalues | Array of lines |
Definition at line 159 of file import_csv.modules.php.
| ImportCsv::write_title_example | ( | $outputlangs, | |
| $headerlinefields | |||
| ) |
Output title line of an example file for this format.
| Translate | $outputlangs | Output language |
| array | $headerlinefields | Array of fields name |
Definition at line 144 of file import_csv.modules.php.