From e94e88e3adec033b71c64ebfb0378a28ea1b0c33 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 14 Jul 2007 14:37:22 +0000 Subject: Added the ability to log time when changing an issue status. git-svn-id: http://redmine.rubyforge.org/svn/trunk@586 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 8 ++++++++ app/views/issues/change_status.rhtml | 13 +++++++++++++ 2 files changed, 21 insertions(+) (limited to 'app') diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index e0005b309..990d95b0e 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -105,6 +105,13 @@ class IssuesController < ApplicationController :value => a.filename) unless a.new_record? } if params[:attachments] and params[:attachments].is_a? Array + # Log time + if logged_in_user.authorized_to(@project, "timelog/edit") + @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => logged_in_user, :spent_on => Date.today) + @time_entry.attributes = params[:time_entry] + @time_entry.save + end + flash[:notice] = l(:notice_successful_update) Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? redirect_to :action => 'show', :id => @issue @@ -115,6 +122,7 @@ class IssuesController < ApplicationController end end @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user } + @activities = Enumeration::get_values('ACTI') end def destroy diff --git a/app/views/issues/change_status.rhtml b/app/views/issues/change_status.rhtml index 11fceccca..ab9aee2f9 100644 --- a/app/views/issues/change_status.rhtml +++ b/app/views/issues/change_status.rhtml @@ -8,10 +8,23 @@ <%= f.hidden_field :lock_version %>
+

<%= @new_status.name %>

<%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %>

<%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>

<%= f.select :fixed_version_id, (@project.versions.collect {|v| [v.name, v.id]}), { :include_blank => true } %>

+
+
+<% if authorize_for('timelog', 'edit') %> +<% fields_for :time_entry, @time_entry, { :builder => TabularFormBuilder, :lang => current_language} do |time_entry| %> +

<%= time_entry.text_field :hours, :size => 6, :label => :label_spent_time %> <%= l(:field_hours) %>

+

<%= time_entry.text_field :comments, :size => 40 %>

+

<%= time_entry.select :activity_id, (@activities.collect {|p| [p.name, p.id]}) %>

+<% end %> +<% end %> +
+ +

<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

-- cgit v1.2.3