25require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
48 public $errors = array();
53 public $warnings = array();
71 public $version =
'dolibarr';
78 public $driverlabel = array();
80 public $driverdesc = array();
82 public $driverversion = array();
84 public $liblabel = array();
86 public $libversion = array();
116 public $thirdpartyobject;
121 public static $mapTableToElement = array(
122 'actioncomm' =>
'agenda',
123 'adherent' =>
'member',
124 'adherent_type' =>
'member_type',
126 'categorie' =>
'category',
129 'contrat' =>
'contract',
130 'entrepot' =>
'stock',
132 'facture' =>
'invoice',
134 'fichinter' =>
'intervention',
137 'product_price' =>
'productprice',
138 'product_fournisseur_price' =>
'productsupplierprice',
139 'projet' =>
'project',
142 'socpeople' =>
'contact',
154 if (is_object($hookmanager)) {
155 $hookmanager->initHooks(array(
'import'));
156 $parameters = array();
157 $reshook = $hookmanager->executeHooks(
'constructModeleImports', $parameters, $this);
158 if ($reshook >= 0 && !empty($hookmanager->resArray)) {
159 foreach ($hookmanager->resArray as $mapList) {
160 self::$mapTableToElement[$mapList[
'table']] = $mapList[
'element'];
203 return $this->extension;
213 return $this->version;
223 return $this->label_lib;
233 return $this->version_lib;
246 dol_syslog(get_class($this).
"::listOfAvailableImportFormat");
248 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/import/";
249 $handle = opendir($dir);
253 if (is_resource($handle)) {
254 while (($file = readdir($handle)) !==
false) {
255 if (preg_match(
"/^import_(.*)\.modules\.php/i", $file, $reg)) {
259 $file = $dir.
"/import_".$moduleid.
".modules.php";
260 $classname =
"Import".ucfirst($moduleid);
263 $module =
new $classname($db,
'');
266 $this->picto[$module->id] = $module->picto;
268 $this->driverlabel[$module->id] = $module->getDriverLabel(
'');
269 $this->driverdesc[$module->id] = $module->getDriverDesc(
'');
270 $this->driverversion[$module->id] = $module->getDriverVersion(
'');
272 $this->liblabel[$module->id] = $module->getLibLabel(
'');
273 $this->libversion[$module->id] = $module->getLibVersion(
'');
280 return array_keys($this->driverlabel);
292 return $this->picto[$key];
303 return $this->driverlabel[$key];
314 return $this->driverdesc[$key];
325 return $this->driverversion[$key];
336 return $this->liblabel[$key];
347 return $this->libversion[$key];
358 $tableElement = preg_replace(
'/^'.preg_quote($this->db->prefix(),
'/').
'/',
'', $tableNameWithPrefix);
359 $element = $tableElement;
361 if (isset(self::$mapTableToElement[$tableElement])) {
362 $element = self::$mapTableToElement[$tableElement];
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.
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.
getDriverVersion()
getDriverVersion
listOfAvailableImportFormat($db, $maxfilenamelength=0)
Load into memory list of available import format.
getDriverExtension()
getDriverExtension
getLibVersion()
getLibVersion
__construct()
Constructor.
getDriverDesc()
getDriverDesc
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.