$value) { if(strpos($key, 'Date')) $bug[$key] = strtotime($value); } extract($bug); $sql = "INSERT INTO zt_bug(id, product, module, title, severity, type, os,status, mailto, openedby, openedDate,openedBuild, assignedTo,assignedDate, resolvedBy, resolution, resolvedBuild, resolvedDate, closedBy, closedDate, lastEditedBy, lastEditedDate ) values($BugID, '$ProjectID', '$ModuleID', '$BugTitle', '$BugSeverity', '$BugType', '$BugOS', '$BugStatus', '$MailTo', '$OpenedBy', '$OpenedDate', '$OpenedBuild', '$AssignedTo', '$AssignedDate', '$ResolvedBy', '$Resolution', '$ResolvedBuild', '$ResolvedDate', '$ClosedBy', '$ClosedDate', '$LastEditedBy', '$LastEditedDate')"; mysql_query($sql) or die(mysql_error()); } } function convertAction() { global $myLink, $companyID; $sql = "SELECT * FROM BugHistory ORDER BY BugID, HistoryID"; $result = mysql_query($sql, $myLink); while($history = mysql_fetch_assoc($result)) { $historys[$history['BugID']][] = $history; } foreach($historys as $bugID => $bugHistorys) { foreach($bugHistorys as $key => $history) { $history['FullInfo'] = addslashes($history['FullInfo']); $history['ActionDate'] = strtotime($history['ActionDate']); if($key == 0) { $sql = "UPDATE zt_bug SET steps = \"$history[FullInfo]\" WHERE id='$bugID'"; mysql_query($sql) or die(mysql_error()); $history['FullInfo'] = ''; } extract($history); $sql = "INSERT INTO zt_action values($HistoryID, $companyID, 'bug', $BugID, '$UserName', '$Action', $ActionDate, '$FullInfo')"; mysql_query($sql) or die(mysql_error()); } } } function fixModulePath() { global $myLink, $companyID; $sql = "SELECT * FROM zt_module ORDER BY grade"; $result = mysql_query($sql, $myLink); while($module = mysql_fetch_assoc($result)) { if($module['grade'] == 1) { $sql = "UPDATE zt_module set path = ',$module[id],' WHERE id=$module[id]"; mysql_query($sql) or die(mysql_error()); } else { $sql = "SELECT path FROM zt_module WHERE id = $module[parent]"; $result2 = mysql_query($sql); $parent = mysql_fetch_assoc($result2); $sql = "UPDATE zt_module set path = '$parent[path]$module[id],' WHERE id=$module[id]"; mysql_query($sql) or die(mysql_error()); } } } function clear() { global $myLink; $sqls[] = "TRUNCATE TABLE zt_user"; $sqls[] = "TRUNCATE TABLE zt_product"; $sqls[] = "TRUNCATE TABLE zt_module"; $sqls[] = "TRUNCATE TABLE zt_bug"; $sqls[] = "TRUNCATE TABLE zt_action"; foreach($sqls as $sql) mysql_query($sql, $myLink); } ?>