@@ -188,6 +188,8 class IssuesController < ApplicationController | |||||
188 | def edit |
|
188 | def edit | |
189 | update_issue_from_params |
|
189 | update_issue_from_params | |
190 |
|
190 | |||
|
191 | @journal = @issue.current_journal | |||
|
192 | ||||
191 | respond_to do |format| |
|
193 | respond_to do |format| | |
192 | format.html { } |
|
194 | format.html { } | |
193 | format.xml { } |
|
195 | format.xml { } | |
@@ -203,6 +205,7 class IssuesController < ApplicationController | |||||
203 | format.xml { head :ok } |
|
205 | format.xml { head :ok } | |
204 | end |
|
206 | end | |
205 | else |
|
207 | else | |
|
208 | @journal = @issue.current_journal | |||
206 | respond_to do |format| |
|
209 | respond_to do |format| | |
207 | format.html { render :action => 'edit' } |
|
210 | format.html { render :action => 'edit' } | |
208 | format.xml { render :xml => @issue.errors, :status => :unprocessable_entity } |
|
211 | format.xml { render :xml => @issue.errors, :status => :unprocessable_entity } | |
@@ -549,7 +552,7 private | |||||
549 | @time_entry = TimeEntry.new |
|
552 | @time_entry = TimeEntry.new | |
550 |
|
553 | |||
551 | @notes = params[:notes] |
|
554 | @notes = params[:notes] | |
552 |
|
|
555 | @issue.init_journal(User.current, @notes) | |
553 | # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed |
|
556 | # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed | |
554 | if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue] |
|
557 | if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue] | |
555 | attrs = params[:issue].dup |
|
558 | attrs = params[:issue].dup | |
@@ -573,14 +576,14 private | |||||
573 | attachments = Attachment.attach_files(@issue, params[:attachments]) |
|
576 | attachments = Attachment.attach_files(@issue, params[:attachments]) | |
574 | render_attachment_warning_if_needed(@issue) |
|
577 | render_attachment_warning_if_needed(@issue) | |
575 |
|
578 | |||
576 | attachments[:files].each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)} |
|
579 | attachments[:files].each {|a| @issue.current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)} | |
577 | call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal}) |
|
580 | call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @issue.current_journal}) | |
578 | if @issue.save |
|
581 | if @issue.save | |
579 | if !@journal.new_record? |
|
582 | if !@issue.current_journal.new_record? | |
580 | # Only send notification if something was actually changed |
|
583 | # Only send notification if something was actually changed | |
581 | flash[:notice] = l(:notice_successful_update) |
|
584 | flash[:notice] = l(:notice_successful_update) | |
582 | end |
|
585 | end | |
583 | call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal}) |
|
586 | call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @issue.current_journal}) | |
584 | return true |
|
587 | return true | |
585 | end |
|
588 | end | |
586 | end |
|
589 | end |
@@ -47,6 +47,8 class Issue < ActiveRecord::Base | |||||
47 | :author_key => :author_id |
|
47 | :author_key => :author_id | |
48 |
|
48 | |||
49 | DONE_RATIO_OPTIONS = %w(issue_field issue_status) |
|
49 | DONE_RATIO_OPTIONS = %w(issue_field issue_status) | |
|
50 | ||||
|
51 | attr_reader :current_journal | |||
50 |
|
52 | |||
51 | validates_presence_of :subject, :priority, :project, :tracker, :author, :status |
|
53 | validates_presence_of :subject, :priority, :project, :tracker, :author, :status | |
52 | validates_length_of :subject, :maximum => 255 |
|
54 | validates_length_of :subject, :maximum => 255 |
General Comments 0
You need to be logged in to leave comments.
Login now