redmine 4.2.3 error on tickets with subtasks

Added by hsc solutions 7 months ago

Hi everyone,
we recently migrated to redmine 4.2.3 and encountered an error with Tickets having subtasks.

We got the following error (ending up in http 500 error):

Unknown column 'issues.is_closed' in 'order clause': SELECT COUNT(`issues`.`id`) AS count_id, `is_closed` AS is_closed FROM `issues` INNER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` INNER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` WHERE `issues`.`root_id` = 28341 AND (issues.lft > 125 AND issues.rgt < 150) AND (projects.status <> 9 AND EXISTS (SELECT 1 AS one FROM enabled_modules em WHERE em.project_id = AND'issue_tracking')) GROUP BY `is_closed` ORDER BY `issues`.`is_closed` ASC):
    110: </div>
    111: <p>
    112:   <strong><%=l(:label_subtask_plural)%></strong>
    113:   <%= render_descendants_stats(@issue) unless @issue.leaf? %>
    114: </p>
    115: <%= form_tag({}, :data => {:cm_url => issues_context_menu_path}) do %>
    116: <%= render_descendants_tree(@issue) unless @issue.leaf? %>

app/helpers/issues_helper.rb:149:in `render_descendants_stats'
app/views/issues/show.html.erb:113:in `_3816cc2767ebce33b1776af4cb28388a'
app/controllers/issues_controller.rb:112:in `block (2 levels) in show'
app/controllers/issues_controller.rb:104:in `show'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

The mysql Statement seems to be wrong at the ORDER BY Statement:
... GROUP BY `is_closed` ORDER BY `issues`.`is_closed` ASC)
'issues'.'is_closed should be 'is_closed'.

Currently we "implemented" a workaround by removing the reorder statement on app/helpers/issues_helper.rb:149

    subtasks_grouped = issue.descendants.visible.joins(:status).select(:is_closed, :id).group(:is_closed).reorder(:is_closed).count(:id)


    subtasks_grouped = issue.descendants.visible.joins(:status).select(:is_closed, :id).group(:is_closed).count(:id)

At least here are our system specs:
  Redmine version                4.2.3.stable
  Ruby version                   2.7.3-p183 (2021-04-05) [x86_64-linux]
  Rails version                  5.2.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
  Subversion                     1.8.10
  Git                            2.1.4
Redmine plugins:
  custom_hsc_views               0.0.1
  redmine_agile                  1.6.2
  redmine_base_deface            1.5.3
  redmine_checklists             3.1.19
  redmine_cms                    1.2.2
  redmine_contacts               4.3.4
  redmine_contacts_helpdesk      4.1.12
  redmine_customize_core_fields  1.0.0
  redmine_more_previews          2.0.7
  redmine_wiki_sql               0.0.1
  that_email_log                 0.0.4
  timelog_timer                  2.0.0
  view_customize                 2.1.0

I dont know hopw to fix this properly. Does anyone encountered the same error?