From 6d5577fa0bc108fcafa92fc4ac4b9ed621bfe33e Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 2 Jul 2016 15:20:59 -0400 Subject: Handle project tags duplication --- app/Model/TagDuplicationModel.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'app/Model/TagDuplicationModel.php') diff --git a/app/Model/TagDuplicationModel.php b/app/Model/TagDuplicationModel.php index 1876391d..fb0d8170 100644 --- a/app/Model/TagDuplicationModel.php +++ b/app/Model/TagDuplicationModel.php @@ -12,6 +12,26 @@ use Kanboard\Core\Base; */ class TagDuplicationModel extends Base { + /** + * Duplicate project tags to another project + * + * @access public + * @param integer $src_project_id + * @param integer $dst_project_id + * @return bool + */ + public function duplicate($src_project_id, $dst_project_id) + { + $tags = $this->tagModel->getAllByProject($src_project_id); + $results = array(); + + foreach ($tags as $tag) { + $results[] = $this->tagModel->create($dst_project_id, $tag['name']); + } + + return ! in_array(false, $results, true); + } + /** * Link tags to the new tasks * -- cgit v1.2.3