0100-adstec-copy_and_relate.patch

patch copy and relate - Karl-Heinz Nirschl, 2010-05-05 14:44

Download (2.09 KB)

View differences:

redmine/app/controllers/issues_controller.rb 2010-05-05 14:38:11.000000000 +0200
288 288
    @target_project ||= @project    
289 289
    @trackers = @target_project.trackers
290 290
    @available_statuses = Workflow.available_statuses(@project)
291
    @relations = collection_for_relation_type_select
291 292
    if request.post?
292 293
      new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
294
      new_relation = params[:new_relation_id].blank? ? nil : params[:new_relation_id]
295
      logger.info "new relation:"
296
      logger.info h(new_relation)      
293 297
      unsaved_issue_ids = []
294 298
      moved_issues = []
295 299
      @issues.each do |issue|
......
302 306
        issue.init_journal(User.current)
303 307
        if r = issue.move_to(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
304 308
          moved_issues << r
309
          if not new_relation.nil?
310
              logger.info "new relation will be generated:"
311
              relation = IssueRelation.new
312
              relation.issue_from    = issue
313
              relation.issue_to      = r
314
              relation.relation_type = new_relation
315
              relation.save
316
          end
305 317
        else
306 318
          unsaved_issue_ids << issue.id
307 319
        end
redmine/app/views/issues/move.rhtml 2010-05-05 14:38:11.000000000 +0200
34 34
</p>
35 35

  
36 36
<p>
37
  <label><%= l(:label_related_issues) %></label>
38
  <%= select_tag('new_relation_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_for_select(@relations)) %>
39
</p>
40

  
41
<p>
37 42
  <label><%= l(:field_start_date) %></label>
38 43
  <%= text_field_tag 'start_date', '', :size => 10 %><%= calendar_for('start_date') %>
39 44
</p>