mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01: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) {
|
||||
$dateFormat = $groupBy == 'DAYOFYEAR' ? 'z' : ($groupBy == 'WEEK' ? 'W' : 'n');
|
||||
if ($groupBy == 'DAYOFYEAR') {
|
||||
// MySQL returns 1-366 for DAYOFYEAR, whereas PHP returns 0-365
|
||||
$date = $groupBy == 'DAYOFYEAR' ? $d->format('Y').($d->format($dateFormat) + 1) : $d->format('Y'.$dateFormat);
|
||||
$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;
|
||||
|
||||
if ($entityType == ENTITY_INVOICE) {
|
||||
|
Loading…
Reference in New Issue
Block a user