--- /usr/share/zabbix/include/classes/api/services/CEvent.php.bak 2020-04-22 09:38:21.697304436 +0900 +++ /usr/share/zabbix/include/classes/api/services/CEvent.php 2020-04-22 09:51:20.654288996 +0900 @@ -471,6 +471,10 @@ $sqlParts['limit'] = $options['limit']; } + if (array_key_exists('distinct', $options)) { + $sqlParts['distinct'] = $options['distinct']; + } + $result = []; $sqlParts = $this->applyQueryOutputOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts); --- /usr/share/zabbix/include/classes/screens/CScreenProblem.php.bak 2020-04-22 09:43:12.454298672 +0900 +++ /usr/share/zabbix/include/classes/screens/CScreenProblem.php 2020-04-22 09:51:24.452288920 +0900 @@ -302,6 +302,9 @@ unset($options['suppressed']); $options['selectSuppressionData'] = ['maintenanceid', 'suppress_until']; } + if (array_key_exists('distinct', $filter)) { + $options['distinct'] = $filter['distinct']; + } $problems = ($filter['show'] == TRIGGERS_OPTION_ALL) ? self::getDataEvents($options) --- /usr/share/zabbix/include/db.inc.php.bak 2020-04-22 09:45:46.907295611 +0900 +++ /usr/share/zabbix/include/db.inc.php 2020-04-22 09:50:50.176289600 +0900 @@ -667,6 +667,10 @@ } function zbx_db_distinct($sql_parts) { + if (array_key_exists('distinct', $sql_parts)) { + return $sql_parts['distinct'] ? ' DISTINCT' : ''; + } + $count = count($sql_parts['from']); if (array_key_exists('left_join', $sql_parts)) { $count += count($sql_parts['left_join']); --- /usr/share/zabbix/include/events.inc.php.bak 2020-04-22 09:52:41.054287402 +0900 +++ /usr/share/zabbix/include/events.inc.php 2020-04-22 09:53:21.908286592 +0900 @@ -475,7 +475,8 @@ 'value' => TRIGGER_VALUE_TRUE, 'sortfield' => ['eventid'], 'sortorder' => ZBX_SORT_DOWN, - 'limit' => ZBX_WIDGET_ROWS + 'limit' => ZBX_WIDGET_ROWS, + 'distinct' => false ]); CArrayHelper::sort($problems, [