@@ -352,6 +352,22 class ApplicationController < ActionController::Base | |||
|
352 | 352 | @attachments = att || [] |
|
353 | 353 | end |
|
354 | 354 | |
|
355 | def parse_params_for_bulk_update(params) | |
|
356 | attributes = (params || {}).reject {|k,v| v.blank?} | |
|
357 | attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} | |
|
358 | if custom = attributes[:custom_field_values] | |
|
359 | custom.reject! {|k,v| v.blank?} | |
|
360 | custom.keys.each do |k| | |
|
361 | if custom[k].is_a?(Array) | |
|
362 | custom[k] << '' if custom[k].delete('__none__') | |
|
363 | else | |
|
364 | custom[k] = '' if custom[k] == '__none__' | |
|
365 | end | |
|
366 | end | |
|
367 | end | |
|
368 | attributes | |
|
369 | end | |
|
370 | ||
|
355 | 371 | # make sure that the user is a member of the project (or admin) if project is private |
|
356 | 372 | # used as a before_filter for actions that do not require any particular permission on the project |
|
357 | 373 | def check_project_privacy |
@@ -252,7 +252,7 class IssuesController < ApplicationController | |||
|
252 | 252 | @issues.sort! |
|
253 | 253 | @copy = params[:copy].present? |
|
254 | 254 | |
|
255 |
attributes = parse_params_for_bulk_ |
|
|
255 | attributes = parse_params_for_bulk_update(params[:issue]) | |
|
256 | 256 | copy_subtasks = (params[:copy_subtasks] == '1') |
|
257 | 257 | copy_attachments = (params[:copy_attachments] == '1') |
|
258 | 258 | |
@@ -495,22 +495,6 class IssuesController < ApplicationController | |||
|
495 | 495 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) |
|
496 | 496 | end |
|
497 | 497 | |
|
498 | def parse_params_for_bulk_issue_attributes(params) | |
|
499 | attributes = (params[:issue] || {}).reject {|k,v| v.blank?} | |
|
500 | attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} | |
|
501 | if custom = attributes[:custom_field_values] | |
|
502 | custom.reject! {|k,v| v.blank?} | |
|
503 | custom.keys.each do |k| | |
|
504 | if custom[k].is_a?(Array) | |
|
505 | custom[k] << '' if custom[k].delete('__none__') | |
|
506 | else | |
|
507 | custom[k] = '' if custom[k] == '__none__' | |
|
508 | end | |
|
509 | end | |
|
510 | end | |
|
511 | attributes | |
|
512 | end | |
|
513 | ||
|
514 | 498 | # Saves @issue and a time_entry from the parameters |
|
515 | 499 | def save_issue_with_child_records |
|
516 | 500 | Issue.transaction do |
@@ -174,7 +174,7 class TimelogController < ApplicationController | |||
|
174 | 174 | end |
|
175 | 175 | |
|
176 | 176 | def bulk_update |
|
177 |
attributes = parse_params_for_bulk_ |
|
|
177 | attributes = parse_params_for_bulk_update(params[:time_entry]) | |
|
178 | 178 | |
|
179 | 179 | unsaved_time_entry_ids = [] |
|
180 | 180 | @time_entries.each do |time_entry| |
@@ -271,20 +271,4 private | |||
|
271 | 271 | end |
|
272 | 272 | scope |
|
273 | 273 | end |
|
274 | ||
|
275 | def parse_params_for_bulk_time_entry_attributes(params) | |
|
276 | attributes = (params[:time_entry] || {}).reject {|k,v| v.blank?} | |
|
277 | attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'} | |
|
278 | if custom = attributes[:custom_field_values] | |
|
279 | custom.reject! {|k,v| v.blank?} | |
|
280 | custom.keys.each do |k| | |
|
281 | if custom[k].is_a?(Array) | |
|
282 | custom[k] << '' if custom[k].delete('__none__') | |
|
283 | else | |
|
284 | custom[k] = '' if custom[k] == '__none__' | |
|
285 | end | |
|
286 | end | |
|
287 | end | |
|
288 | attributes | |
|
289 | end | |
|
290 | 274 | end |
General Comments 0
You need to be logged in to leave comments.
Login now