dolibarr 21.0.0-alpha
ModeleImports Class Reference

Parent class for import file readers. More...

Inheritance diagram for ModeleImports:
Collaboration diagram for ModeleImports:

Public Member Functions

 __construct ()
 Constructor.
 
 getDriverId ()
 getDriverId
 
 getDriverLabel ()
 getDriverLabel
 
 getDriverDesc ()
 getDriverDesc
 
 getDriverExtension ()
 getDriverExtension
 
 getDriverVersion ()
 getDriverVersion
 
 getLibLabel ()
 getDriverLabel
 
 getLibVersion ()
 getLibVersion
 
 listOfAvailableImportFormat ($db, $maxfilenamelength=0)
 Load into memory list of available import format.
 
 getPictoForKey ($key)
 Return picto of import driver.
 
 getDriverLabelForKey ($key)
 Return label of driver import.
 
 getDriverDescForKey ($key)
 Return description of import drivervoi la description d'un driver import.
 
 getDriverVersionForKey ($key)
 Renvoi version d'un driver import.
 
 getLibLabelForKey ($key)
 Renvoi libelle de librairie externe du driver.
 
 getLibVersionForKey ($key)
 Renvoi version de librairie externe du driver.
 
 getElementFromTableWithPrefix ($tableNameWithPrefix)
 Get element from table name with prefix.
 
 import_open_file ($file)
 Open input file.
 
 import_get_nb_of_lines ($file)
 Return nb of records.
 
 import_read_header ()
 Input header line from file.
 
 import_read_record ()
 Return array of next record in input file.
 
 import_close_file ()
 Close file handle.
 
 import_insert ($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
 Insert a record into database.
 

Detailed Description

Parent class for import file readers.

Definition at line 33 of file modules_import.php.

Member Function Documentation

◆ getDriverDesc()

ModeleImports::getDriverDesc ( )

getDriverDesc

Returns
string Description

Definition at line 209 of file modules_import.php.

◆ getDriverDescForKey()

ModeleImports::getDriverDescForKey ( $key)

Return description of import drivervoi la description d'un driver import.

Parameters
string$keyKey
Returns
string

Definition at line 330 of file modules_import.php.

◆ getDriverExtension()

ModeleImports::getDriverExtension ( )

getDriverExtension

Returns
string Driver suffix

Definition at line 219 of file modules_import.php.

◆ getDriverId()

ModeleImports::getDriverId ( )

getDriverId

Returns
string Code of driver

Definition at line 189 of file modules_import.php.

◆ getDriverLabel()

ModeleImports::getDriverLabel ( )

getDriverLabel

Returns
string Label

Definition at line 199 of file modules_import.php.

◆ getDriverLabelForKey()

ModeleImports::getDriverLabelForKey ( $key)

Return label of driver import.

Parameters
string$keyKey
Returns
string

Definition at line 319 of file modules_import.php.

◆ getDriverVersion()

ModeleImports::getDriverVersion ( )

getDriverVersion

Returns
string Driver version

Definition at line 229 of file modules_import.php.

◆ getDriverVersionForKey()

ModeleImports::getDriverVersionForKey ( $key)

Renvoi version d'un driver import.

Parameters
string$keyKey
Returns
string

Definition at line 341 of file modules_import.php.

◆ getElementFromTableWithPrefix()

ModeleImports::getElementFromTableWithPrefix ( $tableNameWithPrefix)

Get element from table name with prefix.

Parameters
string$tableNameWithPrefixTable name with prefix
Returns
string Element name or table element as default

Definition at line 374 of file modules_import.php.

Referenced by ImportCsv\import_insert(), and ImportXlsx\import_insert().

◆ getLibLabel()

ModeleImports::getLibLabel ( )

getDriverLabel

Returns
string Label of external lib

Definition at line 239 of file modules_import.php.

◆ getLibLabelForKey()

ModeleImports::getLibLabelForKey ( $key)

Renvoi libelle de librairie externe du driver.

Parameters
string$keyKey
Returns
string

Definition at line 352 of file modules_import.php.

◆ getLibVersion()

ModeleImports::getLibVersion ( )

getLibVersion

Returns
string Version of external lib

Definition at line 249 of file modules_import.php.

◆ getLibVersionForKey()

ModeleImports::getLibVersionForKey ( $key)

Renvoi version de librairie externe du driver.

Parameters
string$keyKey
Returns
string

Definition at line 363 of file modules_import.php.

◆ getPictoForKey()

ModeleImports::getPictoForKey ( $key)

Return picto of import driver.

Parameters
string$keyKey
Returns
string

Definition at line 308 of file modules_import.php.

◆ import_close_file()

ModeleImports::import_close_file ( )

Close file handle.

Returns
int

Reimplemented in ImportCsv, and ImportXlsx.

Definition at line 461 of file modules_import.php.

References dol_syslog().

◆ import_get_nb_of_lines()

ModeleImports::import_get_nb_of_lines ( $file)

Return nb of records.

File must be closed.

Parameters
string$filePath of filename
Returns
int Return integer <0 if KO, >=0 if OK

Reimplemented in ImportCsv, and ImportXlsx.

Definition at line 411 of file modules_import.php.

References dol_syslog().

◆ import_insert()

ModeleImports::import_insert ( $arrayrecord,
$array_match_file_to_database,
$objimport,
$maxfields,
$importid,
$updatekeys )

Insert a record into database.

Parameters
array<string,array{val:mixed,type:int<-1,1>}>|boolean$arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
array<int|string,string>$array_match_file_to_database Array of target fields where to insert data: [fieldpos] => 's.fieldname', [fieldpos+1]...
Object$objimportObject import (contains objimport->array_import_tables, objimport->array_import_fields, objimport->array_import_convertvalue, ...)
int$maxfieldsMax number of fields to use
string$importidImport key
string[]$updatekeysArray of keys to use to try to do an update first before insert. This field are defined into the module descriptor.
Returns
int Return integer <0 if KO, >0 if OK

Reimplemented in ImportCsv, and ImportXlsx.

Definition at line 484 of file modules_import.php.

References dol_syslog().

◆ import_open_file()

ModeleImports::import_open_file ( $file)

Open input file.

Parameters
string$filePath of filename
Returns
int Return integer <0 if KO, >=0 if OK

Reimplemented in ImportCsv, and ImportXlsx.

Definition at line 393 of file modules_import.php.

References dol_syslog().

◆ import_read_header()

ModeleImports::import_read_header ( )

Input header line from file.

Returns
int Return integer <0 if KO, >=0 if OK

Reimplemented in ImportCsv, and ImportXlsx.

Definition at line 427 of file modules_import.php.

References dol_syslog().

◆ import_read_record()

ModeleImports::import_read_record ( )

Return array of next record in input file.

Returns
array<string,array{val:mixed,type:int<-1,1>}>|boolean Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string)

Reimplemented in ImportCsv, and ImportXlsx.

Definition at line 444 of file modules_import.php.

References dol_syslog().

◆ listOfAvailableImportFormat()

ModeleImports::listOfAvailableImportFormat ( $db,
$maxfilenamelength = 0 )

Load into memory list of available import format.

Parameters
DoliDB$dbDatabase handler
int$maxfilenamelengthMax length of value to show
Returns
array<int,string> List of templates

Definition at line 262 of file modules_import.php.

References dol_syslog().


The documentation for this class was generated from the following file: