View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003537 | mantisbt | custom fields | public | 2004-02-07 03:38 | 2004-02-29 07:20 |
| Reporter | drdoctor | Assigned To | vboctor | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| OS | Linux | ||||
| Product Version | 0.18.0 | ||||
| Summary | 0003537: Rewriting custom values with 0 when updating a bug | ||||
| Description | If you update a bug with existing custom fields, which fields are not contained in the simple update bug page (for example: "milestone" field is an advanced custom field, with a value setted already - M3), the old value is lost after update. | ||||
| Additional Information | 1. Do not set custom field value if user has no write access.
#check if the custom_field was transferred!! | ||||
| Tags | No tags attached. | ||||
| Attached Files | 3537_advanced_custom_values_reset_on_simple_update.diff (1,138 bytes)
Index: bug_update.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/bug_update.php,v
retrieving revision 1.60
diff -u -r1.60 bug_update.php
--- bug_update.php 13 Jan 2004 12:23:50 -0000 1.60
+++ bug_update.php 7 Feb 2004 11:56:29 -0000
@@ -64,13 +64,20 @@
$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id );
foreach( $t_related_custom_field_ids as $t_id ) {
+ $t_custom_field_value = gpc_get_string( "custom_field_$t_id", null );
+
+ # Only update the field if it is posted
+ if ( $t_custom_field_value === null ) {
+ continue;
+ }
+
# Do not set custom field value if user has no write access.
if( !custom_field_has_write_access( $t_id, $f_bug_id ) ) {
continue;
}
$t_def = custom_field_get_definition( $t_id );
- if ( !custom_field_set_value( $t_id, $f_bug_id, gpc_get_string( "custom_field_$t_id", $t_def['default_value'] ) ) ) {
+ if ( !custom_field_set_value( $t_id, $f_bug_id, $t_custom_field_value ) ) {
trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
}
}
| ||||