Bad field order numbers in trac.ini cause problems for admin form
|Reported by:||jdrum00||Owned by:||osimons|
I had three custom fields in trac.ini, with orders of 2, 3, and 4. While that's not really ideal, it does work without any trouble (I think I did it when I was trying to get things to appear in one column or the other). This causes several problems, but hopefully not unfixable ones.
- When I created a new custom field, it was assigned the number 4. Presumably the plugin counted my custom fields and assigned count + 1 as the new order number. But then if I try to edit anything with the custom fields admin form, it complains that order numbers must be unique. Suggestion: take the maximum of the list of order numbers instead of the length, and add one to that.
- The options in the dropdowns only contain the set of preexisting order numbers; in my case, 2, 3, and 4 (or, after adding one, 2, 3, 4 and 4!). This prevents the user from fixing the problem through the plugin form by changing them to 1, 2, and 3. Suggestion: take the maximum order number and generate the list of select options as the range between 1 and that number. Or if you're worried that someone will come in with a single custom field numbered 500, just make sure that all the numbers from 1 to (number-of-fields) are represented in addition to the actual numbers coming in from trac.ini.