From 05593f0824fef0fc296c147ab43b54ca87f9a6b2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 20 Mar 2024 20:05:22 +1100 Subject: [PATCH] Minor fixes --- app/Filters/InvoiceFilters.php | 10 ++++++---- app/Http/Requests/Payment/RefundPaymentRequest.php | 2 -- app/Models/Task.php | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index bd03ca01d42a..0d6d2ff2470a 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -200,14 +200,16 @@ class InvoiceFilters extends QueryFilters */ public function payable(string $client_id = ''): Builder { + if (strlen($client_id) == 0) { return $this->builder; } - return $this->builder->whereIn('status_id', [Invoice::STATUS_DRAFT, Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) - ->where('balance', '>', 0) - ->where('is_deleted', 0) - ->where('client_id', $this->decodePrimaryKey($client_id)); + return $this->builder + ->where('client_id', $this->decodePrimaryKey($client_id)) + ->whereIn('status_id', [Invoice::STATUS_DRAFT, Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) + ->where('is_deleted', 0) + ->where('balance', '>', 0); } diff --git a/app/Http/Requests/Payment/RefundPaymentRequest.php b/app/Http/Requests/Payment/RefundPaymentRequest.php index bf43b65f70d6..abcb694fbb17 100644 --- a/app/Http/Requests/Payment/RefundPaymentRequest.php +++ b/app/Http/Requests/Payment/RefundPaymentRequest.php @@ -57,8 +57,6 @@ class RefundPaymentRequest extends Request if (isset($input['credits'])) { unset($input['credits']); - // foreach($input['credits'] as $key => $credit) - // $input['credits'][$key]['credit_id'] = $this->decodePrimaryKey($credit['credit_id']); } $this->replace($input); diff --git a/app/Models/Task.php b/app/Models/Task.php index f1716b15a870..a5d63760c19d 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -12,6 +12,7 @@ namespace App\Models; use App\Utils\Traits\MakesHash; +use Carbon\CarbonInterval; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Carbon; @@ -248,6 +249,7 @@ class Task extends BaseModel $duration += max($end_time - $start_time, 0); } + // return CarbonInterval::seconds(round($duration))->locale($this->company->locale())->cascade()->forHumans(); return round($duration); }