Feature #13244 » issue_13244.patch
| app/controllers/issues_controller.rb | ||
|---|---|---|
| 47 | 47 | |
| 48 | 48 |
if @query.valid? |
| 49 | 49 |
respond_to do |format| |
| 50 |
format.html {
|
|
| 50 |
format.html do
|
|
| 51 | 51 |
@issue_count = @query.issue_count |
| 52 | 52 |
@issue_pages = Paginator.new @issue_count, per_page_option, params['page'] |
| 53 | 53 |
@issues = @query.issues(:offset => @issue_pages.offset, :limit => @issue_pages.per_page) |
| 54 | 54 |
render :layout => !request.xhr? |
| 55 |
}
|
|
| 56 |
format.api {
|
|
| 55 |
end
|
|
| 56 |
format.api do
|
|
| 57 | 57 |
@offset, @limit = api_offset_and_limit |
| 58 | 58 |
@query.column_names = %w(author) |
| 59 | 59 |
@issue_count = @query.issue_count |
| 60 | 60 |
@issues = @query.issues(:offset => @offset, :limit => @limit) |
| 61 | 61 |
Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
|
| 62 |
}
|
|
| 63 |
format.atom {
|
|
| 62 |
end
|
|
| 63 |
format.atom do
|
|
| 64 | 64 |
@issues = @query.issues(:limit => Setting.feeds_limit.to_i) |
| 65 | 65 |
render_feed(@issues, |
| 66 | 66 |
:title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}")
|
| 67 |
}
|
|
| 68 |
format.csv {
|
|
| 67 |
end
|
|
| 68 |
format.csv do
|
|
| 69 | 69 |
@issues = @query.issues(:limit => Setting.issues_export_limit.to_i) |
| 70 | 70 |
send_data(query_to_csv(@issues, @query, params[:csv]), |
| 71 | 71 |
:type => 'text/csv; header=present', :filename => 'issues.csv') |
| 72 |
}
|
|
| 73 |
format.pdf {
|
|
| 72 |
end
|
|
| 73 |
format.pdf do
|
|
| 74 | 74 |
@issues = @query.issues(:limit => Setting.issues_export_limit.to_i) |
| 75 | 75 |
send_file_headers! :type => 'application/pdf', :filename => 'issues.pdf' |
| 76 |
}
|
|
| 76 |
end
|
|
| 77 | 77 |
end |
| 78 | 78 |
else |
| 79 | 79 |
respond_to do |format| |
| ... | ... | |
| 91 | 91 |
@has_changesets = @issue.changesets.visible.preload(:repository, :user).exists? |
| 92 | 92 |
@relations = |
| 93 | 93 |
@issue.relations. |
| 94 |
select {|r|
|
|
| 94 |
select do |r|
|
|
| 95 | 95 |
r.other_issue(@issue) && r.other_issue(@issue).visible? |
| 96 |
}
|
|
| 96 |
end
|
|
| 97 | 97 |
@journals.reverse! if User.current.wants_comments_in_reverse_order? |
| 98 | 98 | |
| 99 | 99 |
if User.current.allowed_to?(:view_time_entries, @project) |
| ... | ... | |
| 102 | 102 |
end |
| 103 | 103 | |
| 104 | 104 |
respond_to do |format| |
| 105 |
format.html {
|
|
| 105 |
format.html do
|
|
| 106 | 106 |
@allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
| 107 | 107 |
@priorities = IssuePriority.active |
| 108 | 108 |
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) |
| ... | ... | |
| 110 | 110 |
@relation = IssueRelation.new |
| 111 | 111 |
retrieve_previous_and_next_issue_ids |
| 112 | 112 |
render :template => 'issues/show' |
| 113 |
}
|
|
| 114 |
format.api {
|
|
| 113 |
end
|
|
| 114 |
format.api do
|
|
| 115 | 115 |
@changesets = @issue.changesets.visible.preload(:repository, :user).to_a |
| 116 | 116 |
@changesets.reverse! if User.current.wants_comments_in_reverse_order? |
| 117 |
}
|
|
| 118 |
format.atom {
|
|
| 117 |
end
|
|
| 118 |
format.atom do
|
|
| 119 | 119 |
render :template => 'journals/index', :layout => false, |
| 120 | 120 |
:content_type => 'application/atom+xml' |
| 121 |
}
|
|
| 122 |
format.pdf {
|
|
| 121 |
end
|
|
| 122 |
format.pdf do
|
|
| 123 | 123 |
send_file_headers!(:type => 'application/pdf', |
| 124 | 124 |
:filename => "#{@project.identifier}-#{@issue.id}.pdf")
|
| 125 |
}
|
|
| 125 |
end
|
|
| 126 | 126 |
end |
| 127 | 127 |
end |
| 128 | 128 | |
| ... | ... | |
| 143 | 143 |
if @issue.save |
| 144 | 144 |
call_hook(:controller_issues_new_after_save, {:params => params, :issue => @issue})
|
| 145 | 145 |
respond_to do |format| |
| 146 |
format.html {
|
|
| 146 |
format.html do
|
|
| 147 | 147 |
render_attachment_warning_if_needed(@issue) |
| 148 | 148 |
flash[:notice] = |
| 149 | 149 |
l(:notice_issue_successful_create, |
| 150 | 150 |
:id => view_context.link_to("##{@issue.id}", issue_path(@issue),
|
| 151 | 151 |
:title => @issue.subject)) |
| 152 | 152 |
redirect_after_create |
| 153 |
}
|
|
| 154 |
format.api {
|
|
| 153 |
end
|
|
| 154 |
format.api do
|
|
| 155 | 155 |
render :action => 'show', :status => :created, |
| 156 | 156 |
:location => issue_url(@issue) |
| 157 |
}
|
|
| 157 |
end
|
|
| 158 | 158 |
end |
| 159 | 159 |
return |
| 160 | 160 |
else |
| 161 | 161 |
respond_to do |format| |
| 162 |
format.html {
|
|
| 162 |
format.html do
|
|
| 163 | 163 |
if @issue.project.nil? |
| 164 | 164 |
render_error :status => 422 |
| 165 | 165 |
else |
| 166 | 166 |
render :action => 'new' |
| 167 | 167 |
end |
| 168 |
}
|
|
| 168 |
end
|
|
| 169 | 169 |
format.api {render_validation_errors(@issue)}
|
| 170 | 170 |
end |
| 171 | 171 |
end |
| ... | ... | |
| 204 | 204 |
flash[:notice] = l(:notice_successful_update) |
| 205 | 205 |
end |
| 206 | 206 |
respond_to do |format| |
| 207 |
format.html {
|
|
| 207 |
format.html do
|
|
| 208 | 208 |
redirect_back_or_default( |
| 209 | 209 |
issue_path(@issue, previous_and_next_issue_ids_params) |
| 210 | 210 |
) |
| 211 |
}
|
|
| 211 |
end
|
|
| 212 | 212 |
format.api {render_api_ok}
|
| 213 | 213 |
end |
| 214 | 214 |
else |
| 215 |
- |
|
| app/models/time_entry.rb | ||
|---|---|---|
| 133 | 133 |
errors.add :hours, :invalid if hours < 0 |
| 134 | 134 |
errors.add :hours, :invalid if hours == 0.0 && hours_changed? && !Setting.timelog_accept_0_hours? |
| 135 | 135 | |
| 136 |
days_diff = (Date.today - spent_on) |
|
| 137 |
errors.add :spent_on, :invalid if days_diff.to_i > Setting.timelog_max_days_before.to_i |
|
| 138 | ||
| 136 | 139 |
max_hours = Setting.timelog_max_hours_per_day.to_f |
| 137 | 140 |
if hours_changed? && max_hours > 0.0 |
| 138 | 141 |
logged_hours = other_hours_with_same_user_and_day |
| app/views/settings/_timelog.html.erb | ||
|---|---|---|
| 6 | 6 | |
| 7 | 7 |
<p><%= setting_text_field :timelog_max_hours_per_day, :size => 6 %></p> |
| 8 | 8 | |
| 9 |
<p><%= setting_text_field :timelog_max_days_before, :size => 6 %></p> |
|
| 10 | ||
| 9 | 11 |
<p><%= setting_check_box :timelog_accept_0_hours %></p> |
| 10 | 12 | |
| 11 | 13 |
<p><%= setting_check_box :timelog_accept_future_dates %></p> |
| config/locales/en-GB.yml | ||
|---|---|---|
| 1236 | 1236 |
same day (%{logged_hours} hours have already been logged)
|
| 1237 | 1237 |
setting_time_entry_list_defaults: Timelog list defaults |
| 1238 | 1238 |
setting_timelog_accept_0_hours: Accept time logs with 0 hours |
| 1239 |
setting_timelog_max_days_before: How many days in the past can timelogs be added |
|
| 1239 | 1240 |
setting_timelog_max_hours_per_day: Maximum hours that can be logged per day and user |
| 1240 | 1241 |
label_x_revisions: "%{count} revisions"
|
| 1241 | 1242 |
error_can_not_delete_auth_source: This authentication mode is in use and cannot be |
| config/locales/en.yml | ||
|---|---|---|
| 482 | 482 |
setting_time_entry_list_defaults: Timelog list defaults |
| 483 | 483 |
setting_timelog_accept_0_hours: Accept time logs with 0 hours |
| 484 | 484 |
setting_timelog_max_hours_per_day: Maximum hours that can be logged per day and user |
| 485 |
setting_timelog_max_days_before: How many days in the past can timelogs be added |
|
| 485 | 486 |
setting_timelog_accept_future_dates: Accept time logs on future dates |
| 486 | 487 |
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject |
| 487 | 488 |
setting_project_list_defaults: Projects list defaults |
| config/settings.yml | ||
|---|---|---|
| 324 | 324 |
timelog_max_hours_per_day: |
| 325 | 325 |
format: int |
| 326 | 326 |
default: 999 |
| 327 |
timelog_max_days_before: |
|
| 328 |
format: int |
|
| 329 |
default: 999 |
|
| 327 | 330 |
timelog_accept_future_dates: |
| 328 | 331 |
default: 1 |
| 329 | 332 |
show_status_changes_in_mail_subject: |