From 422aa5b40783f17e6088b62b34ec8e1ef8d5c93a Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Fri, 26 Apr 2013 09:54:39 +0000 Subject: [PATCH] #715 Finalized the fix (added the year for group by day, but it is not displayed) SVN:trunk[2703] --- application/dashlet.class.inc.php | 2 +- core/expression.class.inc.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index 638baf2d9e..e0c0627040 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -468,7 +468,7 @@ abstract class DashletGroupBy extends Dashlet case 'day_of_month': $sGroupByLabel = Dict::Format('UI:DashletGroupBy:Prop-GroupBy:DayOfMonth', $sAttLabel); - $sGroupByExpr = "DATE_FORMAT($sClassAlias.$sAttCode, '%m-%d')"; // mm-dd + $sGroupByExpr = "DATE_FORMAT($sClassAlias.$sAttCode, '%Y-%m-%d')"; // mm-dd break; default: diff --git a/core/expression.class.inc.php b/core/expression.class.inc.php index 6bee1a324f..1ae3ba1a06 100644 --- a/core/expression.class.inc.php +++ b/core/expression.class.inc.php @@ -926,15 +926,15 @@ class FunctionExpression extends Expression } elseif ($oFormatExpr->Render() == "'%Y-%m'") { - // yyyy-mm + // yyyy-mm => "yyyy month" $iMonth = (int) substr($sValue, -2); // the two last chars $sRes = substr($sValue, 0, 4).' '.$aMonthToString[$iMonth]; } - elseif ($oFormatExpr->Render() == "'%m-%d'") + elseif ($oFormatExpr->Render() == "'%Y-%m-%d'") { - // mm-dd - $iMonth = (int) substr($sValue, 0, 2); // the two first chars - $sRes = $aMonthToString[$iMonth].' '.substr($sValue, -2); + // yyyy-mm-dd => "month d" + $iMonth = (int) substr($sValue, 5, 2); + $sRes = $aMonthToString[$iMonth].' '.(int)substr($sValue, -2); } } return $sRes;