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, 
'');
 
  282          '@phan-var-force ModeleImports $module';
 
  285          $this->picto[$module->id] = $module->picto;
 
  287          $this->driverlabel[$module->id] = $module->getDriverLabel();
 
  288          $this->driverdesc[$module->id] = $module->getDriverDesc();
 
  289          $this->driverversion[$module->id] = $module->getDriverVersion();
 
  290          $this->drivererror[$module->id] = $module->error ? $module->error : 
'';
 
  292          $this->liblabel[$module->id] = ($module->error ? 
'<span class="error">'.$module->error.
'</span>' : $module->getLibLabel());
 
  293          $this->libversion[$module->id] = $module->getLibVersion();
 
  298    return array_keys($this->driverlabel);
 
 
  310    return  $this->picto[$key];
 
 
  321    return  $this->driverlabel[$key];
 
 
  332    return  $this->driverdesc[$key];
 
 
  343    return  $this->driverversion[$key];
 
 
  354    return  $this->liblabel[$key];
 
 
  365    return  $this->libversion[$key];
 
 
  376    $tableElement = preg_replace(
'/^'.preg_quote($this->db->prefix(), 
'/').
'/', 
'', $tableNameWithPrefix);
 
  377    $element = $tableElement;
 
  379    if (isset(self::$mapTableToElement[$tableElement])) {
 
  380      $element = self::$mapTableToElement[$tableElement];
 
 
  396    $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
 
  398    $this->errors[] = $msg;
 
 
  414    $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
 
  416    $this->errors[] = $msg;
 
 
  430    $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
 
  432    $this->errors[] = $msg;
 
 
  447    $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
 
  449    $this->errors[] = $msg;
 
 
  464    $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
 
  466    $this->errors[] = $msg;
 
 
  484  public function import_insert($arrayrecord, $array_match_file_to_database, $objimport, $maxfields, $importid, $updatekeys)
 
  487    $msg = get_class($this).
"::".__FUNCTION__.
" not implemented";
 
  489    $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 ...