View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0010328 | mantisbt | customization | public | 2009-04-14 14:36 | 2009-04-14 14:41 |
| Reporter | kec161 | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | new | Resolution | open | ||
| Summary | 0010328: Added ability to append the handler to the history of specified custom fields | ||||
| Description | I've added the ability to append the handler to the history entry for specified custom fields. Specify the custom fields in the config_inc file: We have custom testing status fields that we append the handler to. That way, if an issues fails testing and is re-assigned out we can look at the history and easily see who it was assigned to when it failed. We could search the history to see the handler change but this is easier for us. | ||||
| Tags | No tags attached. | ||||
| Attached Files | appendHandler4CustomFields.txt (2,162 bytes)
Index: ./core/history_api.php
diff -u ./core/history_api.php:1.1 ./core/history_api.php:1.2
--- ./core/history_api.php:1.1 Wed Mar 11 15:57:30 2009
+++ ./core/history_api.php Tue Apr 14 14:22:05 2009
@@ -26,7 +26,13 @@
# --------------------
# log the changes (old / new value are supplied to reduce db access)
# events should be logged *after* the modification
+ # Issue 6856: Append the handler to the history for specified custom fields
function history_log_event_direct( $p_bug_id, $p_field_name, $p_old_value, $p_new_value, $p_user_id = null ) {
+ global $g_add_handler_fields;
+ $t_mantis_custom_field_table = config_get( 'mantis_custom_field_table' );
+ $t_mantis_user_table = config_get( 'mantis_user_table' );
+ $t_mantis_bug_table = config_get( 'mantis_bug_table' );
+
# Only log events that change the value
if ( $p_new_value != $p_old_value ) {
if ( null === $p_user_id ) {
@@ -39,6 +45,36 @@
$c_bug_id = db_prepare_int( $p_bug_id );
$c_user_id = db_prepare_int( $p_user_id );
+ # Issue 6856: Get the list of field ids to add the handler to and find the
+ # coresponding field names
+ $handler_field_ids = explode("|", $g_add_handler_fields);
+ $handler_field_names = array();
+ foreach ($handler_field_ids as $id){
+ $query = "SELECT name
+ FROM $t_mantis_custom_field_table
+ WHERE id='$id'";
+
+ $row = db_fetch_array( db_query( $query ) );
+ $name = $row['name'];
+ array_push ($handler_field_names, $name);
+ }
+
+
+ # Issue 6856: If the field is in the list of field names to append the handler,
+ # find the current handler and append it to the end of the new value
+ if (in_array($c_field_name, $handler_field_names)){
+ $query = "SELECT a.username
+ FROM $t_mantis_user_table a, $t_mantis_bug_table b
+ WHERE
+ a.id = b.handler_id
+ AND b.id = $c_bug_id";
+
+ $row = db_fetch_array( db_query( $query ) );
+ $handler = $row['username'];
+
+ $c_new_value = $c_new_value." [$handler]";
+ }
+
$t_mantis_bug_history_table = config_get( 'mantis_bug_history_table' );
$query = "INSERT INTO $t_mantis_bug_history_table
| ||||