mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Plus de plantage si le module ne definie pas la tableau des boxes
This commit is contained in:
parent
831ca9eade
commit
48ad5fd666
|
|
@ -365,30 +365,33 @@ class DolibarrModules
|
|||
{
|
||||
$err=0;
|
||||
|
||||
foreach ($this->boxes as $key => $value)
|
||||
if (is_array($this->boxes))
|
||||
{
|
||||
$titre = $this->boxes[$key][0];
|
||||
$file = $this->boxes[$key][1];
|
||||
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."boxes_def WHERE name ='".$titre."'";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$row = $this->db->fetch_row($result);
|
||||
if ($row[0] == 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (name, file) VALUES ('".$titre."','".$file."')";
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$err++;
|
||||
}
|
||||
foreach ($this->boxes as $key => $value)
|
||||
{
|
||||
$titre = $this->boxes[$key][0];
|
||||
$file = $this->boxes[$key][1];
|
||||
|
||||
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."boxes_def WHERE name ='".$titre."'";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$row = $this->db->fetch_row($result);
|
||||
if ($row[0] == 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (name, file) VALUES ('".$titre."','".$file."')";
|
||||
if (! $this->db->query($sql))
|
||||
{
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $err;
|
||||
|
|
@ -403,18 +406,21 @@ class DolibarrModules
|
|||
{
|
||||
$err=0;
|
||||
|
||||
foreach ($this->boxes as $key => $value)
|
||||
if (is_array($this->boxes))
|
||||
{
|
||||
$titre = $this->boxes[$key][0];
|
||||
$file = $this->boxes[$key][1];
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$file."'";
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->boxes as $key => $value)
|
||||
{
|
||||
$titre = $this->boxes[$key][0];
|
||||
$file = $this->boxes[$key][1];
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$file."'";
|
||||
if (! $this->db->query($sql) )
|
||||
{
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ class modBoutique extends DolibarrModules
|
|||
// Constantes
|
||||
$this->const = array();
|
||||
|
||||
// Boites
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'boutique';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user