r810: More logging stuff
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 10 May 2006 01:05:16 +0000 (01:05 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 10 May 2006 01:05:16 +0000 (01:05 +0000)
editreport.php
includes/class_logging.php

index f9ab84d626ceb08a452952d8b6abca1c5b808dd4..2c1726ab115d87bd5e0d0a009d8c784a9eb9d3de 100644 (file)
@@ -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();
        
        // -------------------------------------------------------------------
index 29137d8758d1321f4faee7d152eba40b824b21d3..66e3949a0ca1b85e3cd97ef733620fce0f3b6178 100644 (file)
@@ -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))
+                               {
+                                       
+                               }
+                       }
+               }
+       }
 }
 
 /*=====================================================================*\