From e519234fe026fdabcd56db4d028daef15106bb67 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Aug 2023 08:24:30 +1000 Subject: [PATCH] v5.6.25 --- app/Models/Credit.php | 8 ++++---- .../Migration/PaymentMigrationRepository.php | 2 ++ app/Repositories/PaymentRepository.php | 2 +- app/Repositories/SubscriptionRepository.php | 2 ++ app/Repositories/TaskRepository.php | 9 ++++++--- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/Models/Credit.php b/app/Models/Credit.php index 0fb203bd38d3..12923bc4f555 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -57,11 +57,11 @@ use Laracasts\Presenter\PresentableTrait; * @property string|null $private_notes * @property string|null $terms * @property string|null $tax_name1 - * @property string $tax_rate1 + * @property float $tax_rate1 * @property string|null $tax_name2 - * @property string $tax_rate2 + * @property float $tax_rate2 * @property string|null $tax_name3 - * @property string $tax_rate3 + * @property float $tax_rate3 * @property string $total_taxes * @property int $uses_inclusive_taxes * @property string|null $custom_value1 @@ -90,7 +90,7 @@ use Laracasts\Presenter\PresentableTrait; * @property string|null $reminder2_sent * @property string|null $reminder3_sent * @property string|null $reminder_last_sent - * @property string $paid_to_date + * @property float $paid_to_date * @property int|null $subscription_id * @property-read \Illuminate\Database\Eloquent\Collection $activities * @property-read int|null $activities_count diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index c5de18c89ecd..762944609f83 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -146,6 +146,8 @@ class PaymentMigrationRepository extends BaseRepository } if (array_key_exists('credits', $data) && is_array($data['credits']) && count($data['credits']) > 0) { + + /** @var float $credit_totals **/ $credit_totals = array_sum(array_column($data['credits'], 'amount')); $credits = Credit::whereIn('id', array_column($data['credits'], 'credit_id'))->withTrashed()->get(); diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 0c3ce1c8ce75..4400e66155ef 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -188,7 +188,7 @@ class PaymentRepository extends BaseRepository $paymentable->save(); $credit = $credit->service()->markSent()->save(); - (new ApplyCreditPayment($credit, $payment, $paid_credit['amount'], $credit->company))->handle(); + (new ApplyCreditPayment($credit, $payment, $paid_credit['amount']))->handle(); } } } diff --git a/app/Repositories/SubscriptionRepository.php b/app/Repositories/SubscriptionRepository.php index dd647ca5d32f..4e1d05f9f291 100644 --- a/app/Repositories/SubscriptionRepository.php +++ b/app/Repositories/SubscriptionRepository.php @@ -48,6 +48,7 @@ class SubscriptionRepository extends BaseRepository DB::connection(config('database.default'))->beginTransaction(); $data = []; + /** @var \App\Models\Client $client **/ $client = Client::factory()->create([ 'user_id' => $subscription->user_id, 'company_id' => $subscription->company_id, @@ -56,6 +57,7 @@ class SubscriptionRepository extends BaseRepository 'settings' => ClientSettings::defaults(), ]); + /** @var \App\Models\ClientContact $contact **/ $contact = ClientContact::factory()->create([ 'user_id' => $subscription->user_id, 'company_id' => $subscription->company_id, diff --git a/app/Repositories/TaskRepository.php b/app/Repositories/TaskRepository.php index be1f17e4911d..051a2c1c5689 100644 --- a/app/Repositories/TaskRepository.php +++ b/app/Repositories/TaskRepository.php @@ -148,13 +148,16 @@ class TaskRepository extends BaseRepository * Store tasks in bulk. * * @param array $task - * @return task|null + * @return Task|null */ public function create($task): ?Task { + /** @var \App\Models\User $user **/ + $user = auth()->user(); + return $this->save( $task, - TaskFactory::create(auth()->user()->company()->id, auth()->user()->id) + TaskFactory::create($user->company()->id, $user->id) ); } @@ -175,7 +178,7 @@ class TaskRepository extends BaseRepository /** * Sorts the task status order IF the old status has changed between requests * - * @param stdCLass $old_task The old task object + * @param \stdCLass $old_task The old task object * @param Task $new_task The new Task model * @return void */