Skip to content

Commit e93a437

Browse files
authored
Merge pull request #3242 from jeedom/fix/history-range-with-grouping
implode groupingType if is array
2 parents 70361c4 + 67bda28 commit e93a437

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

core/ajax/cmd.ajax.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@
246246
}
247247

248248
if (init('action') == 'byEqLogic') {
249-
if (init('typeCmd')) {
250-
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'), init('typeCmd'))));
251-
} else {
252-
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'))));
253-
}
254-
}
249+
if (init('typeCmd')) {
250+
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'), init('typeCmd'))));
251+
} else {
252+
ajax::success(utils::o2a(cmd::byEqLogicId(init('eqLogic_id'))));
253+
}
254+
}
255255

256256
if (init('action') == 'getCmd') {
257257
$cmd = cmd::byId(init('id'));
@@ -422,6 +422,13 @@
422422
}
423423
$return['derive'] = $derive;
424424
$groupingType = init('groupingType');
425+
if (is_array($groupingType)) {
426+
if (isset($groupingType['function']) && isset($groupingType['time'])) {
427+
$groupingType = $groupingType['function'] . '::' . $groupingType['time'];
428+
} else {
429+
$groupingType = implode('::', array_values($groupingType));
430+
}
431+
}
425432
if ($groupingType == '') {
426433
$groupingType = $cmd->getDisplay('groupingType');
427434
}
@@ -497,7 +504,7 @@
497504
if (init('action') == 'getLastHistory') {
498505
$cmd = cmd::byId(init('id'));
499506
$_time = date('Y-m-d H:i:s', strtotime(init('time')));
500-
if(is_object($cmd)){
507+
if (is_object($cmd)) {
501508
ajax::success($cmd->getLastHistory($_time));
502509
} else {
503510
throw new Exception(__('Nombre maximum de niveaux d’éléments affichés dans les graphiques de liens', __FILE__) . ' ' . init('id'));

0 commit comments

Comments
 (0)