Mandatory custom fields whose visibility depends on a component are not required on bug creation

RESOLVED FIXED in Bugzilla 4.4

Status

()

Bugzilla
Creating/Changing Bugs
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: b.cropp, Assigned: Frédéric Buclin)

Tracking

({regression})

Bugzilla 4.4
regression
Bug Flags:
approval +
approval4.4 +

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0 (Beta/Release)
Build ID: 20121219124323

Steps to reproduce:

We created several custom fields which are mandatory for bug creation.


Actual results:

After upgrade from Bugzilla 4.2.4 to 4.4 over Bazaar these fields are not mandatory anymore while you create a new bug although the mandatory bit in field settings is still set.

Then if you try to change anything in that new bug, you are prompted to fill out every mandatory field.


Expected results:

You should be forced to fill the mandatory fields while bug creation (as it was in 4.2.4).
(Assignee)

Comment 1

4 years ago
I cannot reproduce. How are your mandatory custom fields configured? Do they depend on some other fields and/or value?
(Reporter)

Comment 2

4 years ago
They only appear, if a specific component is used.

Can be set on task creation: active	
Displayed in taskmail for new Tasks: active
Type: drop down
Is obsolete: inactive
Sortkey: 0
Is mandatory: active

I tried to change any settings except the mandatory bit with no success.
(Assignee)

Updated

4 years ago
Keywords: qawanted
I can confirm that the bug only appears when "Field only appears when:" is set to a "Component". If you have the field always appear or it only appears when a "Product" is shown, then it will verify that the field is set when the bug is created.

My steps:
(1) Go to Administration -> Custom Fields -> Add a new custom field
(2) Set the type to a "Drop Down"
(3) Check "Can be set on bug creation"
(4) Check "Is Mandatory"
(5) Set "Field only appears when:" to "Component"
(6) Select a component
(7) Submit
(8) Click on the field
(9) Edit Legal values for this field
(10) Add 2-3 dummy values
(11) Submit
(12) Add a new bug
(13) Select the project/component specified in #5
(14) Set all of the fields, except for the new custom field
(15) Press submit, observe that it lets you submit the bug, even though your custom field hasn't been set.
(Assignee)

Comment 4

3 years ago
I confirm that this issue only happens when the visibility is set to "Component". This is still an issue with Bugzilla 4.5.1.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: qawanted
Summary: Mandatory custom field not required on bug creation → Mandatory custom fields whose visibility depends on a component are not required on bug creation
Target Milestone: --- → Bugzilla 4.4
(Assignee)

Comment 5

3 years ago
(In reply to b.cropp from comment #0)
> You should be forced to fill the mandatory fields while bug creation (as it
> was in 4.2.4).

It's also broken in 4.2. It was working fine in 4.0, though.
Keywords: regression
(Assignee)

Comment 6

3 years ago
Created attachment 8351366 [details] [diff] [review]
patch, v1

In bug 782210, we moved the call to _check_field_is_mandatory() before setting $bug->{component_id}, which is why the validation always failed. We then fixed is_set_on_bug() in Bugzilla::Field::ChoiceInterface, but forgot to do the same for this method in Bugzilla::Component.
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #8351366 - Flags: review?(pami.ketolainen)
Attachment #8351366 - Flags: review?(dkl)

Comment 7

3 years ago
(In reply to Frédéric Buclin from comment #6)
> Created attachment 8351366 [details] [diff] [review]
> patch, v1

The patch looks OK to me, but I don't have the permission to accept the review flag.

One thing I noticed is that when you don't select a value for the required custom field it is not visible after you go back form "A value must be set for the 'Test' field. Please press Back and try again". The component needs to be reselected to make the field visible. But I guess that is not in the scope of this bug.

Updated

3 years ago
Attachment #8351366 - Flags: review?(pami.ketolainen) → review+
(Assignee)

Updated

3 years ago
Flags: approval?
Flags: approval4.4?
Comment on attachment 8351366 [details] [diff] [review]
patch, v1

Review of attachment 8351366 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl
Attachment #8351366 - Flags: review?(dkl) → review+

Updated

3 years ago
Flags: approval?
Flags: approval4.4?
Flags: approval4.4+
Flags: approval+
(Assignee)

Comment 9

3 years ago
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Component.pm
Committed revision 8846.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.4/
modified Bugzilla/Component.pm
Committed revision 8646.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Assignee)

Comment 10

3 years ago
Added to relnotes for 4.4.2.
You need to log in before you can comment on or make changes to this bug.