Project

General

Profile

Actions

Defect #17091

closed

Spent time report

Added by Daniel Wagner almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

If I try to add a required custom field which is defined as multi-valued list to a spent time report I get an "Redmine 500 error": Internal error.

I've already tried to mark the field as non-required, but without any effect on the error.

In the production.log I found the following additional messages regarding this error:

Started GET "/redmine/projects/project/time_entries/report?utf8=%E2%9C%93&f%5B%5D=spent_on&op%5Bspent_on%5D=*&f%5B%5D=&columns=month&criteria%5B%5D=cf_7" for 127.0.0.1 at 2014-06-04 14:39:32 +0200
Processing by TimelogController#report as HTML
  Parameters: {"utf8"=>"✓", "f"=>["spent_on", ""], "op"=>{"spent_on"=>"*"}, "columns"=>"month", "criteria"=>["cf_7"], "project_id"=>"project"}
  Current user: user (id=12)
Completed 500 Internal Server Error in 46.8ms

ActiveRecord::StatementInvalid (Mysql2::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 'AS , tyear AS tyear, tmonth AS tmonth, tweek AS tweek, spent_on AS spent_on FROM' at line 1: SELECT SUM(`time_entries`.`hours`) AS sum_hours,  AS , tyear AS tyear, tmonth AS tmonth, tweek AS tweek, spent_on AS spent_on FROM `time_entries` LEFT OUTER JOIN `projects` ON `projects`.`id` = `time_entries`.`project_id` LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `time_entries`.`activity_id` AND `enumerations`.`type` IN ('TimeEntryActivity') LEFT OUTER JOIN `issues` ON `issues`.`id` = `time_entries`.`issue_id` LEFT OUTER JOIN custom_values cf_7 ON cf_7.customized_type = 'Issue' AND cf_7.customized_id = issues.id AND cf_7.custom_field_id = 7 AND (((1=1) AND (issues.tracker_id IN (SELECT tracker_id FROM custom_fields_trackers WHERE custom_field_id = 7)) AND (EXISTS (SELECT 1 FROM custom_fields ifa WHERE ifa.is_for_all = 1 AND ifa.id = 7) OR issues.project_id IN (SELECT project_id FROM custom_fields_projects WHERE custom_field_id = 7)))) AND cf_7.value <> '' AND cf_7.id = (SELECT max(cf_7_2.id) FROM custom_values cf_7_2 WHERE cf_7_2.customized_type = cf_7.customized_type AND cf_7_2.customized_id = cf_7.customized_id AND cf_7_2.custom_field_id = cf_7.custom_field_id) WHERE (projects.status <> 9 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='time_tracking')) AND ((time_entries.spent_on IS NOT NULL) AND projects.id = 135) GROUP BY tyear, tmonth, tweek, spent_on):
  lib/redmine/helpers/time_report.rb:48:in `run'
  lib/redmine/helpers/time_report.rb:35:in `initialize'
  app/controllers/timelog_controller.rb:83:in `new'
  app/controllers/timelog_controller.rb:83:in `report'

Our installation is as follows:

Environment:
  Redmine version                2.5.1.stable
  Ruby version                   1.9.3-p231 (2012-05-25) [i386-mingw32]
  Rails version                  3.2.17
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.5
  Git                            1.9.0
  Filesystem                     
Redmine plugins:
  redmine_wiki_lists             0.0.3

Database is

5.5.36 MySQL Community Server (GPL)


Related issues

Is duplicate of Redmine - Defect #16519: Generating a spent time report on a list type custom field with multiple values causes an invalid SQL errorClosedJean-Philippe Lang

Actions
Actions #1

Updated by Daniel Wagner almost 10 years ago

Seems that the (generated?) SQL has an unneeded ", AS " in its SELECT clause.

Actions #2

Updated by Daniel Wagner almost 10 years ago

I was able to reproduce the issue on a fresh installation of Bitnami Redmine 2.5.1-1.

If I change the custom field so that multiple values aren't allow, I can't reproduce the error any more.

Actions #3

Updated by Toshi MARUYAMA almost 10 years ago

  • Category set to Time tracking
Actions #4

Updated by Toshi MARUYAMA almost 10 years ago

  • Target version set to 2.5.2
Actions #5

Updated by Jean-Philippe Lang almost 10 years ago

  • Status changed from New to Closed
  • Target version deleted (2.5.2)
  • Resolution set to Duplicate

Sames as #16519, already fixed for 2.5.2

Actions #6

Updated by Jean-Philippe Lang almost 10 years ago

  • Is duplicate of Defect #16519: Generating a spent time report on a list type custom field with multiple values causes an invalid SQL error added
Actions

Also available in: Atom PDF