FIX: Documents no change directory if change reference of the task.
This commit is contained in:
parent
24ee2bce14
commit
4800918323
@ -58,6 +58,8 @@ class Task extends CommonObject
|
|||||||
var $timespent_fk_user;
|
var $timespent_fk_user;
|
||||||
var $timespent_note;
|
var $timespent_note;
|
||||||
|
|
||||||
|
public $oldcopy;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -316,6 +318,30 @@ class Task extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
|
||||||
|
{
|
||||||
|
// We remove directory
|
||||||
|
if ($conf->projet->dir_output)
|
||||||
|
{
|
||||||
|
$project = new Project($this->db);
|
||||||
|
$project->fetch($this->fk_project);
|
||||||
|
|
||||||
|
$olddir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->oldcopy->ref);
|
||||||
|
$newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref);
|
||||||
|
if (file_exists($olddir))
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
$res=dol_move($olddir, $newdir);
|
||||||
|
if (! $res)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorFailToRenameDir',$olddir,$newdir);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -82,6 +82,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->fetch($id,$ref);
|
$object->fetch($id,$ref);
|
||||||
|
$object->oldcopy = clone $object;
|
||||||
|
|
||||||
$tmparray=explode('_',$_POST['task_parent']);
|
$tmparray=explode('_',$_POST['task_parent']);
|
||||||
$task_parent=$tmparray[1];
|
$task_parent=$tmparray[1];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user