Fix: Removed errors

This commit is contained in:
Laurent Destailleur 2009-04-29 21:39:31 +00:00
parent f65f1d3ba7
commit f561be941e

View File

@ -179,9 +179,9 @@ class DolibarrModules
if (! $err) if (! $err)
{ {
if (!$this->db->query($array_sql[$i])) if (!$this->db->query($array_sql[$i]))
{ {
$err++; $err++;
} }
} }
} }
@ -391,7 +391,7 @@ class DolibarrModules
$this->db->query($sql); $this->db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,entity) VALUES"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,value,visible,entity) VALUES";
$sql.= " ('".$this->const_name."','1',0,".$conf->entity.")"; $sql.= " ('".$this->const_name."','1',0,".$conf->entity.")";
dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG); dol_syslog("DolibarrModules::_active sql=".$sql, LOG_DEBUG);
if (!$this->db->query($sql)) if (!$this->db->query($sql))
{ {
@ -673,8 +673,8 @@ class DolibarrModules
if (! $resql) if (! $resql)
{ {
$err++; $err++;
} }
*/ */
} }
$i++; $i++;
} }
@ -970,10 +970,10 @@ class DolibarrModules
{ {
$name = $this->const_name."_DIR_".strtoupper($this->dirs[$key][0]); $name = $this->const_name."_DIR_".strtoupper($this->dirs[$key][0]);
$dir = $this->dirs[$key][1]; $dir = $this->dirs[$key][1];
$const = $this->dirs[$key][2]; $const = empty($this->dirs[$key][2])?'':$this->dirs[$key][2];
// Define directory full path // Define directory full path
if (empty($conf->entity)) $fulldir = DOL_DATA_ROOT.$dir; if (empty($conf->global->MULTICOMPANY)) $fulldir = DOL_DATA_ROOT.$dir;
else $fulldir = DOL_DATA_ROOT."/".$conf->entity.$dir; else $fulldir = DOL_DATA_ROOT."/".$conf->entity.$dir;
// Create dir if it does not exists // Create dir if it does not exists
if ($fulldir && ! file_exists($fulldir)) if ($fulldir && ! file_exists($fulldir))
@ -986,7 +986,7 @@ class DolibarrModules
} }
} }
// define the constant if requested // define the constant if requested
if (isset($const) && $const) if ($const)
{ {
$result = $this->insert_dirs($name,$dir); $result = $this->insert_dirs($name,$dir);
if ($result) $err++; if ($result) $err++;
@ -995,9 +995,10 @@ class DolibarrModules
} }
return $err; return $err;
} }
/**
/**
* \brief Insert directories in llx_const * \brief Insert directories in llx_const
* \return int Number of errors (0 if OK) * \return int Number of errors (0 if OK)
*/ */
@ -1008,35 +1009,36 @@ class DolibarrModules
$err=0; $err=0;
$sql = "SELECT count(*)"; $sql = "SELECT count(*)";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE name ='".$name."'"; $sql.= " WHERE name ='".$name."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
$row = $this->db->fetch_row($result); $row = $this->db->fetch_row($result);
if ($row[0] == 0) if ($row[0] == 0)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
$sql.= " VALUES ('".$name."','chaine','".$dir."','Directory for module ".$this->name."','0',".$conf->entity.")"; $sql.= " VALUES ('".$name."','chaine','".$dir."','Directory for module ".$this->name."','0',".$conf->entity.")";
dol_syslog("DolibarrModules::insert_dir_output sql=".$sql); dol_syslog("DolibarrModules::insert_dir_output sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
} }
} }
else else
{ {
$err++; $err++;
} }
return $err; return $err;
} }
/** /**
* \brief Remove directory entries * \brief Remove directory entries
* \return int Nombre d'erreurs (0 si ok) * \return int Number of errors (0 if OK)
*/ */
function delete_dirs() function delete_dirs()
{ {