Project

General

Profile

Defect #857

ref_issues does not work with redmine extra query operators plugin

Added by Tony Marschall almost 8 years ago. Updated almost 8 years ago.

Status:
フィードバック(Reopend)
Priority:
通常(Normal)
Target version:
-
Start date:
10/25/2011
Due date:
% Done:

0%

Estimated time:

Description

ref_issues does not work with redmine extra query operators plugin and maybe other plugins extending issue query filters

Select from debug log without extra filters:

SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `issue_statuses`.`id` AS t2_r0, `issue_statuses`.`name` AS t2_r1, `issue_statuses`.`is_closed` AS t2_r2, `issue_statuses`.`is_default` AS t2_r3, `issue_statuses`.`position` AS t2_r4, `issue_statuses`.`default_done_ratio` AS t2_r5, `users`.`id` AS t3_r0, `users`.`login` AS t3_r1, `users`.`hashed_password` AS t3_r2, `users`.`firstname` AS t3_r3, `users`.`lastname` AS t3_r4, `users`.`mail` AS t3_r5, `users`.`admin` AS t3_r6, `users`.`status` AS t3_r7, `users`.`last_login_on` AS t3_r8, `users`.`language` AS t3_r9, `users`.`auth_source_id` AS t3_r10, `users`.`created_on` AS t3_r11, `users`.`updated_on` AS t3_r12, `users`.`type` AS t3_r13, `users`.`identity_url` AS t3_r14, `users`.`mail_notification` AS t3_r15, `users`.`salt` AS t3_r16, `trackers`.`id` AS t4_r0, `trackers`.`name` AS t4_r1, `trackers`.`is_in_chlog` AS t4_r2, `trackers`.`position` AS t4_r3, `trackers`.`is_in_roadmap` AS t4_r4, `enumerations`.`id` AS t5_r0, `enumerations`.`name` AS t5_r1, `enumerations`.`position` AS t5_r2, `enumerations`.`is_default` AS t5_r3, `enumerations`.`type` AS t5_r4, `enumerations`.`active` AS t5_r5, `enumerations`.`project_id` AS t5_r6, `enumerations`.`parent_id` AS t5_r7, `issue_categories`.`id` AS t6_r0, `issue_categories`.`project_id` AS t6_r1, `issue_categories`.`name` AS t6_r2, `issue_categories`.`assigned_to_id` AS t6_r3, `versions`.`id` AS t7_r0, `versions`.`project_id` AS t7_r1, `versions`.`name` AS t7_r2, `versions`.`description` AS t7_r3, `versions`.`effective_date` AS t7_r4, `versions`.`created_on` AS t7_r5, `versions`.`updated_on` AS t7_r6, `versions`.`wiki_page_title` AS t7_r7, `versions`.`status` AS t7_r8, `versions`.`sharing` AS t7_r9 FROM `issues` LEFT OUTER JOIN `projects` ON `projects`.id = `issues`.project_id LEFT OUTER JOIN `issue_statuses` ON `issue_statuses`.id = `issues`.status_id LEFT OUTER JOIN `users` ON `users`.id = `issues`.assigned_to_id AND (`users`.`type` = 'User' OR `users`.`type` = 'AnonymousUser' ) LEFT OUTER JOIN `trackers` ON `trackers`.id = `issues`.tracker_id LEFT OUTER JOIN `enumerations` ON `enumerations`.id = `issues`.priority_id AND (`enumerations`.`type` = 'IssuePriority' ) LEFT OUTER JOIN `issue_categories` ON `issue_categories`.id = `issues`.category_id LEFT OUTER JOIN `versions` ON `versions`.id = `issues`.fixed_version_id WHERE (((issue_statuses.is_closed=0) AND projects.id = 7)) AND (projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) ORDER BY issues.id DESC

Select from debug log with extra filters:

