Project

General

Profile

Patch #2277 » new_setting-issue_startdate_is_adddate-r2087.diff

Patch created against r2087 - Mischa The Evil, 2008-12-04 22:55

View differences:

app/controllers/issues_controller.rb (working copy)
133 133
    @issue.status = default_status
134 134
    @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.role_for_project(@project), @issue.tracker)).uniq
135 135
    
136
  if Setting.issue_startdate_is_adddate?
136 137
    if request.get? || request.xhr?
137 138
      @issue.start_date ||= Date.today
138 139
    else
......
145 146
        Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added')
146 147
        redirect_to :controller => 'issues', :action => 'show', :id => @issue
147 148
        return
148
      end		
149
    end	
149
      end
150
    end
151
  elsif !Setting.issue_startdate_is_adddate
152
    if !request.get? && !request.xhr?
153
      requested_status = IssueStatus.find_by_id(params[:issue][:status_id])
154
      # Check that the user is allowed to apply the requested status
155
      @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status
156
      if @issue.save
157
        attach_files(@issue, params[:attachments])
158
        flash[:notice] = l(:notice_successful_create)
159
        Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added')
160
        redirect_to :controller => 'issues', :action => 'show', :id => @issue
161
        return
162
      end
163
    end
164
  end
150 165
    @priorities = Enumeration::get_values('IPRI')
151 166
    render :layout => !request.xhr?
152 167
  end
app/views/settings/_issues.rhtml (working copy)
7 7
<p><label><%= l(:setting_display_subprojects_issues) %></label>
8 8
<%= check_box_tag 'settings[display_subprojects_issues]', 1, Setting.display_subprojects_issues? %><%= hidden_field_tag 'settings[display_subprojects_issues]', 0 %></p>
9 9

  
10
<p><label><%= l(:setting_issue_startdate_is_adddate) %></label>
11
<%= check_box_tag 'settings[issue_startdate_is_adddate]', 1, Setting.issue_startdate_is_adddate? %><%= hidden_field_tag 'settings[issue_startdate_is_adddate]', 0 %></p>
12

  
10 13
<p><label><%= l(:setting_issues_export_limit) %></label>
11 14
<%= text_field_tag 'settings[issues_export_limit]', Setting.issues_export_limit, :size => 6 %></p>
12 15
</div>
config/settings.yml (working copy)
137 137
    To change your notification preferences, please click here: http://hostname/my/account
138 138
gravatar_enabled:  
139 139
  default: 0
140
issue_startdate_is_adddate:
141
  default: 0
lang/en.yml (working copy)
223 223
setting_mail_handler_api_key: API key
224 224
setting_sequential_project_identifiers: Generate sequential project identifiers
225 225
setting_gravatar_enabled: Use Gravatar user icons
226
setting_issue_startdate_is_adddate: Use todays date as start date for new issues (otherwise leave empty, default)
226 227

  
227 228
permission_edit_project: Edit project
228 229
permission_select_project_modules: Select project modules
(1-1/9)