From 21ef63320d96aedddc68fc46c4223ce236138bec Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 8 Jun 2005 23:30:47 +0000 Subject: [PATCH] r256: Logs now work with the new custom fields system. Took a while, but it works better than before! --- editreport.php | 3 --- includes/functions.php | 26 -------------------------- showhistory.php | 9 +++------ showreport.php | 2 -- 4 files changed, 3 insertions(+), 37 deletions(-) diff --git a/editreport.php b/editreport.php index 82e0af3..5c7808f 100644 --- a/editreport.php +++ b/editreport.php @@ -72,7 +72,6 @@ if ($_POST['do'] == 'update') $hist[0] = (array)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[bugid]"); $hist2[0] = (array)$temp = $noinitialcustom = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]"); - process_custom_field_names($hist2[0]); process_custom_fields($bug['bugid']); $dependencies = preg_split('#([^0-9].*?)#', $bugsys->in['dependency'], -1, PREG_SPLIT_NO_EMPTY); @@ -101,8 +100,6 @@ if ($_POST['do'] == 'update') $hist[1] = (array)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug[bugid]"); $hist2[1] = (array)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]"); - process_custom_field_names($hist2[1]); - $diff[0] = array_diff_assoc($hist[0], $hist[1]); $diff[1] = array_diff_assoc($hist[1], $hist[0]); diff --git a/includes/functions.php b/includes/functions.php index fd8db42..36fdd3b 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -496,32 +496,6 @@ function process_custom_fields($bugid, $inputdata = array()) $bugsys->db->query("REPLACE INTO " . TABLE_PREFIX . "bugvaluefill (bugid, " . implode(', ', $fieldbuild) . ") VALUES ($bugid, " . implode(', ', $fieldvalue) . ")"); } -// ################# Start process_custom_field_names ################ -// renames all custom fields for logging -function process_custom_field_names(&$array) -{ - global $bugsys; - static $fields; - - if (!is_array($fields)) - { - $fields = array(); - $fields_fetch = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield"); - $fields['bugid'] = 'bugid'; - while ($field = $bugsys->db->fetch_array($fields_fetch)) - { - $fields["field$field[fieldid]"] = $field['shortname']; - } - } - - foreach ($array AS $idname => $value) - { - $newarray[ $fields["$idname"] ] = $value; - } - - $array = $newarray; -} - /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/showhistory.php b/showhistory.php index 459687c..55f47c0 100644 --- a/showhistory.php +++ b/showhistory.php @@ -42,7 +42,7 @@ $customfields = $db->query(" while ($field = $db->fetch_array($customfields)) { - $fieldlist[] = 'custom_' . $field['shortname']; + $fieldlist["custom_field$field[fieldid]"] = 'custom_field' . $field['fieldid'] . " (\"$field[name]\")"; } // ################################################################### @@ -76,12 +76,9 @@ foreach ($logs AS $dateline => $logitems) { $hasvalues = ((empty($log['original']) AND (empty($log['changed']) AND $log['changed'] != 0)) ? false : true); - if (preg_match('#^custom_#', $log['field'])) + if ($newlog = $fieldlist["$log[field]"]) { - if (!in_array($log['field'], $fieldlist)) - { - $hasvalues = false; - } + $log['field'] = $newlog; } $show['changes'] = (($hasvalues) ? true : $show['changes']); diff --git a/showreport.php b/showreport.php index c388eb1..7a0f77a 100644 --- a/showreport.php +++ b/showreport.php @@ -109,11 +109,9 @@ foreach ($fieldlist AS $fieldid => $field) { $temp = unserialize($field['selects']); $value = trim($temp[0]); - echo 'using default'; } else { - echo 'no default'; continue; } } -- 2.22.5