From faa530d2ef5ab6021d1d744d0f06001673ec2f49 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 10 May 2006 01:05:16 +0000 Subject: [PATCH] r810: More logging stuff --- editreport.php | 25 +++++++++++++++++++++++++ includes/class_logging.php | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/editreport.php b/editreport.php index f9ab84d..2c1726a 100644 --- a/editreport.php +++ b/editreport.php @@ -58,6 +58,26 @@ require_once('./includes/class_history.php'); $log = new History(); $log->bugid = $bug['bugid']; +// setup new logging +require_once('./includes/class_logging.php'); +$log2 = new Logging; +$log2->set_bugid($bug['bugid']); + +$bugfields = array( + 'duplicateof', + 'dependency', + 'hidden', + 'summary', + 'status', + 'severity', + 'priority', + 'versionid' => 'version', + 'assignedto' => 'assignto', + 'resolution', + 'productid' => 'product', + 'componentid' => 'component' +); + // ################################################################### if ($_POST['do'] == 'update') @@ -68,6 +88,8 @@ if ($_POST['do'] == 'update') $bugapi->dorelations = array(); $bugapi->fetch(); + $log2->add_data(true, $bugapi->objdata, $bugfields); + // ------------------------------------------------------------------- // handle autoaction $autoaction = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "autoaction WHERE actionid = " . $bugsys->input_clean('autoaction', TYPE_UINT)); @@ -155,6 +177,9 @@ if ($_POST['do'] == 'update') $bugapi->set('assignedto', $bugsys->in['assignedto']); } + $log2->add_data(false, $bugapi->values, $bugfields); + print_r($log2); exit; + $bugapi->update(); // ------------------------------------------------------------------- diff --git a/includes/class_logging.php b/includes/class_logging.php index 29137d8..66e3949 100644 --- a/includes/class_logging.php +++ b/includes/class_logging.php @@ -96,6 +96,32 @@ class Logging $this->{$array}["$element"]["$prefix$fdisplay"] = $data["$fname"]; } } + + // ################################################################### + /** + * Adds strings to the IDs so that it's human-readable and that's + * stored in the database so that if whatever value is deleted, + * the text still exists in the end. This takes the element and a list + * of fields to prossess in order to work. + * + * @access public + * + * @param string Element name + * @param array List of fields to use + */ + function process_fields($element, $fields) + { + foreach (array('original', 'modified') AS $array) + { + foreach ($this->{$array}["$element"] AS $display => $fname) + { + if (in_array($fname, $fields)) + { + + } + } + } + } } /*=====================================================================*\ -- 2.22.5