From 09e32ad262ed653f7054581bfe355ac583cbb11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:52:52 +0300 Subject: [PATCH 1/2] include 'taxes' in cloneable_relations for recurring transactions --- app/Console/Commands/RecurringCheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/RecurringCheck.php b/app/Console/Commands/RecurringCheck.php index fa1ae8f9b..cf5baa62a 100644 --- a/app/Console/Commands/RecurringCheck.php +++ b/app/Console/Commands/RecurringCheck.php @@ -223,7 +223,7 @@ class RecurringCheck extends Command protected function getTransactionModel(Transaction $template, Date $schedule_date): Transaction { - $template->cloneable_relations = []; + $template->cloneable_relations = ['taxes']; $model = $template->duplicate(); From 84ee8b123a5bbfefc9e62534e12088f554019b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Tue, 22 Apr 2025 19:55:33 +0300 Subject: [PATCH 2/2] fixed recurring cloneable relations type --- app/Console/Commands/RecurringCheck.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Console/Commands/RecurringCheck.php b/app/Console/Commands/RecurringCheck.php index cf5baa62a..1e8e56c1a 100644 --- a/app/Console/Commands/RecurringCheck.php +++ b/app/Console/Commands/RecurringCheck.php @@ -218,6 +218,8 @@ class RecurringCheck extends Command $model->created_from = 'core::recurring'; $model->save(); + $this->updateRelationTypes($model, $template->cloneable_relations); + return $model; } @@ -233,6 +235,8 @@ class RecurringCheck extends Command $model->created_from = 'core::recurring'; $model->save(); + $this->updateRelationTypes($model, $template->cloneable_relations); + return $model; } @@ -266,4 +270,15 @@ class RecurringCheck extends Command { return Str::replace('-recurring', '', $recurring_type); } + + public function updateRelationTypes($model, $relations) + { + foreach ($relations as $relation) { + if (! method_exists($model, $relation)) { + continue; + } + + $model->$relation()->update(['type' => $model->type]); + } + } }