1.1.3. 在mantis目录下面新增bug_add_testlink.php页面,进行testlink和mantis的BUG关联的处理
新增:mantisug_add_testlink.php
<?php
//2013-01-06 luly 增加BUG时,进行testlink关联
function write_execution_bug($exec_id, $bug_id,$just_delete=false)
{
$conn = mysql_connect("localhost","root","");
$execution_bugs = 'testlink.ttexecution_bugs';
// Instead of Check if record exists before inserting, do delete + insert
$sql = "DELETE FROM {$execution_bugs} " .
"WHERE execution_id={$exec_id} " .
"AND bug_id='" . $bug_id ."'";
$result = mysql_query($sql,$conn);
if(!$just_delete)
{
$sql = "INSERT INTO {$execution_bugs} " .
"(execution_id,bug_id) " .
"VALUES({$exec_id},'" . $bug_id . "')";
$result = mysql_query($sql,$conn);
}
return $result ? 1 : 0;
}
?>
1.1.4. 修改bug_report.php,如果存在exec_id,则进行testlink和mantis的BUG关联
修改mantisug_report.php
(1)在一开始增加一句:
//2013-01-06 luly 增加BUG时,进行testlink关联
require_once( 'bug_add_testlink.php' );
//***********************************************************//
(2)修改如下内容:
$t_bug_id = $t_bug_data->create();
=》
//2013-01-06 luly 增加BUG时,进行testlink关联
//$t_bug_id = $t_bug_data->create();
$testlink_exec_id = $_POST["exec_id"];
if ($testlink_exec_id!= "")
{
$t_bug_id = $t_bug_data->create();
write_execution_bug($testlink_exec_id,$t_bug_id);
}
else
{
$t_bug_id = $t_bug_data->create();
}