1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Updates for deleting activities when purging clients

This commit is contained in:
David Bomba 2023-07-16 16:36:52 +10:00
parent 073948facf
commit af8a788dfb
3 changed files with 7 additions and 2 deletions

View File

@ -347,6 +347,11 @@ class Client extends BaseModel implements HasLocalePreference
return $this->hasMany(Credit::class)->withTrashed();
}
public function purgeable_activities()
{
return $this->hasMany(Activity::class);
}
public function activities()
{
return $this->hasMany(Activity::class)->take(50)->orderBy('id', 'desc');

View File

@ -136,7 +136,7 @@ class ClientRepository extends BaseRepository
$client->projects()->forceDelete();
$client->credits()->forceDelete();
$client->quotes()->forceDelete();
$client->activities()->forceDelete();
$client->purgeable_activities()->forceDelete();
$client->recurring_invoices()->forceDelete();
$client->expenses()->forceDelete();
$client->recurring_expenses()->forceDelete();

View File

@ -148,7 +148,7 @@ class DeletePayment
$client
->service()
->updatePaidToDate(($paymentable_credit->pivot->amount) * -1)
// ->updatePaidToDate(($paymentable_credit->pivot->amount) * -1)
->adjustCreditBalance($paymentable_credit->pivot->amount)
->save();
});