ImportCsv
class ImportCsv extends ModeleImports (View source)
Class to import CSV files
Properties
| DoliDB | $db | ||
| string | $datatoimport | from ModeleImports | |
| string | $error | from ModeleImports | |
| string[]|array<int, array<string, string>> | $errors | from ModeleImports | |
| string[]|array<int, array<string, string>> | $warnings | from ModeleImports | |
| string | $id | ||
| string | $label | from ModeleImports | |
| string | $extension | from ModeleImports | |
| string | $version | Dolibarr version of driver |
|
| array{0: int, 1: int} | $phpmin | PHP minimal version required by driver |
from ModeleImports |
| string | $label_lib | ||
| string | $version_lib | ||
| array<string, string> | $driverlabel | from ModeleImports | |
| array<string, string> | $driverdesc | from ModeleImports | |
| array<string, string> | $driverversion | from ModeleImports | |
| array<string, string> | $drivererror | from ModeleImports | |
| array<string, string> | $liblabel | from ModeleImports | |
| array<string, string> | $libversion | from ModeleImports | |
| $charset | |||
| array<string, string>|string | $picto | from ModeleImports | |
| string | $desc | from ModeleImports | |
| string | $escape | from ModeleImports | |
| string | $enclosure | from ModeleImports | |
| Societe | $thirdpartyobject | from ModeleImports | |
| static array<string, string> | $mapTableToElement | from ModeleImports | |
| string|string[] | $separator | ||
| string | $file | ||
| resource | $handle | ||
| $cacheconvert | |||
| $cachefieldtable | |||
| $nbinsert | |||
| $nbupdate | |||
| int | $col |
Methods
Load into memory list of available import format
Return description of import drivervoi la description d'un driver import
Renvoi libelle de librairie externe du driver
Renvoi version de librairie externe du driver
Get element from table name with prefix
Open input file
Return nb of records. File must be closed.
Input header line from file
Return array of next record in input file.
Close file handle
Insert a record into database
Output header of an example file for this format
Output title line of an example file for this format
Output record of an example file for this format
Output footer of an example file for this format
Details
__construct(DoliDB $db, string $datatoimport)
Constructor
string
getDriverId()
getDriverId
string
getDriverLabel()
getDriverLabel
string
getDriverDesc()
getDriverDesc
string
getDriverExtension()
getDriverExtension
string
getDriverVersion()
getDriverVersion
string
getLibLabel()
getDriverLabel
string
getLibVersion()
getLibVersion
listOfAvailableImportFormat($db, int $maxfilenamelength = 0)
Load into memory list of available import format
@param DoliDB $db Database handler
string
getPictoForKey(string $key)
Return picto of import driver
string
getDriverLabelForKey(string $key)
Return label of driver import
string
getDriverDescForKey(string $key)
Return description of import drivervoi la description d'un driver import
string
getDriverVersionForKey(string $key)
Renvoi version d'un driver import
string
getLibLabelForKey(string $key)
Renvoi libelle de librairie externe du driver
string
getLibVersionForKey(string $key)
Renvoi version de librairie externe du driver
string
getElementFromTableWithPrefix(string $tableNameWithPrefix)
Get element from table name with prefix
import_open_file(string $file)
Open input file
import_get_nb_of_lines(string $file)
Return nb of records. File must be closed.
import_read_header()
Input header line from file
@return int Return integer <0 if KO, >=0 if OK
import_read_record()
Return array of next record in input file.
@return array|boolean Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string)
import_close_file()
Close file handle
@return integer
int
import_insert(array<string, array{val: mixed, type: int<-1, 1>}>|bool $arrayrecord, array<int|string, string> $array_match_file_to_database, object $objimport, int $maxfields, string $importid, string[] $updatekeys)
Insert a record into database
string
write_header_example($outputlangs)
Output header of an example file for this format
@param Translate $outputlangs Output language
write_title_example($outputlangs, string[] $headerlinefields)
Output title line of an example file for this format
@param Translate $outputlangs Output language
write_record_example($outputlangs, mixed[] $contentlinevalues)
Output record of an example file for this format
@param Translate $outputlangs Output language
string
write_footer_example($outputlangs)
Output footer of an example file for this format
@param Translate $outputlangs Output language