Defect #47 ยป issue.patch
| app/models/issue.rb (working copy) | ||
|---|---|---|
|
validates_presence_of :subject, :description, :priority, :tracker, :author, :status
|
||
|
validates_inclusion_of :done_ratio, :in => 0..100
|
||
|
validates_associated :custom_values, :on => :update
|
||
|
validates_uniqueness_of :subject
|
||
|
# set default status for new issues
|
||
|
def before_validation
|
||
| ... | ... | |
|
custom_values.each {|c|
|
||
|
@current_journal.details << JournalDetail.new(:property => 'cf',
|
||
|
:prop_key => c.custom_field_id,
|
||
|
:old_value => @custom_values_before_change[c.custom_field_id],
|
||
|
:value => c.value) unless @custom_values_before_change[c.custom_field_id]==c.value
|
||
|
:old_value => (@custom_values_before_change[c.custom_field_id].length > 250 ? @custom_values_before_change[c.custom_field_id].slice(0..250) + "..." : @custom_values_before_change[c.custom_field_id]),
|
||
|
:value => (c.value.length > 250 ? c.value.slice(0..250) + "..." : c.value)) unless (@custom_values_before_change[c.custom_field_id]==c.value || @custom_values_before_change[c.custom_field_id].nil? || c.value.nil? )
|
||
|
}
|
||
|
@current_journal.save unless @current_journal.details.empty? and @current_journal.notes.empty?
|
||
|
end
|
||