/** * * */ private function copy_requirements($source_id, $target_id, $user_id) { $mappings = null; // need to get subtree and create a new one $filters = array(); $filters['exclude_node_types'] = array('testplan' => 'exclude', 'testcase' => 'exclude', 'testsuite' => 'exclude', 'requirement' => 'exclude'); $elements = $this->tree_manager->get_children($source_id, $filters['exclude_node_types']); if (!is_null($elements)) { $mappings = array(); $reqSpecMgr = new requirement_spec_mgr($this->db); $options = array('copy_also' => array('testcase_assignments' => false)); foreach ($elements as $piece) { // function copy_to($id, $parent_id, $tproject_id, $user_id,$options = null) $op = $reqSpecMgr->copy_to($piece['id'], $target_id, $target_id, $user_id, $options); $mappings += $op['mappings']; } } return $mappings; }
/** * * */ private function copy_requirements($source_id, $target_id, $user_id) { $mappings = null; // need to get subtree and create a new one $filters = array(); $filters['exclude_node_types'] = array('testplan' => 'exclude', 'testcase' => 'exclude', 'testsuite' => 'exclude', 'requirement' => 'exclude'); $elements = $this->tree_manager->get_children($source_id, $filters['exclude_node_types']); if (!is_null($elements)) { $mappings = array(); $reqSpecMgr = new requirement_spec_mgr($this->db); // Development Note - 20110817 // why we choose to do not copy testcase_assignments ? // Because due to order used to copy different items, when we ask to copy // requirements WE DO NOT HAVE TEST CASES on new test project. // $options = array('copy_also' => array('testcase_assignments' => false), 'caller' => 'copy_testproject'); foreach ($elements as $piece) { $op = $reqSpecMgr->copy_to($piece['id'], $target_id, $target_id, $user_id, $options); $mappings += $op['mappings']; } } return !is_null($mappings) && isset($mappings['req']) ? $mappings['req'] : null; }