Skip to content

Commit

Permalink
Init custom fields default value when reporting bug
Browse files Browse the repository at this point in the history
Fix for #13406, written by labattsguy. Prior to this, default values
for custom fields were not written to the database at all.

Partially reverts commit bbe690f
  • Loading branch information
dregad committed Oct 20, 2011
1 parent ac8630b commit dc0c718
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bug_report.php
Expand Up @@ -162,7 +162,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'], '' ), false ) ) {
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 Expand Up @@ -191,26 +191,26 @@

# update relationship target bug last updated
bug_update_date( $t_bug_id );

# Send the email notification
email_relationship_added( $f_master_bug_id, $t_bug_id, relationship_get_complementary_type( $f_rel_type ) );
}

# copy notes from parent
if ( $f_copy_notes_from_parent ) {

$t_parent_bugnotes = bugnote_get_all_bugnotes( $f_master_bug_id );

foreach ( $t_parent_bugnotes as $t_parent_bugnote ) {

$t_private = $t_parent_bugnote->view_state == VS_PRIVATE;

bugnote_add( $t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking,
bugnote_add( $t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking,
$t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr,
$t_parent_bugnote->reporter_id, /* send_email */ FALSE , /* log history */ FALSE);
}
}

# copy attachments from parent
if ( $f_copy_attachments_from_parent ) {
file_copy_attachments( $f_master_bug_id, $t_bug_id );
Expand Down

0 comments on commit dc0c718

Please sign in to comment.