From 2d30499b48d605550a9a7e96517264c75671f9d6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Aug 2025 07:48:30 +1000 Subject: [PATCH] Static analysis cleanup --- .../Reports/ReportExportController.php | 28 ++--- .../InvoiceTransactionEventEntryCash.php | 112 +++++++++--------- app/Models/Client.php | 1 + app/Models/Credit.php | 3 + app/Models/Invoice.php | 1 + app/Models/Location.php | 2 + app/Models/Payment.php | 1 + app/Models/Project.php | 3 + app/Models/Quote.php | 1 + app/Models/RecurringInvoice.php | 1 + 10 files changed, 83 insertions(+), 70 deletions(-) diff --git a/app/Http/Controllers/Reports/ReportExportController.php b/app/Http/Controllers/Reports/ReportExportController.php index df52aa0c22..79e98993c2 100644 --- a/app/Http/Controllers/Reports/ReportExportController.php +++ b/app/Http/Controllers/Reports/ReportExportController.php @@ -69,21 +69,21 @@ class ReportExportController extends BaseController } - private function isXlsxData($fileData) - { - // Check minimum size (XLSX files are typically > 1KB) - if (strlen($fileData) < 1024) { - return false; - } + // private function isXlsxData($fileData) + // { + // // Check minimum size (XLSX files are typically > 1KB) + // if (strlen($fileData) < 1024) { + // return false; + // } - // Check ZIP signature - $header = substr($fileData, 0, 4); - if ($header !== 'PK' . chr(3) . chr(4)) { - return false; - } + // // Check ZIP signature + // $header = substr($fileData, 0, 4); + // if ($header !== 'PK' . chr(3) . chr(4)) { + // return false; + // } - // Check for XLSX-specific content - return strpos($fileData, '[Content_Types].xml') !== false; - } + // // Check for XLSX-specific content + // return strpos($fileData, '[Content_Types].xml') !== false; + // } } diff --git a/app/Listeners/Invoice/InvoiceTransactionEventEntryCash.php b/app/Listeners/Invoice/InvoiceTransactionEventEntryCash.php index 3118fe2268..93d4dfe79f 100644 --- a/app/Listeners/Invoice/InvoiceTransactionEventEntryCash.php +++ b/app/Listeners/Invoice/InvoiceTransactionEventEntryCash.php @@ -93,80 +93,80 @@ class InvoiceTransactionEventEntryCash * * @param mixed $invoice */ - private function getCancelledMetaData($invoice) - { + // private function getCancelledMetaData($invoice) + // { - $calc = $invoice->calc(); + // $calc = $invoice->calc(); - $details = []; + // $details = []; - $taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray()); + // $taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray()); - foreach ($taxes as $tax) { - $tax_detail = [ - 'tax_name' => $tax['name'], - 'tax_rate' => $tax['tax_rate'], - 'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(), - 'tax_amount' => $this->calculateRatio($tax['total']), - 'tax_amount_paid' => $this->calculateRatio($tax['total']), - 'tax_amount_remaining' => 0, - ]; - $details[] = $tax_detail; - } + // foreach ($taxes as $tax) { + // $tax_detail = [ + // 'tax_name' => $tax['name'], + // 'tax_rate' => $tax['tax_rate'], + // 'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(), + // 'tax_amount' => $this->calculateRatio($tax['total']), + // 'tax_amount_paid' => $this->calculateRatio($tax['total']), + // 'tax_amount_remaining' => 0, + // ]; + // $details[] = $tax_detail; + // } - return new TransactionEventMetadata([ - 'tax_report' => [ - 'tax_details' => $details, - 'payment_history' => $this->payments->toArray(), - 'tax_summary' => [ - 'total_taxes' => $invoice->total_taxes, - 'total_paid' => $this->getTotalTaxPaid($invoice), - 'status' => 'cancelled', - ], - ], - ]); + // return new TransactionEventMetadata([ + // 'tax_report' => [ + // 'tax_details' => $details, + // 'payment_history' => $this->payments->toArray(), + // 'tax_summary' => [ + // 'total_taxes' => $invoice->total_taxes, + // 'total_paid' => $this->getTotalTaxPaid($invoice), + // 'status' => 'cancelled', + // ], + // ], + // ]); - } + // } /** * Set all tax details to 0 * * @param mixed $invoice */ - private function getDeletedMetaData($invoice) - { + // private function getDeletedMetaData($invoice) + // { - $calc = $invoice->calc(); + // $calc = $invoice->calc(); - $details = []; + // $details = []; - $taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray()); + // $taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray()); - foreach ($taxes as $tax) { - $tax_detail = [ - 'tax_name' => $tax['name'], - 'tax_rate' => $tax['tax_rate'], - 'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(), - 'tax_amount' => $tax['total'], - 'tax_amount_paid' => $this->calculateRatio($tax['total']), - 'tax_amount_remaining' => 0, - ]; - $details[] = $tax_detail; - } + // foreach ($taxes as $tax) { + // $tax_detail = [ + // 'tax_name' => $tax['name'], + // 'tax_rate' => $tax['tax_rate'], + // 'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(), + // 'tax_amount' => $tax['total'], + // 'tax_amount_paid' => $this->calculateRatio($tax['total']), + // 'tax_amount_remaining' => 0, + // ]; + // $details[] = $tax_detail; + // } - return new TransactionEventMetadata([ - 'tax_report' => [ - 'tax_details' => $details, - 'payment_history' => $this->payments->toArray(), - 'tax_summary' => [ - 'total_taxes' => $invoice->total_taxes, - 'total_paid' => $this->getTotalTaxPaid($invoice),0, - 'status' => 'deleted', - ], - ], - ]); + // return new TransactionEventMetadata([ + // 'tax_report' => [ + // 'tax_details' => $details, + // 'payment_history' => $this->payments->toArray(), + // 'tax_summary' => [ + // 'total_taxes' => $invoice->total_taxes, + // 'total_paid' => $this->getTotalTaxPaid($invoice),0, + // 'status' => 'deleted', + // ], + // ], + // ]); - } + // } private function getMetadata($invoice) { diff --git a/app/Models/Client.php b/app/Models/Client.php index dc378f0334..523b0e610f 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -108,6 +108,7 @@ use Illuminate\Contracts\Translation\HasLocalePreference; * @property-read \Illuminate\Database\Eloquent\Collection $system_logs * @property-read \Illuminate\Database\Eloquent\Collection $tasks * @property-read \Illuminate\Database\Eloquent\Collection $recurring_invoices + * @property-read \Illuminate\Database\Eloquent\Collection $locations * @method static \Illuminate\Database\Eloquent\Builder|Client exclude($columns) * @method static \Database\Factories\ClientFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|Client filter(\App\Filters\QueryFilters $filters) diff --git a/app/Models/Credit.php b/app/Models/Credit.php index 091430fcd6..fd946ddf78 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -93,6 +93,9 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string|null $reminder3_sent * @property string|null $reminder_last_sent * @property float $paid_to_date + * @property int|null $location_id + * @property object|null $e_invoice + * @property object|null $tax_data * @property int|null $subscription_id * @property \Illuminate\Database\Eloquent\Collection $activities * @property int|null $activities_count diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 2c936176db..fde6f1ae9b 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -45,6 +45,7 @@ use App\Utils\Number; * @property int $status_id * @property int|null $project_id * @property int|null $vendor_id + * @property int|null $location_id * @property int|null $recurring_id * @property int|null $design_id * @property string|null $number diff --git a/app/Models/Location.php b/app/Models/Location.php index 3fcecd675c..88eca085fd 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -22,6 +22,8 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property int $id * @property int $company_id * @property int $user_id + * @property int|null $vendor_id + * @property int|null $client_id * @property int|null $assigned_user_id * @property string|null $name * @property string|null $website diff --git a/app/Models/Payment.php b/app/Models/Payment.php index e507617b8a..bfc3d7e094 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -93,6 +93,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property-read \Illuminate\Database\Eloquent\Collection $documents * @property-read \Illuminate\Database\Eloquent\Collection $invoices * @property \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection $paymentables + * @property-read \Illuminate\Database\Eloquent\Collection $activities * @mixin \Eloquent */ class Payment extends BaseModel diff --git a/app/Models/Project.php b/app/Models/Project.php index c06b3de4dd..0033315207 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -57,6 +57,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed() * @property-read \Illuminate\Database\Eloquent\Collection $documents * @property-read \Illuminate\Database\Eloquent\Collection $tasks + * @property-read \Illuminate\Database\Eloquent\Collection $expenses + * @property-read \Illuminate\Database\Eloquent\Collection $invoices + * @property-read \Illuminate\Database\Eloquent\Collection $quotes * @mixin \Eloquent */ class Project extends BaseModel diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 0d801914ed..af4b9dd957 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -42,6 +42,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property int $status_id * @property int|null $project_id * @property int|null $vendor_id + * @property int|null $location_id * @property int|null $recurring_id * @property int|null $design_id * @property int|null $invoice_id diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 01579692f2..2b87466b80 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -36,6 +36,7 @@ use App\Models\Presenters\RecurringInvoicePresenter; * @property int|null $project_id * @property int|null $vendor_id * @property int $status_id + * @property int|null $location_id * @property string|null $number * @property float $discount * @property bool $is_amount_discount