diff --git a/app/Models/Client.php b/app/Models/Client.php index acd034b9643c..5896488cce73 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -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'); diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php index ec324ef6934d..f9abbd6fa88b 100644 --- a/app/Repositories/ClientRepository.php +++ b/app/Repositories/ClientRepository.php @@ -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(); diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index fb50797b64f5..98242ecb8543 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -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(); });