Defect #4788

issue filter with custom fields failed after upgrade to 0.9.2

Added by Mikhail Grinfeld almost 12 years ago. Updated almost 11 years ago.

Status:ClosedStart date:2010-02-10
Priority:NormalDue date:
Assignee:Eric Davis% Done:

0%

Category:Issues
Target version:-
Resolution:Invalid Affected version:

Description

Hi,

I upgraded our company redmine from 0.8.6 to 0.9.1 and then to 0.9.2

When I tried to run some of saved queries I got internal error page. After some investigation I found that only queries filtering with custom fields failed.

Here redmine log:

Processing IssuesController#index (for 192.168.1.112 at 2010-02-10 10:38:15) [GET]
  Parameters: {"project_id"=>"telemessage", "action"=>"index", "controller"=>"issues", "query_id"=>"43"}

ArgumentError (wrong number of arguments (6 for 5)):
  app/models/query.rb:392:in `sql_for_field'
  app/models/query.rb:392:in `statement'
  app/models/query.rb:374:in `each_key'
  app/models/query.rb:374:in `statement'
  app/models/query.rb:413:in `issue_count'
  app/controllers/issues_controller.rb:69:in `index'
  C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
  C:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering c:/TeleMessage/redmine-0.8.1/public/500.html (500 Internal Server Error)

We have following configuration:

Ruby version              1.8.6 (i386-mingw32)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Database adapter          mysql
Database schema version   20091227112908

MySQL Community Server 5.051
Microsoft Windows 2008 Server

Any help will be helpfull :)
Mikhail Grinfeld

History

#1 Updated by Jean-Philippe Lang almost 12 years ago

Can not reproduce. And I don't see how you can get this ArgumentError since #sql_for_field actually accepts 6 arguments.
Please retry with a fresh Redmine 0.9.2 code:

Rendering c:/TeleMessage/redmine-0.8.1/public/500.html (500 Internal Server Error)

#2 Updated by Mikhail Grinfeld almost 12 years ago

Thx, Jean-Philippe,

I install fresh copy and everything was OK. I began to install plug-ins one by one and found that after installing last version of question plug-in caused problems

So, next time I need to be careful with plug-ins after upgrade.

Again, thx
Redmine is great tool.

#3 Updated by Jean-Philippe Lang almost 12 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

Thanks for your feedback.

#4 Updated by Adrian Citu about 11 years ago

Hi Jean-Philippe, Mikhail,

I have encountered the same problem with Redmine version 1.0.1 and the questions plugin v0.3. With a bit of luck, I've solved the bug and then understood the mystery: the questions plugin uses an alias that replaces the original sql_for_field with a wrapper function whose prototype has 5 parameters.

This is the file:

vendor/plugins/question_plugin/lib/question_query_patch.rb

And here is the alias:

alias_method :sql_for_field_before_question, :sql_for_field
alias_method :sql_for_field, :question_sql_for_field

The fix - for me - was to correct the prototype of the sql_for_field_before_question wrapper as in the following patch:

--- vendor/plugins/question_plugin/lib/question_query_patch.rb.PATCHED    2011-01-13 06:23:42.000000000 -0800
+++ vendor/plugins/question_plugin/lib/question_query_patch.rb.ORIGINAL    2011-01-13 06:14:38.000000000 -0800
@@ -60,7 +60,7 @@
     end

     # Wrapper for +sql_for_field+ so Questions can use a different table than Issues
-    def question_sql_for_field(field, operator, v, db_table, db_field, is_custom_filter=false)
+    def question_sql_for_field(field, v, db_table, db_field, is_custom_filter)
       if field == "question_assigned_to_id" || field == "question_asked_by_id" 
         v = values_for(field).clone

@@ -85,7 +85,7 @@
         return sql

       else
-        return sql_for_field_before_question(field, operator, v, db_table, db_field, is_custom_filter)
+        return sql_for_field_before_question(field, v, db_table, db_field, is_custom_filter)
       end

     end

Best regards,
Adrian

#5 Updated by Siegfried Vogel almost 11 years ago

  • Status changed from Closed to Reopened
  • Assignee set to Eric Davis

Eric,
could you please add this patch to the next version of Question Plugin?
Thank you.

#6 Updated by Etienne Massip almost 11 years ago

  • Status changed from Reopened to Closed

Closed as this is not a vanilla Redmine issue, please see with Eric on github for plugin support.

Also available in: Atom PDF