Mercurial > hg > soundsoftware-site
comparison app/controllers/timelog_controller.rb @ 929:5f33065ddc4b redmine-1.3
Update to Redmine SVN rev 9414 on 1.3-stable branch
author | Chris Cannam |
---|---|
date | Wed, 27 Jun 2012 14:54:18 +0100 |
parents | cbb26bc654de |
children | 433d4f72a19b |
comparison
equal
deleted
inserted
replaced
909:cbb26bc654de | 929:5f33065ddc4b |
---|---|
103 end | 103 end |
104 end | 104 end |
105 | 105 |
106 def new | 106 def new |
107 @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) | 107 @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) |
108 @time_entry.attributes = params[:time_entry] | 108 @time_entry.safe_attributes = params[:time_entry] |
109 | 109 |
110 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | 110 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
111 render :action => 'edit' | 111 render :action => 'edit' |
112 end | 112 end |
113 | 113 |
114 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } | 114 verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } |
115 def create | 115 def create |
116 @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) | 116 @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) |
117 @time_entry.attributes = params[:time_entry] | 117 @time_entry.safe_attributes = params[:time_entry] |
118 | 118 |
119 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | 119 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
120 | 120 |
121 if @time_entry.save | 121 if @time_entry.save |
122 respond_to do |format| | 122 respond_to do |format| |
133 end | 133 end |
134 end | 134 end |
135 end | 135 end |
136 | 136 |
137 def edit | 137 def edit |
138 @time_entry.attributes = params[:time_entry] | 138 @time_entry.safe_attributes = params[:time_entry] |
139 | 139 |
140 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | 140 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
141 end | 141 end |
142 | 142 |
143 verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } | 143 verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } |
144 def update | 144 def update |
145 @time_entry.attributes = params[:time_entry] | 145 @time_entry.safe_attributes = params[:time_entry] |
146 | 146 |
147 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) | 147 call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) |
148 | 148 |
149 if @time_entry.save | 149 if @time_entry.save |
150 respond_to do |format| | 150 respond_to do |format| |
171 attributes = parse_params_for_bulk_time_entry_attributes(params) | 171 attributes = parse_params_for_bulk_time_entry_attributes(params) |
172 | 172 |
173 unsaved_time_entry_ids = [] | 173 unsaved_time_entry_ids = [] |
174 @time_entries.each do |time_entry| | 174 @time_entries.each do |time_entry| |
175 time_entry.reload | 175 time_entry.reload |
176 time_entry.attributes = attributes | 176 time_entry.safe_attributes = attributes |
177 call_hook(:controller_time_entries_bulk_edit_before_save, { :params => params, :time_entry => time_entry }) | 177 call_hook(:controller_time_entries_bulk_edit_before_save, { :params => params, :time_entry => time_entry }) |
178 unless time_entry.save | 178 unless time_entry.save |
179 # Keep unsaved time_entry ids to display them in flash error | 179 # Keep unsaved time_entry ids to display them in flash error |
180 unsaved_time_entry_ids << time_entry.id | 180 unsaved_time_entry_ids << time_entry.id |
181 end | 181 end |