r201: Show custom fields on showreport.php
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 28 May 2005 19:13:29 +0000 (19:13 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 28 May 2005 19:13:29 +0000 (19:13 +0000)
showreport.php
templates/default/SHOWREPORT.tpl

index eb4e936cb441e5503e981b014551ca6aca1d4ee2..057db6bb351970dca7af9b3528a20817c3d686d3 100644 (file)
@@ -56,6 +56,50 @@ $bug['assigninfo'] = ((is_array($assigninfo)) ? construct_user_display($assignin
 
 $show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true : false);
 
+// -------------------------------------------------------------------
+// custom fields
+$customfields = '';
+
+$allfields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield");
+while ($field = $db->fetch_array($allfields))
+{
+       $fieldlist["$field[shortname]"] = $field;
+}
+
+$fieldvalues = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]");
+
+foreach ($fieldvalues AS $shortname => $value)
+{
+       if ($shortname == 'bugid')
+       {
+               continue;
+       }
+       
+       $field =& $fieldlist["$shortname"];
+       
+       $customfields .= "<div><strong>$field[name]:</strong> ";
+       
+       if ($value == '')
+       {
+               $value = $field['defaultvalue'];
+       }
+       
+       if ($field['type'] == 'input_text' OR $field['type'] == 'textarea')
+       {
+               $customfields .= $value;
+       }
+       else if ($field['type'] == 'input_checkbox')
+       {
+               $customfields .= (($value) ? 'True' : 'False');
+       }
+       else
+       {
+               $temp = unserialize($field['selects']);
+               $customfields .= $temp["$value"];
+       }
+       $customfields .= "</div>\n\n";
+}
+
 // -------------------------------------------------------------------
 // hilight
 $words = explode(' ', $bugsys->in['hilight']);
index 7cba68c88156e2f169122616cfdeaf598e93542f..3f10ff40d10dd81382eab6c62b5da903b042713d 100644 (file)
@@ -7,6 +7,8 @@
 <div><strong>Priority:</strong> $bug[priority]</div>
 <if condition="$bug['assigninfo']"><div><strong>Assigned to:</strong> $bug[assigninfo]</div></if>
 
+$customfields
+
 <div>[<a href="showhistory.php?bugid=$bug[bugid]">Show Bug History</a>]<if condition="$show['editreport']"> [<a href="editreport.php?bugid=$bug[bugid]">Edit Bug Report</a>]</if></div>
 
 <br />