<?php
# ---------------------------------------------------------------------
# truc is a tool for requirement and use case tracking
# Copyright (C) 2006 ASDIS - http://sf.net/projects/truc
#
# (rth) Initial truc version based on rth
# Copyright (C) 2005 George Holbrook - hide@address.com
#
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
include"./api/include_api.php";
auth_authenticate_user();
$s_test_details = session_set_properties("test", $_GET);
$test_id = $s_test_details['test_id'];
$test_version_id = $s_test_details['test_version_id'];
$redirect_page = "test_detail_page.php?test_id=$test_id";
$current_test_name = test_get_name($test_id);
$user_properties = session_get_user_properties();
$user_id = $user_properties['user_id'];
$username = $user_properties['username'];
if (usecase_locked(-1,$test_id,$username)) {
html_print_operation_failed( 'usecase_edit_page',error_report_msg(CAN_NOT_MODIFY_USECASE_LOCKED,usecase_locked_by(-1,$test_id)), "test_detail_page.php?test_id=".$test_id);
exit;
}
session_validate_form_set($_POST, "test_detail_update_page.php");
$testname = session_validate_form_get_field('testname_required');
$testpurpose = session_validate_form_get_field('testpurpose');
$testpre = session_validate_form_get_field('testpre');
$testpost = session_validate_form_get_field('testpost');
$testcomments = session_validate_form_get_field('testcomments');
$testpriority = session_validate_form_get_field('testpriority');
$teststatus = session_validate_form_get_field('teststatus');
$testareatested = session_validate_form_get_field('testareatested');
$testtype = session_validate_form_get_field('testtype');
$ba_owner = session_validate_form_get_field('ba_owner');
$qa_owner = session_validate_form_get_field('qa_owner');
$tester = session_validate_form_get_field('tester');
$assigned_to = session_validate_form_get_field('assigned_to');
$assigned_by = session_validate_form_get_field('assigned_by');
$dateassigned = session_validate_form_get_field('dateassigned');
$dateexpcomplete = session_validate_form_get_field('dateexpcomplete');
$dateactcomplete = session_validate_form_get_field('dateactcomplete');
//$datebasignoff = session_validate_form_get_field('datebasignoff');
//$signoff_by = session_validate_form_get_field('signoff_by');
$autopass = session_validate_form_get_field('chk_autopass');
$steps = session_validate_form_get_field('chk_steps');
$auto = session_validate_form_get_field('chk_auto');
$performance = session_validate_form_get_field('chk_performance');
$email = session_validate_form_get_field('email');
$duration = session_validate_form_get_field('test_duration');
if (!util_date_isvalid($dateassigned) ||
!util_date_isvalid($dateexpcomplete) ||
!util_date_isvalid($dateactcomplete)) {
error_report_show("test_detail_update_page.php", INVALID_DATE );
}
if (session_validate_form_get_field('save')=='Update') test_update_test($test_id, $test_version_id, $testname, $testpurpose, $testcomments, $testpriority, $teststatus,
$testareatested, $testtype, $ba_owner, $qa_owner, $tester, $assigned_to, $assigned_by,
$dateassigned, $dateexpcomplete, $dateactcomplete, $duration, $autopass, $steps, $auto, $performance,$testpre,$testpost );
if (session_validate_form_get_field('save')=='Upgrade') test_upgrade_test($test_id, $test_version_id, $testname, $testpurpose, $testcomments, $testpriority, $teststatus,
$testareatested, $testtype, $ba_owner, $qa_owner, $tester, $assigned_to, $assigned_by,
$dateassigned, $dateexpcomplete, $dateactcomplete, $duration, $autopass, $steps, $auto, $performance,$testpre,$testpost );
/*
if ($teststatus == 'Not Running' AND $assigned_to != '' AND $email=='YES') {
$current_user_row = user_get_current_user_name();
$assigned_to_row = user_get_name_by_username($assigned_to);
$f_email = USER_EMAIL;
$f_firstname = USER_FNAME;
$f_lastname = USER_LNAME;
$current_user_email = $current_user_row[$f_email];
$current_user_firstname = $current_user_row[$f_firstname];
$current_user_lastname = $current_user_row[$f_lastname];
$assigned_user_email = $assigned_to_row[$f_email];
$assigned_user_firstname = $assigned_to_row[$f_firstname];
$assigned_user_lastname = $assigned_to_row[$f_lastname];
$send_to = $current_user_email;
if ($current_user_email != $assigned_user_email[$f_email]) {
$send_to .= ', ' . $assigned_user_email;
}
#Build up the message and format to be sent
$subject = $testname." is currently Not Running. ";
$message = "$assigned_user_firstname $assigned_user_lastname, you have been assigned to fix ".
$testname.". $current_user_firstname $current_user_lastname has stated \"$testcomments\".
When you have resolved this issue, please inform $current_user_firstname. Thank you.";
$headers = "From: hide@address.com\r\n"."To: ".$assigned_user_email."\r\n"."Reply-To: ".$current_user_email."\r\n";
mail($send_to, $subject, $message, $headers);
}
*/
# validation succeeded
#html_redirect($redirect_page);
session_validate_form_reset();
html_print_operation_successful( "update_test_page", $redirect_page );
?>