Example #1
0
$gx = $tcase_mgr->getTcSearchSkeleton($args);
$gui = (object) array_merge((array) $ga, (array) $gx);
initSearch($gui, $args, $tproject_mgr);
$map = null;
if ($args->tprojectID && $args->doAction == 'doSearch') {
    $tables = tlObjectWithDB::getDBTables(array('cfield_design_values', 'nodes_hierarchy', 'requirements', 'req_coverage', 'tcsteps', 'testcase_keywords', 'tcversions', 'users'));
    $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($args->tprojectID);
    $gui->tcasePrefix .= $tcase_cfg->glue_character;
    $from = array('by_keyword_id' => ' ', 'by_custom_field' => ' ', 'by_requirement_doc_id' => '', 'users' => '');
    $tcaseID = null;
    $emptyTestProject = false;
    if ($args->targetTestCase != "" && strcmp($args->targetTestCase, $gui->tcasePrefix) != 0) {
        if (strpos($args->targetTestCase, $tcase_cfg->glue_character) === false) {
            $args->targetTestCase = $gui->tcasePrefix . $args->targetTestCase;
        }
        $tcaseID = $tcase_mgr->getInternalID($args->targetTestCase);
        $filter['by_tc_id'] = " AND NH_TCV.parent_id = " . intval($tcaseID);
    } else {
        $tproject_mgr->get_all_testcases_id($args->tprojectID, $a_tcid);
        if (!is_null($a_tcid)) {
            $filter['by_tc_id'] = " AND NH_TCV.parent_id IN (" . implode(",", $a_tcid) . ") ";
        } else {
            // Force Nothing extracted, because test project
            // has no test case defined
            $emptyTestProject = true;
            $filter['by_tc_id'] = " AND 1 = 0 ";
        }
    }
    if ($args->version) {
        $filter['by_version'] = " AND TCV.version = {$args->version} ";
    }
Example #2
0
/**
 * process_testcase
 *
 */
function process_testcase(&$dbHandler, $externalID, $tprojectID, $tprojectPrefix, $version)
{
    $ret = array();
    $ret['url'] = null;
    $ret['msg'] = sprintf(lang_get('testcase_not_found'), $externalID, $tprojectPrefix);
    $tcase_mgr = new testcase($dbHandler);
    $tcaseID = $tcase_mgr->getInternalID($externalID);
    if ($tcaseID > 0) {
        $ret['url'] = "lib/testcases/archiveData.php?edit=testcase&id={$tcaseID}";
        $cookie = buildCookie($dbHandler, $tcaseID, $tprojectID, 'ys-tproject_');
        setcookie($cookie['value'], $cookie['path'], TL_COOKIE_KEEPTIME, '/');
    }
    return $ret;
}
Example #3
0
     $date_to = date_create_from_format('Y-n-j', $args->creation_date_to);
 }
 if (!is_null($args->creation_date_from)) {
     $db_date = $db->db->DBdate($args->creation_date_from);
     $filter['by_creation_date_from'] = " AND TCV.creation_ts >= {$db_date} ";
 }
 if (!is_null($args->creation_date_to)) {
     $db_date = $db->db->DBdate($args->creation_date_to);
     $filter['by_creation_date_to'] = " AND TCV.creation_ts <= {$db_date} ";
 }
 if ($args->targetTestCase != "" && strcmp($args->targetTestCase, $gui->tcasePrefix) != 0) {
     if (strpos($args->targetTestCase, $tcase_cfg->glue_character) === false) {
         $args->targetTestCase = $gui->tcasePrefix . $args->targetTestCase;
     }
     $tcase_mgr = new testcase($db);
     $tcaseID = $tcase_mgr->getInternalID($args->targetTestCase, $tcase_cfg->glue_character);
     $filter['by_tc_id'] = " AND NH_TCV.parent_id = {$tcaseID} ";
 } else {
     $tproject_mgr->get_all_testcases_id($args->tprojectID, $a_tcid);
     $filter['by_tc_id'] = " AND NH_TCV.parent_id IN (" . implode(",", $a_tcid) . ") ";
 }
 if ($args->version) {
     $filter['by_version'] = " AND TCV.version = {$args->version} ";
 }
 if ($args->keyword_id) {
     $from['by_keyword_id'] = " JOIN {$tables['testcase_keywords']} KW ON KW.testcase_id = NH_TC.id ";
     $filter['by_keyword_id'] = " AND KW.keyword_id = {$args->keyword_id} ";
 }
 if ($args->name != "") {
     $args->name = $db->prepare_string($args->name);
     $filter['by_name'] = " AND NH_TC.name like '%{$args->name}%' ";
Example #4
0
/**
 *
 *
 */
function processTestCase(&$dbHandler, $tplEngine, $args, &$gui, $grants, $cfg)
{
    $get_path_info = false;
    $item_mgr = new testcase($dbHandler);
    // has sense only when we work on test case
    $dummy = testcase::getLayout();
    $gui->tableColspan = $dummy->tableToDisplayTestCaseSteps->colspan;
    $gui->viewerArgs['refresh_tree'] = 'no';
    $gui->path_info = null;
    $gui->platforms = null;
    $gui->loadOnCancelURL = '';
    $gui->attachments = null;
    $gui->direct_link = null;
    $gui->steps_results_layout = $cfg['spec']->steps_results_layout;
    $gui->bodyOnUnload = "storeWindowSize('TCEditPopup')";
    if ($args->caller == 'navBar' && !is_null($args->targetTestCase) && strcmp($args->targetTestCase, $args->tcasePrefix) != 0) {
        $args->id = $item_mgr->getInternalID($args->targetTestCase);
        $args->tcversion_id = testcase::ALL_VERSIONS;
        // I've added $args->caller, in order to make clear the logic, because some actions need to be done ONLY
        // when we have arrived to this script because user has requested a search from navBar.
        // Before we have trusted the existence of certain variables (do not think this old kind of approach is good).
        //
        // why strcmp($args->targetTestCase,$args->tcasePrefix) ?
        // because in navBar targetTestCase is initialized with testcase prefix to provide some help to user
        // then if user request search without adding nothing, we will not be able to search.
        // From navBar we want to allow ONLY to search for ONE and ONLY ONE test case ID.
        $gui->viewerArgs['show_title'] = 'no';
        $gui->viewerArgs['display_testproject'] = 1;
        $gui->viewerArgs['display_parent_testsuite'] = 1;
        if (!($get_path_info = $args->id > 0)) {
            $gui->warning_msg = $args->id == 0 ? lang_get('testcase_does_not_exists') : lang_get('prefix_does_not_exists');
        }
    }
    // because we can arrive here from a User Search Request, if args->id == 0 => nothing found
    if ($args->id > 0) {
        if ($get_path_info || $args->show_path) {
            $gui->path_info = $item_mgr->tree_manager->get_full_path_verbose($args->id);
        }
        $platform_mgr = new tlPlatform($dbHandler, $args->tproject_id);
        $gui->platforms = $platform_mgr->getAllAsMap();
        $gui->attachments[$args->id] = getAttachmentInfosFrom($item_mgr, $args->id);
        $gui->direct_link = $item_mgr->buildDirectWebLink($_SESSION['basehref'], $args->id);
        $gui->id = $args->id;
        $identity = new stdClass();
        $identity->id = $args->id;
        $identity->tproject_id = $args->tproject_id;
        $identity->version_id = $args->tcversion_id;
        try {
            $item_mgr->show($tplEngine, $gui, $identity, $grants);
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        exit;
    } else {
        $templateCfg = templateConfiguration();
        // need to initialize search fields
        $xbm = $item_mgr->getTcSearchSkeleton();
        $xbm->warning_msg = lang_get('no_records_found');
        $xbm->pageTitle = lang_get('caption_search_form');
        $xbm->tableSet = null;
        $xbm->doSearch = false;
        $xbm->tproject_id = $args->tproject_id;
        $tplEngine->assign('gui', $xbm);
        $tplEngine->display($templateCfg->template_dir . 'tcSearchResults.tpl');
    }
}
 * @internal revisions
 *
 */
require_once '../../../config.inc.php';
require_once 'common.php';
require_once 'tree.class.php';
// require_once('dBug.php');
testlinkInitPage($db);
echo "<pre> testcase - constructor - testcase(&\$db)";
echo "</pre>";
$tcase_mgr = new testcase($db);
// new dBug($tcase_mgr);
try {
    $fullEID = 'PTJ09-1';
    echo '<br>Testing getInternalID with fullEID<br>';
    $va = $tcase_mgr->getInternalID($fullEID);
    new dBug($va);
} catch (Exception $e) {
    echo 'Message: ' . $e->getMessage();
}
try {
    $EID = 1;
    echo '<br>Testing getInternalID with ONLY NUMERIC EID<br>';
    $va = $tcase_mgr->getInternalID($EID);
    new dBug($va);
} catch (Exception $e) {
    echo 'Message: ' . $e->getMessage();
}
try {
    $EID = 1;
    echo '<br>Testing getInternalID with ONLY NUMERIC EID<br>';
 /**
  * 
  * 
  */
 private function init_filter_tc_id()
 {
     $key = 'filter_tc_id';
     $selection = $this->args->{$key};
     $internal_id = null;
     if (!$this->testproject_mgr) {
         $this->testproject_mgr = new testproject($this->db);
     }
     if (!$this->tc_mgr) {
         $this->tc_mgr = new testcase($this->db);
     }
     $tc_prefix = $this->testproject_mgr->getTestCasePrefix($this->args->testproject_id);
     $tc_prefix .= $this->configuration->tc_cfg->glue_character;
     if (!$selection || $selection == $tc_prefix || $this->args->reset_filters) {
         $selection = null;
     } else {
         $this->do_filtering = true;
         // we got the external ID here when filtering, but need the internal one
         $internal_id = $this->tc_mgr->getInternalID($selection);
     }
     $this->filters[$key] = array('selected' => $selection ? $selection : $tc_prefix);
     $this->active_filters[$key] = $internal_id;
 }
function saveImportedTCData(&$db, $tcData, $tproject_id, $container_id, $userID, $kwMap, $duplicatedLogic = array('hitCriteria' => 'name', 'actionOnHit' => null))
{
    static $messages;
    static $fieldSizeCfg;
    static $feedbackMsg;
    static $tcase_mgr;
    static $tproject_mgr;
    static $req_spec_mgr;
    static $req_mgr;
    static $safeSizeCfg;
    static $linkedCustomFields;
    static $tprojectHas;
    static $reqSpecSet;
    static $getVersionOpt;
    static $userObj;
    if (!$tcData) {
        return;
    }
    // $tprojectHas = array('customFields' => false, 'reqSpec' => false);
    $hasCustomFieldsInfo = false;
    $hasRequirements = false;
    if (is_null($messages)) {
        $feedbackMsg = array();
        $messages = array();
        $fieldSizeCfg = config_get('field_size');
        $tcase_mgr = new testcase($db);
        $tproject_mgr = new testproject($db);
        $req_spec_mgr = new requirement_spec_mgr($db);
        $req_mgr = new requirement_mgr($db);
        $userObj = new tlUser();
        $k2l = array('already_exists_updated', 'original_name', 'testcase_name_too_long', 'start_warning', 'end_warning', 'testlink_warning', 'hit_with_same_external_ID');
        foreach ($k2l as $k) {
            $messages[$k] = lang_get($k);
        }
        $messages['start_feedback'] = $messages['start_warning'] . "\n" . $messages['testlink_warning'] . "\n";
        $messages['cf_warning'] = lang_get('no_cf_defined_can_not_import');
        $messages['reqspec_warning'] = lang_get('no_reqspec_defined_can_not_import');
        $feedbackMsg['cfield'] = lang_get('cf_value_not_imported_missing_cf_on_testproject');
        $feedbackMsg['tcase'] = lang_get('testcase');
        $feedbackMsg['req'] = lang_get('req_not_in_req_spec_on_tcimport');
        $feedbackMsg['req_spec'] = lang_get('req_spec_ko_on_tcimport');
        // because name can be changed automatically during item creation
        // to avoid name conflict adding a suffix automatically generated,
        // is better to use a max size < max allowed size
        $safeSizeCfg = new stdClass();
        $safeSizeCfg->testcase_name = $fieldSizeCfg->testcase_name * 0.8;
        // Get CF with scope design time and allowed for test cases linked to this test project
        $linkedCustomFields = $tcase_mgr->cfield_mgr->get_linked_cfields_at_design($tproject_id, 1, null, 'testcase', null, 'name');
        $tprojectHas['customFields'] = !is_null($linkedCustomFields);
        $reqSpecSet = $tproject_mgr->getReqSpec($tproject_id, null, array('RSPEC.id', 'NH.name AS title', 'RSPEC.doc_id as rspec_doc_id', 'REQ.req_doc_id'), 'req_doc_id');
        $tprojectHas['reqSpec'] = !is_null($reqSpecSet) && count($reqSpecSet) > 0;
        $getVersionOpt = array('output' => 'minimun');
        $tcasePrefix = $tproject_mgr->getTestCasePrefix($tproject_id);
    }
    $resultMap = array();
    $tc_qty = sizeof($tcData);
    $userIDCache = array();
    for ($idx = 0; $idx < $tc_qty; $idx++) {
        $tc = $tcData[$idx];
        $name = $tc['name'];
        $summary = $tc['summary'];
        $steps = $tc['steps'];
        // I've changed value to use when order has not been provided
        // from testcase:DEFAULT_ORDER to a counter, because with original solution
        // an issue arise with 'save execution and go next'
        // if use has not provided order I think is OK TestLink make any choice.
        $node_order = isset($tc['node_order']) ? intval($tc['node_order']) : $idx + 1;
        $internalid = $tc['internalid'];
        $preconditions = $tc['preconditions'];
        $exec_type = isset($tc['execution_type']) ? $tc['execution_type'] : TESTCASE_EXECUTION_TYPE_MANUAL;
        $importance = isset($tc['importance']) ? $tc['importance'] : MEDIUM;
        $externalid = $tc['externalid'];
        if (intval($externalid) <= 0) {
            $externalid = null;
        }
        $personID = $userID;
        if (!is_null($tc['author_login'])) {
            if (isset($userIDCache[$tc['author_login']])) {
                $personID = $userIDCache[$tc['author_login']];
            } else {
                $userObj->login = $tc['author_login'];
                if ($userObj->readFromDB($db, tlUser::USER_O_SEARCH_BYLOGIN) == tl::OK) {
                    $personID = $userObj->dbID;
                }
                // I will put always a valid userID on this cache,
                // this way if author_login does not exit, and is used multiple times
                // i will do check for existence JUST ONCE.
                $userIDCache[$tc['author_login']] = $personID;
            }
        }
        $name_len = tlStringLen($name);
        if ($name_len > $fieldSizeCfg->testcase_name) {
            // Will put original name inside summary
            $xx = $messages['start_feedback'];
            $xx .= sprintf($messages['testcase_name_too_long'], $name_len, $fieldSizeCfg->testcase_name) . "\n";
            $xx .= $messages['original_name'] . "\n" . $name . "\n" . $messages['end_warning'] . "\n";
            $summary = nl2br($xx) . $summary;
            $name = tlSubStr($name, 0, $safeSizeCfg->testcase_name);
        }
        $kwIDs = null;
        if (isset($tc['keywords']) && $tc['keywords']) {
            $kwIDs = implode(",", buildKeywordList($kwMap, $tc['keywords']));
        }
        $doCreate = true;
        if ($duplicatedLogic['actionOnHit'] == 'update_last_version') {
            switch ($duplicatedLogic['hitCriteria']) {
                case 'name':
                    $info = $tcase_mgr->getDuplicatesByName($name, $container_id);
                    break;
                case 'internalID':
                    $dummy = $tcase_mgr->tree_manager->get_node_hierarchy_info($internalid, $container_id);
                    if (!is_null($dummy)) {
                        $info = null;
                        $info[$internalid] = $dummy;
                    }
                    break;
                case 'externalID':
                    $info = $tcase_mgr->get_by_external($externalid, $container_id);
                    break;
            }
            if (!is_null($info)) {
                $tcase_qty = count($info);
                switch ($tcase_qty) {
                    case 1:
                        $doCreate = false;
                        $tcase_id = key($info);
                        $last_version = $tcase_mgr->get_last_version_info($tcase_id, $getVersionOpt);
                        $tcversion_id = $last_version['id'];
                        $ret = $tcase_mgr->update($tcase_id, $tcversion_id, $name, $summary, $preconditions, $steps, $personID, $kwIDs, $node_order, $exec_type, $importance);
                        $ret['id'] = $tcase_id;
                        $ret['tcversion_id'] = $tcversion_id;
                        $resultMap[] = array($name, $messages['already_exists_updated']);
                        break;
                    case 0:
                        $doCreate = true;
                        break;
                    default:
                        $doCreate = false;
                        break;
                }
            }
        }
        if ($doCreate) {
            // Want to block creation of with existent EXTERNAL ID, if containers ARE DIFFERENT.
            $item_id = intval($tcase_mgr->getInternalID($externalid, array('tproject_id' => $tproject_id)));
            if ($item_id > 0) {
                // who is his parent ?
                $owner = $tcase_mgr->getTestSuite($item_id);
                if ($owner != $container_id) {
                    // Get full path of existent Test Cases
                    $stain = $tcase_mgr->tree_manager->get_path($item_id, null, 'name');
                    $n = count($stain);
                    $stain[$n - 1] = $tcasePrefix . config_get('testcase_cfg')->glue_character . $externalid . ':' . $stain[$n - 1];
                    $stain = implode('/', $stain);
                    $resultMap[] = array($name, $messages['hit_with_same_external_ID'] . $stain);
                    $doCreate = false;
                }
            }
        }
        if ($doCreate) {
            $createOptions = array('check_duplicate_name' => testcase::CHECK_DUPLICATE_NAME, 'action_on_duplicate_name' => $duplicatedLogic['actionOnHit'], 'external_id' => $externalid);
            if ($ret = $tcase_mgr->create($container_id, $name, $summary, $preconditions, $steps, $personID, $kwIDs, $node_order, testcase::AUTOMATIC_ID, $exec_type, $importance, $createOptions)) {
                $resultMap[] = array($name, $ret['msg']);
            }
        }
    }
    return $resultMap;
}
Example #8
0
 $path_info = null;
 $get_path_info = false;
 $item_mgr = new testcase($db);
 $viewerArgs['refresh_tree'] = 'no';
 $gui->platforms = null;
 $gui->tableColspan = 5;
 $gui->loadOnCancelURL = '';
 $gui->attachments = null;
 $gui->direct_link = null;
 $gui->steps_results_layout = config_get('spec_cfg')->steps_results_layout;
 // has been called from a test case search
 if (!is_null($args->targetTestCase) && strcmp($args->targetTestCase, $args->tcasePrefix) != 0) {
     $viewerArgs['show_title'] = 'no';
     $viewerArgs['display_testproject'] = 1;
     $viewerArgs['display_parent_testsuite'] = 1;
     $args->id = $item_mgr->getInternalID($args->targetTestCase);
     if (!($get_path_info = $args->id > 0)) {
         $gui->warning_msg = $args->id == 0 ? lang_get('testcase_does_not_exists') : lang_get('prefix_does_not_exists');
     }
 }
 if ($args->id > 0) {
     if ($get_path_info || $args->show_path) {
         $path_info = $item_mgr->tree_manager->get_full_path_verbose($args->id);
     }
     $platform_mgr = new tlPlatform($db, $args->tproject_id);
     $gui->platforms = $platform_mgr->getAllAsMap();
     $gui->attachments[$args->id] = getAttachmentInfosFrom($item_mgr, $args->id);
     $gui->direct_link = $item_mgr->buildDirectWebLink($_SESSION['basehref'], $args->id);
 }
 $gui->id = $args->id;
 $item_mgr->show($smarty, $gui, $templateCfg->template_dir, $args->id, $args->tcversion_id, $viewerArgs, $path_info, $args->show_mode);
Example #9
0
/**
 * 
 *
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $iParams = array("edit" => array(tlInputParameter::STRING_N, 0, 50), "id" => array(tlInputParameter::INT_N), "show_path" => array(tlInputParameter::INT_N), "show_mode" => array(tlInputParameter::STRING_N, 0, 50), "tcase_id" => array(tlInputParameter::INT_N), "tcversion_id" => array(tlInputParameter::INT_N), "tproject_id" => array(tlInputParameter::INT_N), "targetTestCase" => array(tlInputParameter::STRING_N, 0, 24), "tcasePrefix" => array(tlInputParameter::STRING_N, 0, 16), "tcaseExternalID" => array(tlInputParameter::STRING_N, 0, 16), "tcaseVersionNumber" => array(tlInputParameter::INT_N));
    $args = new stdClass();
    R_PARAMS($iParams, $args);
    // For more information about the data accessed in session here, see the comment
    // in the file header of lib/functions/tlTestCaseFilterControl.class.php.
    $form_token = isset($_REQUEST['form_token']) ? $_REQUEST['form_token'] : 0;
    $mode = 'edit_mode';
    $cfg = config_get('testcase_cfg');
    $session_data = isset($_SESSION[$mode]) && isset($_SESSION[$mode][$form_token]) ? $_SESSION[$mode][$form_token] : null;
    $args->refreshTree = isset($session_data['setting_refresh_tree_on_action']) ? $session_data['setting_refresh_tree_on_action'] : 0;
    $args->user_id = isset($_SESSION['userID']) ? $_SESSION['userID'] : 0;
    $args->feature = $args->edit;
    $args->opt_requirements = null;
    $args->automationEnabled = 0;
    $args->requirementsEnabled = 0;
    $args->testPriorityEnabled = 0;
    $args->tcasePrefix = trim($args->tcasePrefix);
    $tprojectMgr = new testproject($dbHandler);
    if ($args->tproject_id <= 0 && strlen($args->tcaseExternalID) > 0) {
        // parse to get JUST prefix
        $gluePos = strrpos($args->tcaseExternalID, $cfg->glue_character);
        // Find the last glue char
        $status_ok = $gluePos !== false;
        if ($status_ok) {
            $tcasePrefix = substr($args->tcaseExternalID, 0, $gluePos);
        }
        $dummy = $tprojectMgr->get_by_prefix($tcasePrefix);
        $tcaseMgr = new testcase($dbHandler);
        $args->tcase_id = $tcaseMgr->getInternalID($args->tcaseExternalID);
        $tcinfo = $tcaseMgr->get_basic_info($args->tcase_id, array('number' => $args->tcaseVersionNumber));
        if (!is_null($tcinfo)) {
            $args->tcversion_id = $tcinfo[0]['tcversion_id'];
        }
        unset($tcaseMgr);
    } else {
        $dummy = $tprojectMgr->get_by_id($args->tproject_id);
    }
    if (!is_null($dummy)) {
        $args->tproject_id = $dummy['id'];
    }
    $args->opt_requirements = $dummy['opt']->requirementsEnabled;
    $args->requirementsEnabled = $dummy['opt']->requirementsEnabled;
    $args->automationEnabled = $dummy['opt']->automationEnabled;
    $args->testPriorityEnabled = $dummy['opt']->testPriorityEnabled;
    if (!$args->tcversion_id) {
        $args->tcversion_id = testcase::ALL_VERSIONS;
    }
    // used to manage goback
    if (intval($args->tcase_id) > 0) {
        $args->feature = 'testcase';
        $args->id = intval($args->tcase_id);
    }
    $args->id = is_null($args->id) ? 0 : $args->id;
    switch ($args->feature) {
        case 'testsuite':
            $_SESSION['setting_refresh_tree_on_action'] = $args->refreshTree ? 1 : 0;
            break;
        case 'testproject':
            $args->id = $args->tproject_id;
            break;
    }
    if (strpos($args->targetTestCase, $cfg->glue_character) === false) {
        $args->targetTestCase = $args->tcasePrefix . $args->targetTestCase;
    }
    return $args;
}
 /**
  *
  */
 function addTestCase(&$argsObj, $request)
 {
     $obj = $this->initGuiBean();
     $node = $this->reqMgr->tree_mgr->get_node_hierarchy_info($argsObj->req_version_id);
     $dummy = $this->reqMgr->get_by_id($node['parent_id'], $argsObj->req_version_id);
     $req_version = $dummy[0];
     $obj->req = $req_version;
     $obj->req_spec_id = $argsObj->req_spec_id;
     $obj->req_version_id = $argsObj->req_version_id;
     $obj->template = "reqView.php?refreshTree=0&requirement_id={$argsObj->req_id}";
     // Analise test case identity
     $cfg = config_get('testcase_cfg');
     $status_ok = false;
     $msg = sprintf(lang_get('provide_full_external_tcase_id'), $argsObj->tcasePrefix, $cfg->glue_character);
     $gluePos = strrpos($argsObj->tcaseIdentity, $cfg->glue_character);
     $isFullExternal = $gluePos !== false;
     if ($isFullExternal) {
         //echo __LINE__ . ' :: status ok:' . $status_ok . '<br>';
         $status_ok = true;
         $rawTestCasePrefix = substr($argsObj->tcaseIdentity, 0, $gluePos);
         $status_ok = strcmp($rawTestCasePrefix, $argsObj->tcasePrefix) == 0;
         //echo __LINE__ . ' :: status ok:' . $status_ok . '<br>';
         if (!$status_ok) {
             $msg = sprintf(lang_get('seems_to_belong_to_other_tproject'), $rawTestCasePrefix, $argsObj->tcasePrefix);
         }
     }
     if ($status_ok) {
         // IMPORANT NOTICE: audit info is managed on reqMgr method
         $alienMgr = new testcase($this->db);
         $tcase_id = $alienMgr->getInternalID($argsObj->tcaseIdentity, array('tproject_id' => $argsObj->tproject_id));
         if ($tcase_id > 0) {
             $this->reqMgr->assign_to_tcase($argsObj->req_id, $tcase_id, intval($argsObj->user_id));
         } else {
             $status_ok = false;
             $msg = sprintf(lang_get('tcase_doesnot_exist'), $argsObj->tcaseIdentity);
         }
     }
     if (!$status_ok) {
         $obj->user_feedback = $msg;
         $obj->template .= "&user_feedback=" . urlencode($obj->user_feedback);
     }
     return $obj;
 }