mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Add a default project setting for issues created from estimates
Redmine has no default-project setting for new issues, so the preview page used the first project the user could add issues to whenever an appointment had no project. The plugin settings now have a Default project; the order is: project chosen on the page, the appointment's project, the default project, then the first allowed project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
5 files changed
+20
-3
No files matched your search
@@ -160,14 +160,16 @@ class CustomerAppointmentsController < ApplicationController
|
||||
@builder = RedmineQboCalendar::EstimateIssueBuilder.new(@appointment)
|
||||
@available_projects = Project.allowed_to(User.current, :add_issues).sorted.to_a
|
||||
|
||||
# A project chosen on the page wins, then the appointment's project, then the first allowed one
|
||||
# A project chosen on the page wins, then the appointment's project, then the default project
|
||||
# from the plugin settings, then the first project the user can add issues to
|
||||
default_project = @available_projects.detect { |p| p.id == RedmineQboCalendar::EstimateIssueBuilder.default_project_id }
|
||||
@target_project =
|
||||
if @project
|
||||
@project if @available_projects.include?(@project)
|
||||
elsif @available_projects.include?(@appointment.project)
|
||||
@appointment.project
|
||||
else
|
||||
@available_projects.first
|
||||
default_project || @available_projects.first
|
||||
end
|
||||
return deny_access unless @target_project
|
||||
|
||||
|
||||
Reference in new issue
Block a user