mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 11:07:31 -04:00 
			
		
		
		
	
						commit
						0b2d4e7554
					
				| @ -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'); | ||||||
| @ -357,7 +349,7 @@ class CheckData extends Command | |||||||
| 
 | 
 | ||||||
|         Client::cursor()->each(function ($client) use($wrong_balances){ |         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_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(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -192,7 +192,7 @@ class Client extends BaseModel implements HasLocalePreference | |||||||
| 
 | 
 | ||||||
|     public function invoices() |     public function invoices() | ||||||
|     { |     { | ||||||
|         return $this->hasMany(Invoice::class); |         return $this->hasMany(Invoice::class)->withTrashed(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function shipping_country() |     public function shipping_country() | ||||||
|  | |||||||
| @ -196,7 +196,7 @@ class Invoice extends BaseModel | |||||||
| 
 | 
 | ||||||
|     public function payments() |     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; |             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