我想知道你是否对这个问题有任何想法:我们想在两个状态之间的特定“地方”再添加一个状态,但我们的枚举用完了。
枚举如下所示:
$s_status_enum_string = "10:new,20:feedback,40:confirmed,50:assigned,52:in progress,53:code review pending,54:merge pending, 56:merged, 58:resolved, 60:testing, 70:tested, 90:closed, 91:updating test documentation";
我想在52和53之间添加一个新状态,以便在状态的下拉菜单中按所需顺序显示。
我尝试了不同的东西 - 包括更改.php文件定义,然后在mantis_bug_table中更新MySQL表的状态字段,但它会混淆所有视图和过滤器。
有什么想法吗?
答案 0 :(得分:2)
以下步骤可能会对您有所帮助:
答案 1 :(得分:0)
如果有人遇到此问题,您需要更改以下内容:
在config_inc.php中修改$ g_status_enum_string以根据需要枚举新状态。
在custom_constants_inc.php中,请确保执行与上述相同的操作。
在数据库中,运行SQL命令,例如:
UPDATE mantisclone.mantis_bug_table SET status=100 WHERE status=10;
将现有状态ID的实际记录更改为新记录。
在custom_strings_inc.php中修改$ s_status_enum_string并输入新的状态。例如我的一个是:
$s_sanity_test_bug_title = "Set Issue Sanity Test";
$s_sanity_test_bug_button = "Issue Sanity Test Pending";
$s_email_notification_title_for_sanity_test = "The following issue is NOW SANITY TEST PENDING";
最后,您需要一个小脚本来更改mantis_filters_table中现有的枚举值。这是我的,在你认为合适时改变它:
<?php
$mantisDB="myMantisDatabaseName";
mysql_connect("localhost", "XXXX", "YYYY") or die("Could not connect: " . mysql_error());
mysql_select_db($mantisDB);
$result = mysql_query("SELECT id, filter_string FROM $mantisDB.mantis_filters_table");
function parseRecord($statusArray)
{
$newStatus = array( "10" => "100",
"20" => "200",
"50" => "300",
"52" => "400",
"53" => "500",
"54" => "540",
"56" => "560",
"58" => "580",
"60" => "600",
"70" => "700",
"75" => "450",
"90" => "900",
"91" => "910"
);
foreach ($statusArray as $key=>$value)
{
if(array_key_exists($value, $newStatus))
{
echo "Found value $value, replacing it with " . $newStatus[$value] . "\n";
$statusArray[$key] = (int)$newStatus[$value];
}
}
}
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$statusID = $row["id"];
$serializedString = $row["filter_string"];
$unserializedArray = unserialize(substr($serializedString,3)); // There's a prepended 'v8#' string in there, don't know why.
parseRecord(&$unserializedArray["hide_status"]);
parseRecord(&$unserializedArray["show_status"]);
$newSerialized = "v8#".serialize($unserializedArray);
// echo $newSerialized;
$changeStatus = mysql_query("UPDATE $mantisDB.mantis_filters_table SET filter_string='$newSerialized' WHERE id=$statusID");
}
mysql_free_result($result);
?>
我希望这有效,请告诉我您是否遇到任何问题。