Search code examples
phpmysqlyiicrmmysql-5.6

list is not in GROUP BY clause and contains nonaggregated column in X2CRM


I have created a custom module in X2CRM. Then, I created a new record in that module and logged time using the Log Time widget. Ultimately, when I retrieve the same record by clicking on that record name from the All records view, it throws the following error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #7 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'x2_db.x2_actions.complete' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

I have seen similar issue with other frameworks on Google, but this one is the builtin code generator module (which I created from the Admin area). So, those solution do not work for this CRM.

I have reviewed the logs but found nothing there.

Update:

I have found in the stack trace that the call to this SQL is being sent from the following line in source code:

ActionHistoryChartWidget::getChartData('1675792337', 1675967470, '8', 'tasks', NULL)


Solution

  • Apparently, this is related to MySQL where the Group BY clause is not corresponding to the data in SELECT clause. So, you will need to synchronize the select data and the remaining items in the query.

    As a quick workaround, as I can see that the

    getChartData()

    function is causing the issue, you can open another record view from the same module and disable the Charts widget. You can do this first by hiding the Charts Widget. If that does not work, then you can simply delete this widget from the detail view page (for now). You can do so by clicking on X icon for that widget.

    Then, you CRM will start to work!