Feature #13244 » issue_13244.patch
| app/controllers/issues_controller.rb | ||
|---|---|---|
|
if @query.valid?
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html do
|
||
|
@issue_count = @query.issue_count
|
||
|
@issue_pages = Paginator.new @issue_count, per_page_option, params['page']
|
||
|
@issues = @query.issues(:offset => @issue_pages.offset, :limit => @issue_pages.per_page)
|
||
|
render :layout => !request.xhr?
|
||
|
}
|
||
|
format.api {
|
||
|
end
|
||
|
format.api do
|
||
|
@offset, @limit = api_offset_and_limit
|
||
|
@query.column_names = %w(author)
|
||
|
@issue_count = @query.issue_count
|
||
|
@issues = @query.issues(:offset => @offset, :limit => @limit)
|
||
|
Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
|
||
|
}
|
||
|
format.atom {
|
||
|
end
|
||
|
format.atom do
|
||
|
@issues = @query.issues(:limit => Setting.feeds_limit.to_i)
|
||
|
render_feed(@issues,
|
||
|
:title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}")
|
||
|
}
|
||
|
format.csv {
|
||
|
end
|
||
|
format.csv do
|
||
|
@issues = @query.issues(:limit => Setting.issues_export_limit.to_i)
|
||
|
send_data(query_to_csv(@issues, @query, params[:csv]),
|
||
|
:type => 'text/csv; header=present', :filename => 'issues.csv')
|
||
|
}
|
||
|
format.pdf {
|
||
|
end
|
||
|
format.pdf do
|
||
|
@issues = @query.issues(:limit => Setting.issues_export_limit.to_i)
|
||
|
send_file_headers! :type => 'application/pdf', :filename => 'issues.pdf'
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
else
|
||
|
respond_to do |format|
|
||
| ... | ... | |
|
@has_changesets = @issue.changesets.visible.preload(:repository, :user).exists?
|
||
|
@relations =
|
||
|
@issue.relations.
|
||
|
select {|r|
|
||
|
select do |r|
|
||
|
r.other_issue(@issue) && r.other_issue(@issue).visible?
|
||
|
}
|
||
|
end
|
||
|
@journals.reverse! if User.current.wants_comments_in_reverse_order?
|
||
|
if User.current.allowed_to?(:view_time_entries, @project)
|
||
| ... | ... | |
|
end
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html do
|
||
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||
|
@priorities = IssuePriority.active
|
||
|
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
|
||
| ... | ... | |
|
@relation = IssueRelation.new
|
||
|
retrieve_previous_and_next_issue_ids
|
||
|
render :template => 'issues/show'
|
||
|
}
|
||
|
format.api {
|
||
|
end
|
||
|
format.api do
|
||
|
@changesets = @issue.changesets.visible.preload(:repository, :user).to_a
|
||
|
@changesets.reverse! if User.current.wants_comments_in_reverse_order?
|
||
|
}
|
||
|
format.atom {
|
||
|
end
|
||
|
format.atom do
|
||
|
render :template => 'journals/index', :layout => false,
|
||
|
:content_type => 'application/atom+xml'
|
||
|
}
|
||
|
format.pdf {
|
||
|
end
|
||
|
format.pdf do
|
||
|
send_file_headers!(:type => 'application/pdf',
|
||
|
:filename => "#{@project.identifier}-#{@issue.id}.pdf")
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
if @issue.save
|
||
|
call_hook(:controller_issues_new_after_save, {:params => params, :issue => @issue})
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html do
|
||
|
render_attachment_warning_if_needed(@issue)
|
||
|
flash[:notice] =
|
||
|
l(:notice_issue_successful_create,
|
||
|
:id => view_context.link_to("##{@issue.id}", issue_path(@issue),
|
||
|
:title => @issue.subject))
|
||
|
redirect_after_create
|
||
|
}
|
||
|
format.api {
|
||
|
end
|
||
|
format.api do
|
||
|
render :action => 'show', :status => :created,
|
||
|
:location => issue_url(@issue)
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
return
|
||
|
else
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html do
|
||
|
if @issue.project.nil?
|
||
|
render_error :status => 422
|
||
|
else
|
||
|
render :action => 'new'
|
||
|
end
|
||
|
}
|
||
|
end
|
||
|
format.api {render_validation_errors(@issue)}
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
flash[:notice] = l(:notice_successful_update)
|
||
|
end
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
format.html do
|
||
|
redirect_back_or_default(
|
||
|
issue_path(@issue, previous_and_next_issue_ids_params)
|
||
|
)
|
||
|
}
|
||
|
end
|
||
|
format.api {render_api_ok}
|
||
|
end
|
||
|
else
|
||
|
-
|
||
| app/models/time_entry.rb | ||
|---|---|---|
|
errors.add :hours, :invalid if hours < 0
|
||
|
errors.add :hours, :invalid if hours == 0.0 && hours_changed? && !Setting.timelog_accept_0_hours?
|
||
|
days_diff = (Date.today - spent_on)
|
||
|
errors.add :spent_on, :invalid if days_diff.to_i > Setting.timelog_max_days_before.to_i
|
||
|
max_hours = Setting.timelog_max_hours_per_day.to_f
|
||
|
if hours_changed? && max_hours > 0.0
|
||
|
logged_hours = other_hours_with_same_user_and_day
|
||
| app/views/settings/_timelog.html.erb | ||
|---|---|---|
|
<p><%= setting_text_field :timelog_max_hours_per_day, :size => 6 %></p>
|
||
|
<p><%= setting_text_field :timelog_max_days_before, :size => 6 %></p>
|
||
|
<p><%= setting_check_box :timelog_accept_0_hours %></p>
|
||
|
<p><%= setting_check_box :timelog_accept_future_dates %></p>
|
||
| config/locales/en-GB.yml | ||
|---|---|---|
|
same day (%{logged_hours} hours have already been logged)
|
||
|
setting_time_entry_list_defaults: Timelog list defaults
|
||
|
setting_timelog_accept_0_hours: Accept time logs with 0 hours
|
||
|
setting_timelog_max_days_before: How many days in the past can timelogs be added
|
||
|
setting_timelog_max_hours_per_day: Maximum hours that can be logged per day and user
|
||
|
label_x_revisions: "%{count} revisions"
|
||
|
error_can_not_delete_auth_source: This authentication mode is in use and cannot be
|
||
| config/locales/en.yml | ||
|---|---|---|
|
setting_time_entry_list_defaults: Timelog list defaults
|
||
|
setting_timelog_accept_0_hours: Accept time logs with 0 hours
|
||
|
setting_timelog_max_hours_per_day: Maximum hours that can be logged per day and user
|
||
|
setting_timelog_max_days_before: How many days in the past can timelogs be added
|
||
|
setting_timelog_accept_future_dates: Accept time logs on future dates
|
||
|
setting_show_status_changes_in_mail_subject: Show status changes in issue mail notifications subject
|
||
|
setting_project_list_defaults: Projects list defaults
|
||
| config/settings.yml | ||
|---|---|---|
|
timelog_max_hours_per_day:
|
||
|
format: int
|
||
|
default: 999
|
||
|
timelog_max_days_before:
|
||
|
format: int
|
||
|
default: 999
|
||
|
timelog_accept_future_dates:
|
||
|
default: 1
|
||
|
show_status_changes_in_mail_subject:
|
||