Qual: Removed warnings
This commit is contained in:
parent
72ed513091
commit
e20038708c
@ -62,7 +62,7 @@ class Import
|
|||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
dol_syslog("Import::load_arrays user=".$user->id." filter=".$filter);
|
dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -73,14 +73,14 @@ class Import
|
|||||||
$dir = $dirroot.'/includes/modules';
|
$dir = $dirroot.'/includes/modules';
|
||||||
|
|
||||||
// Search available exports
|
// Search available exports
|
||||||
$handle=@opendir($dir);
|
$handle=@opendir(dol_osencode($dir));
|
||||||
if (is_resource($handle))
|
if (! is_resource($handle)) continue;
|
||||||
{
|
|
||||||
// Search module files
|
// Search module files
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (preg_match("/^(mod.*)\.class\.php/i",$file,$reg))
|
if (! preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) continue;
|
||||||
{
|
|
||||||
$modulename=$reg[1];
|
$modulename=$reg[1];
|
||||||
|
|
||||||
// Defined if module is enabled
|
// Defined if module is enabled
|
||||||
@ -88,9 +88,9 @@ class Import
|
|||||||
$part=strtolower(preg_replace('/^mod/i','',$modulename));
|
$part=strtolower(preg_replace('/^mod/i','',$modulename));
|
||||||
if (empty($conf->$part->enabled)) $enabled=false;
|
if (empty($conf->$part->enabled)) $enabled=false;
|
||||||
|
|
||||||
if ($enabled)
|
if (empty($enabled)) continue;
|
||||||
{
|
|
||||||
// Chargement de la classe
|
// Init load class
|
||||||
$file = $dir."/".$modulename.".class.php";
|
$file = $dir."/".$modulename.".class.php";
|
||||||
$classname = $modulename;
|
$classname = $modulename;
|
||||||
require_once($file);
|
require_once($file);
|
||||||
@ -117,10 +117,7 @@ class Import
|
|||||||
//print $bool." $perm[0]"."<br>";
|
//print $bool." $perm[0]"."<br>";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Permissions ok
|
// Load lang file
|
||||||
// if ($bool)
|
|
||||||
// {
|
|
||||||
// Charge fichier lang en rapport
|
|
||||||
$langtoload=$module->getLangFilesArray();
|
$langtoload=$module->getLangFilesArray();
|
||||||
if (is_array($langtoload))
|
if (is_array($langtoload))
|
||||||
{
|
{
|
||||||
@ -157,15 +154,11 @@ class Import
|
|||||||
|
|
||||||
dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r]));
|
dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r]));
|
||||||
$i++;
|
$i++;
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,19 +168,18 @@ class Import
|
|||||||
* Build an import example file.
|
* Build an import example file.
|
||||||
* Arrays this->array_export_xxx are already loaded for required datatoexport
|
* Arrays this->array_export_xxx are already loaded for required datatoexport
|
||||||
*
|
*
|
||||||
* @param User $user User qui exporte
|
* @param string $model Name of import engine ('csv', ...)
|
||||||
* @param string $model Modele d'export
|
|
||||||
* @param string $headerlinefields Array of values for first line of example file
|
* @param string $headerlinefields Array of values for first line of example file
|
||||||
* @param string $contentlinevalues Array of values for content line of example file
|
* @param string $contentlinevalues Array of values for content line of example file
|
||||||
* @return string <0 if KO, >0 if OK
|
* @return string <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function build_example_file($user, $model, $headerlinefields, $contentlinevalues)
|
function build_example_file($model, $headerlinefields, $contentlinevalues)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$indice=0;
|
$indice=0;
|
||||||
|
|
||||||
dol_syslog("Import::build_example_file ".$model);
|
dol_syslog(get_class($this)."::build_example_file ".$model);
|
||||||
|
|
||||||
// Creation de la classe d'import du model Import_XXX
|
// Creation de la classe d'import du model Import_XXX
|
||||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/";
|
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/";
|
||||||
@ -238,7 +230,7 @@ class Import
|
|||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
$sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')";
|
$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);
|
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -249,7 +241,7 @@ class Import
|
|||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
$this->errno=$this->db->lasterrno();
|
$this->errno=$this->db->lasterrno();
|
||||||
dol_syslog("Import::create error ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -267,7 +259,7 @@ class Import
|
|||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em';
|
||||||
$sql.= ' WHERE em.rowid = '.$id;
|
$sql.= ' WHERE em.rowid = '.$id;
|
||||||
|
|
||||||
dol_syslog("Import::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -86,6 +86,6 @@ foreach($fieldstarget as $code=>$label)
|
|||||||
//var_dump($headerlinefields);
|
//var_dump($headerlinefields);
|
||||||
//var_dump($contentlinevalues);
|
//var_dump($contentlinevalues);
|
||||||
|
|
||||||
print $objimport->build_example_file($user,$format,$headerlinefields,$contentlinevalues);
|
print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -86,11 +86,7 @@ if ($action == 'add')
|
|||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)";
|
||||||
$sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")";
|
$sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")";
|
||||||
|
|
||||||
if ($db->query($sql))
|
if (! $db->query($sql))
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
@ -115,7 +111,7 @@ if ($action == 'add')
|
|||||||
// Remove a notification
|
// Remove a notification
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"];
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user