From 0f1a8a3997f88510fb5a8e035d01ebef9c46f5e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Feb 2020 13:01:07 +0100 Subject: [PATCH] Implement min and max for generic graph --- htdocs/core/customreports.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index fbac65a1942..dca4da544c9 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -351,6 +351,14 @@ if (! empty($search_measures) && ! empty($search_xaxis)) $tmpval = preg_replace('/\-average$/', '', $val); $sql .= 'AVG('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', '; } + elseif (preg_match('/\-min$/', $val)) { + $tmpval = preg_replace('/\-min$/', '', $val); + $sql .= 'MIN('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', '; + } + elseif (preg_match('/\-max$/', $val)) { + $tmpval = preg_replace('/\-max$/', '', $val); + $sql .= 'MAX('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', '; + } } $sql = preg_replace('/,\s*$/', '', $sql); $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';