Deleting a product/component throws an error

RESOLVED FIXED in Bugzilla 4.2

Status

()

Bugzilla
Administration
--
major
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Frédéric Buclin, Assigned: timello)

Tracking

({regression})

Bugzilla 4.2
regression
Bug Flags:
approval +

Details

Attachments

(1 attachment)

v1
1.00 KB, patch
Max Kanat-Alexander
: review+
Details | Diff | Splinter Review
(Reporter)

Description

8 years ago
Try to delete a product from editproducts.cgi. In 4.1 only, you get the following error:

 visibility_value_id is not a valid parameter for the Bugzilla::Field::match function.

Traceback:

 at Bugzilla/Object.pm line 445
	Bugzilla::Object::_check_field(...) called at Bugzilla/Object.pm line 228
	Bugzilla::Object::match(...) called at Bugzilla/Field.pm line 256
	Bugzilla::Field::match(...) called at Bugzilla/Field/ChoiceInterface.pm line 113
	Bugzilla::Field::ChoiceInterface::controls_visibility_of_fields(...) called at Bugzilla/Field/ChoiceInterface.pm line 41
	Bugzilla::Field::ChoiceInterface::_check_if_controller(...) called at Bugzilla/Product.pm line 272
	Bugzilla::Product::remove_from_db(...) called at /var/www/html/bugzilla/editproducts.cgi line 235
(Assignee)

Comment 1

8 years ago
True.
Status: NEW → ASSIGNED
(Assignee)

Comment 2

8 years ago
Also, that happens when removing components.
Summary: Deleting a product throws an error → Deleting a product/component throws an error
(Assignee)

Comment 3

8 years ago
Created attachment 474962 [details] [diff] [review]
v1
Assignee: administration → timello
Attachment #474962 - Flags: review?(mkanat)
(Assignee)

Updated

8 years ago
Attachment #474962 - Flags: review?(mkanat) → review?(LpSolit)
(Assignee)

Updated

8 years ago
Attachment #474962 - Flags: review?(LpSolit) → review?(mkanat)
(Reporter)

Comment 4

8 years ago
This also prevents field values from being deleted, in editvalues.cgi.

Comment 5

8 years ago
Comment on attachment 474962 [details] [diff] [review]
v1

>=== modified file 'Bugzilla/Field/ChoiceInterface.pm'
>+            "SELECT id FROM fielddefs
>+               INNER JOIN field_visibility ON id = field_id
>+             WHERE value_id = ? AND visibility_field_id = ?", undef,

  You don't need that INNER JOIN, you just need to select field_id from field_visibility, and make sure that you do SELECT DISTINCT.
Attachment #474962 - Flags: review?(mkanat) → review-
(Assignee)

Comment 6

8 years ago
(In reply to comment #5)
> Comment on attachment 474962 [details] [diff] [review]
> v1
> 
> >=== modified file 'Bugzilla/Field/ChoiceInterface.pm'
> >+            "SELECT id FROM fielddefs
> >+               INNER JOIN field_visibility ON id = field_id
> >+             WHERE value_id = ? AND visibility_field_id = ?", undef,
> 
>   You don't need that INNER JOIN, you just need to select field_id from
> field_visibility, and make sure that you do SELECT DISTINCT.

Yes, we do need. value_id is not unique in field_visibility the primary key is both columns.
(Reporter)

Comment 7

8 years ago
Increasing severity as it affects several parts of administration, see comments 2 and 4. This prevents me from doing some QA too.
Severity: normal → major

Comment 8

8 years ago
Comment on attachment 474962 [details] [diff] [review]
v1

>=== modified file 'Bugzilla/Field/ChoiceInterface.pm'
>+               INNER JOIN field_visibility ON id = field_id

  id and field_id should have table names on them, to be clear.

  Otherwise this looks fine. :-)
Attachment #474962 - Flags: review- → review+

Updated

8 years ago
Flags: approval+
(Assignee)

Comment 9

8 years ago
Committing to: bzr+ssh://timello%40gmail.com@bzr.mozilla.org/bugzilla/trunk/                                                  
modified Bugzilla/Field/ChoiceInterface.pm
Committed revision 7548.
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.