This commit is contained in:
estellbright
2018-04-28 10:18:46 +08:00
parent 538b7c65a3
commit 101832bcfd
2 changed files with 14 additions and 1 deletions
+3 -1
View File
@@ -306,7 +306,9 @@ class file extends control
$file = $this->file->getById($fileID);
$this->dao->delete()->from(TABLE_FILE)->where('id')->eq($fileID)->exec();
$this->loadModel('action')->create($file->objectType, $file->objectID, 'deletedFile', '', $extra=$file->title);
@unlink($file->realPath);
/* Fix Bug #1518. */
$fileRecord = $this->dao->select('id')->from(TABLE_FILE)->where('pathname')->eq($file->pathname)->fetch();
if(empty($fileRecord)) @unlink($file->realPath);
die(js::reload('parent'));
}
}
+11
View File
@@ -1221,6 +1221,17 @@ class testcaseModel extends model
$this->dao->insert(TABLE_CASESTEP)->data($step)->exec();
}
}
/* Fix bug #1518. */
$oldFile = $this->dao->select('*')->from(TABLE_FILE)->where('objectID')->eq($case->fromCaseID)->fetchAll();
foreach($oldFile as $fileID => $File)
{
$File->objectID = $caseID;
$File->addedBy = $this->app->user->account;
$File->addedDate = helper::today();
$File->downloads = 0;
unset($File->id);
$this->dao->insert(TABLE_FILE)->data($File)->exec();
}
$this->loadModel('action')->create('case', $caseID, 'fromlib', '', $case->lib);
}
}