Permalink
Browse files

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

into develop

Conflicts:
	htdocs/projet/class/task.class.php
  • Loading branch information...
2 parents 9a70541 + 48543a0 commit b23bbc24324ff0f8ce6fe03e5022b2021d09b6ad @eldy eldy committed Apr 15, 2012
Showing with 11 additions and 27 deletions.
  1. +3 −3 htdocs/projet/class/project.class.php
  2. +8 −24 htdocs/projet/class/task.class.php
@@ -56,10 +56,10 @@ class Project extends CommonObject
*
* @param DoliDB $DB Database handler
*/
- function Project($DB)
+ function __construct($db)
{
- $this->db = $DB;
- $this->societe = new Societe($DB);
+ $this->db = $db;
+ $this->societe = new Societe($db);
$this->statuts_short = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
$this->statuts = array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed');
@@ -66,10 +66,9 @@ class Task extends CommonObject
*
* @param DoliDB $DB Database handler
*/
- function Task($DB)
+ function __construct($db)
{
- $this->db = $DB;
- return 1;
+ $this->db = $db;
}
@@ -320,24 +319,6 @@ function delete($user, $notrigger=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)
{
// Delete linked contacts
@@ -392,8 +373,11 @@ function delete($user, $notrigger=0)
//Delete associated link file
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);
+ $projectstatic=new Project($this->db);
+ $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))
{
require_once(DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php");
@@ -954,4 +938,4 @@ function delTimeSpent($user, $notrigger=0)
}
}
-?>
+?>

0 comments on commit b23bbc2

Please sign in to comment.