Skip to content

Commit

Permalink
Fix #5920: Don't log custom fields in bug_report
Browse files Browse the repository at this point in the history
For consistency with other fields in Mantis, when a bug is first
reported, the custom field values should not be stored in the history
logs.
  • Loading branch information
amyreese committed Oct 29, 2009
1 parent 7b1cf36 commit 4d20ad4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bug_report.php
Expand Up @@ -134,7 +134,7 @@
}

$t_def = custom_field_get_definition( $t_id );
if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], $t_def['default_value'] ) ) ) {
if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], $t_def['default_value'] ), false ) ) {
error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) );
trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
}
Expand Down
7 changes: 5 additions & 2 deletions core/custom_field_api.php
Expand Up @@ -1296,10 +1296,11 @@ function custom_field_default_to_value( $p_value, $p_type ) {
* @param int $p_field_id custom field id
* @param int $p_bug_id bug id
* @param mixed $p_value
* @param boolean $p_log create history logs for new values
* @return bool
* @access public
*/
function custom_field_set_value( $p_field_id, $p_bug_id, $p_value ) {
function custom_field_set_value( $p_field_id, $p_bug_id, $p_value, $p_log_insert=true ) {
$c_field_id = db_prepare_int( $p_field_id );
$c_bug_id = db_prepare_int( $p_bug_id );

Expand Down Expand Up @@ -1337,7 +1338,9 @@ function custom_field_set_value( $p_field_id, $p_bug_id, $p_value ) {
VALUES
( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
db_query_bound( $query, Array( $c_field_id, $c_bug_id, $p_value ) );
history_log_event_direct( $c_bug_id, $t_name, '', $p_value );
if ( $p_log_insert ) {
history_log_event_direct( $c_bug_id, $t_name, '', $p_value );
}
}

custom_field_clear_cache( $p_field_id );
Expand Down

0 comments on commit 4d20ad4

Please sign in to comment.