humorfish 访问次数 : 22 注册日期 : 07-01-28 15:50 上次访问 : 09-12-11 08:47 |
由于我管理一个团队,主要负责客户现场的服务,由于客户需求非常多,公司研发、客户和我们现场沟通频繁,需要一个软件平台进行对各种工作的管理,听说了BUGFREE,由于以前从未接触过PHP、MYSQL,前段时间花了一个月左右对BUGFREE进行了改造,改造成"本地现场服务管理系统",针对工程、研发、客户三方都可以使用的系统;;使用起来还不错;下面我写一下改造过程遇到和解决的一些经验: 1)写了导出到EXCEL的函数: /** * Get bug to Excel info * * @author Chunsheng Wang * @global obj the object of ADO class created in SetupBug.inc.php file. * @param string $Fields Mini|Medium|All|FieldsList like BugID,ProjectID... * @param string $Where condition string. * @return array $ExcelInfo Excel Info list. */ function bugGetExcelInfo($Fields, $Where) { global $MyDB; global $BugConfig ; $Fields = explode(",", $Fields); /* Merge the $Fields to $FieldsList. */ foreach($Fields as $FieldName) { $ExcelInfo .= iconv("UTF-8","gb2312", $BugConfig["BugFields"][$FieldName]) . "t"; $FieldsList[$FieldName] = $FieldName; } $ExcelInfo .= "n"; /* Create the query sql. */ $FieldsList = join(",", $FieldsList); $SQL = " SELECT $FieldsList FROM BugInfo " . $Where; if(eregi("ASC",$SQL)) { $SQL = eregi_replace("ASC","DESC" ,$SQL); } else if(eregi("DESC",$SQL)) { $SQL = eregi_replace("DESC","ASC",$SQL); } /* Merge the $_SESSION["BugUserAclSQL"] and param $Where. */ //$SQL .= dbMergeSQL($Where, $_SESSION["BugUserAclSQL"]); // Execute the SQL. $ResultID = $MyDB->query($SQL); if($ResultID) { // Get all user list. $BugUserList = bugGetUserList(); while($BugInfo = $ResultID->fetchRow()) { foreach($BugInfo as $Key => $Value) { if(eregi("To|By|BugType",$Key)) { $ToByList = explode(",",$Value); foreach($ToByList AS $ToBy) { $ExcelInfo .= iconv("UTF-8","gb2312",!empty($BugUserList[$ToBy]) ? $BugUserList[$ToBy] : $ToBy) . " "; } } elseif(eregi("Severity",$Key)) { $ExcelInfo .= iconv("UTF-8","gb2312",$BugConfig["Severitys"][$Value] ); } elseif(eregi("Severity",$Key)) { $ExcelInfo .= iconv("UTF-8","gb2312",$BugConfig["Severitys"][$Value]); } elseif(eregi("BugOS",$Key)) { $ExcelInfo .= iconv("UTF-8","gb2312",$BugConfig["BugOS"][$Value]); } elseif(eregi("Status",$Key)) { $ExcelInfo .= iconv("UTF-8","gb2312",$BugConfig["Status"][$Value]); } else { $ExcelInfo .= iconv("UTF-8","gb2312", $Value); } $ExcelInfo .= "t"; } $ExcelInfo .= "n"; } return $ExcelInfo; } else { die($MyDB->errorMsg()); } } 2)发送邮件中带文件附件 现在bugAddFile函数中,增加 服务器上文件名+倒入的文件名 的数组 $FileNames[] = $FullTodayPath . "/" . $PartFileName . ";" . $FileTitle; $ResultInfo["FNameList"] = @join(",",$FileNames); 然后在sysMail函数改造: // Add Attachment if(!empty($Attachment)) { $AttList = explode(",",$Attachment); foreach($AttList as $Atts) { $Att = explode(";",$Atts); $Mail->AddAttachment($Att[0],$Att[1]) ; } } 3)无须利用MAILSERVER,也可以利用代理机发送邮件 其实不用在上网代理机上安装什么邮件服务器,也可以发送软件 /* 8. Mail setting. */ $BugConfig["Mail"]["On"] = true; $BugConfig["Mail"]["FromAddress"] = "mymailname@xxxxxx.com"; $BugConfig["Mail"]["FromName"] = "xxxxxxxxxxxxxxx"; $BugConfig["Mail"]["ReportTo"] = array(); // Where bug statistics message sened to. If empty, to all users. $BugConfig["Mail"]["SendMethod"] = "SMTP"; // MAIL|SENDMAIL|SMTP|QMAIL /* 9. SMTP param setting. */ $BugConfig["Mail"]["SendParam"]["Host"] = "代理服务器的IP地址"; // The server to connect. Default is localhost $BugConfig["Mail"]["SendParam"]["SMTPAuth"] = ture; // Whether or not to use SMTP authentication. Default is FALSE $BugConfig["Mail"]["SendParam"]["Username"] = "mymailname#smtpserveraddress"; // The username to use for SMTP authentication. 比如:humorfish#smtp.263.com $BugConfig["Mail"]["SendParam"]["Password"] = "mymailpassword"; 4)得到文件类型的BUG 比如碰到如此文件:我的一些BUGFREE经验.v3.0.doc 原BUGFREE处理就会有问题,应该把下面一段老代码改掉: // Get file type. $FileType = explode(".",$BugFileList["name"][$I]); $FileType = strtolower($FileType[1]); 改成: // Get file type. $FileType = explode(".",$BugFileList["name"][$I]); foreach($FileType as $FileTypeItem) { $FileType = strtolower($FileTypeItem); } 我今天想起了四点经验,就写到这;BUGFREE很不错,主要是开源的,不涉及软件版本问题; 大家可以通过humorfish@yahoo.com与我沟通。 下回有空在写写经验 |
回帖 |
wwccss 访问次数 : 593 注册日期 : 05-05-01 10:08 上次访问 : 10-07-19 11:44 |
不错,支持一下。期待楼主更精彩的帖子。 |
回帖 |