Redmine-: DO NOT FORCE TRACKER OF SUBTASKS IN FEATURES TO TASK

In redmine backlog plugin, we confronted the backlog constricts subtasks’ type of tracker. Here is the patch context. we can avoid forcing tracking of subtacks in backlog

118,121c118
<             # https://github.com/backlogs/redmine_backlogs/issues/547
<             #--> FIX: DO NOT FORCE TRACKER OF SUBTASKS IN FEATURES TO TASK
<             # the following line is marked and modified by nelson @ 12.13.2016
<             # self.tracker = Tracker.find(RbTask.tracker) unless self.tracker_id == RbTask.tracker --- >             self.tracker = Tracker.find(RbTask.tracker) unless self.tracker_id == RbTask.tracker
197c181,182
<                                               self.fixed_version_id, self.fixed_version_id]).to_a --- >                                               self.fixed_version_id, self.fixed_version_id,
>                                               RbTask.tracker]).to_a


 

However, the modification may happen a bug while you try modify the parent of issue after creating the issue.
The bug is that the issue will forcibly change its tracker id according to the parent. It might be correct behavior for some cases.
But If you deem the cases confuse you, you can alter the code as follows.


# plugins/redmine_backlogs/lib/backlogs_issue_patch.rb
def backlogs_after_save
# ..
# omitted
# ..
if self.story?
# omitted
tasklist = RbTask.find(:all, :conditions => ["root_id=? and lft>? and rgt<? and
(
(? is NULL and not fixed_version_id is NULL)
or
(not ? is NULL and fixed_version_id is NULL)
or
(not ? is NULL and not fixed_version_id is NULL and ?<>fixed_version_id)
) and tracker_id = ?", self.root_id, self.lft, self.rgt,
self.fixed_version_id, self.fixed_version_id,
self.fixed_version_id, self.fixed_version_id,
RbTask.tracker]).to_a
# omitted
end
# omitted
end

 

Redmine-Support multi-values query

You should modify this app/controllers/issues_controller.rb

Here comes the patch file as an example


diff --git a/app/models/query.rb b/app/models/query.rb
index 4e72ae5..6319302 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -720,7 +720,11 @@ class Query < ActiveRecord::Base
           if is_custom_filter
             sql = "(#{db_table}.#{db_field} <> '' AND CAST(#{db_table}.#{db_field} AS decimal(60,3)) = #{value.first.to_i})"
           else
-            sql = "#{db_table}.#{db_field} = #{value.first.to_i}"
+            if value.length > 1
+              sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| val.to_i}.join(",") + ")"
+            else
+              sql = "#{db_table}.#{db_field} = #{value.first.to_i}"
+            end
           end
         when :float
           if is_custom_filter