diff --git a/VERSION.txt b/VERSION.txt index 95980c282c..86df7a18a9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.12.16 \ No newline at end of file +5.12.17 \ No newline at end of file diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 495f83e984..1b8bdc1cb4 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -75,7 +75,7 @@ class Handler extends ExceptionHandler ]; protected $hostedDontReport = [ - MaxAttemptsExceededException::class, + // MaxAttemptsExceededException::class, CommandNotFoundException::class, ValidationException::class, ModelNotFoundException::class, diff --git a/app/Export/CSV/ExpenseExport.php b/app/Export/CSV/ExpenseExport.php index e570fc9e75..aeb45fb920 100644 --- a/app/Export/CSV/ExpenseExport.php +++ b/app/Export/CSV/ExpenseExport.php @@ -265,6 +265,7 @@ class ExpenseExport extends BaseExport $entity['expense.net_amount'] = round($expense->amount, $precision) - $total_tax_amount; } else { $entity['expense.net_amount'] = round($expense->amount, $precision); + $entity['expense.amount'] = round($expense->amount, $precision) + $total_tax_amount; } } else { @@ -274,7 +275,8 @@ class ExpenseExport extends BaseExport $entity['expense.net_amount'] = round(($expense->amount - round($total_tax_amount, $precision)), $precision); } else { $total_tax_amount = ($expense->amount * (($expense->tax_rate1 ?? 0) / 100)) + ($expense->amount * (($expense->tax_rate2 ?? 0) / 100)) + ($expense->amount * (($expense->tax_rate3 ?? 0) / 100)); - $entity['expense.net_amount'] = round(($expense->amount + round($total_tax_amount, $precision)), $precision); + $entity['expense.net_amount'] = round($expense->amount, $precision); + $entity['expense.amount'] = round($expense->amount, $precision) + $total_tax_amount; } } diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 73345518a6..094ea8c9b4 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -329,7 +329,7 @@ class ClientController extends BaseController //delete all documents $client->documents->each(function ($document) { try { - Storage::disk(config('filesystems.default'))->delete($document->url); + Storage::disk($document->disk)->delete($document->url); } catch (\Exception $e) { nlog($e->getMessage()); } diff --git a/app/Http/Controllers/Reports/ReportExportController.php b/app/Http/Controllers/Reports/ReportExportController.php index c70a8bf135..df52aa0c22 100644 --- a/app/Http/Controllers/Reports/ReportExportController.php +++ b/app/Http/Controllers/Reports/ReportExportController.php @@ -34,19 +34,19 @@ class ReportExportController extends BaseController return response()->json(['message' => 'Still working.....'], 409); } - $report = base64_decode($report); + // $report = base64_decode($report); - Cache::forget($hash); + // Cache::forget($hash); - if($this->isXlsxData($report)){ + // if($this->isXlsxData($report)){ - return response($report, 200, [ - 'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'Content-Disposition' => 'inline; filename="report.xlsx"', - 'Content-Length' => strlen($report) - ]); + // return response($report, 200, [ + // 'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + // 'Content-Disposition' => 'inline; filename="report.xlsx"', + // 'Content-Length' => strlen($report) + // ]); - } + // } // Check if the content starts with PDF signature (%PDF-) $isPdf = str_starts_with(trim($report), '%PDF-'); diff --git a/app/Http/Controllers/Reports/ReportPreviewController.php b/app/Http/Controllers/Reports/ReportPreviewController.php index 4d0a2b7da3..17c495bee7 100644 --- a/app/Http/Controllers/Reports/ReportPreviewController.php +++ b/app/Http/Controllers/Reports/ReportPreviewController.php @@ -31,6 +31,8 @@ class ReportPreviewController extends BaseController $report = Cache::get($hash); + nlog($report); + if (!$report) { return response()->json(['message' => 'Still working.....'], 409); } diff --git a/app/Jobs/Client/CheckVat.php b/app/Jobs/Client/CheckVat.php index 4501de1f19..552c9eadd4 100644 --- a/app/Jobs/Client/CheckVat.php +++ b/app/Jobs/Client/CheckVat.php @@ -59,7 +59,7 @@ class CheckVat implements ShouldQueue public function middleware() { - return [(new WithoutOverlapping($this->client->client_hash))->releaseAfter(60)]; + return [(new WithoutOverlapping($this->client->client_hash))->releaseAfter(60)->expireAfter(60)]; } } diff --git a/app/Listeners/Payment/PaymentBalanceActivity.php b/app/Listeners/Payment/PaymentBalanceActivity.php index 23e562a57e..82a8b9c371 100644 --- a/app/Listeners/Payment/PaymentBalanceActivity.php +++ b/app/Listeners/Payment/PaymentBalanceActivity.php @@ -19,7 +19,13 @@ use Illuminate\Queue\Middleware\WithoutOverlapping; class PaymentBalanceActivity implements ShouldQueue { + use InteractsWithQueue; + + public $tries = 1; + + public $delay = 5; + /** * Create the event listener. * @@ -45,4 +51,13 @@ class PaymentBalanceActivity implements ShouldQueue { return [(new WithoutOverlapping($event->payment->client->client_hash))->releaseAfter(60)->expireAfter(60)]; } + + public function failed($exception) + { + if ($exception) { + nlog('PaymentBalanceActivity failed', ['exception' => $exception]); + } + + // config(['queue.failed.driver' => null]); + } } diff --git a/app/Models/Client.php b/app/Models/Client.php index 1cdec93974..dc378f0334 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -926,7 +926,12 @@ class Client extends BaseModel implements HasLocalePreference { return $this->company->company_key.'/'; } - + + /** + * document_filepath + * @deprecated. not used. + * @return string + */ public function document_filepath(): string { return $this->company->company_key.'/documents/'; diff --git a/app/PaymentDrivers/Stripe/Jobs/StripeWebhook.php b/app/PaymentDrivers/Stripe/Jobs/StripeWebhook.php index 494cd3a1fc..83631fd980 100644 --- a/app/PaymentDrivers/Stripe/Jobs/StripeWebhook.php +++ b/app/PaymentDrivers/Stripe/Jobs/StripeWebhook.php @@ -88,4 +88,12 @@ class StripeWebhook implements ShouldQueue ], $stripe->stripe_connect_auth); } } + + public function failed($exception = null) + { + nlog("StripeWebhook failed: " . $exception->getMessage()); + + config(['queue.failed.driver' => null]); + + } } diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index 9cd6bb26a6..8039d6e77b 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -32,7 +32,7 @@ class BankMatchingService implements ShouldQueue public $timeout = 3600; - public function __construct(public $company_id, public $db) + public function __construct(public int $company_id, public string $db) { } diff --git a/app/Services/Client/Statement.php b/app/Services/Client/Statement.php index a69998df08..81f2723624 100644 --- a/app/Services/Client/Statement.php +++ b/app/Services/Client/Statement.php @@ -212,6 +212,7 @@ class Statement $this->client->settings = $settings; $this->entity = \App\Models\Invoice::factory()->make(); //@phpstan-ignore-line + $this->entity->client_id = $this->client->id;//@phpstan-ignore-line $this->entity->client = $this->client;//@phpstan-ignore-line $ii = \App\Models\InvoiceInvitation::factory()->make(); //@phpstan-ignore-line $ii->setRelation('invoice', $this->entity); //@phpstan-ignore-line @@ -219,17 +220,10 @@ class Statement $ii->setRelation('company', $this->client->company); $ii->setRelation('user', $this->client->user); $this->entity->client->setRelation('company', $this->client->company); - $this->entity->setRelation('invitations', $ii); //@phpstan-ignore-line + $this->entity->setRelation('invitations', collect([$ii])); //@phpstan-ignore-line $this->entity->setRelation('company', $this->client->company); $this->entity->setRelation('user', $this->client->user); - // $this->entity = \App\Models\Invoice::factory()->make(); //@phpstan-ignore-line - // $this->entity->client = \App\Models\Client::factory()->make(['settings' => $settings]); //@phpstan-ignore-line - // $this->entity->client->setRelation('company', $this->client->company); - // $this->entity->setRelation('invitations', \App\Models\InvoiceInvitation::factory()->make()); //@phpstan-ignore-line - // $this->entity->setRelation('company', $this->client->company); - // $this->entity->setRelation('user', $this->client->user); - } return $this; diff --git a/config/ninja.php b/config/ninja.php index e7a1c7e817..c3c2a2df4c 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.12.16'), - 'app_tag' => env('APP_TAG', '5.12.16'), + 'app_version' => env('APP_VERSION', '5.12.17'), + 'app_tag' => env('APP_TAG', '5.12.17'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), diff --git a/config/scout.php b/config/scout.php index d41e4b8c55..ec1ec2464e 100644 --- a/config/scout.php +++ b/config/scout.php @@ -42,7 +42,11 @@ return [ | */ - 'queue' => env('SCOUT_QUEUE', true), + // 'queue' => env('SCOUT_QUEUE', true), + 'queue' => [ + 'connection' => 'redis', + 'queue' => 'scout' + ], /* |--------------------------------------------------------------------------