/** * Get info about user(s) role at test project level, * with indication about the nature of role: inherited or assigned. * * To get a user role we consider a 3 layer model: * layer 1 - user <--- uplayer * layer 2 - test project <--- in this fuction we are interested in this level. * layer 3 - test plan * * args : $tproject_id * [$user_id] * * @return array map with effetive_role in context ($tproject_id) * key: user_id * value: map with keys: * login (from users table - useful for debug) * user_role_id (from users table - useful for debug) * uplayer_role_id (always = user_role_id) * uplayer_is_inherited * effective_role_id user role for test project * is_inherited */ function get_tproject_effective_role(&$db, $tproject, $user_id = null, $users = null) { $effective_role = array(); $tproject_id = $tproject['id']; if (!is_null($user_id)) { $users = tlUser::getByIDs($db, (array) $user_id); } else { if (is_null($users)) { $users = tlUser::getAll($db); } } if ($users) { foreach ($users as $id => $user) { // manage admin exception $isInherited = 1; $effectiveRoleID = $user->globalRoleID; $effectiveRole = $user->globalRole; if ($user->globalRoleID != TL_ROLES_ADMIN && !$tproject['is_public']) { $isInherited = $tproject['is_public']; $effectiveRoleID = TL_ROLES_NO_RIGHTS; $effectiveRole = '<no rights>'; } if (isset($user->tprojectRoles[$tproject_id])) { $isInherited = 0; $effectiveRoleID = $user->tprojectRoles[$tproject_id]->dbID; $effectiveRole = $user->tprojectRoles[$tproject_id]; } $effective_role[$id] = array('login' => $user->login, 'user' => $user, 'user_role_id' => $user->globalRoleID, 'uplayer_role_id' => $user->globalRoleID, 'uplayer_is_inherited' => 0, 'effective_role_id' => $effectiveRoleID, 'effective_role' => $effectiveRole, 'is_inherited' => $isInherited); } } return $effective_role; }
/** * Show Test Case * * * @internal * * returns: * * rev : * */ function show(&$smarty, $guiObj, $identity, $grants) { $env_tproject_id = $identity->tproject_id; $id = $identity->id; $version_id = isset($identity->version_id) ? $identity->version_id : self::ALL_VERSIONS; $idSet = is_array($id) ? $id : (array) $id; $status_ok = $idSet[0] > 0 ? 1 : 0; $idCard = new stdClass(); $idCard->tcase_id = intval($idSet[0]); $idCard->tcversion_id = $version_id; $idCard->tproject_id = $identity->tproject_id; $gui = $this->initShowGui($guiObj, $grants, $idSet[0], $idCard); $userIDSet = array(); if ($status_ok) { // Add To Testplan button will be disabled if the testcase doesn't belong to the current selected testproject // $gui->can_do->add2tplan = 'no'; if ($env_tproject_id == $gui->tproject_id) { $gui->can_do->add2tplan = $gui->can_do->add2tplan == 'yes' ? $grants->testplan_planning : 'no'; } else { $gui->can_do->add2tplan = 'no'; } } if ($status_ok && sizeof($idSet)) { $cfx = 0; $cfPlaces = $this->buildCFLocationMap(); $req_mgr = new requirement_mgr($this->db); $allReqs = $req_mgr->get_all_for_tcase($idSet); $allTCKeywords = $this->getKeywords($idSet, null, 'testcase_id', ' ORDER BY keyword ASC '); $ovx = 0; foreach ($idSet as $key => $tc_id) { // using $version_id has sense only when we are working on ONE SPECIFIC Test Case // if we are working on a set of test cases $version_id will be ALL VERSIONS if (!($tc_array = $this->get_by_id($tc_id, $version_id, null, array('renderGhost' => true, 'withGhostString' => true)))) { continue; } $tc_array[0]['tc_external_id'] = $gui->tcasePrefix . $tc_array[0]['tc_external_id']; $tc_array[0]['ghost'] = '[ghost]"TestCase":"' . $tc_array[0]['tc_external_id'] . '","Version":"' . $tc_array[0]['version'] . '"[/ghost]'; // status quo of execution and links of tc versions $gui->status_quo[] = $this->get_versions_status_quo($tc_id); $gui->linked_versions[] = $this->get_linked_versions($tc_id); $gui->keywords_map[] = isset($allTCKeywords[$tc_id]) ? $allTCKeywords[$tc_id] : null; $tc_current = $tc_array[0]; $gui->tc_current_version[] = array($tc_current); // Get UserID and Updater ID for current Version $userIDSet[$tc_current['author_id']] = null; $userIDSet[$tc_current['updater_id']] = null; foreach ($cfPlaces as $locationKey => $locationFilter) { $gui->cf_current_version[$cfx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $tc_current['id']); } // Other versions (if exists) if (count($tc_array) > 1) { $gui->testcase_other_versions[] = array_slice($tc_array, 1); $target_idx = count($gui->testcase_other_versions) - 1; $loop2do = count($gui->testcase_other_versions[$target_idx]); $ref =& $gui->testcase_other_versions[$target_idx]; for ($qdx = 0; $qdx < $loop2do; $qdx++) { $ref[$qdx]['ghost'] = '[ghost]"TestCase":"' . $tc_array[0]['tc_external_id'] . '","Version":"' . $ref[$qdx]['version'] . '"[/ghost]'; $target_tcversion = $gui->testcase_other_versions[$target_idx][$qdx]['id']; foreach ($cfPlaces as $locationKey => $locationFilter) { $gui->cf_other_versions[$cfx][$qdx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $target_tcversion); } } } else { $gui->testcase_other_versions[] = null; $gui->cf_other_versions[$cfx] = null; } $cfx++; // Get author and updater id for each version if ($gui->testcase_other_versions[0]) { foreach ($gui->testcase_other_versions[0] as $key => $version) { $userIDSet[$version['author_id']] = null; $userIDSet[$version['updater_id']] = null; } } $gui->arrReqs[] = isset($allReqs[$tc_id]) ? $allReqs[$tc_id] : null; } } // Removing duplicate and NULL id's unset($userIDSet['']); $gui->users = tlUser::getByIDs($this->db, array_keys($userIDSet), 'id'); $gui->cf = null; $this->initShowGuiActions($gui); $tplCfg = templateConfiguration('tcView'); $smarty->assign('gui', $gui); $smarty->display($tplCfg->template_dir . $tplCfg->default_template); }
if (isset($gui->execStatusValues[$cfg->tc_status['all']])) { unset($gui->execStatusValues[$cfg->tc_status['all']]); } $of = web_editor("bulk_exec_notes", $_SESSION['basehref'], $cfg->editorCfg); $of->Value = getItemTemplateContents('execution_template', $of->InstanceName, null); // Magic numbers that can be determined by trial and error $gui->bulk_exec_notes_editor = $of->CreateHTML(10, 60); unset($of); } else { $gui->exec_notes_editors = createExecNotesWebEditor($gui->map_last_exec, $_SESSION['basehref'], $cfg->editorCfg); } // To silence smarty errors // future must be initialized in a right way $smarty->assign('test_automation_enabled', 0); $smarty->assign('cfg', $cfg); $smarty->assign('users', tlUser::getByIDs($db, $userSet, 'id')); $smarty->assign('gui', $gui); $smarty->assign('g_bugInterface', $g_bugInterface); $smarty->display($templateCfg->template_dir . $templateCfg->default_template); /* function: args: returns: rev: 20100922 - asimon - let this page be functional withouth a form token too 20100625 - asimon - fixed a little bug in platform id initializing when no platform is used (now number 0 instead of value null) 20090913 - franciscom - fixed bug on filter_status initialization
/** * * @param id: test plan id * @return map: * key: user id * value: map with key=platform id * value: map with keys: 'total' and verbose status * values: test case count. * */ public function getStatusTotalsByTester($id) { $unassigned = lang_get('unassigned'); $data_set = $this->getStatusTotalsByAssignedTesterPlatform($id); if (!is_null($data_set)) { $code_verbose = $this->getStatusForReports(); $userSet = array_keys($data_set); // need to find a better way (with less overhead and data movement) to do this $userCol = tlUser::getByIDs($this->db, $userSet, tlUser::TLOBJ_O_GET_DETAIL_MINIMUM); foreach ($userSet as $testedBy) { $user_platform[$testedBy]['type'] = 'tester'; $user_platform[$testedBy]['name'] = $unassigned; if ($testedBy > 0) { $user_platform[$testedBy]['name'] = $userCol[$testedBy]->getDisplayName(); } $user_platform[$testedBy]['total_tc'] = 0; foreach ($code_verbose as $status_code => $status_verbose) { $user_platform[$testedBy]['details'][$status_verbose]['qty'] = 0; } // this will be removed from final result $user_platform[$testedBy]['details']['total']['qty'] = 0; $platformIDSet = array_keys($data_set[$assignedTo]); foreach ($platformIDSet as $platformID) { foreach ($data_set[$testedBy][$platformID] as $verboseStatus => $counter) { if (!isset($user_platform[$testedBy]['details'][$verboseStatus])) { $user_platform[$testedBy]['details'][$verboseStatus]['qty'] = 0; } $user_platform[$testedBy]['details'][$verboseStatus]['qty'] += $counter; } } $user_platform[$testedBy]['total_tc'] = $user_platform[$testedBy]['details']['total']['qty']; unset($user_platform[$testedBy]['details']['total']); } } return $user_platform; }
/** * Get info about user(s) role at test project level, * with indication about the nature of role: inherited or assigned. * * To get a user role we consider a 3 layer model: * layer 1 - user <--- uplayer * layer 2 - test project <--- in this fuction we are interested in this level. * layer 3 - test plan * * args : $tproject_id * [$user_id] * * @return array map with effetive_role in context ($tproject_id) * key: user_id * value: map with keys: * login (from users table - useful for debug) * user_role_id (from users table - useful for debug) * uplayer_role_id (always = user_role_id) * uplayer_is_inherited * effective_role_id user role for test project * is_inherited */ function get_tproject_effective_role(&$db, $tproject_id, $user_id = null, $users = null) { $effective_role = array(); if (!is_null($user_id)) { $users = tlUser::getByIDs($db, (array) $user_id); } else { if (is_null($users)) { $users = tlUser::getAll($db); } } if ($users) { foreach ($users as $id => $user) { $isInherited = 1; $effectiveRoleID = $user->globalRoleID; $effectiveRole = $user->globalRole; if (isset($user->tprojectRoles[$tproject_id])) { $isInherited = 0; $effectiveRoleID = $user->tprojectRoles[$tproject_id]->dbID; $effectiveRole = $user->tprojectRoles[$tproject_id]; } $effective_role[$id] = array('login' => $user->login, 'user' => $user, 'user_role_id' => $user->globalRoleID, 'uplayer_role_id' => $user->globalRoleID, 'uplayer_is_inherited' => 0, 'effective_role_id' => $effectiveRoleID, 'effective_role' => $effectiveRole, 'is_inherited' => $isInherited); } } return $effective_role; }
function builGuiUsers(&$dbHandler, $itemSet) { unset($itemSet['']); $userSet = null; if ($itemSet) { foreach ($itemSet as $value) { $userSet[] = $value; } } return tlUser::getByIDs($dbHandler, $userSet, 'id'); }
/** * send_mail_to_testers * * * @return void */ function send_mail_to_testers(&$dbHandler, &$tcaseMgr, &$guiObj, &$argsObj, $features, $operation) { $testers['new'] = null; $mail_details['new'] = lang_get('mail_testcase_assigned') . "<br /><br />"; $mail_subject['new'] = lang_get('mail_subject_testcase_assigned'); $use_testers['new'] = true; $tcaseSet = null; $tcnames = null; $email = array(); $userSet[] = $argsObj->userID; $userSet[] = $argsObj->testerID; $userData = tlUser::getByIDs($dbHandler, $userSet); $assigner = $userData[$argsObj->userID]->firstName . ' ' . $userData[$argsObj->userID]->lastName; $email['from_address'] = config_get('from_email'); $body_first_lines = lang_get('testproject') . ': ' . $argsObj->tproject_name . '<br />' . lang_get('testplan') . ': ' . $guiObj->testPlanName . '<br /><br />'; // Get testers id foreach ($features as $feature_id => $value) { if ($use_testers['new']) { $testers['new'][$value['user_id']][$value['tcase_id']] = $value['tcase_id']; } $tcaseSet[$value['tcase_id']] = $value['tcase_id']; $tcversionSet[$value['tcversion_id']] = $value['tcversion_id']; } $infoSet = $tcaseMgr->get_by_id_bulk($tcaseSet, $tcversionSet); foreach ($infoSet as $value) { $tcnames[$value['testcase_id']] = $guiObj->testCasePrefix . $value['tc_external_id'] . ' ' . $value['name']; } $path_info = $tcaseMgr->tree_manager->get_full_path_verbose($tcaseSet, array('output_format' => 'simple')); $flat_path = null; foreach ($path_info as $tcase_id => $pieces) { $flat_path[$tcase_id] = implode('/', $pieces) . '/' . $tcnames[$tcase_id]; } foreach ($testers as $tester_type => $tester_set) { if (!is_null($tester_set)) { $email['subject'] = $mail_subject[$tester_type] . ' ' . $guiObj->testPlanName; foreach ($tester_set as $user_id => $value) { $userObj = $userData[$user_id]; $email['to_address'] = $userObj->emailAddress; $email['body'] = $body_first_lines; $email['body'] .= sprintf($mail_details[$tester_type], $userObj->firstName . ' ' . $userObj->lastName, $assigner); foreach ($value as $tcase_id) { $email['body'] .= $flat_path[$tcase_id] . '<br />'; } $email['body'] .= '<br />' . date(DATE_RFC1123); $email_op = email_send($email['from_address'], $email['to_address'], $email['subject'], $email['body'], '', true, true); } // foreach($tester_set as $user_id => $value) } } }
/** * Show Test Case logic * * @param object $smarty reference to smarty object (controls viewer). * @param integer $id Test case unique identifier * @param integer $version_id (optional) you can work on ONE test case version, * or on ALL; default: ALL * * @internal [viewer_args]: map with keys action msg_result refresh_tree: controls if tree view is refreshed after every operation. default: yes user_feedback disable_edit: used to overwrite user rights default: 0 -> no returns: rev : 20090215 - franciscom - added info about links to test plans 20081114 - franciscom - added arguments and options that are useful when this method is used to display test case search results. path_info: map: key: testcase id value: array with path to test case, where: element 0 -> test project name other elements test suites name new options on viewer_args: hilite_testcase_name,show_match_count 20070930 - franciscom - REQ - BUGID 1078 added disable_edit argument */ function show(&$smarty, $guiObj, $template_dir, $id, $version_id = self::ALL_VERSIONS, $viewer_args = null, $path_info = null, $mode = null) { // echo 'DEBUG' . __FUNCTION__ . '<br>'; $status_ok = 1; $gui = is_null($guiObj) ? new stdClass() : $guiObj; $gui->parentTestSuiteName = ''; $gui->path_info = $path_info; $gui->tprojectName = ''; $gui->linked_versions = null; $gui->tc_current_version = array(); $gui->bodyOnLoad = ""; // 20101008 - asimon - BUGID 3311 $gui->bodyOnUnload = "storeWindowSize('TCEditPopup')"; $gui->submitCode = ""; $gui->dialogName = ''; $gui->platforms = null; $gui->tableColspan = 5; // sorry magic related to table to display steps $gui->opt_requirements = false; $gui_cfg = config_get('gui'); $the_tpl = config_get('tpl'); $my_template = isset($the_tpl['tcView']) ? $the_tpl['tcView'] : 'tcView.tpl'; $tcase_cfg = config_get('testcase_cfg'); $req_mgr = new requirement_mgr($this->db); $tc_other_versions = array(); $status_quo_map = array(); $keywords_map = array(); $arrReqs = array(); $userid_array = array(); // 20090718 - franciscom $cf_smarty = null; $formatOptions = null; $cfPlaces = $this->buildCFLocationMap(); if (!is_null($mode) && $mode == 'editOnExec') { // refers to two javascript functions present in testlink_library.js // and logic used to refresh both frames when user call this // method to edit a test case while executing it. $gui->dialogName = 'tcview_dialog'; $gui->bodyOnLoad = "dialog_onLoad({$gui->dialogName})"; $gui->bodyOnUnload = "dialog_onUnload({$gui->dialogName})"; $gui->submitCode = "return dialog_onSubmit({$gui->dialogName})"; } $viewer_defaults = array('title' => lang_get('title_test_case'), 'show_title' => 'no', 'action' => '', 'msg_result' => '', 'user_feedback' => '', 'refreshTree' => 1, 'disable_edit' => 0, 'display_testproject' => 0, 'display_parent_testsuite' => 0, 'hilite_testcase_name' => 0, 'show_match_count' => 0); if (!is_null($viewer_args) && is_array($viewer_args)) { foreach ($viewer_defaults as $key => $value) { if (isset($viewer_args[$key])) { $viewer_defaults[$key] = $viewer_args[$key]; } } } $gui->show_title = $viewer_defaults['show_title']; $gui->display_testcase_path = !is_null($path_info); $gui->hilite_testcase_name = $viewer_defaults['hilite_testcase_name']; $gui->pageTitle = $viewer_defaults['title']; $gui->show_match_count = $viewer_defaults['show_match_count']; if ($gui->show_match_count && $gui->display_testcase_path) { $gui->match_count = count($path_info); } // fine grain control of operations // if( $viewer_defaults['disable_edit'] == 1 || has_rights($this->db,"mgt_modify_tc") == 'no' ) // BUGID 3387 if ($viewer_defaults['disable_edit'] == 1 || has_rights($this->db, "mgt_modify_tc") == false) { $mode = 'editDisabled'; } $gui->show_mode = $mode; $gui->can_do = $this->getShowViewerActions($mode); if (is_array($id)) { $a_id = $id; } else { $status_ok = $id > 0 ? 1 : 0; $a_id = array($id); } if ($status_ok) { $path2root = $this->tree_manager->get_path($a_id[0]); $tproject_id = $path2root[0]['parent_id']; $info = $this->tproject_mgr->get_by_id($tproject_id); $gui->opt_requirements = $info['opt']->requirementsEnabled; $platformMgr = new tlPlatform($this->db, $tproject_id); $gui->platforms = $platformMgr->getAllAsMap(); // BUGID 2378 $testplans = $this->tproject_mgr->get_all_testplans($tproject_id, array('plan_status' => 1)); $gui->has_testplans = !is_null($testplans) && count($testplans) > 0 ? 1 : 0; if ($viewer_defaults['display_testproject']) { $gui->tprojectName = $info['name']; } if ($viewer_defaults['display_parent_testsuite']) { $parent_idx = count($path2root) - 2; $gui->parentTestSuiteName = $path2root[$parent_idx]['name']; } $tcasePrefix = $this->tproject_mgr->getTestCasePrefix($tproject_id); if (trim($tcasePrefix) != "") { // Add To Testplan button will be disabled if the testcase doesn't belong to the current selected testproject // $gui->can_do->add2tplan = 'no'; if ($_SESSION['testprojectPrefix'] == $tcasePrefix) { $gui->can_do->add2tplan = $gui->can_do->add2tplan == 'yes' ? has_rights($this->db, "testplan_planning") : 'no'; } else { $gui->can_do->add2tplan = 'no'; } $tcasePrefix .= $tcase_cfg->glue_character; } } if ($status_ok && sizeof($a_id)) { $cfx = 0; $allTCKeywords = $this->getKeywords($a_id, null, 'testcase_id', ' ORDER BY keyword ASC '); $allReqs = $req_mgr->get_all_for_tcase($a_id); foreach ($a_id as $key => $tc_id) { $tc_array = $this->get_by_id($tc_id, $version_id); if (!$tc_array) { continue; } $tc_array[0]['tc_external_id'] = $tcasePrefix . $tc_array[0]['tc_external_id']; // get the status quo of execution and links of tc versions $status_quo_map[] = $this->get_versions_status_quo($tc_id); $gui->linked_versions[] = $this->get_linked_versions($tc_id); $keywords_map[] = isset($allTCKeywords[$tc_id]) ? $allTCKeywords[$tc_id] : null; $tc_current = $tc_array[0]; $tcversion_id_current = $tc_array[0]['id']; $gui->tc_current_version[] = array($tc_current); //Get UserID and Updater ID for current Version $userid_array[$tc_current['author_id']] = null; $userid_array[$tc_current['updater_id']] = null; // BUGID 3431 foreach ($cfPlaces as $locationKey => $locationFilter) { // BUGID 3431 $cf_current_version[$cfx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $tproject_id, null, $tcversion_id_current); } // Other versions (if exists) if (count($tc_array) > 1) { $tc_other_versions[] = array_slice($tc_array, 1); $target_idx = count($tc_other_versions) - 1; // BUGID 3431 $loop2do = count($tc_other_versions[$target_idx]); // echo 'count($tc_other_versions):' . count($tc_other_versions) . '<br>'; // echo '$loop2do:' . $loop2do . '<br>'; for ($qdx = 0; $qdx < $loop2do; $qdx++) { $target_tcversion = $tc_other_versions[$target_idx][$qdx]['id']; foreach ($cfPlaces as $locationKey => $locationFilter) { // BUGID 3431 $cf_other_versions[$cfx][$qdx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $tproject_id, null, $target_tcversion); } } } else { $tc_other_versions[] = null; $cf_other_versions[$cfx] = null; } $cfx++; // Get author and updater id for each version if ($tc_other_versions[0]) { foreach ($tc_other_versions[0] as $key => $version) { $userid_array[$version['author_id']] = null; $userid_array[$version['updater_id']] = null; } } $tcReqs = isset($allReqs[$tc_id]) ? $allReqs[$tc_id] : null; $arrReqs[] = $tcReqs; } // foreach($a_id as $key => $tc_id) } // if (sizeof($a_id)) // Removing duplicate and NULL id's unset($userid_array['']); $passeduserarray = array_keys($userid_array); $gui->cf = null; // $cf_current_version; // $cf_smarty; $gui->cf_current_version = $cf_current_version; // $cf_smarty; $gui->cf_other_versions = $cf_other_versions; // $cf_smarty; $gui->refreshTree = $viewer_defaults['refreshTree']; $gui->sqlResult = $viewer_defaults['msg_result']; $gui->action = $viewer_defaults['action']; $gui->user_feedback = $viewer_defaults['user_feedback']; $gui->execution_types = $this->execution_types; $gui->tcase_cfg = $tcase_cfg; $gui->users = tlUser::getByIDs($this->db, $passeduserarray, 'id'); $gui->status_quo = $status_quo_map; $gui->testcase_other_versions = $tc_other_versions; $gui->arrReqs = $arrReqs; $gui->view_req_rights = has_rights($this->db, "mgt_view_req"); $gui->keywords_map = $keywords_map; $smarty->assign('gui', $gui); $smarty->display($template_dir . $my_template); }
/** * Show Test Case logic * * @param object $smarty reference to smarty object (controls viewer). * @param integer $id Test case unique identifier * @param integer $version_id (optional) you can work on ONE test case version, * or on ALL; default: ALL * * @internal [viewer_args]: map with keys action msg_result refresh_tree: controls if tree view is refreshed after every operation. default: yes user_feedback disable_edit: used to overwrite user rights default: 0 -> no returns: rev : */ function show(&$smarty, $guiObj, $identity, $grants) { $env_tproject_id = $identity->tproject_id; $id = $identity->id; $version_id = isset($identity->version_id) ? $identity->version_id : self::ALL_VERSIONS; $idSet = is_array($id) ? $id : (array) $id; $status_ok = $idSet[0] > 0 ? 1 : 0; $gui = $this->initShowGui($guiObj, $grants); $gui->grants = $grants; $gui->testcase_other_versions = array(); if ($status_ok) { $req_mgr = new requirement_mgr($this->db); $path2root = $this->tree_manager->get_path($idSet[0]); $gui->tproject_id = $path2root[0]['parent_id']; $info = $this->tproject_mgr->get_by_id($gui->tproject_id); $gui->opt_requirements = $info['opt']->requirementsEnabled; $gui->requirementsEnabled = $info['opt']->requirementsEnabled; $platformMgr = new tlPlatform($this->db, $gui->tproject_id); $gui->platforms = $platformMgr->getAllAsMap(); $testplans = $this->tproject_mgr->get_all_testplans($gui->tproject_id, array('plan_status' => 1)); $gui->has_testplans = !is_null($testplans) && count($testplans) > 0 ? 1 : 0; if ($gui->display_testproject) { $gui->tprojectName = $info['name']; } if ($gui->display_parent_testsuite) { $parent_idx = count($path2root) - 2; $gui->parentTestSuiteName = $path2root[$parent_idx]['name']; } $tcasePrefix = $this->tproject_mgr->getTestCasePrefix($gui->tproject_id); if (trim($tcasePrefix) != "") { // 'Add To Testplan' button will be disabled if the testcase doesn't belong // to the current selected testproject // $gui->can_do->add2tplan = 'no'; if ($env_tproject_id != $gui->tproject_id) { $gui->can_do->add2tplan = $gui->can_do->add2tplan == 'yes' ? $grants->testplan_planning : 'no'; } else { $gui->can_do->add2tplan = 'yes'; } $tcasePrefix .= $gui->tcase_cfg->glue_character; } } $userid_array = array(); if ($status_ok && sizeof($idSet)) { $cfx = 0; $allTCKeywords = $this->getKeywords($idSet, null, 'testcase_id', ' ORDER BY keyword ASC '); $allReqs = $req_mgr->get_all_for_tcase($idSet); $tcStatus2exclude = config_get('tplanDesign')->hideTestCaseWithStatusIn; foreach ($idSet as $key => $tc_id) { $tc_array = $this->get_by_id($tc_id, $version_id); if (!$tc_array) { continue; } $gui->attach[$tc_id] = new stdClass(); $gui->attach[$tc_id]->itemID = $tc_id; $gui->attach[$tc_id]->dbTable = $this->attachmentTableName; $gui->attach[$tc_id]->infoSet = null; $gui->attach[$tc_id]->gui = null; list($gui->attach[$tc_id]->infoSet, $gui->attach[$tc_id]->gui) = $this->buildAttachSetup($tc_id); $gui->attach[$tc_id]->gui->display = TRUE; $gui->attach[$tc_id]->enabled = $gui->attach[$tc_id]->gui->enabled; $tc_array[0]['tc_external_id'] = $tcasePrefix . $tc_array[0]['tc_external_id']; // get the status quo of execution and links of tc versions // $gui->status_quo_map[] = $this->get_versions_status_quo($tc_id); $gui->status_quo[] = $this->get_versions_status_quo($tc_id); $gui->linked_versions[] = $this->get_linked_versions($tc_id); $gui->keywords_map[] = isset($allTCKeywords[$tc_id]) ? $allTCKeywords[$tc_id] : null; $tc_current = $tc_array[0]; // add new attribute // enabledOnTestPlanDesign $tc_current['enabledOnTestPlanDesign'] = !isset($tcStatus2exclude[$tc_current['status']]); $tcversion_id_current = $tc_current['id']; $gui->tc_current_version[] = array($tc_current); //Get UserID and Updater ID for current Version $userid_array[$tc_current['author_id']] = null; $userid_array[$tc_current['updater_id']] = null; $cfPlaces = $this->buildCFLocationMap(); foreach ($cfPlaces as $locationKey => $locationFilter) { $gui->cf_current_version[$cfx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $tcversion_id_current); } // Other versions (if exists) if (count($tc_array) > 1) { $gui->testcase_other_versions[] = array_slice($tc_array, 1); $target_idx = count($gui->testcase_other_versions) - 1; $loop2do = count($gui->testcase_other_versions[$target_idx]); for ($qdx = 0; $qdx < $loop2do; $qdx++) { $tcRef =& $gui->testcase_other_versions[$target_idx][$qdx]; $tcRef['enabledOnTestPlanDesign'] = !isset($tcStatus2exclude[$tcRef['status']]); $target_tcversion = $tcRef['id']; foreach ($cfPlaces as $locationKey => $locationFilter) { $gui->cf_other_versions[$cfx][$qdx][$locationKey] = $this->html_table_of_custom_field_values($tc_id, 'design', $locationFilter, null, null, $gui->tproject_id, null, $target_tcversion); } } } else { $gui->testcase_other_versions[] = null; $gui->cf_other_versions[$cfx] = null; } $cfx++; // Get author and updater id for each version // @TODO - franciscom - explain magic ZERO if ($gui->testcase_other_versions[0]) { foreach ($gui->testcase_other_versions[0] as $key => $version) { $userid_array[$version['author_id']] = null; $userid_array[$version['updater_id']] = null; } } $tcReqs = isset($allReqs[$tc_id]) ? $allReqs[$tc_id] : null; $gui->arrReqs[] = $tcReqs; } // foreach($a_id as $key => $tc_id) } // if (sizeof($a_id)) // Removing duplicate and NULL id's unset($userid_array['']); $this->initShowGuiActions(&$gui); $gui->users = tlUser::getByIDs($this->db, array_keys($userid_array), 'id'); $smarty->assign('gui', $gui); $dummy = templateConfiguration('tcView'); $smarty->display($dummy->template_dir . $dummy->default_template); }