mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 21:47:32 -05: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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user