|
dolibarr 24.0.0-beta
|
Parent class for import file readers. More...


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. | |
| runImportBulkTrigger ($importid, $user, $langs, $conf) | |
| Execute one global trigger for fast_bulk mode. | |
| 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. | |
| 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. | |
Protected Member Functions | |
| getImportTriggerMode () | |
| Return effective trigger mode for import flow. | |
| registerImportBulkEvent ($tablename, $operation) | |
| Register one SQL operation into bulk trigger stats. | |
| getImportTriggerActions ($tableElement, $operation, $element, $object=null) | |
| Return trigger actions to execute for an import operation done in SQL legacy mode. | |
| buildImportTriggerActionFromPrefix ($triggerprefix, $operation) | |
| Build trigger action code from prefix and operation. | |
| getImportTriggerPrefixFromObject ($object) | |
| Return trigger prefix from a business object. | |
| getImportGenericTriggerPrefix ($element, $tableElement) | |
| Return generic trigger prefix derived from element or table. | |
| getImportTriggerActionsFromHooks ($tableElement, $operation, $element, $object=null) | |
| Resolve import trigger actions from hooks. | |
| triggerImportSqlOperation ($tablename, $operation, $rowid, $importid, $user, $langs, $conf) | |
| Execute triggers for SQL legacy import. | |
| commonImportInsert ($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys, $recordpositionbase=0) | |
| Shared implementation of import_insert for CSV/XLSX. | |
Parent class for import file readers.
Definition at line 33 of file modules_import.class.php.
|
protected |
Build trigger action code from prefix and operation.
| string | $triggerprefix | Trigger prefix (for example COMPANY or LINEORDER) |
| string | $operation | SQL operation (insert|update) |
Definition at line 640 of file modules_import.class.php.
Referenced by getImportTriggerActions().
|
protected |
Shared implementation of import_insert for CSV/XLSX.
| array<int,array{val:mixed,type:int}>|array<string,array{val:mixed,type:int}>|bool | $arrayrecord Array of read values | |
| array<int|string,string> | $array_match_file_to_database Array of target fields where to insert data | |
| Object | $objimport | Object import descriptor |
| int | $maxfields | Max number of fields to use |
| string | $importid | Import key |
| string[] | $updatekeys | Array of keys used to update first before insert |
| int | $recordpositionbase | 0 when $arrayrecord starts at 0, 1 when starts at 1 |
Definition at line 1002 of file modules_import.class.php.
References $conf, dol_include_once(), dol_print_error(), dol_stringtotime(), dol_syslog(), dol_trunc(), getDolGlobalString(), getElementFromTableWithPrefix(), getImportTriggerMode(), isModEnabled(), num2Alpha(), price2num(), registerImportBulkEvent(), string, testSqlAndScriptInject(), and triggerImportSqlOperation().
Referenced by ImportCsv\import_insert(), ImportXlsx\import_insert(), and import_insert().
| ModeleImports::getDriverDesc | ( | ) |
| ModeleImports::getDriverDescForKey | ( | $key | ) |
Return description of import drivervoi la description d'un driver import.
| string | $key | Key |
Definition at line 404 of file modules_import.class.php.
| ModeleImports::getDriverExtension | ( | ) |
getDriverExtension
Definition at line 293 of file modules_import.class.php.
| ModeleImports::getDriverId | ( | ) |
| ModeleImports::getDriverLabel | ( | ) |
| ModeleImports::getDriverLabelForKey | ( | $key | ) |
Return label of driver import.
| string | $key | Key |
Definition at line 393 of file modules_import.class.php.
| ModeleImports::getDriverVersion | ( | ) |
getDriverVersion
Definition at line 303 of file modules_import.class.php.
| ModeleImports::getDriverVersionForKey | ( | $key | ) |
Renvoi version d'un driver import.
| string | $key | Key |
Definition at line 415 of file modules_import.class.php.
| ModeleImports::getElementFromTableWithPrefix | ( | $tableNameWithPrefix | ) |
Get element from table name with prefix.
| string | $tableNameWithPrefix | Table name with prefix |
Definition at line 448 of file modules_import.class.php.
Referenced by commonImportInsert(), and triggerImportSqlOperation().
|
protected |
Return generic trigger prefix derived from element or table.
| string | $element | Object element name |
| string | $tableElement | Table name without DB prefix |
Definition at line 682 of file modules_import.class.php.
References string.
Referenced by getImportTriggerActions().
|
protected |
Return trigger actions to execute for an import operation done in SQL legacy mode.
| string | $tableElement | Table name without database prefix |
| string | $operation | Operation insert|update |
| string | $element | Element name |
| object | null | $object | Object context |
Definition at line 569 of file modules_import.class.php.
References $object, buildImportTriggerActionFromPrefix(), getImportGenericTriggerPrefix(), getImportTriggerActionsFromHooks(), and getImportTriggerPrefixFromObject().
Referenced by triggerImportSqlOperation().
|
protected |
Resolve import trigger actions from hooks.
Hook signature:
| string | $tableElement | Table name without prefix |
| string | $operation | insert|update |
| string | $element | Element name |
| object | null | $object | Object context |
Definition at line 711 of file modules_import.class.php.
References $object, and string.
Referenced by getImportTriggerActions().
|
protected |
Return effective trigger mode for import flow.
Definition at line 465 of file modules_import.class.php.
References getDolGlobalString(), and string.
Referenced by commonImportInsert(), runImportBulkTrigger(), and triggerImportSqlOperation().
|
protected |
Return trigger prefix from a business object.
| object | $object | Business object |
Definition at line 664 of file modules_import.class.php.
References $object.
Referenced by getImportTriggerActions().
| ModeleImports::getLibLabel | ( | ) |
getDriverLabel
Definition at line 313 of file modules_import.class.php.
| ModeleImports::getLibLabelForKey | ( | $key | ) |
Renvoi libelle de librairie externe du driver.
| string | $key | Key |
Definition at line 426 of file modules_import.class.php.
| ModeleImports::getLibVersion | ( | ) |
getLibVersion
Definition at line 323 of file modules_import.class.php.
| ModeleImports::getLibVersionForKey | ( | $key | ) |
Renvoi version de librairie externe du driver.
| string | $key | Key |
Definition at line 437 of file modules_import.class.php.
| ModeleImports::getPictoForKey | ( | $key | ) |
Return picto of import driver.
| string | $key | Key |
Definition at line 382 of file modules_import.class.php.
| ModeleImports::import_close_file | ( | ) |
Close file handle.
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 980 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::import_get_nb_of_lines | ( | $file | ) |
Return nb of records.
File must be closed.
| string | $file | Path of filename |
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 930 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::import_insert | ( | $arrayrecord, | |
| $array_match_file_to_database, | |||
| $objimport, | |||
| $maxfields, | |||
| $importid, | |||
| $updatekeys ) |
Insert a record into database.
| 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 | $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 in ImportCsv, and ImportXlsx.
Definition at line 1817 of file modules_import.class.php.
References commonImportInsert().
| ModeleImports::import_open_file | ( | $file | ) |
Open input file.
| string | $file | Path of filename |
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 912 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::import_read_header | ( | ) |
Input header line from file.
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 946 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::import_read_record | ( | ) |
Return array of next record in input file.
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 963 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::listOfAvailableImportFormat | ( | $db, | |
| $maxfilenamelength = 0 ) |
Load into memory list of available import format.
Definition at line 336 of file modules_import.class.php.
References dol_syslog().
|
protected |
Register one SQL operation into bulk trigger stats.
| string | $tablename | Table name with prefix |
| string | $operation | insert|update |
Definition at line 484 of file modules_import.class.php.
Referenced by commonImportInsert().
| ModeleImports::runImportBulkTrigger | ( | $importid, | |
| $user, | |||
| $langs, | |||
| $conf ) |
|
protected |
Execute triggers for SQL legacy import.
| string | $tablename | Table name with database prefix |
| string | $operation | Operation insert|update |
| int | $rowid | Row id if available, 0 otherwise |
| string | $importid | Import key |
| User | $user | User |
| Translate | $langs | Langs object |
| Conf | $conf | Conf object |
Definition at line 772 of file modules_import.class.php.
References $conf, $object, dol_syslog(), getDolGlobalInt(), getElementFromTableWithPrefix(), getImportTriggerActions(), and getImportTriggerMode().
Referenced by commonImportInsert().
| ModeleImports::write_footer_example | ( | $outputlangs | ) |
Output footer of an example file for this format.
| Translate | $outputlangs | Output language |
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 1883 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::write_header_example | ( | $outputlangs | ) |
Output header of an example file for this format.
| Translate | $outputlangs | Output language |
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 1830 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::write_record_example | ( | $outputlangs, | |
| $contentlinevalues ) |
Output record of an example file for this format.
| Translate | $outputlangs | Output language |
| mixed[] | $contentlinevalues | Array of lines |
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 1866 of file modules_import.class.php.
References dol_syslog().
| ModeleImports::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 |
Reimplemented in ImportCsv, and ImportXlsx.
Definition at line 1848 of file modules_import.class.php.
References dol_syslog().