Corect bug #364
This commit is contained in:
parent
c628cfd99a
commit
779e33d490
@ -319,6 +319,43 @@ class Task extends CommonObject
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Delete associated link file
|
||||
|
||||
//retreive project ref to know project folder
|
||||
$sql = "SELECT p.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid=t.fk_projet";
|
||||
$sql.= " WHERE t.rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete(retreive proj ref) sql=".$sql, LOG_DEBUG);
|
||||
$resql_projref=$this->db->query($sql);
|
||||
if ($resql_projref)
|
||||
{
|
||||
if ($this->db->num_rows($resql_projref))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql_projref);
|
||||
$projectref = $obj->ref;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql_projref);
|
||||
|
||||
if ($conf->projet->dir_output)
|
||||
{
|
||||
$dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($projectref) . '/' . dol_sanitizeFileName($this->id);
|
||||
dol_syslog(get_class($this)."::delete(retreive proj ref) dir=".$dir, LOG_DEBUG);
|
||||
if (file_exists($dir))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php");
|
||||
$res = @dol_delete_dir_recursive($dir);
|
||||
if (!$res)
|
||||
{
|
||||
$this->error = 'ErrorFailToDeleteDir';
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -332,7 +369,8 @@ class Task extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Delete rang of line
|
||||
//$this->delRangOfLine($this->id, $this->element);
|
||||
|
||||
@ -368,7 +406,8 @@ class Task extends CommonObject
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -395,6 +434,7 @@ class Task extends CommonObject
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
if ($obj) $ret=$obj->nb;
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user