function results_email($project_id, $release_id, $build_id, $testset_id, $test_id, $recipients, $action)
{
    $display_generic_info = true;
    $display_generic_url = true;
    $generic_url = RTH_URL . "login.php?project_id={$project_id}&page=results_test_run_page.php&release_id={$release_id}&build_id={$build_id}&testset_id={$testset_id}&test_id={$test_id}";
    $username = session_get_username();
    $project_name = session_get_project_name();
    $release_name = admin_get_release_name($release_id);
    $build_name = admin_get_build_name($build_id);
    $testset_name = admin_get_testset_name($testset_id);
    $user_details = user_get_name_by_username($username);
    $first_name = $user_details[USER_FNAME];
    $last_name = $user_details[USER_LNAME];
    $row_test_detail = testset_query_test_details($testset_id, $test_id);
    $test_name = $row_test_detail[TEST_NAME];
    $status = $row_test_detail[TEST_TS_ASSOC_STATUS];
    $finished = $row_test_detail[TEST_TS_ASSOC_FINISHED];
    $assigned_to = $row_test_detail[TEST_TS_ASSOC_ASSIGNED_TO];
    $comments = $row_test_detail[TEST_TS_ASSOC_COMMENTS];
    $root_cause = $row_test_detail[TEST_RESULTS_ROOT_CAUSE];
    # CREATE EMAIL SUBJECT AND MESSAGE
    switch ($action) {
        case "test_run":
            $subject = "RTH: Test Run Notification - {$test_name}";
            $message = "Test {$test_name} has been run by {$first_name} {$last_name}\n" . NEWLINE;
            break;
        case "update_test_result":
            $subject = "RTH: Test Result has been Updated";
            $message = "The test result for {$test_name} has been updated by {$first_name} {$last_name}\n" . NEWLINE;
            break;
    }
    # Generic link to results page if the $generic_url variable has been set
    if ($display_generic_url) {
        $message .= "Click the following link to view the Test Results:" . NEWLINE;
        $message .= "{$generic_url}\n" . NEWLINE;
    }
    if ($display_generic_info) {
        $message .= "Project Name: {$project_name}\r" . NEWLINE;
        $message .= "Release Name: {$release_name}\r" . NEWLINE;
        $message .= "Build Name: {$build_name}\r" . NEWLINE;
        $message .= "TestSet Name: {$testset_name}\r\n\r" . NEWLINE;
        $message .= "Test Name: {$test_name}\r" . NEWLINE;
        $message .= "Status: {$status}\r" . NEWLINE;
        if (!empty($root_cause)) {
            $message .= "Root Cause: {$root_cause}\r" . NEWLINE;
        }
        $message .= "Comments: {$comments}\r\n\r" . NEWLINE;
    }
    email_send($recipients, $subject, $message);
}
Пример #2
0
function html_release_map($map)
{
    $release_properties = session_get_properties("release");
    $html_top_row = "<tr>" . NEWLINE;
    $html_bottom_row = "<tr>" . NEWLINE;
    foreach ($map as $key) {
        switch ($key) {
            case "release_link":
                $release_name = admin_get_release_name($release_properties['release_id']);
                $html_top_row .= "<td class='sub_menu' nowrap>";
                $html_top_row .= "<b><a href=release_page.php>" . lang_get('release_name') . "</a></b>";
                $html_top_row .= "</td>" . NEWLINE;
                $html_bottom_row .= "<td class='sub_menu' nowrap>";
                $html_bottom_row .= "{$release_name}";
                $html_bottom_row .= "</td>" . NEWLINE;
                break;
            case "build_link":
                $build_name = admin_get_build_name($release_properties['build_id']);
                $html_top_row .= "<td class='sub_menu' nowrap>";
                $html_top_row .= "<b><a href=build_page.php>" . lang_get('build_name') . "</a></b>";
                $html_top_row .= "</td>" . NEWLINE;
                $html_bottom_row .= "<td class='sub_menu' nowrap>";
                $html_bottom_row .= "{$build_name}";
                $html_bottom_row .= "</td>" . NEWLINE;
                break;
            case "testset_link":
                $testset_name = admin_get_testset_name($release_properties['testset_id']);
                $html_top_row .= "<td class='sub_menu' nowrap>";
                $html_top_row .= "<b><a href=testset_page.php>" . lang_get('testset_name') . "</a></b>";
                $html_top_row .= "</td>" . NEWLINE;
                $html_bottom_row .= "<td class='sub_menu' nowrap>";
                $html_bottom_row .= "{$testset_name}";
                $html_bottom_row .= "</td>" . NEWLINE;
                break;
            case "copy_testset_link":
                $testset_name = admin_get_testset_name($release_properties['testset_id']);
                $html_top_row .= "<td class='sub_menu' rowspan=2 nowrap>";
                $html_top_row .= "<b><a href=testset_page.php>" . lang_get('copy_testset_to') . "</a></b>";
                $html_top_row .= "</td>" . NEWLINE;
                $html_bottom_row .= "<td></td>" . NEWLINE;
                break;
            default:
                $html_top_row .= "<td class='sub_menu' nowrap><b>{$key}</b></td>" . NEWLINE;
                $html_bottom_row .= "<td></td>" . NEWLINE;
        }
        $html_top_row .= "<td class='sub_menu' rowspan=2 nowrap>&nbsp;</td>" . NEWLINE;
    }
    $html_top_row .= "</tr>" . NEWLINE;
    $html_bottom_row .= "</tr>" . NEWLINE;
    print "<table width=1 cellspacing=2>" . NEWLINE;
    print $html_top_row;
    print $html_bottom_row;
    print "</table>" . NEWLINE;
}
# where available for the user to check/uncheck.
$records = "";
$select_group = "";
html_window_title();
html_print_body();
html_page_title($project_name . " - " . lang_get("testset_copy_page"));
html_page_header($db, $project_name);
html_print_menu();
html_testset_menu($db, $page, $project_id, $s_copy_properties);
if (isset($_GET['testset_menu_testset_id']) && $_GET['testset_menu_testset_id'] != 'all') {
    $release_id = $_GET['testset_menu_release_id'];
    $build_id = $_GET['testset_menu_build_id'];
    $testset_id = $_GET['testset_menu_testset_id'];
    $release_name = admin_get_release_name($release_id);
    $build_name = admin_get_build_name($build_id);
    $testset_name = admin_get_testset_name($testset_id);
    print "<form method='post' action='{$page}?" . $_SERVER['QUERY_STRING'] . "' name=results>" . NEWLINE;
    print "<div align=center>" . NEWLINE;
    print "<br>" . NEWLINE;
    html_print_tests_filter($project_id, $filter_manual_auto, $filter_test_type, $filter_ba_owner, $filter_qa_owner, $filter_tester, $filter_area_tested, $filter_test_status = null, $filter_priority, $filter_per_page, $filter_search);
    print "<br>" . NEWLINE;
    $rows = test_copy_filter_rows($project_id, $release_id, $build_id, $testset_id, $filter_manual_auto, $filter_ba_owner, $filter_qa_owner, $filter_tester, $filter_test_type, $filter_area_tested, $filter_priority, $filter_per_page, $filter_search, $order_by, $order_dir, $page_number);
    $order_by = $s_table_display_options['order_by'];
    $order_dir = $s_table_display_options['order_dir'];
    print "" . NEWLINE;
    if (!empty($rows)) {
        ################################################################################
        # Testset table
        print "<table class=width100 rules=cols>" . NEWLINE;
        # Table headers
        print "<tr class=tbl_header>" . NEWLINE;
 print "&amp;legend='Passed','Failed','Awaiting Review','WIP','Not Running','Not Started','Not Used'";
 if ($project_name == "PCA") {
     print ",'Finished: QA Review', 'Finished: Business Review', 'WinRunner Issue'";
 }
 # pie 1 title
 print "&amp;p1_title=" . lang_get("all_tests_in") . " " . $project_name;
 # pie 1 theme
 if ($project_name == "PCA") {
     print "&amp;p1_theme=pca";
 } else {
     print "&amp;p1_theme=test";
 }
 # pie 1 data
 print "&amp;p1_data={$pc_passed_in_project},{$pc_failed_in_project},{$pc_awaiting_review_in_project},{$pc_wip_in_project},{$pc_not_running_in_project},{$pc_not_started_in_project},{$pc_tests_not_run}";
 # pie 2 title
 print "&amp;p2_title=" . lang_get("tests_in_ts") . " " . admin_get_testset_name($testset_id);
 # pie 2 theme
 if ($project_name == "PCA") {
     print "&amp;p2_theme=pca";
 } else {
     print "&amp;p2_theme=test";
 }
 # pie 2 data
 print "&amp;p2_data={$testset_num_of_passed},{$testset_num_of_failed},{$testset_num_of_awaiting_review},{$testset_num_of_wip},{$testset_num_of_not_running},{$testset_num_of_not_started},{$testset_num_of_finished_qa},{$testset_num_of_finished_ba},{$testset_num_of_wr_issue}";
 # end img
 print "\">" . NEWLINE;
 $g_timer->mark_time("First Table");
 print "<br><br>" . NEWLINE;
 print "<form method=post action='{$page}?_release_id={$release_id}&amp;_build_id={$build_id}'>";
 print "<table class=width80 rules=all>" . NEWLINE;
 print "<tr>" . NEWLINE;
     $table_body .= "<td></td>" . NEWLINE;
     $table_body .= "<td></td>" . NEWLINE;
     $table_body .= "<td></td>" . NEWLINE;
     if ($count_percent_cov > 100) {
         $count_percent_cov = "100";
     }
     $count_total_percent_cov += $count_percent_cov;
     $table_body .= "<td>{$count_percent_cov}%</td>" . NEWLINE;
     $table_body .= "</tr>" . NEWLINE;
     $table_body .= "</tbody>" . NEWLINE;
 }
 # If some of the requirements have been covered, display the graph
 if ($count_total_percent_cov) {
     print "<img src=\"images/pie_chart_image.php";
     # pie chart title
     print "?graph_title=" . lang_get("status_of") . " " . admin_get_release_name($release_id) . ", " . admin_get_build_name($build_id) . ", " . admin_get_testset_name($testset_id);
     # legend
     print "&amp;legend='Passed','Failed','Awaiting Review','WIP','Not Running','Not Started','Finished QA','Finished BA','Winrunner Issue'";
     if ($project_name == "PCA") {
         print ",'Finished: QA Review', 'Finished: Business Review', 'WinRunner Issue'";
     }
     # data
     print "&amp;data={$passed_count},{$failed_count},{$awaiting_review_count},{$wip_count},{$not_running_count},{$not_started_count},{$finished_qa_count},{$finished_ba_count},{$wr_issue_count}";
     # theme
     if ($project_name == "PCA") {
         print "&amp;theme=pca";
     } else {
         print "&amp;theme=test";
     }
     print "\">" . NEWLINE;
 }
function testset_add_tests_from_session($testset_properties, $f_status, $property_set)
{
    $checked_tests = array();
    $project_id = session_get_project_id();
    $s_user_properties = session_get_user_properties();
    $s_project_properties = session_get_project_properties();
    $testset_id = $testset_properties['testset_id'];
    $testset_name = admin_get_testset_name($testset_id);
    $build_id = $testset_properties['build_id'];
    $build_name = admin_get_build_name($build_id);
    $release_id = $testset_properties['release_id'];
    $release_name = admin_get_release_name($release_id);
    global $db;
    $testsuite_tbl = TEST_TBL;
    $f_test_id = TEST_TBL . "." . TEST_ID;
    $f_project_id = TEST_TBL . "." . PROJECT_ID;
    $f_deleted = TEST_TBL . "." . TEST_DELETED;
    $f_archived = TEST_TBL . "." . TEST_ARCHIVED;
    $ts_assoc_tbl = TEST_TS_ASSOC_TBL;
    $f_ts_assoc_id = TEST_TS_ASSOC_TBL . "." . TEST_TS_ASSOC_ID;
    $f_ts_assoc_test_id = TEST_TS_ASSOC_TBL . "." . TEST_TS_ASSOC_TEST_ID;
    $q = "SELECT {$f_test_id},\n\t\t\t{$f_ts_assoc_id},\n\t\t\t{$f_status}\n\t     FROM {$ts_assoc_tbl}\n\t     RIGHT JOIN {$testsuite_tbl} ON {$f_ts_assoc_test_id} = {$f_test_id}\n\t     WHERE {$f_project_id} = {$project_id}\n\t     AND {$f_archived} = 'N'\n\t     AND {$f_deleted} = 'N'\n\t     GROUP BY {$f_test_id}";
    $rs = db_query($db, $q);
    while ($row = db_fetch_row($db, $rs)) {
        if (isset($row[$f_status])) {
            # If the checkbox is ticked, then form an association between Test/TestSet
            if (session_records_ischecked($property_set, $row[TEST_ID], $row[$f_status])) {
                $checked_tests[$row[TEST_ID]] = "on";
            }
        }
    }
    testset_edit($testset_id, $checked_tests);
}