Error executing the ref_issues macro (Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND (issue_statuses.is_closed=0) AND projects.id = 7)) AND (projects.status=1 ' at line 1: SELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `issue_statuses`.`id` AS t2_r0, `issue_statuses`.`name` AS t2_r1, `issue_statuses`.`is_closed` AS t2_r2, `issue_statuses`.`is_default` AS t2_r3, `issue_statuses`.`position` AS t2_r4, `issue_statuses`.`default_done_ratio` AS t2_r5, `users`.`id` AS t3_r0, `users`.`login` AS t3_r1, `users`.`hashed_password` AS t3_r2, `users`.`firstname` AS t3_r3, `users`.`lastname` AS t3_r4, `users`.`mail` AS t3_r5, `users`.`admin` AS t3_r6, `users`.`status` AS t3_r7, `users`.`last_login_on` AS t3_r8, `users`.`language` AS t3_r9, `users`.`auth_source_id` AS t3_r10, `users`.`created_on` AS t3_r11, `users`.`updated_on` AS t3_r12, `users`.`type` AS t3_r13, `users`.`identity_url` AS t3_r14, `users`.`mail_notification` AS t3_r15, `users`.`salt` AS t3_r16, `trackers`.`id` AS t4_r0, `trackers`.`name` AS t4_r1, `trackers`.`is_in_chlog` AS t4_r2, `trackers`.`position` AS t4_r3, `trackers`.`is_in_roadmap` AS t4_r4, `enumerations`.`id` AS t5_r0, `enumerations`.`name` AS t5_r1, `enumerations`.`position` AS t5_r2, `enumerations`.`is_default` AS t5_r3, `enumerations`.`type` AS t5_r4, `enumerations`.`active` AS t5_r5, `enumerations`.`project_id` AS t5_r6, `enumerations`.`parent_id` AS t5_r7, `issue_categories`.`id` AS t6_r0, `issue_categories`.`project_id` AS t6_r1, `issue_categories`.`name` AS t6_r2, `issue_categories`.`assigned_to_id` AS t6_r3, `versions`.`id` AS t7_r0, `versions`.`project_id` AS t7_r1, `versions`.`name` AS t7_r2, `versions`.`description` AS t7_r3, `versions`.`effective_date` AS t7_r4, `versions`.`created_on` AS t7_r5, `versions`.`updated_on` AS t7_r6, `versions`.`wiki_page_title` AS t7_r7, `versions`.`status` AS t7_r8, `versions`.`sharing` AS t7_r9 FROM `issues` LEFT OUTER JOIN `projects` ON `projects`.id = `issues`.project_id LEFT OUTER JOIN `issue_statuses` ON `issue_statuses`.id = `issues`.status_id LEFT OUTER JOIN `users` ON `users`.id = `issues`.assigned_to_id AND (`users`.`type` = 'User' OR `users`.`type` = 'AnonymousUser' ) LEFT OUTER JOIN `trackers` ON `trackers`.id = `issues`.tracker_id LEFT OUTER JOIN `enumerations` ON `enumerations`.id = `issues`.priority_id AND (`enumerations`.`type` = 'IssuePriority' ) LEFT OUTER JOIN `issue_categories` ON `issue_categories`.id = `issues`.category_id LEFT OUTER JOIN `versions` ON `versions`.id = `issues`.fixed_version_id WHERE ((() AND (issue_statuses.is_closed=0) AND projects.id = 7)) AND (projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) ORDER BY issues.id DESC)

There are empty brackets

... ON `versions`.id = `issues`.fixed_version_id WHERE ((() AND (issue_statuses.is_closed=0) AND ..

redmine extra query operators plugin: http://www.redmine.org/plugins/redmine_extra_query_operators

History

#1

Updated by Haru Iida almost 8 years ago

  • Assignee set to Tomohisa Kusukawa
#2

Updated by Tomohisa Kusukawa almost 8 years ago

  • Status changed from 新規(New) to 担当(Assigned)
#3

Updated by Tomohisa Kusukawa almost 8 years ago

  • Status changed from 担当(Assigned) to フィードバック(Reopend)
  • Assignee changed from Tomohisa Kusukawa to Tony Marschall

redmine_extra_query_operators does not work on my environment that hasn't wiki_extensions.
(redmine1.2.0, Rails2.3.11, ruby 1.8.7)

redmine_extra_query_operators Ver0.0.3
It doesn't work "Apply" and "Save" link in Issues list.

redmine_extra_query_operators Ver0.0.4
It makes Internal error when click issues tab.

Processing IssuesController#index (for 192.168.1.61 at 2011-11-13 12:17:50) [GET]
  Parameters: {"project_id"=>"prj1", "action"=>"index", "controller"=>"issues"}
Rendering template within layouts/base
Rendering issues/index.rhtml

ActionView::TemplateError (undefined method `value_for' for #<Query:0xb6df3f84>) on line #148 of vendor/plugins/redmine_extra_query_operators_v004/app/views/queries/_filters.rhtml:
145:                <span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field), :size => 3, :class => "values_#{field}" %> <%= l(:label_eqo_mw_tip) %></span>
146:            <%# VVK end %>
147:     <% when :string, :text %>
148:         <span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field), :class => "values_#{field}", :id => "values_#{field}", :size => 30 %></span>
149:     <% when :integer, :float %>
150:         <span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field), :class => "values_#{field}", :id => "values_#{field}_1", :size => 6 %></span>
151:         <span class="span_values_<%= field %>"><%= text_field_tag "v[#{field}][]", query.value_for(field, 1), :class => "values_#{field}", :id => "values_#{field}_2", :size => 6 %></span>

    vendor/plugins/redmine_extra_query_operators_v004/app/views/queries/_filters.rhtml:148:in `_run_rhtml_vendor47plugins47redmine_extra_query_operators_v00447app47views47queries47_filters46rhtml_locals_filters_object_query'
    vendor/plugins/redmine_extra_query_operators_v004/app/views/queries/_filters.rhtml:121:in `each'
    vendor/plugins/redmine_extra_query_operators_v004/app/views/queries/_filters.rhtml:121:in `_run_rhtml_vendor47plugins47redmine_extra_query_operators_v00447app47views47queries47_filters46rhtml_locals_filters_object_query'
    app/views/issues/index.rhtml:17:in `_run_rhtml_app47views47issues47index46rhtml'
    app/views/issues/index.rhtml:11:in `_run_rhtml_app47views47issues47index46rhtml'
    app/controllers/issues_controller.rb:91:in `index'
    app/controllers/issues_controller.rb:90:in `index'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /work/redmine-trunk2/public/500.html (500 Internal Server Error)

#4

Updated by Tony Marschall almost 8 years ago

Same error here. I have setup a github repos with patches from forum to work with current stable version

https://github.com/tonymarschall/redmine_extra_query_operators

#5

Updated by Tony Marschall almost 8 years ago

This patch solves my problem. Its only for redmine_extra_query_operators plugin. Do not know how to build a generic solution for this problem.

user@dev:/var/www/default-ssl/dev14# diff vendor/plugins/redmine_wiki_extensions/lib/wiki_extensions_ref_issue.rb ../dev13/vendor/plugins/redmine_wiki_extensions/lib/wiki_extensions_ref_issue.rb 
250,265d249
<       when "t>" 
<         sql = "#{db_table}.#{db_field} > '%s'" % [connection.quoted_date((( Date.parse(value.first) rescue Date.today )).to_time.end_of_day)]
<       when "t<" 
<         sql = "#{db_table}.#{db_field} < '%s'" % [connection.quoted_date(( Date.parse(value.first) rescue Date.today ).to_time.at_beginning_of_day)]
<       when "t><" 
<         sql = "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(( Date.parse(value[0]) rescue Date.today ).to_time.at_beginning_of_day), connection.quoted_date(( Date.parse(value[1]) rescue Date.today ).to_time.end_of_day)]
<       when "tm=" 
<         from=Time.now.at_beginning_of_month.months_ago(value.first.to_i*-1)
<         to=from.at_end_of_month
<         sql = "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(to)]
<       when "tw=" 
<         from=Time.now.at_beginning_of_week+(value.first.to_i).week
<         to=Time.now.at_end_of_week+(value.first.to_i).week
<         sql = "#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [connection.quoted_date(from), connection.quoted_date(to)]
<       when "=r" 
<         sql = "#{db_table}.#{db_field} RLIKE '#{connection.quote_string(value.first.to_s)}'" 

Also available in: Atom PDF