mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 07:57:33 -05:00 
			
		
		
		
	Fixes for checkdata
This commit is contained in:
		
							parent
							
								
									61c3a3f57e
								
							
						
					
					
						commit
						0fd97f3a03
					
				@ -76,9 +76,6 @@ class CheckData extends Command
 | 
				
			|||||||
            config(['database.default' => $database]);
 | 
					            config(['database.default' => $database]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! $this->option('client_id')) {
 | 
					 | 
				
			||||||
            $this->checkPaidToDate();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->checkInvoiceBalances();
 | 
					        $this->checkInvoiceBalances();
 | 
				
			||||||
        $this->checkInvoicePayments();
 | 
					        $this->checkInvoicePayments();
 | 
				
			||||||
@ -286,11 +283,6 @@ class CheckData extends Command
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function checkPaidToDate()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        //Check the client paid to date value matches the sum of payments by the client
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private function checkInvoiceBalances()
 | 
					    private function checkInvoiceBalances()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -327,7 +319,7 @@ class CheckData extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
           $total_invoice_payments = 0;
 | 
					           $total_invoice_payments = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            foreach($client->invoices->where('is_deleted', false) as $invoice)
 | 
					            foreach($client->invoices as $invoice)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                $total_amount = $invoice->payments->sum('pivot.amount');
 | 
					                $total_amount = $invoice->payments->sum('pivot.amount');
 | 
				
			||||||
                $total_refund = $invoice->payments->sum('pivot.refunded');
 | 
					                $total_refund = $invoice->payments->sum('pivot.refunded');
 | 
				
			||||||
@ -387,8 +379,8 @@ class CheckData extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        foreach(Client::cursor() as $client)
 | 
					        foreach(Client::cursor() as $client)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            $invoice_balance = $client->invoices->where('is_deleted', false)->sum('balance');
 | 
					            $invoice_balance = $client->invoices->sum('balance');
 | 
				
			||||||
            $invoice_amounts = $client->invoices->where('is_deleted', false)->sum('amount') - $invoice_balance;
 | 
					            $invoice_amounts = $client->invoices->sum('amount') - $invoice_balance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
 | 
					            $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -84,12 +84,9 @@ class InvoiceRepository extends BaseRepository
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoice->is_deleted = true;
 | 
					        $invoice->service()->handleCancellation()->save();
 | 
				
			||||||
        $invoice->save();
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $invoice->delete();
 | 
					        $invoice = $this->invoice_repo->delete($invoice);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        event(new InvoiceWasDeleted($invoice, $invoice->company));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $invoice;
 | 
					        return $invoice;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -12,8 +12,8 @@ return [
 | 
				
			|||||||
    'require_https' => env('REQUIRE_HTTPS', true),
 | 
					    'require_https' => env('REQUIRE_HTTPS', true),
 | 
				
			||||||
    'app_url' => env('APP_URL', ''),
 | 
					    'app_url' => env('APP_URL', ''),
 | 
				
			||||||
    'app_domain' => env('APP_DOMAIN', ''),
 | 
					    'app_domain' => env('APP_DOMAIN', ''),
 | 
				
			||||||
    'app_version' => '5.0.11',
 | 
					    'app_version' => '5.0.12',
 | 
				
			||||||
    'minimum_client_version' => '5.0.11',
 | 
					    'minimum_client_version' => '5.0.12',
 | 
				
			||||||
    'terms_version' => '1.0.1',
 | 
					    'terms_version' => '1.0.1',
 | 
				
			||||||
    'api_secret' => env('API_SECRET', ''),
 | 
					    'api_secret' => env('API_SECRET', ''),
 | 
				
			||||||
    'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'),
 | 
					    'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user