mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 13:04:30 -04:00
Fix for group by week on the dashboard
This commit is contained in:
parent
1619e893fa
commit
f5e7d380a4
@ -62,8 +62,15 @@ class DashboardRepository
|
|||||||
|
|
||||||
foreach ($period as $d) {
|
foreach ($period as $d) {
|
||||||
$dateFormat = $groupBy == 'DAYOFYEAR' ? 'z' : ($groupBy == 'WEEK' ? 'W' : 'n');
|
$dateFormat = $groupBy == 'DAYOFYEAR' ? 'z' : ($groupBy == 'WEEK' ? 'W' : 'n');
|
||||||
// MySQL returns 1-366 for DAYOFYEAR, whereas PHP returns 0-365
|
if ($groupBy == 'DAYOFYEAR') {
|
||||||
$date = $groupBy == 'DAYOFYEAR' ? $d->format('Y').($d->format($dateFormat) + 1) : $d->format('Y'.$dateFormat);
|
// MySQL returns 1-366 for DAYOFYEAR, whereas PHP returns 0-365
|
||||||
|
$date = $d->format('Y') . ($d->format($dateFormat) + 1);
|
||||||
|
} elseif ($groupBy == 'WEEK' && ($d->format($dateFormat) < 10)) {
|
||||||
|
// PHP zero pads the week
|
||||||
|
$date = $d->format('Y') . round($d->format($dateFormat));
|
||||||
|
} else {
|
||||||
|
$date = $d->format('Y'.$dateFormat);
|
||||||
|
}
|
||||||
$records[] = isset($data[$date]) ? $data[$date] : 0;
|
$records[] = isset($data[$date]) ? $data[$date] : 0;
|
||||||
|
|
||||||
if ($entityType == ENTITY_INVOICE) {
|
if ($entityType == ENTITY_INVOICE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user