diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Model/ProjectDuplication.php | 4 | ||||
-rw-r--r-- | app/Model/ProjectMetadata.php | 19 | ||||
-rw-r--r-- | app/Template/project/duplicate.php | 1 |
3 files changed, 22 insertions, 2 deletions
diff --git a/app/Model/ProjectDuplication.php b/app/Model/ProjectDuplication.php index 9c5f80ad..79011258 100644 --- a/app/Model/ProjectDuplication.php +++ b/app/Model/ProjectDuplication.php @@ -21,7 +21,7 @@ class ProjectDuplication extends Base */ public function getOptionalSelection() { - return array('category', 'projectPermission', 'action', 'swimlane', 'task'); + return array('category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata'); } /** @@ -32,7 +32,7 @@ class ProjectDuplication extends Base */ public function getPossibleSelection() { - return array('board', 'category', 'projectPermission', 'action', 'swimlane', 'task'); + return array('board', 'category', 'projectPermission', 'action', 'swimlane', 'task', 'projectMetadata'); } /** diff --git a/app/Model/ProjectMetadata.php b/app/Model/ProjectMetadata.php index 85498053..256f5e1f 100644 --- a/app/Model/ProjectMetadata.php +++ b/app/Model/ProjectMetadata.php @@ -27,4 +27,23 @@ class ProjectMetadata extends Metadata { return 'project_id'; } + + /** + * Helper method to duplicate all metadata to another project + * + * @access public + * @param integer $src_project_id + * @param integer $dst_project_id + * @return boolean + */ + public function duplicate($src_project_id, $dst_project_id) + { + $metadata = $this->getAll($src_project_id); + + if (! $this->save($dst_project_id, $metadata)) { + return false; + } + + return true; + } } diff --git a/app/Template/project/duplicate.php b/app/Template/project/duplicate.php index 7cfa8969..e856ec80 100644 --- a/app/Template/project/duplicate.php +++ b/app/Template/project/duplicate.php @@ -18,6 +18,7 @@ <?= $this->form->checkbox('action', t('Actions'), 1, true) ?> <?= $this->form->checkbox('swimlane', t('Swimlanes'), 1, false) ?> <?= $this->form->checkbox('task', t('Tasks'), 1, false) ?> + <?= $this->form->checkbox('projectMetadata', t('Metadata'), 1, false) ?> <div class="form-actions"> <button type="submit" class="btn btn-red"><?= t('Duplicate') ?></button> |