mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 07:07:31 -04:00 
			
		
		
		
	
						commit
						0b2d4e7554
					
				| @ -76,9 +76,6 @@ class CheckData extends Command | ||||
|             config(['database.default' => $database]); | ||||
|         } | ||||
| 
 | ||||
|         if (! $this->option('client_id')) { | ||||
|             $this->checkPaidToDate(); | ||||
|         } | ||||
| 
 | ||||
|         $this->checkInvoiceBalances(); | ||||
|         $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() | ||||
|     { | ||||
| 
 | ||||
| @ -327,7 +319,7 @@ class CheckData extends Command | ||||
| 
 | ||||
|            $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_refund = $invoice->payments->sum('pivot.refunded'); | ||||
| @ -357,7 +349,7 @@ class CheckData extends Command | ||||
| 
 | ||||
|         Client::cursor()->each(function ($client) use($wrong_balances){ | ||||
| 
 | ||||
|             $client->invoices->where('is_deleted', false)->each(function ($invoice) use($wrong_balances){ | ||||
|             $client->invoices->where('is_deleted', false)->each(function ($invoice) use($wrong_balances, $client){ | ||||
| 
 | ||||
|                 $total_amount = $invoice->payments->sum('pivot.amount'); | ||||
|                 $total_refund = $invoice->payments->sum('pivot.refunded'); | ||||
| @ -387,8 +379,8 @@ class CheckData extends Command | ||||
| 
 | ||||
|         foreach(Client::cursor() as $client) | ||||
|         { | ||||
|             $invoice_balance = $client->invoices->where('is_deleted', false)->sum('balance'); | ||||
|             $invoice_amounts = $client->invoices->where('is_deleted', false)->sum('amount') - $invoice_balance; | ||||
|             $invoice_balance = $client->invoices->sum('balance'); | ||||
|             $invoice_amounts = $client->invoices->sum('amount') - $invoice_balance; | ||||
| 
 | ||||
|             $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first(); | ||||
| 
 | ||||
|  | ||||
| @ -192,7 +192,7 @@ class Client extends BaseModel implements HasLocalePreference | ||||
| 
 | ||||
|     public function invoices() | ||||
|     { | ||||
|         return $this->hasMany(Invoice::class); | ||||
|         return $this->hasMany(Invoice::class)->withTrashed(); | ||||
|     } | ||||
| 
 | ||||
|     public function shipping_country() | ||||
|  | ||||
| @ -196,7 +196,7 @@ class Invoice extends BaseModel | ||||
| 
 | ||||
|     public function payments() | ||||
|     { | ||||
|         return $this->morphToMany(Payment::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps(); | ||||
|         return $this->morphToMany(Payment::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps()->withTrashed(); | ||||
|         ; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -84,12 +84,9 @@ class InvoiceRepository extends BaseRepository | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         $invoice->is_deleted = true; | ||||
|         $invoice->save(); | ||||
| 
 | ||||
|         $invoice->delete(); | ||||
| 
 | ||||
|         event(new InvoiceWasDeleted($invoice, $invoice->company)); | ||||
|         $invoice->service()->handleCancellation()->save(); | ||||
|          | ||||
|         $invoice = $this->invoice_repo->delete($invoice); | ||||
| 
 | ||||
|         return $invoice; | ||||
|     } | ||||
|  | ||||
| @ -12,8 +12,8 @@ return [ | ||||
|     'require_https' => env('REQUIRE_HTTPS', true), | ||||
|     'app_url' => env('APP_URL', ''), | ||||
|     'app_domain' => env('APP_DOMAIN', ''), | ||||
|     'app_version' => '5.0.11', | ||||
|     'minimum_client_version' => '5.0.11', | ||||
|     'app_version' => '5.0.12', | ||||
|     'minimum_client_version' => '5.0.12', | ||||
|     'terms_version' => '1.0.1', | ||||
|     'api_secret' => env('API_SECRET', ''), | ||||
|     'google_maps_api_key' => env('GOOGLE_MAPS_API_KEY'), | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user