25require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
61 public $version =
'dolibarr';
68 public $driverlabel = array();
70 public $driverdesc = array();
72 public $driverversion = array();
74 public $liblabel = array();
76 public $libversion = array();
84 public static $mapTableToElement = array(
85 'actioncomm' =>
'agenda',
86 'adherent' =>
'member',
87 'adherent_type' =>
'member_type',
89 'categorie' =>
'category',
92 'contrat' =>
'contract',
93 'entrepot' =>
'stock',
95 'facture' =>
'invoice',
97 'fichinter' =>
'intervention',
100 'product_price' =>
'productprice',
101 'product_fournisseur_price' =>
'productsupplierprice',
102 'projet' =>
'project',
105 'socpeople' =>
'contact',
117 if (is_object($hookmanager)) {
118 $hookmanager->initHooks(array(
'import'));
119 $parameters = array();
120 $reshook = $hookmanager->executeHooks(
'constructModeleImports', $parameters, $this);
121 if ($reshook >= 0 && !empty($hookmanager->resArray)) {
122 foreach ($hookmanager->resArray as $mapList) {
123 self::$mapTableToElement[$mapList[
'table']] = $mapList[
'element'];
166 return $this->extension;
176 return $this->version;
186 return $this->label_lib;
196 return $this->version_lib;
209 dol_syslog(get_class($this).
"::listOfAvailableImportFormat");
211 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/import/";
212 $handle = opendir($dir);
216 if (is_resource($handle)) {
217 while (($file = readdir($handle)) !==
false) {
218 if (preg_match(
"/^import_(.*)\.modules\.php/i", $file, $reg)) {
222 $file = $dir.
"/import_".$moduleid.
".modules.php";
223 $classname =
"Import".ucfirst($moduleid);
226 $module =
new $classname($db,
'');
229 $this->picto[$module->id] = $module->picto;
231 $this->driverlabel[$module->id] = $module->getDriverLabel(
'');
232 $this->driverdesc[$module->id] = $module->getDriverDesc(
'');
233 $this->driverversion[$module->id] = $module->getDriverVersion(
'');
235 $this->liblabel[$module->id] = $module->getLibLabel(
'');
236 $this->libversion[$module->id] = $module->getLibVersion(
'');
243 return array_keys($this->driverlabel);
255 return $this->picto[$key];
266 return $this->driverlabel[$key];
277 return $this->driverdesc[$key];
288 return $this->driverversion[$key];
299 return $this->liblabel[$key];
310 return $this->libversion[$key];
321 $tableElement = preg_replace(
'/^'.preg_quote($this->db->prefix(),
'/').
'/',
'', $tableNameWithPrefix);
322 $element = $tableElement;
324 if (isset(self::$mapTableToElement[$tableElement])) {
325 $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.