dolibarr 21.0.0-beta
|
Class to import Excel files. More...
Public Member Functions | |
__construct ($db, $datatoimport) | |
Constructor. | |
write_header_example ($outputlangs) | |
Output header of an example file for this format. | |
write_title_example ($outputlangs, $headerlinefields) | |
Output title line of an example file for this format. | |
write_record_example ($outputlangs, $contentlinevalues) | |
Output record of an example file for this format. | |
write_footer_example ($outputlangs) | |
Output footer of an example file for this format. | |
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. | |
Public Member Functions inherited from ModeleImports | |
__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. | |
Class to import Excel files.
Definition at line 41 of file import_xlsx.modules.php.
ImportXlsx::__construct | ( | $db, | |
$datatoimport ) |
Constructor.
DoliDB | $db | Database handler |
string | $datatoimport | String code describing import set (ex: 'societe_1') |
Definition at line 114 of file import_xlsx.modules.php.
References dol_syslog(), versioncompare(), and versionphparray().
ImportXlsx::import_close_file | ( | ) |
Close file handle.
Reimplemented from ModeleImports.
Definition at line 374 of file import_xlsx.modules.php.
ImportXlsx::import_get_nb_of_lines | ( | $file | ) |
Return nb of records.
File must be closed.
string | $file | Path of filename |
Reimplemented from ModeleImports.
Definition at line 292 of file import_xlsx.modules.php.
ImportXlsx::import_insert | ( | $arrayrecord, | |
$array_match_file_to_database, | |||
$objimport, | |||
$maxfields, | |||
$importid, | |||
$updatekeys ) |
Insert a record into database.
array<int,array{val:mixed,type:int}>|bool | $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 | $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 |
string[] | $updatekeys | Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. |
Reimplemented from ModeleImports.
Definition at line 396 of file import_xlsx.modules.php.
References $conf, dol_include_once(), dol_print_error(), dol_stringtotime(), dol_syslog(), dol_trunc(), getDolGlobalString(), ModeleImports\getElementFromTableWithPrefix(), num2Alpha(), price2num(), and testSqlAndScriptInject().
ImportXlsx::import_open_file | ( | $file | ) |
Open input file.
string | $file | Path of filename |
Reimplemented from ModeleImports.
Definition at line 268 of file import_xlsx.modules.php.
References dol_syslog().
ImportXlsx::import_read_header | ( | ) |
Input header line from file.
Reimplemented from ModeleImports.
Definition at line 313 of file import_xlsx.modules.php.
ImportXlsx::import_read_record | ( | ) |
Return array of next record in input file.
Reimplemented from ModeleImports.
Definition at line 334 of file import_xlsx.modules.php.
References dol_strlen().
ImportXlsx::write_footer_example | ( | $outputlangs | ) |
Output footer of an example file for this format.
Translate | $outputlangs | Output language |
Definition at line 244 of file import_xlsx.modules.php.
ImportXlsx::write_header_example | ( | $outputlangs | ) |
Output header of an example file for this format.
Translate | $outputlangs | Output language |
Definition at line 173 of file import_xlsx.modules.php.
References $conf.
ImportXlsx::write_record_example | ( | $outputlangs, | |
$contentlinevalues ) |
Output record of an example file for this format.
Translate | $outputlangs | Output language |
mixed[] | $contentlinevalues | Array of lines |
Definition at line 224 of file import_xlsx.modules.php.
ImportXlsx::write_title_example | ( | $outputlangs, | |
$headerlinefields ) |
Output title line of an example file for this format.
Translate | $outputlangs | Output language |
string[] | $headerlinefields | Array of fields name |
Definition at line 198 of file import_xlsx.modules.php.
References $conf.