@@ -104,7 +104,7 class Enumeration < ActiveRecord::Base | |||||
104 | end |
|
104 | end | |
105 |
|
105 | |||
106 | # Does the +new+ Hash override the previous Enumeration? |
|
106 | # Does the +new+ Hash override the previous Enumeration? | |
107 |
def self.overrid |
|
107 | def self.overriding_change?(new, previous) | |
108 | if (same_active_state?(new['active'], previous.active)) && same_custom_values?(new,previous) |
|
108 | if (same_active_state?(new['active'], previous.active)) && same_custom_values?(new,previous) | |
109 | return false |
|
109 | return false | |
110 | else |
|
110 | else |
@@ -252,10 +252,10 class Project < ActiveRecord::Base | |||||
252 | parent_activity = TimeEntryActivity.find(activity['parent_id']) |
|
252 | parent_activity = TimeEntryActivity.find(activity['parent_id']) | |
253 | activity['name'] = parent_activity.name |
|
253 | activity['name'] = parent_activity.name | |
254 | activity['position'] = parent_activity.position |
|
254 | activity['position'] = parent_activity.position | |
255 |
if Enumeration.overrid |
|
255 | if Enumeration.overriding_change?(activity, parent_activity) | |
256 | project_activity = self.time_entry_activities.create(activity) |
|
256 | project_activity = self.time_entry_activities.create(activity) | |
257 | if project_activity.new_record? |
|
257 | if project_activity.new_record? | |
258 |
raise ActiveRecord::Rollback, "Overrid |
|
258 | raise ActiveRecord::Rollback, "Overriding TimeEntryActivity was not successfully saved" | |
259 | else |
|
259 | else | |
260 | self.time_entries. |
|
260 | self.time_entries. | |
261 | where(["activity_id = ?", parent_activity.id]). |
|
261 | where(["activity_id = ?", parent_activity.id]). |
General Comments 0
You need to be logged in to leave comments.
Login now