Closed (fixed)
Project:
Unfuddle Feedback
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 Dec 2012 at 15:07 UTC
Updated:
2 Jan 2013 at 22:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
jody lynnInstead of re-creating the settings form with hook_menu_alter, you need to use hook_form_alter to add a new field to the form. This way other modules can also alter the form.
Don't use the alter hook for adding the new milestone field to the ticket - just add it in where the other fields are added in unfuddle_feedback. Alter hooks are for additional modules to use not usually the module that invokes it.
In the install file, that update function is for sites that used to be on an old version of unfuddle_feedback. No longer relevant for new changes. To delete the new variable you want to put a variable_del in a hook_uninstall in the install file.
Get a copy of the module from git using the 'Version Control' tab of the project page and copy over your changes. Then you can generate a real patch with
git diff > 1864814.patchComment #2
barancekk commentedThank you very much for comments. I created hook_form_alter(), hook_uninstall(). Real patch file is uploaded in attachment.
Comment #3
jody lynnName the variable unfuddle_feedback_milestone so that it's namespaced to the module that defines it.
To get only the changes you want, and not irrelevant ones, you can do git add -p and answer y/n to each bit and then do git diff --staged to get a diff of just what you added.
This stuff is added in by drupal.org's packaging if you don't get the code from git. We don't want to add this into the codebase, so delete this stuff.
This is just some kind of whitespace change we don't want.
You don't need the ">0" as 0 will evaluate to false anyway.
You should instead implement hook_form_FORM_ID_alter and condense these two lines
Comment #4
barancekk commentedThanks a lot for comments. Everything is updated in new patch in attachment. I used the > 0 condition in (($milestone_id = variable_get('unfuddle_api_milestone', 0)) > 0) to tell php to get only positive numbers and not string but the decision of format for assignee should be on the web user that sets it.
Comment #5
barancekk commentedYou can ignore the patch version in comment 4 and use this one. Thanks
Comment #6
dags commentedThis should probably be moved to the Unfuddle API project. Also, if an incorrect Milestone number is given, it will create a ticket without any milestone. It might good to add some validation code to check the milestone number and let the user know if they've entered an invalid number. Or use UnfuddleAPI's getMilestones() method in combination with some AJAX to return and populate the Milestone field.
Comment #7
jody lynnI committed this to 7.x-1.x
I am fine with the milestone setting being in unfuddle_feedback where it's needed. If unfuddle_api users want more settings and that's one of them we can move the setting over there in the future.
Also not concerned about validating the milestone since adding tickets in no milestone is what has always happened by default.