View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011684 | mantisbt | custom fields | public | 2010-03-19 11:18 | 2014-12-22 08:24 |
Reporter | david_s_nl | Assigned To | vboctor | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | git trunk | ||||
Target Version | 1.2.5 | Fixed in Version | 1.2.5 | ||
Summary | 0011684: Incorrect error "A necessary field "MyField" was empty. Please recheck your inputs." when submitting new issue | ||||
Description | When creating a new issue i get an application error 11: "A necessary field "my custom field" was empty. Please recheck your inputs.". This error message is not correct because "Required On Report" was not checked for the corresponding custom field. | ||||
Steps To Reproduce | I have reproduced this error on "mantisbt-1.2.0-2010-03-17-master-1.2.x-e961c55.zip", on an empty database;
See the attached screenshot for the custom field properties. | ||||
Tags | No tags attached. | ||||
Attached Files | 11684.diff (2,821 bytes)
--- C:/mantisbt-1.2.1-official/bug_report.php Fri Apr 23 14:28:34 2010 +++ H:/mantisbt-1.2.1-custom/bug_report.php Thu May 27 11:39:49 2010 @@ -104,18 +104,31 @@ $t_def = custom_field_get_definition( $t_id ); # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_report'] || - $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM || - $t_def['type'] == CUSTOM_FIELD_TYPE_LIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) { + if ( $t_def['require_report'] + && ( $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM + || $t_def['type'] == CUSTOM_FIELD_TYPE_LIST + || $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST + || $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO + ) + && !gpc_isset_custom_field( $t_id, $t_def['type'] ) + ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_EMPTY_FIELD, ERROR ); } - if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); + if( gpc_isset_custom_field( $t_id, $t_def['type'] ) ) { + $t_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ); + if ( $t_def['display_report'] + && !custom_field_validate( + $t_id, + $t_custom_field_value + ) + ) { + error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); + trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); + } } } @@ -135,14 +148,32 @@ # Handle custom field submission foreach( $t_related_custom_field_ids as $t_id ) { + $t_def = custom_field_get_definition( $t_id ); # Do not set custom field value if user has no write access. - if( !custom_field_has_write_access( $t_id, $t_bug_id ) ) { + if ( !$t_def['display_report'] + || !custom_field_has_write_access( $t_id, $t_bug_id ) + ) { + continue; + } + + $t_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], ''); + if ( empty($t_custom_field_value) + && !$t_def['require_report'] + ) { continue; } - $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, $t_custom_field_value, false ) ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } 11684-2.diff (2,658 bytes)
--- C:/mantis/mantisbt-1.2.1-official/bug_report.php Fri Apr 23 14:28:34 2010 +++ C:/mantis/mantisbt-1.2.1-patches/bug_report.php Fri Jun 04 11:21:34 2010 @@ -104,18 +104,24 @@ $t_def = custom_field_get_definition( $t_id ); # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_report'] || - $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM || - $t_def['type'] == CUSTOM_FIELD_TYPE_LIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) { + if ( $t_def['require_report'] + && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX + && !gpc_isset_custom_field($t_id, $t_def['type']) + ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_EMPTY_FIELD, ERROR ); } - if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); + if(gpc_isset_custom_field($t_id, $t_def['type'])) { + $t_custom_field_value = gpc_get_custom_field("custom_field_$t_id", $t_def['type'], NULL); + if ( $t_def['display_report'] + && !custom_field_validate( + $t_id, + $t_custom_field_value + ) + ) { + error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); + trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); + } } } @@ -135,13 +141,21 @@ # Handle custom field submission foreach( $t_related_custom_field_ids as $t_id ) { + $t_def = custom_field_get_definition( $t_id ); # Do not set custom field value if user has no write access. - if( !custom_field_has_write_access( $t_id, $t_bug_id ) ) { + if ( !$t_def['display_report'] + || !custom_field_has_write_access( $t_id, $t_bug_id ) + ) { continue; } - $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 ) ) { + $t_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], ''); + if ( empty($t_custom_field_value) + && !$t_def['require_report'] + ) { + continue; + } + if(!custom_field_set_value($t_id, $t_bug_id, $t_custom_field_value, false)) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } 11684-2-bug_update.diff (1,561 bytes)
--- C:/mantis/mantisbt-1.2.1-official/bug_update.php Fri Apr 23 14:28:34 2010 +++ C:/mantis/mantisbt-1.2.1-patches/bug_update.php Wed Jun 30 09:42:05 2010 @@ -137,19 +137,19 @@ continue; } + $t_old_custom_field_value = custom_field_get_value( $t_id, $f_bug_id ); # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_' . $t_custom_status_label] || - $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM || - $t_def['type'] == CUSTOM_FIELD_TYPE_LIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); + if ( $t_def['require_' . $t_custom_status_label] + && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX + && !gpc_isset_custom_field($t_id, $t_def['type']) + ) { + if(!isset($t_old_custom_field_value)) { + error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } } $t_new_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], '' ); - $t_old_custom_field_value = custom_field_get_value( $t_id, $f_bug_id ); # Don't update the custom field if the new value both matches the old value and is valid # This ensures that changes to custom field validation will force the update of old invalid custom field values bug11684-full.patch (5,221 bytes)
diff -Naur mantisbt-1.2.3/bug_report.php mantisbt-patch/bug_report.php --- mantisbt-1.2.3/bug_report.php 2010-09-27 16:11:01.000000000 +0200 +++ mantisbt-patch/bug_report.php 2010-09-27 16:09:38.000000000 +0200 @@ -104,18 +104,24 @@ $t_def = custom_field_get_definition( $t_id ); # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_report'] || - $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM || - $t_def['type'] == CUSTOM_FIELD_TYPE_LIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) { + if ( $t_def['require_report'] + && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX + && !gpc_isset_custom_field($t_id, $t_def['type']) + ) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_EMPTY_FIELD, ERROR ); } - if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); + if(gpc_isset_custom_field($t_id, $t_def['type'])) { + $t_custom_field_value = gpc_get_custom_field("custom_field_$t_id", $t_def['type'], NULL); + if ( $t_def['display_report'] + && !custom_field_validate( + $t_id, + $t_custom_field_value + ) + ) { + error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); + trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); + } } } @@ -135,13 +141,21 @@ # Handle custom field submission foreach( $t_related_custom_field_ids as $t_id ) { + $t_def = custom_field_get_definition( $t_id ); # Do not set custom field value if user has no write access. - if( !custom_field_has_write_access( $t_id, $t_bug_id ) ) { + if ( !$t_def['display_report'] + || !custom_field_has_write_access( $t_id, $t_bug_id ) + ) { continue; } - $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 ) ) { + $t_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], ''); + if ( empty($t_custom_field_value) + && !$t_def['require_report'] + ) { + continue; + } + if(!custom_field_set_value($t_id, $t_bug_id, $t_custom_field_value, false)) { error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); } diff -Naur mantisbt-1.2.3/bug_update.php mantisbt-patch/bug_update.php --- mantisbt-1.2.3/bug_update.php 2010-09-27 16:10:52.000000000 +0200 +++ mantisbt-patch/bug_update.php 2010-09-27 16:09:33.000000000 +0200 @@ -137,19 +137,19 @@ continue; } + $t_old_custom_field_value = custom_field_get_value( $t_id, $f_bug_id ); # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_' . $t_custom_status_label] || - $t_def['type'] == CUSTOM_FIELD_TYPE_ENUM || - $t_def['type'] == CUSTOM_FIELD_TYPE_LIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || - $t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); + if ( $t_def['require_' . $t_custom_status_label] + && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX + && !gpc_isset_custom_field($t_id, $t_def['type']) + ) { + if(!isset($t_old_custom_field_value)) { + error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } } $t_new_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], '' ); - $t_old_custom_field_value = custom_field_get_value( $t_id, $f_bug_id ); # Don't update the custom field if the new value both matches the old value and is valid # This ensures that changes to custom field validation will force the update of old invalid custom field values diff -Naur mantisbt-1.2.3/core/custom_field_api.php mantisbt-patch/core/custom_field_api.php --- mantisbt-1.2.3/core/custom_field_api.php 2010-09-27 16:11:18.000000000 +0200 +++ mantisbt-patch/core/custom_field_api.php 2010-09-27 16:34:03.000000000 +0200 @@ -1172,12 +1172,11 @@ $t_valid &= ( $p_value == null ) || ( ( $p_value !== false ) && ( $p_value > 0 ) ); break; case CUSTOM_FIELD_TYPE_CHECKBOX: - # Checkbox fields can hold a null value (when no checkboxes are ticked) + case CUSTOM_FIELD_TYPE_MULTILIST: + # These fields can hold a null value (when no values are selected) if( $p_value === '' ) { break; } - # If checkbox field value is not null then we need to validate it... (note: no "break" statement here!) - case CUSTOM_FIELD_TYPE_MULTILIST: $t_values = explode( '|', $p_value ); $t_possible_values = custom_field_prepare_possible_values( $row['possible_values'] ); $t_possible_values = explode( '|', $t_possible_values ); custom_field_api.php.diff (1,086 bytes)
--- mantisbt-1.2.4\core\custom_field_api.php 2010-12-14 21:26:32.000000000 +0100 +++ mantis4\core\custom_field_api.php 2010-12-29 14:26:31.928750000 +0100 @@ -403,11 +403,12 @@ $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); $query = "INSERT INTO $t_custom_field_table - ( name, possible_values ) + ( name, possible_values, default_value, valid_regexp ) VALUES - ( " . db_param() . ',' . db_param() . ')'; + ( " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ')'; + + db_query_bound( $query, Array( $c_name, '', '', '' ) ); - db_query_bound( $query, Array( $c_name, '' ) ); return db_insert_id( $t_custom_field_table ); } @@ -1420,6 +1421,8 @@ } } + $t_custom_field_value = string_attribute( $t_custom_field_value ); + global $g_custom_field_type_definition; if( isset( $g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'] ) ) { call_user_func( $g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'], $p_field_def, $t_custom_field_value ); | ||||
related to | 0011628 | closed | dhx | Error 0001303 / Custom Field (Checkbox) evaluated as mandantory even when it is not |
has duplicate | 0011850 | closed | dhx | Mantis thinks custom fields are required when "Display When ...." fields are checked |
has duplicate | 0011861 | closed | atrol | Custom enum field marked as not mandatory is validated as mandatory |
has duplicate | 0011869 | closed | atrol | error reporting issues if user doesn't have write access to a custom field |
has duplicate | 0011881 | closed | atrol | Custom field required when reporting issue after upgrade |
has duplicate | 0011918 | closed | atrol | Can't create new issues since I created a list type custom field |
has duplicate | 0011951 | closed | atrol | Bug report page ask for custom fields not required nor displayed |
has duplicate | 0011957 | closed | atrol | Non required field is forced to fill in. |
has duplicate | 0012115 | closed | atrol | custom field is mandatory, although not configured to be so |
has duplicate | 0012137 | closed | atrol | Customer Fields causes problems with upgrading |
has duplicate | 0012237 | closed | atrol | bug of Validate the custom fields |
has duplicate | 0012353 | closed | atrol | Not requiered custom field got validated on new issue |
has duplicate | 0012202 | closed | atrol | Cannot update older issues after upgrading from 1.1.0 to 1.2.1. Get APPLICATION ERROR #11 |
has duplicate | 0012550 | closed | atrol | custom field required, but not configured as required |
has duplicate | 0012572 | closed | atrol | Multiselection custom field is required even when marked to not be |
has duplicate | 0012619 | closed | vboctor | Custom fields are reported as required after upgrade from 1.1.0 to 1.2.3 |
has duplicate | 0012753 | closed | atrol | Enumerate custom fields always required |
related to | 0013406 | closed | dregad | Default values for custom fields are not written to database |
related to | 0016020 | closed | dregad | Port Fix of 0011684 to master branch |
The list, radio and enum custom field types cannot currently hold a null value. This is why bug_report.php is complaining about the list field having an empty value. Maybe we should allow for null values in these fields and we'll simply print a label like "Undefined" when a value hasn't yet been set? |
|
Sounds OK to me.. printing the label "Undefined", i assume you are talking about the manage custom field page. FYI: |
|
i have the very same problem with the version 1.2.1. is there any quick fix or patch? |
|
i tried to find a workaround by supplying default values, but if the user does not have write access he has no chance to report a bug. |
|
I found a workaround: Downgrade to 1.2.0! I believe that these are side effects from 0011628 |
|
I have a custom field "Affected versions" defined as "=released_versions". This field is used to signal which versions are affected by a given issue beyond the one the bug is reported against. Given it's declaration, it is difficult to set a default without inserting a dummy release for each project, having NULL values in such fields like lists or enum should be OK - it's a missing value. |
|
Same error here and I'm confused why the field should ever get a NULL value when a default value is defined. |
|
We also encountered this bug after upgrading from 1.1.6 to 1.2.1. We have a custom Enumeration type No|Yes. Default value No. Required on Report unchecked. Display on Report also unchecked. The use case is that this enumeration type would default to No and only be set to Yes later by developers. Thus it is not required when reporting. The workaround for this error message in Mantis 1.2.1 is to check "Display on Report", this serves to populate the custom field with the default value and thus it passes validation. However this is not ideal as reporters have nothing to do with this field. |
|
Could this please be targetted to 1.2.2? It's quite annoying for users, first when they encounter an inability to report an issue, and then again when the Report Issue screen becomes cluttered with custom fields they don't use. |
|
I reported a duplicate of this bug and attached a patch in 0011951. |
|
Thanks Sergiodf. I can confirm the patch in 0011951 worked for me. Hope it gets incorporated in the next Mantis release too. (perhaps this issue could be updated to block severity and have the patch attached?) |
|
Spoke too soon... After applying the patch I'm seeing a situation where an Enumeration type of No|Yes, default value No, Display Report = no, Required on report = no, is now triggering a different error, which is the second ERROR_CUSTOM_FIELD_INVALID_VALUE instance, ie in the code:
The issue is still submitted, however the error leads the user to think it wasn't. |
|
I have attached a new patch. I hope this time solves your situation, djcarr. |
|
Here is what I posted to the mailing list: Many custom field types in MantisBT are sets[1] (mathematics: set Users should be modifying their custom fields to add a new option However I do NOT recommend adding an "Undefined" option as it is a sign List and enumeration fields are basically the same mathematical concept I do agree that there is a need for a field which is a set of mutually [1] http://en.wikipedia.org/wiki/Set_%28computer_science%29 |
|
The follow up to my comment on the mailing list was that we need to document things clearer so that administrators understand that the "require" checkbox has no effect on radio/list/enum fields. If the "display" checkbox is not checked on reporting an issue, you MUST provide a default value for the field. I've assigned this issue to myself and I'll do what I can to make it easier for users to understand. |
|
That's fair enough, but my experience of this issue is that the error still occurs even when you DO provide a default value for the field. Scenario was: "Custom Enumeration type No|Yes. Default value No. Required on Report unchecked. Display on Report also unchecked." - this configuration worked in previous versions, and is a very valid and common end user scenario. So this to me falls under the definition of a regression. I can see from the mailing list that it may be getting confused with the separate logistical issue that occurs when a default value is not provided. |
|
Sergiodf's latest patch does work for me, though I should mention that it simply allows the still-undefined types to proceed through the Report Bug validation. On the Bug View page, the custom fields will have no value (blank). This also probably means they won't obey filters in the way one would expect. It is only once you edit the bug that you will see the custom fields populated with their defaults, and when you save the bug again they are finally persisted. Is it possible in the Report Bug screen to have hidden fields that populate the undisplayed custom fields with their default values, so that the validation will succeed, AND the default values get stored to the bug? |
|
I don't think hidden fields is a good idea, because you can not trust on http post sent by client (it could have been modified). |
|
Hi, we have the same prob with 1.2.1. Enum Ja|Nein with Nein as default. No Display on Report, No required on Report. Then we get the error. It only works with: See on Report and the writeAccess to Reporter. The the box showes and Nein ist selected and written to the issue... would be fine to see fixed in next release... store the default to the issue when the user can't access or see the field on the page.. |
|
So... Why empty multilists work fine in mantis 1.1.8? |
|
part of the patch:
|
|
You are right, crazya. I realized yesterday after hour. |
|
We should consider the special case of CUSTOM_FIELD_TYPE_CHECKBOX, where emptyness is a valid selection. |
|
New patch: 11684-2.diff |
|
Temporary workaround: Add additional value to custom field (eg. "undefined") and set this value as "default value" |
|
Hi, i have the same Problem and found the same code like crazya. I have changed it nearly like crazya but only error message changed to validation error. This code and also dominiks workaround only works if the field is displayed at reporting :( |
|
Hi, it seems like I have the same issue when updating a issue. Could it be related ? |
|
Yes, highmqn, it is the same problem. This validations should be in a function instead of copied in every file. |
|
Thanks a lot ! Does the problem still appears when the custom field is not displayed ? |
|
Just to be clear does Sergiodf patch resolve this issue? basically this bug should have the highest possible priority since it basically as made all installations of Mantis 1.2.1 that uses custom fields non functional. |
|
Good morning, I have just updated our test server with 1.2.2 to check if this issue was fixed and I can reproduce it. The problem is that we have a Custom Enumeration type called "Test On Site?" that has the values "No|Yes" and a default value "No". The "Required on Report" field is unchecked and "Display When Reporting Issues" is also unchecked. However when a new issue is raised, the error: "A necessary field "Test On Site?" was empty. Please recheck your inputs." is reported. We are still running 1.2.0 after finding the issue in the 1.2.1 release. Is there a workaround? Mark Retallack. PS. thanks for all the hard work that has gone into creating Mantis. |
|
markretallack, you can try applying 11684-2.diff (and eventually 11684-2-bug_update.diff). |
|
I had this problem after upgrading from 1.2.0 to 1.2.1. I was able to get it working again by modifying the core/custom_field_api.php, bug_report.php and bug_update.php files. Changes: Diff (against 1.2.1 release):
bug_update.php
|
|
@dhx: Selecting empty values in enumerations/lists and deselecting all entries in a multilist are IHMO perfect and valid methods to express an empty set in HTML UI controls. Even mantis makes use of this, e. g. in several version list boxes. However, I don't see this as an UI issue. If the admin decided that a field isn't required then there's always the possibility of a default NULL/undecided value, and mantis should be able to handle that. This is an absolute showstopper for us to work with mantis > 1.2.0. We have several enumeration fields that are only required under special circumstances, so the default value is empty - and this doesn't work anymore. |
|
@nimmich: you can't deselect a selection you've made in a combo box (enumeration) or list control. As such you'll need to add an "Unspecified" option to your radio/list/enumeration custom field possible values string. You'll also need to change the default value of the custom field to match the newly added "Unspecified" string. You can then safely turn off the "require" checkbox for certain pages and not worry about the user leaving the field blank (it'll use the default value instead). You can deselect all options in a multiple-selection list control therefore MantisBT 1.2.x allows null values for the multilist custom field type. |
|
@dhx: By now requiring that a new enumeration entry of "Unspecified" or "Undefined" or whatever be created is firstly not very elegant, and secondly causes a further problem for us. We have a custom enumeration that is not required or displayed when reporting an issue, but is required when updating it. This is because the value is not known at the time you log the issue, but will be known when you update it later. If the default value of the enumeration is empty/null, then when you log it, it will not have any value, but when you update it, you will be forced to select a value. However, if you have a default value of "Unspecified", there will be no way to force the person updating the issue to change that value as it is a valid value and therefore passes the 'required' test. This allows an issue to flow the entire workflow and still have this value set at "Unspecified" because there was no forced requirement to change it. If an empty or null value was once again allowed (as it was in previous versions) then you would once again be able to only force a value to be populated later in the process. |
|
I would also like to add that even if you use a default value of "Unspecified", this has absolutely no effect when the field is not displayed on the report page. An empty value is still set, which then causes the issue to fail. The only way around this is to display each and every enumeration field on the report page, which unnecessarily clutters up the report page. |
|
macarbiter is right, I can confirm that use case (we have the same in my company's project) and the problem, that now every custom field must be visible on bug submit page, which confuses a lot of users, as they don't know what to enter here. |
|
I am getting this after the upgrade as well. I am currently on 1.2.1. |
|
I have to agree with the last three notes. We are finding this issue is a complete showstopper for updating to the latest Mantis version. |
|
I wonder if we can turn our thoughts to the solution here. My thoughts run along the lines of:
|
|
Hi all, Sergiodf, there is something missing in you patch. For an empty multiselection list, when modifying a bug, the empty value is forbidden, which does not make sense, because we should be able to select nothing. There is a small correction to do in custom_field_api.php. I added a new patch, containing both corrections of Sergiodf + the correction in custom field api (to be applied with “patch -p1”). Hope this will help. |
|
Sometimes there's the need of displaying a combo list for a custom field, which is required, and without a default value, so the user is forced to select one of the items. Even better if it displayed a "select a value from the list" default item (not selectable itself...) So...i think: |
|
I understand that certain types can not store a NULL value. In the other hand if I set a default value to the field I somewhat thought that the default value will be applied. If the field is assigned to that certain project then it has to be created when the issue is created (with the default value if it is not displayed or not required). Later on let say when the issue is updated the field should show the current value. I dont know how complicated it is to code, but I think this would resolve the problem. I agree with the comments above, this is a major inconvenience now. |
|
There was a recent commit (for an upcoming 1.2.4 release) recently which should solve a number of problems related to custom fields (especially on the update page). See: http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=76c9a79ef7d88a135e226088c167e90065ef9277 |
|
I am currently on 1.2.3 |
|
Same here, 1.2.3 and still happening. This behavior (not accepting null values) makes the flag "required" in the "Manage Custom Fields" section a bit useless. I cannot leave the field empty, so it is the same as I configure the field "required". |
|
Same in 1.3.0 nightly versions. |
|
Is there any indication when this will be fixed or at least a working patch file for 1.2.3 will be available? We embarked on a process to get Mantis 1.2 rolled out to our whole company after we had been successfully using 1.1 for the last few years. However, this bug has caused a major set-back on this roll-out, and the choice to go with Mantis is starting to be second guessed. |
|
I also noticed this now in our mantis 1.2.3 and this is somewhat a showstopper for us. Have this been planned to be fixed in 1.2.4? |
|
Victor Boctor attached a patch in 0012619 for those who don't like this behavior. |
|
I have added a patch I have done to take care of the problem. It inserts empty strings in the fields that are declared "NOT NULL", which seems to be sufficient. |
|
@Sergiodf, @dhx and others. I've done a check-in based on a fix that I did before knowing about this issue. When I inspected Sergiodf's patch, I found that he has more changes. Please validate my fix / latest and feel free to provide a patch on top. I hope that my fix unblocks the majority of the users (if not all). However, if there are other changes that are necessary to completely handle the regression, then let us get it in before 1.2.5 is released. See the attached changeset (890c36eb) for more details. |
|
@vboctor, thanks for reverting the change of functionality in 1.2.x - I can confirm that your changes look OK. We can work on improving custom field validation/etc in a later major version of MantisBT. |
|
I tried vboctor's patch but it does not work with custom fields of type "List" having a default value defined but unchecking "Display When Reporting Issues". In my installation, I have a field where the only boxes checked are "Display When Closing Issues" and "Required On Close" (this field is used only when closing an issue). Using vboctor's patch, it is not possible to submit a new issue. |
|
@Sergiodf, did you apply both my patches? I did a follow up patch soon after the first one that should probably fix the issue you mentioned. |
|
You are right, Victor. I did not apply the "follow up patch". |
|
Should we mark this issue as resolved then? Any objections? If we are to revisit the change of behavior for 1.3.x, then we should open a new feature request and link to this one. |
|
This issue should be marked as resolved, in my opinion. |
|
We're seeing the same problem in 1.2.4 and a quick check of the attached patch diffs against the source we've installed suggests that the patch didn't make it into the 1.2.4 release. |
|
cjm1, the fixed and target version is set to 1.2.x which means that the fix will be available with next version 1.2.5 |
|
Sorry...my bad. For some reason I missed 1.2.4 being released and as I'd only just seen it assumed it was new in the last few days, rather than being released before the patch became available. |
|
Thanks to vboctor for fixing this issue. But in one case it hasn't worked very well: I expanded the patch from vboctor to fix this remaining issue so therefore I hope that the application may now work appropriate. bug_report.php from line 101 based on master-1.2.x 890c36eb
bug_update.php from line 150 based on master-1.2.x 890c36eb
|
|
dissi, please enter a new issue for this problem and attach your patch. |
|
MantisBT: master-1.2.x 890c36eb 2011-01-09 03:00 Details Diff |
Issue 0012619: Custom fields are reported as required after upgrade from 1.1.0 to 1.2.3. Issue 0011684: Incorrect error "A necessary field "MyField" was empty. Please recheck your inputs." when submitting new issue. There is a lot of details about this issue in issue 0011684. In 1.2.1 a breaking change was introduced which blocks users from submitting / updating issues for projects with certain custom field configurations. The aim of this fix is to unblock these users. We can do follow up fixes to improve on this for 1.2.x or to come up with the alternative strategy for 1.3.x. The goal is to come up with an approach that doesn't break existing users. The worst thing is that users upgrade and then find out that they can continue to use the product. If there is a path for upgrade to avoid these issues, then we should automate it as part of the upgrade script. I haven't marked the issue as completely fixed until dhx checks it out, since he was working on the issue. I've used my fix for 0012619 + one more fix for the update code path. When I compared my fix to the attached patches, I note that the patches have more changes to handle things like special cases for checkboxes and the case where user doesn't have read-write. We may incorporate these after we do the necessary validations. Thanks for Sergiodf for contributing the patches. |
Affected Issues 0011684, 0012619 |
|
mod - bug_report.php | Diff File | ||
mod - bug_update.php | Diff File | ||
mod - core/custom_field_api.php | Diff File | ||
MantisBT: master-1.2.x 7ab6eb38 2011-01-09 03:23 Details Diff |
Follow up fix for: Issue 0012619: Custom fields are reported as required after upgrade from 1.1.0 to 1.2.3. Issue 0011684: Incorrect error "A necessary field "MyField" was empty. Please recheck your inputs." when submitting new issue. |
Affected Issues 0011684, 0012619 |
|
mod - core/custom_field_api.php | Diff File | ||
MantisBT: master 3d969053 2013-06-19 21:31 Details Diff |
Fix 0016020: allow empty required custom fields This is a port of the following 1.2.x commits: - 890c36eb616cf5f1d115efa8b5de61b8b737937a - 7ab6eb383a29a73ad65ade7de504d45477c87fb3 See related issues 0012619, 0011684 for details |
Affected Issues 0011684, 0012619, 0016020 |
|
mod - bug_report.php | Diff File | ||
mod - core/custom_field_api.php | Diff File |