comparison app/models/.svn/text-base/issue.rb.svn-base @ 507:0c939c159af4 redmine-1.2

Update to Redmine 1.2.1 on 1.2-stable branch (Redmine SVN rev 6270)
author Chris Cannam
date Thu, 14 Jul 2011 10:32:19 +0100
parents cbce1fd3b1b7
children
comparison
equal deleted inserted replaced
441:cbce1fd3b1b7 507:0c939c159af4
224 def tracker_id=(tid) 224 def tracker_id=(tid)
225 self.tracker = nil 225 self.tracker = nil
226 result = write_attribute(:tracker_id, tid) 226 result = write_attribute(:tracker_id, tid)
227 @custom_field_values = nil 227 @custom_field_values = nil
228 result 228 result
229 end
230
231 def description=(arg)
232 if arg.is_a?(String)
233 arg = arg.gsub(/(\r\n|\n|\r)/, "\r\n")
234 end
235 write_attribute(:description, arg)
229 end 236 end
230 237
231 # Overrides attributes= so that tracker_id gets assigned first 238 # Overrides attributes= so that tracker_id gets assigned first
232 def attributes_with_tracker_first=(new_attributes, *args) 239 def attributes_with_tracker_first=(new_attributes, *args)
233 return if new_attributes.nil? 240 return if new_attributes.nil?
868 # Called after_save 875 # Called after_save
869 def create_journal 876 def create_journal
870 if @current_journal 877 if @current_journal
871 # attributes changes 878 # attributes changes
872 (Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on)).each {|c| 879 (Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on)).each {|c|
880 before = @issue_before_change.send(c)
881 after = send(c)
882 next if before == after || (before.blank? && after.blank?)
873 @current_journal.details << JournalDetail.new(:property => 'attr', 883 @current_journal.details << JournalDetail.new(:property => 'attr',
874 :prop_key => c, 884 :prop_key => c,
875 :old_value => @issue_before_change.send(c), 885 :old_value => @issue_before_change.send(c),
876 :value => send(c)) unless send(c)==@issue_before_change.send(c) 886 :value => send(c))
877 } 887 }
878 # custom fields changes 888 # custom fields changes
879 custom_values.each {|c| 889 custom_values.each {|c|
880 next if (@custom_values_before_change[c.custom_field_id]==c.value || 890 next if (@custom_values_before_change[c.custom_field_id]==c.value ||
881 (@custom_values_before_change[c.custom_field_id].blank? && c.value.blank?)) 891 (@custom_values_before_change[c.custom_field_id].blank? && c.value.blank?))