Redmine日历视图不工作

时间:2014-04-09 15:20:46

标签: mysql calendar redmine

我已经在Debian 7盒子上成功安装了Redmine。环境是:

Environment:
  Redmine version                2.5.1.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.17
  Environment                    production
  Database adapter               Mysql2
SCM:
  Git                            1.7.10.4
  Filesystem                     
Redmine plugins:
  scrum                          0.5.0

问题在于,当我点击"日历"选项卡,我收到以下错误:

  

500执行查询时发生错误并已记录。请将此错误报告给Redmine管理员。

我查看了Apache日志,这就是它所说的:

  

Query :: StatementInvalid:Mysql2 :: Error:Column' start_date' where子句不明确:SELECT issuesid AS t0_r0,issuestracker_id AS t0_r1,issuesproject_id AS t0_r2,{ {1}}。issues AS t0_r3,subjectissues AS t0_r4,descriptionissues AS t0_r5,due_date。{{1 AS t0_r6,issuescategory_id AS t0_r7,issuesstatus_id AS t0_r8,issuesassigned_to_id AS t0_r9,{{1 } {。{1}} AS t0_r10,issuespriority_id AS t0_r11,issuesfixed_version_id AS t0_r12,issuesauthor_id AS t0_r13,issueslock_version AS t0_r14,issuescreated_on AS t0_r15,issuesupdated_on AS t0_r16,issuesstart_date AS t0_r17,issuesdone_ratio AS t0_r18,issuesestimated_hours AS t0_r19,issuesparent_id AS t0_r20 ,issuesroot_id AS t0_r21,issueslft AS t0_r22,issuesrgt AS t0_r23,issues。{ {1}} AS t0_r24,is_privateissues AS t0_r25,closed_onissues AS t1_r0,sprint_idissues AS t1_r1,{ {1}}。position AS t1_r2,projectsid AS t1_r3,projectsname AS t1_r4,projects。{{1 AS t1_r5,descriptionprojects AS t1_r6,homepageprojects AS t1_r7,is_publicprojects AS t1_r8,{{1 } {。{1}} AS t1_r9,parent_idprojects AS t1_r10,created_onprojects AS t1_r11,updated_onprojects AS t1_r12,identifierprojects AS t1_r13,statusprojects AS t2_r0,lftprojects AS t2_r1,rgtprojects AS t2_r 2,inherit_membersprojects AS t2_r3,product_backlog_idissue_statuses AS t2_r4,idissue_statuses AS t2_r5,nameissue_statuses AS t3_r0,is_closedissue_statuses AS t3_r1,is_defaultissue_statuses AS t3_r2,positionissue_statuses AS t3_r3, default_done_ratiotrackers AS t3_r4,idtrackers AS t3_r5,nametrackers AS t4_r0,is_in_chlog。{{ 1}} AS t4_r1,trackersposition AS t4_r2,trackersis_in_roadmap AS t4_r3,trackersfields_bits AS t4_r4,{{ 1}}。users AS t4_r5,idusers AS t4_r6,loginusers AS t4_r7,hashed_password。{{1} } AS t4_r8,usersfirstname AS t4_r9,userslastname AS t4_r10,usersmail AS t4_r11,{{1} }。users AS t4_r12,adminusers AS t4_r13,statususers AS t4_r14,last_login_onusers AS t4_r15,languageusers AS t4_r16,auth_source_idusers AS t4_r17,created_onusers AS t5_r0,updated_onusers AS t5_r1,typeusers AS t5_r2,identity_urlusers AS t5_r3,mail_notificationusers AS t5_r4, saltusers AS t5_r5,must_change_passwdenumerations AS t5_r6,idenumerations AS t5_r7,name。{{ 1}} AS t5_r8,enumerationsposition AS t6_r0,enumerationsis_default AS t6_r1,enumerationstype AS t6_r2,{{ 1}}。enumerations AS t6_r3,activeenumerations AS t6_r4,project_idenumerations AS t6_r5,parent_id。{{1} } AS t6_r6,enumerationsposition_name AS t6_r7,sprintsid AS t6_r8, sprintsname AS t6_r9来自sprints内部加入description开启sprintsstart_date = sprintsend_date INNER JOIN sprints ON user_idsprints = project_idsprints LEFT OUTER JOIN created_on ON sprints。{{1} } = updated_onsprints LEFT OUTER JOIN is_product_backlog ON issuesissue_statuses = issue_statusesid LEFT OUTER JOIN {{ 1}} ON issuesstatus_id = projectsprojectsidissues IN(' IssuePriority') LEFT OUTER JOIN project_id ON trackerstrackers = idissues WHERE(projects.status<> 9 AND projects.id IN(SELECT em.project_id FROM enabled_modules em WHERE em.name =' issue_tracking'))AND((issues.status_id IN(SELECT id FROM issue_statuses WHERE is_closed = 0))AND项目。 id IN(1,2))AND(((start_date BETWEEN' 2014-03-30' AND' 2014-05-03')或(due_date BETWEEN' 2014- 03-30' AND' 2014-05-03')))

有任何线索吗?

2 个答案:

答案 0 :(得分:2)

Mysql2 ::错误:where子句中的列'start_date'不明确:

当你得到这个错误的时候,插件的列号名称与redmine列名相同。

例如:起始日期

插件列表

1.scrum 2.holidays

这两个插件具有相同的列名start_date。

所以一个解决方案是 1.转到calendars.controller并找到此行

events + = @ query.issues(:include => [:tracker,:assigned_to,:priority],                               :conditions => [“(( start_date BETWEEN?AND?)或(due_date BETWEEN?AND?))”,@ calendar.startdt,@ calendar.enddt,@ calendar.startdt,@ calendar.enddt]                               )

在此行中将start_date更改为issues.start_date。

所以应该看起来像..

events + = @ query.issues(:include => [:tracker,:assigned_to,:priority],                               :conditions => [“(( issues.start_date BETWEEN?AND?)或(due_date BETWEEN?AND?))”,@ calendar.startdt,@ calendar.enddt,@ calendar.startdt,@ calendar.enddt]                               )

重启服务器......

答案 1 :(得分:1)

您需要修改redmine / app / controller / calendar_controller.rb文件。

在start_date和due_date之前添加问题,如下所示:

events + = @ query.issues(:include => [:tracker,:assigned_to,:priority],                               :conditions => ["((issues.start_date BETWEEN?AND?)OR(issues.due_date BETWEEN?AND?))",@ calendar.startdt,@ calendar.enddt,@ calendar.startdt,@ calendar.enddt ]                               )

并重启Redmine。