mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:07:33 -05:00 
			
		
		
		
	Hide outstanding on dashboard from non-admins
This commit is contained in:
		
							parent
							
								
									614044364b
								
							
						
					
					
						commit
						d0232e00f6
					
				@ -80,8 +80,13 @@ class DashboardApiController extends BaseAPIController
 | 
				
			|||||||
            ->where('accounts.id', '=', Auth::user()->account_id)
 | 
					            ->where('accounts.id', '=', Auth::user()->account_id)
 | 
				
			||||||
            ->where('clients.is_deleted', '=', false)
 | 
					            ->where('clients.is_deleted', '=', false)
 | 
				
			||||||
            ->groupBy('accounts.id')
 | 
					            ->groupBy('accounts.id')
 | 
				
			||||||
            ->groupBy(DB::raw('CASE WHEN clients.currency_id IS NULL THEN CASE WHEN accounts.currency_id IS NULL THEN 1 ELSE accounts.currency_id END ELSE clients.currency_id END'))
 | 
					            ->groupBy(DB::raw('CASE WHEN clients.currency_id IS NULL THEN CASE WHEN accounts.currency_id IS NULL THEN 1 ELSE accounts.currency_id END ELSE clients.currency_id END'));
 | 
				
			||||||
            ->get();
 | 
					
 | 
				
			||||||
 | 
					        if (!$view_all) {
 | 
				
			||||||
 | 
					            $balances->where('clients.user_id', '=', $user_id);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $balances = $balances->get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $pastDue = DB::table('invoices')
 | 
					        $pastDue = DB::table('invoices')
 | 
				
			||||||
                    ->leftJoin('clients', 'clients.id', '=', 'invoices.client_id')
 | 
					                    ->leftJoin('clients', 'clients.id', '=', 'invoices.client_id')
 | 
				
			||||||
 | 
				
			|||||||
@ -82,8 +82,13 @@ class DashboardController extends BaseController
 | 
				
			|||||||
            ->where('accounts.id', '=', Auth::user()->account_id)
 | 
					            ->where('accounts.id', '=', Auth::user()->account_id)
 | 
				
			||||||
            ->where('clients.is_deleted', '=', false)
 | 
					            ->where('clients.is_deleted', '=', false)
 | 
				
			||||||
            ->groupBy('accounts.id')
 | 
					            ->groupBy('accounts.id')
 | 
				
			||||||
            ->groupBy(DB::raw('CASE WHEN clients.currency_id IS NULL THEN CASE WHEN accounts.currency_id IS NULL THEN 1 ELSE accounts.currency_id END ELSE clients.currency_id END'))
 | 
					            ->groupBy(DB::raw('CASE WHEN clients.currency_id IS NULL THEN CASE WHEN accounts.currency_id IS NULL THEN 1 ELSE accounts.currency_id END ELSE clients.currency_id END'));
 | 
				
			||||||
            ->get();
 | 
					
 | 
				
			||||||
 | 
					        if (!$view_all) {
 | 
				
			||||||
 | 
					            $balances->where('clients.user_id', '=', $user_id);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $balances = $balances->get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
 | 
					        $activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)
 | 
				
			||||||
                ->where('activities.activity_type_id', '>', 0);
 | 
					                ->where('activities.activity_type_id', '>', 0);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user