committed by
Frédéric Guillot
parent
9c5f5a5854
commit
38e82fe5e5
@@ -58,9 +58,21 @@ class TaskDuplicationModel extends Base
|
|||||||
if ($new_task_id !== false) {
|
if ($new_task_id !== false) {
|
||||||
$this->tagDuplicationModel->duplicateTaskTags($task_id, $new_task_id);
|
$this->tagDuplicationModel->duplicateTaskTags($task_id, $new_task_id);
|
||||||
$this->taskLinkModel->create($new_task_id, $task_id, 4);
|
$this->taskLinkModel->create($new_task_id, $task_id, 4);
|
||||||
|
|
||||||
|
$externalLinks = $this->taskExternalLinkModel->getAll($task_id);
|
||||||
|
foreach ($externalLinks as $externalLink) {
|
||||||
|
$this->taskExternalLinkModel->create([
|
||||||
|
'task_id' => $new_task_id,
|
||||||
|
'creator_id' => $externalLink['creator_id'],
|
||||||
|
'dependency' => $externalLink['dependency'],
|
||||||
|
'title' => $externalLink['title'],
|
||||||
|
'link_type' => $externalLink['link_type'],
|
||||||
|
'url' => $externalLink['url'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$hook_values = [ 'source_task_id' => $task_id, 'destination_task_id' => $new_task_id];
|
$hook_values = ['source_task_id' => $task_id, 'destination_task_id' => $new_task_id];
|
||||||
$this->hook->reference('model:task:duplication:aftersave', $hook_values);
|
$this->hook->reference('model:task:duplication:aftersave', $hook_values);
|
||||||
|
|
||||||
return $new_task_id;
|
return $new_task_id;
|
||||||
|
|||||||
@@ -92,6 +92,18 @@ class TaskRecurrenceModel extends TaskDuplicationModel
|
|||||||
if ($recurring_task_id !== false) {
|
if ($recurring_task_id !== false) {
|
||||||
$this->tagDuplicationModel->duplicateTaskTags($task_id, $recurring_task_id);
|
$this->tagDuplicationModel->duplicateTaskTags($task_id, $recurring_task_id);
|
||||||
|
|
||||||
|
$externalLinks = $this->taskExternalLinkModel->getAll($task_id);
|
||||||
|
foreach ($externalLinks as $externalLink) {
|
||||||
|
$this->taskExternalLinkModel->create([
|
||||||
|
'task_id' => $recurring_task_id,
|
||||||
|
'creator_id' => $externalLink['creator_id'],
|
||||||
|
'dependency' => $externalLink['dependency'],
|
||||||
|
'title' => $externalLink['title'],
|
||||||
|
'link_type' => $externalLink['link_type'],
|
||||||
|
'url' => $externalLink['url'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$parent_update = $this->db
|
$parent_update = $this->db
|
||||||
->table(TaskModel::TABLE)
|
->table(TaskModel::TABLE)
|
||||||
->eq('id', $task_id)
|
->eq('id', $task_id)
|
||||||
|
|||||||
@@ -13,12 +13,6 @@ class TaskDuplicateAnotherProjectTest extends Base
|
|||||||
{
|
{
|
||||||
public function testSuccess()
|
public function testSuccess()
|
||||||
{
|
{
|
||||||
$this->container['externalLinkManager'] = $this
|
|
||||||
->getMockBuilder('Kanboard\Core\ExternalLink\ExternalLinkManager')
|
|
||||||
->setConstructorArgs(array($this->container))
|
|
||||||
->setMethods(['push'])
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$projectModel = new ProjectModel($this->container);
|
$projectModel = new ProjectModel($this->container);
|
||||||
$taskCreationModel = new TaskCreationModel($this->container);
|
$taskCreationModel = new TaskCreationModel($this->container);
|
||||||
$taskFinderModel = new TaskFinderModel($this->container);
|
$taskFinderModel = new TaskFinderModel($this->container);
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ abstract class Base extends PHPUnit\Framework\TestCase
|
|||||||
$this->container['db']->getStatementHandler()->withLogging();
|
$this->container['db']->getStatementHandler()->withLogging();
|
||||||
$this->container['cli'] = new \Symfony\Component\Console\Application('Kanboard', 'test');
|
$this->container['cli'] = new \Symfony\Component\Console\Application('Kanboard', 'test');
|
||||||
|
|
||||||
|
$this->container['externalLinkManager'] = $this
|
||||||
|
->getMockBuilder('Kanboard\Core\ExternalLink\ExternalLinkManager')
|
||||||
|
->setConstructorArgs(array($this->container))
|
||||||
|
->getMock();
|
||||||
|
|
||||||
$this->container['httpClient'] = $this
|
$this->container['httpClient'] = $this
|
||||||
->getMockBuilder('\Kanboard\Core\Http\Client')
|
->getMockBuilder('\Kanboard\Core\Http\Client')
|
||||||
->setConstructorArgs(array($this->container))
|
->setConstructorArgs(array($this->container))
|
||||||
|
|||||||
@@ -498,12 +498,6 @@ class ProjectDuplicationModelTest extends Base
|
|||||||
|
|
||||||
public function testCloneProjectWithTasks()
|
public function testCloneProjectWithTasks()
|
||||||
{
|
{
|
||||||
$this->container['externalLinkManager'] = $this
|
|
||||||
->getMockBuilder('Kanboard\Core\ExternalLink\ExternalLinkManager')
|
|
||||||
->setConstructorArgs(array($this->container))
|
|
||||||
->setMethods(['push'])
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$projectModel = new ProjectModel($this->container);
|
$projectModel = new ProjectModel($this->container);
|
||||||
$projectDuplicationModel = new ProjectDuplicationModel($this->container);
|
$projectDuplicationModel = new ProjectDuplicationModel($this->container);
|
||||||
$taskCreationModel = new TaskCreationModel($this->container);
|
$taskCreationModel = new TaskCreationModel($this->container);
|
||||||
@@ -528,12 +522,6 @@ class ProjectDuplicationModelTest extends Base
|
|||||||
|
|
||||||
public function testCloneProjectWithSwimlanesAndTasks()
|
public function testCloneProjectWithSwimlanesAndTasks()
|
||||||
{
|
{
|
||||||
$this->container['externalLinkManager'] = $this
|
|
||||||
->getMockBuilder('Kanboard\Core\ExternalLink\ExternalLinkManager')
|
|
||||||
->setConstructorArgs(array($this->container))
|
|
||||||
->setMethods(['push'])
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$projectModel = new ProjectModel($this->container);
|
$projectModel = new ProjectModel($this->container);
|
||||||
$projectDuplicationModel = new ProjectDuplicationModel($this->container);
|
$projectDuplicationModel = new ProjectDuplicationModel($this->container);
|
||||||
$swimlaneModel = new SwimlaneModel($this->container);
|
$swimlaneModel = new SwimlaneModel($this->container);
|
||||||
@@ -584,12 +572,6 @@ class ProjectDuplicationModelTest extends Base
|
|||||||
|
|
||||||
public function testCloneProjectWithTags()
|
public function testCloneProjectWithTags()
|
||||||
{
|
{
|
||||||
$this->container['externalLinkManager'] = $this
|
|
||||||
->getMockBuilder('Kanboard\Core\ExternalLink\ExternalLinkManager')
|
|
||||||
->setConstructorArgs(array($this->container))
|
|
||||||
->setMethods(['push'])
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$projectModel = new ProjectModel($this->container);
|
$projectModel = new ProjectModel($this->container);
|
||||||
$projectDuplicationModel = new ProjectDuplicationModel($this->container);
|
$projectDuplicationModel = new ProjectDuplicationModel($this->container);
|
||||||
$taskCreationModel = new TaskCreationModel($this->container);
|
$taskCreationModel = new TaskCreationModel($this->container);
|
||||||
|
|||||||
@@ -17,17 +17,6 @@ use Kanboard\Model\UserModel;
|
|||||||
|
|
||||||
class TaskProjectDuplicationModelTest extends Base
|
class TaskProjectDuplicationModelTest extends Base
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->container['externalLinkManager'] = $this
|
|
||||||
->getMockBuilder('Kanboard\Core\ExternalLink\ExternalLinkManager')
|
|
||||||
->setConstructorArgs(array($this->container))
|
|
||||||
->setMethods(['push'])
|
|
||||||
->getMock();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testDuplicateAnotherProject()
|
public function testDuplicateAnotherProject()
|
||||||
{
|
{
|
||||||
$taskProjectDuplicationModel = new TaskProjectDuplicationModel($this->container);
|
$taskProjectDuplicationModel = new TaskProjectDuplicationModel($this->container);
|
||||||
|
|||||||
Reference in New Issue
Block a user