Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git

into develop

Conflicts:
	htdocs/projet/class/task.class.php
This commit is contained in:
Laurent Destailleur 2012-04-15 18:49:09 +02:00
commit b23bbc2432
2 changed files with 11 additions and 27 deletions

View File

@ -56,10 +56,10 @@ class Project extends CommonObject
* *
* @param DoliDB $DB Database handler * @param DoliDB $DB Database handler
*/ */
function Project($DB) function __construct($db)
{ {
$this->db = $DB; $this->db = $db;
$this->societe = new Societe($DB); $this->societe = new Societe($db);
$this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); $this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
$this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'); $this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');

View File

@ -66,10 +66,9 @@ class Task extends CommonObject
* *
* @param DoliDB $DB Database handler * @param DoliDB $DB Database handler
*/ */
function Task($DB) function __construct($db)
{ {
$this->db = $DB; $this->db = $db;
return 1;
} }
@ -320,24 +319,6 @@ class Task extends CommonObject
return 0; 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 (! $error) if (! $error)
{ {
// Delete linked contacts // Delete linked contacts
@ -392,8 +373,11 @@ class Task extends CommonObject
//Delete associated link file //Delete associated link file
if ($conf->projet->dir_output) if ($conf->projet->dir_output)
{ {
$dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($projectref) . '/' . dol_sanitizeFileName($this->id); $projectstatic=new Project($this->db);
dol_syslog(get_class($this)."::delete(retreive proj ref) dir=".$dir, LOG_DEBUG); $projectstatic->fetch($this->fk_project);
$dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref) . '/' . dol_sanitizeFileName($this->id);
dol_syslog(get_class($this)."::delete dir=".$dir, LOG_DEBUG);
if (file_exists($dir)) if (file_exists($dir))
{ {
require_once(DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php");
@ -954,4 +938,4 @@ class Task extends CommonObject
} }
} }
?> ?>