[DRE-commits] [redmine] 02/03: Backport upstream patch to fix Bulk Edit

Antonio Terceiro terceiro at moszumanska.debian.org
Mon Feb 13 16:38:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository redmine.

commit 35f72508dacbf58d1adbb1cfb2bce5d11129bcde
Author: Thomas Klose <thomas.klose at hiperscan.com>
Date:   Mon Feb 13 14:18:47 2017 -0200

    Backport upstream patch to fix Bulk Edit
    
    Closes: #852694
    Signed-off-by: Antonio Terceiro <terceiro at debian.org>
---
 debian/changelog                                   |  5 ++
 ...how-fields-required-after-status-tracker-.patch | 95 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 101 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 49b00d8..131d62b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,11 @@ redmine (3.3.1-3) UNRELEASED; urgency=medium
     dbconfig-common (Closes: #852130)
     - add a autopkgtest for install/purge/install
 
+  [ Thomas Klose ]
+  * Backport upstream patch to fix Bulk Edit functionality when changing
+    between statuses that have different sets of read-only/mandatory fields.
+    (Closes: #852694)
+
  -- Antonio Terceiro <terceiro at debian.org>  Sun, 04 Dec 2016 18:15:22 -0200
 
 redmine (3.3.1-2) unstable; urgency=medium
diff --git a/debian/patches/0006-Bulk-edit-show-fields-required-after-status-tracker-.patch b/debian/patches/0006-Bulk-edit-show-fields-required-after-status-tracker-.patch
new file mode 100644
index 0000000..b196f12
--- /dev/null
+++ b/debian/patches/0006-Bulk-edit-show-fields-required-after-status-tracker-.patch
@@ -0,0 +1,95 @@
+From: Jean-Philippe Lang <jp_lang at yahoo.fr>
+Date: Mon, 13 Feb 2017 14:07:59 -0200
+Subject: Bulk edit: show fields required after status/tracker change
+
+Backported-by: Thomas Klose <thomas.klose at hiperscan.com>
+Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852694
+Original: http://www.redmine.org/projects/redmine/repository/revisions/15815
+
+This patch must be dropped when upgrading Redmine to version 3.4+.
+---
+ app/controllers/issues_controller.rb | 25 +++++++++++++++++++++----
+ app/views/issues/bulk_edit.html.erb  |  6 ++++--
+ 2 files changed, 25 insertions(+), 6 deletions(-)
+
+diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
+index c640aad..556425a 100644
+--- a/app/controllers/issues_controller.rb
++++ b/app/controllers/issues_controller.rb
+@@ -217,24 +217,41 @@ class IssuesController < ApplicationController
+       end
+     end
+ 
++    edited_issues = Issue.where(:id => @issues.map(&:id)).to_a
++
+     @allowed_projects = Issue.allowed_target_projects
+     if params[:issue]
+       @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s}
+       if @target_project
+         target_projects = [@target_project]
++        edited_issues.each {|issue| issue.project = @target_project}
+       end
+     end
+     target_projects ||= @projects
+ 
++    @trackers = target_projects.map {|p| Issue.allowed_target_trackers(p) }.reduce(:&)
++    if params[:issue]
++      @target_tracker = @trackers.detect {|t| t.id.to_s == params[:issue][:tracker_id].to_s}
++      if @target_tracker
++        edited_issues.each {|issue| issue.tracker = @target_tracker}
++      end
++    end
++
+     if @copy
+       # Copied issues will get their default statuses
+       @available_statuses = []
+     else
+-      @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
++      @available_statuses = edited_issues.map(&:new_statuses_allowed_to).reduce(:&)
+     end
+-    @custom_fields = @issues.map{|i|i.editable_custom_fields}.reduce(:&)
++    if params[:issue]
++      @target_status = @available_statuses.detect {|t| t.id.to_s == params[:issue][:status_id].to_s}
++      if @target_status
++        edited_issues.each {|issue| issue.status = @target_status}
++      end
++    end
++
++    @custom_fields = edited_issues.map{|i|i.editable_custom_fields}.reduce(:&)
+     @assignables = target_projects.map(&:assignable_users).reduce(:&)
+-    @trackers = target_projects.map {|p| Issue.allowed_target_trackers(p) }.reduce(:&)
+     @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
+     @categories = target_projects.map {|p| p.issue_categories}.reduce(:&)
+     if @copy
+@@ -242,7 +259,7 @@ class IssuesController < ApplicationController
+       @subtasks_present = @issues.detect {|i| !i.leaf?}.present?
+     end
+ 
+-    @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
++    @safe_attributes = edited_issues.map(&:safe_attribute_names).reduce(:&)
+ 
+     @issue_params = params[:issue] || {}
+     @issue_params[:custom_field_values] ||= {}
+diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb
+index 37bdb6d..29b4881 100644
+--- a/app/views/issues/bulk_edit.html.erb
++++ b/app/views/issues/bulk_edit.html.erb
+@@ -43,14 +43,16 @@
+   <label for="issue_tracker_id"><%= l(:field_tracker) %></label>
+   <%= select_tag('issue[tracker_id]',
+                  content_tag('option', l(:label_no_change_option), :value => '') +
+-                   options_from_collection_for_select(@trackers, :id, :name, @issue_params[:tracker_id])) %>
++                   options_from_collection_for_select(@trackers, :id, :name, @issue_params[:tracker_id]),
++                   :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
+ </p>
+ <% if @available_statuses.any? %>
+ <p>
+   <label for='issue_status_id'><%= l(:field_status) %></label>
+   <%= select_tag('issue[status_id]',
+                  content_tag('option', l(:label_no_change_option), :value => '') +
+-                   options_from_collection_for_select(@available_statuses, :id, :name, @issue_params[:status_id])) %>
++                   options_from_collection_for_select(@available_statuses, :id, :name, @issue_params[:status_id]),
++                   :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')") %>
+ </p>
+ <% end %>
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 6361bfb..11d488b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
 0003-Use-production-environment-by-default.patch
 0004-Add-multi-tenancy-support.patch
 0005-Assume-default-instance.patch
+0006-Bulk-edit-show-fields-required-after-status-tracker-.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/redmine.git



More information about the Pkg-ruby-extras-commits mailing list