diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 9478480709c14b678841187f3933fe7a8d74b684..c6a835fedb5f4c8bb56ab620b5747dd962d9a72a 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -234,8 +234,9 @@ class Import $this->db->begin(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'import_model ('; - $sql.= 'label, type, field)'; - $sql.= " VALUES ('".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; + $sql.= 'fk_user, label, type, field'; + $sql.= ')'; + $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; dol_syslog("Import::create sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); @@ -318,15 +319,12 @@ class Import { if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. - - //// Call triggers - //include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers + // Call triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('IMPORT_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers } } diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index fdeb586c92e4b376162b2e293eeb46b1e468edc2..2acf78e557a1cc8f6d30b807ff5cbf5b76feb0fc 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -27,8 +27,9 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); $datatoimport=isset($_GET["datatoimport"])? $_GET["datatoimport"] : (isset($_POST["datatoimport"])?$_POST["datatoimport"]:''); $format=isset($_GET["format"])? $_GET["format"] : (isset($_POST["format"])?$_POST["format"]:''); -// C'est un wrapper, donc header vierge +// This file is a wrapper, so empty header function llxHeader() { print '<html><title>Build an import example file</title><body>'; } +// This file is a wrapper, so empty footer function llxFooter() { print '</body></html>'; } require("../main.inc.php"); diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index df983adc2c493df7f36f09c021dbaaea0024524f..25d1e087bd15016031863fff6497dc8b003f86f0 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1641,8 +1641,8 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') /** * Return not used field number * - * @param array $fieldssource - * @param array $listofkey + * @param array &$fieldssource Array of field source + * @param array &$listofkey Array of keys * @return void */ function getnewkey(&$fieldssource,&$listofkey)