Project

General

Profile

Hook plugin help

Added by Pedro Braz about 11 years ago

Hello.

I need create a process what create one project for each issue that specific kind os track created.
I create a plugin and use the Hook controller_issues_new_after_save:

module GeradorProjetos
class Hooks < Redmine::Hook::ViewListener
def controller_issues_new_after_save(context={ })
tracker_id = issue[:tracker_id]
case tracker_id
when 2
params[:project] = {"name"=>issue[:subject],
"description"=>issue[:subject],
"homepage"=>issue[:subject],
"is_public"=>"0",
"parent_id"=>issue[:project_id],
"identifier"=>issue[:subject],
"tracker_ids"=>["2", "6"]}

ProjectsController.create
end
end
end
end

How i use the ProjectsController to create this project?