@@ -562,17 +562,17 private | |||||
562 | # TODO: move attach_files to the model so this can be moved to the |
|
562 | # TODO: move attach_files to the model so this can be moved to the | |
563 | # model also |
|
563 | # model also | |
564 | def issue_update |
|
564 | def issue_update | |
565 | @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today) |
|
565 | if params[:time_entry] && params[:time_entry][:hours].present? && User.current.allowed_to?(:log_time, @project) | |
566 | @time_entry.attributes = params[:time_entry] |
|
566 | @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today) | |
567 | if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.valid? |
|
567 | @time_entry.attributes = params[:time_entry] | |
|
568 | @issue.time_entries << @time_entry | |||
|
569 | end | |||
|
570 | ||||
|
571 | if @issue.valid? | |||
568 | attachments = attach_files(@issue, params[:attachments]) |
|
572 | attachments = attach_files(@issue, params[:attachments]) | |
569 | attachments.each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)} |
|
573 | attachments.each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)} | |
570 | call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal}) |
|
574 | call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal}) | |
571 | if @issue.save |
|
575 | if @issue.save | |
572 | # Log spend time |
|
|||
573 | if User.current.allowed_to?(:log_time, @project) |
|
|||
574 | @time_entry.save |
|
|||
575 | end |
|
|||
576 | if !@journal.new_record? |
|
576 | if !@journal.new_record? | |
577 | # Only send notification if something was actually changed |
|
577 | # Only send notification if something was actually changed | |
578 | flash[:notice] = l(:notice_successful_update) |
|
578 | flash[:notice] = l(:notice_successful_update) |
General Comments 0
You need to be logged in to leave comments.
Login now