27require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
53 public $errors = array();
58 public $warnings = array();
79 public $version =
'dolibarr';
85 public $phpmin = array(7, 0);
103 public $driverlabel = array();
108 public $driverdesc = array();
113 public $driverversion = array();
118 public $drivererror = array();
123 public $liblabel = array();
128 public $libversion = array();
158 public $thirdpartyobject;
172 if (is_object($hookmanager)) {
173 $hookmanager->initHooks(array(
'import'));
174 $parameters = array();
175 $reshook = $hookmanager->executeHooks(
'constructModeleImports', $parameters, $this);
176 if ($reshook >= 0 && !empty($hookmanager->resArray)) {
177 foreach ($hookmanager->resArray as $mapList) {
178 self::$mapTableToElement[$mapList[
'table']] = $mapList[
'element'];
221 return $this->extension;
231 return $this->version;
241 return $this->label_lib;
251 return $this->version_lib;
264 dol_syslog(get_class($this).
"::listOfAvailableImportFormat");
266 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/import/";
267 $handle = opendir($dir);
270 if (is_resource($handle)) {
271 while (($file = readdir($handle)) !==
false) {
273 if (preg_match(
"/^import_(.*)\.modules\.php/i", $file, $reg)) {
277 $file = $dir.
"/import_".$moduleid.
".modules.php";
278 $classname =
"Import".ucfirst($moduleid);
281 $module =
new $classname($db,
'');
284 $this->picto[$module->id] = $module->picto;
286 $this->driverlabel[$module->id] = $module->getDriverLabel(
'');
287 $this->driverdesc[$module->id] = $module->getDriverDesc(
'');
288 $this->driverversion[$module->id] = $module->getDriverVersion(
'');
289 $this->drivererror[$module->id] = $module->error ? $module->error :
'';
291 $this->liblabel[$module->id] = ($module->error ?
'<span class="error">'.$module->error.
'</span>' : $module->getLibLabel(
''));
292 $this->libversion[$module->id] = $module->getLibVersion(
'');
297 return array_keys($this->driverlabel);
309 return $this->picto[$key];
320 return $this->driverlabel[$key];
331 return $this->driverdesc[$key];
342 return $this->driverversion[$key];
353 return $this->liblabel[$key];
364 return $this->libversion[$key];
375 $tableElement = preg_replace(
'/^'.preg_quote($this->db->prefix(),
'/').
'/',
'', $tableNameWithPrefix);
376 $element = $tableElement;
378 if (isset(self::$mapTableToElement[$tableElement])) {
379 $element = self::$mapTableToElement[$tableElement];
395 $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
397 $this->errors[] = $msg;
413 $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
415 $this->errors[] = $msg;
429 $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
431 $this->errors[] = $msg;
446 $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
448 $this->errors[] = $msg;
463 $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
465 $this->errors[] = $msg;
483 public function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
486 $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
488 $this->errors[] = $msg;
Parent class for import file readers.
getLibVersionForKey($key)
Renvoi version de librairie externe du driver.
getDriverDescForKey($key)
Return description of import drivervoi la description d'un driver import.
getElementFromTableWithPrefix($tableNameWithPrefix)
Get element from table name with prefix.
getDriverLabelForKey($key)
Return label of driver import.
import_get_nb_of_lines($file)
Return nb of records.
getLibLabel()
getDriverLabel
getDriverVersionForKey($key)
Renvoi version d'un driver import.
getDriverLabel()
getDriverLabel
getPictoForKey($key)
Return picto of import driver.
getLibLabelForKey($key)
Renvoi libelle de librairie externe du driver.
import_read_record()
Return array of next record in input file.
import_open_file($file)
Open input file.
import_read_header()
Input header line from file.
getDriverVersion()
getDriverVersion
listOfAvailableImportFormat($db, $maxfilenamelength=0)
Load into memory list of available import format.
getDriverExtension()
getDriverExtension
getLibVersion()
getLibVersion
__construct()
Constructor.
import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
Insert a record into database.
getDriverDesc()
getDriverDesc
import_close_file()
Close file handle.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
const MODULE_MAPPING
This mapping defines the conversion to the current internal names from the alternative allowed names ...