Closed Bug 595569 Opened 14 years ago Closed 14 years ago

Deleting a product/component throws an error

Categories

(Bugzilla :: Administration, task)

task
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: timello)

Details

(Keywords: regression)

Attachments

(1 file)

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
True.
Status: NEW → ASSIGNED
Also, that happens when removing components.
Summary: Deleting a product throws an error → Deleting a product/component throws an error
Attached patch v1Splinter Review
Assignee: administration → timello
Attachment #474962 - Flags: review?(mkanat)
Attachment #474962 - Flags: review?(mkanat) → review?(LpSolit)
Attachment #474962 - Flags: review?(LpSolit) → review?(mkanat)
This also prevents field values from being deleted, in editvalues.cgi.
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-
(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.
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 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+
Flags: approval+
Committing to: bzr+ssh://timello%40gmail.com@bzr.mozilla.org/bugzilla/trunk/                                                  
modified Bugzilla/Field/ChoiceInterface.pm
Committed revision 7548.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: