summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormluepkes <michael@luepkes.net>2015-01-12 00:11:48 +0100
committermluepkes <michael@luepkes.net>2015-01-12 00:11:48 +0100
commit81f3131bbc4eaabf8f7e2d8825e0ba45a5e1b507 (patch)
treee42173a3051ef7c4834eaaf792b4818af52cd420
parent0a7c5bd4e1e2f80121ec3550a799be8266026329 (diff)
Implemented Project duplication with Tasks within Controller\Project
-rw-r--r--app/Controller/Project.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/Controller/Project.php b/app/Controller/Project.php
index d0da53d0..2aa4ac74 100644
--- a/app/Controller/Project.php
+++ b/app/Controller/Project.php
@@ -307,7 +307,14 @@ class Project extends Base
$this->checkCSRFParam();
- if ($this->project->duplicate($project['id'])) {
+ $clone_project_id = $this->project->duplicate($project['id']);
+
+ if ($clone_project_id) {
+ // Find all task for source project and clone to target project
+ $tasks = $this->taskFinder->getAll($project['id']);
+ foreach($tasks as $task) {
+ $this->taskDuplication->duplicateToProject($task['id'], $clone_project_id);
+ }
$this->session->flash(t('Project cloned successfully.'));
} else {
$this->session->flashError(t('Unable to clone this project.'));