From 08de7be767d8c8f057387a690edcec5db2e1ac53 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 5 Sep 2020 08:31:24 +1000 Subject: [PATCH 1/3] Fixes for tesats --- app/Services/Payment/UpdateInvoicePayment.php | 28 --- tests/Integration/DesignTest.php | 192 ------------------ 2 files changed, 220 deletions(-) delete mode 100644 tests/Integration/DesignTest.php diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 88a3c3635d21..641708c7d05f 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -9,7 +9,6 @@ * @license https://opensource.org/licenses/AAL */ - namespace App\Services\Payment; use App\Events\Invoice\InvoiceWasUpdated; @@ -25,9 +24,6 @@ class UpdateInvoicePayment { use MakesHash; - /** - * @deprecated This is bad logic, assumes too much. - */ public $payment; public $payment_hash; @@ -84,30 +80,6 @@ class UpdateInvoicePayment }); - // } else { - // SystemLogger::dispatch( - // [ - // 'payment' => $this->payment, - // 'invoices' => $invoices, - // 'invoices_total' => $invoices_total, - // 'payment_amount' => $this->payment->amount, - // 'partial_check_amount' => $total, - // ], - // SystemLog::CATEGORY_GATEWAY_RESPONSE, - // SystemLog::EVENT_PAYMENT_RECONCILIATION_FAILURE, - // SystemLog::TYPE_LEDGER, - // $this->payment->client - // ); - - // throw new \Exception("payment amount {$this->payment->amount} does not match invoice totals {$invoices_total} reversing payment"); - - // $this->payment->invoice()->delete(); - // $this->payment->is_deleted=true; - // $this->payment->save(); - // $this->payment->delete(); - // } - - return $this->payment; } } diff --git a/tests/Integration/DesignTest.php b/tests/Integration/DesignTest.php deleted file mode 100644 index daafe7218be1..000000000000 --- a/tests/Integration/DesignTest.php +++ /dev/null @@ -1,192 +0,0 @@ -makeTestData(); - } - - public function testInvoiceDesignExists() - { - $this->contact = $this->invoice->client->primary_contact()->first(); - - $design = json_decode(Design::find(3)); - - $designer = new Designer($this->invoice, $design, $this->company->settings->pdf_variables, 'quote'); - - $html = $designer->build()->getHtml(); - - $this->assertNotNull($html); - - $this->invoice = factory(\App\Models\Invoice::class)->create([ - 'user_id' => $this->user->id, - 'client_id' => $this->client->id, - 'company_id' => $this->company->id, - ]); - - $this->invoice->uses_inclusive_taxes = false; - - $this->invoice->service()->createInvitations()->markSent()->applyNumber()->save(); - - $this->invoice->fresh(); - $this->invoice->load('invitations'); - - $settings = $this->invoice->client->settings; - $settings->invoice_design_id = "VolejRejNm"; - $settings->all_pages_header = true; - $settings->all_pages_footer = true; - - $this->client->settings = $settings; - $this->client->save(); - - CreateInvoicePdf::dispatchNow($this->invoice->invitations->first()); - } - - public function testQuoteDesignExists() - { - $this->contact = $this->quote->client->primary_contact()->first(); - - $design = json_decode(Design::find(3)); - - $designer = new Designer($this->quote, $design, $this->company->settings->pdf_variables, 'quote'); - - $html = $designer->build()->getHtml(); - - $this->assertNotNull($html); - - $this->quote = factory(\App\Models\Invoice::class)->create([ - 'user_id' => $this->user->id, - 'client_id' => $this->client->id, - 'company_id' => $this->company->id, - ]); - - $this->quote->uses_inclusive_taxes = false; - - $this->quote->service()->createInvitations()->markSent()->save(); - - $this->quote->fresh(); - $this->quote->load('invitations'); - $settings = $this->quote->client->settings; - $settings->invoice_design_id = "VolejRejNm"; - $settings->all_pages_header = true; - $settings->all_pages_footer = true; - - $this->client->settings = $settings; - $this->client->save(); - - $this->quote->setRelation('client', $this->client); - - $invitation = $this->quote->invitations->first(); - $invitation->setRelation('quote', $this->quote); - - CreateQuotePdf::dispatchNow($invitation); - } - - - public function testCreditDesignExists() - { - $design = json_decode(Design::find(3)); - - $designer = new Designer($this->credit, $design, $this->company->settings->pdf_variables, 'credit'); - - $html = $designer->build()->getHtml(); - - $this->assertNotNull($html); - - $settings = $this->invoice->client->settings; - $settings->quote_design_id = "4"; - $settings->all_pages_header = true; - $settings->all_pages_footer = true; - - $this->credit->client_id = $this->client->id; - $this->credit->setRelation('client', $this->client); - - $this->credit->service()->createInvitations()->markSent()->save(); - $this->credit->fresh(); - $this->credit->load('invitations'); - - $invitation = $this->credit->invitations->first(); - $invitation->setRelation('credit', $this->credit); - - - $this->client->settings = $settings; - $this->client->save(); - - CreateCreditPdf::dispatchNow($invitation); - } - - public function testAllDesigns() - { - - $this->quote->client_id = $this->client->id; - $this->quote->setRelation('client', $this->client); - $this->quote->save(); - - - for ($x=1; $x<=9; $x++) { - - $settings = $this->invoice->client->settings; - $settings->quote_design_id = (string)$this->encodePrimaryKey($x); - $settings->all_pages_header = true; - $settings->all_pages_footer = true; - $this->client->settings = $settings; - $this->client->save(); - - $this->quote->service()->createInvitations()->markSent()->save(); - $this->quote->fresh(); - $this->quote->load('invitations'); - - $invitation = $this->quote->invitations->first(); - $invitation->setRelation('quote', $this->quote); - - CreateQuotePdf::dispatchNow($invitation); - - $this->quote->number = $this->getNextQuoteNumber($this->quote->client); - -// $this->quote->save(); - - } - - $this->assertTrue(true); - } - -} From ba75a44eb83d18eccffeda934438aa6d81e65bcf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 6 Sep 2020 19:38:10 +1000 Subject: [PATCH 2/3] Laravel 7.x Shift (#40) * Adopt Laravel coding style The Laravel framework adopts the PSR-2 coding style with some additions. Laravel apps *should* adopt this coding style as well. However, Shift allows you to customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config to your project. You may use [Shift's .php_cs][2] file as a base. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200 * Shift bindings PHP 5.5.9+ adds the new static `class` property which provides the fully qualified class name. This is preferred over using class name strings as these references are checked by the parser. * Shift core files * Shift to Throwable * Add laravel/ui dependency * Unindent vendor mail templates * Shift config files * Default config files In an effort to make upgrading the constantly changing config files easier, Shift defaulted them so you can review the commit diff for changes. Moving forward, you should use ENV variables or create a separate config file to allow the core config files to remain automatically upgradeable. * Shift Laravel dependencies * Shift cleanup * Upgrade to Laravel 7 Co-authored-by: Laravel Shift --- .env.dusk.example | 2 +- .env.example | 2 +- .env.travis | 2 +- app/Console/Commands/CheckData.php | 127 +- app/Console/Commands/CreateTestData.php | 95 +- app/Console/Commands/DemoMode.php | 146 +- app/Console/Commands/ImportMigrations.php | 8 +- app/Console/Commands/PostUpdate.php | 59 +- app/Console/Commands/SendTestEmails.php | 10 +- .../Commands/TestData/CreateTestCreditJob.php | 11 +- .../TestData/CreateTestInvoiceJob.php | 14 +- .../Commands/TestData/CreateTestQuoteJob.php | 14 +- app/Console/Kernel.php | 8 +- app/DataMapper/Analytics/LoginFailure.php | 64 +- app/DataMapper/Analytics/LoginSuccess.php | 64 +- app/DataMapper/BaseSettings.php | 8 +- app/DataMapper/ClientSettings.php | 33 +- app/DataMapper/CompanySettings.php | 251 +- app/DataMapper/DefaultSettings.php | 10 +- app/DataMapper/EmailSpooledForSend.php | 21 +- app/DataMapper/EmailTemplateDefaults.php | 13 +- app/DataMapper/FeesAndLimits.php | 2 +- app/DataMapper/FreeCompanySettings.php | 137 +- app/DataMapper/InvoiceItem.php | 2 +- app/DataMapper/PaymentMethodMeta.php | 2 +- app/DataMapper/PaymentTransaction.php | 2 +- app/Designs/AbstractDesign.php | 10 +- app/Designs/Bold.php | 2 +- app/Designs/Business.php | 2 +- app/Designs/Clean.php | 4 +- app/Designs/Creative.php | 5 +- app/Designs/Custom.php | 14 +- app/Designs/Designer.php | 41 +- app/Designs/Elegant.php | 4 +- app/Designs/Hipster.php | 4 +- app/Designs/Modern.php | 4 +- app/Designs/Photo.php | 5 +- app/Designs/Plain.php | 3 +- app/Designs/Playful.php | 4 +- app/Events/Account/AccountCreated.php | 14 +- app/Events/Client/ClientWasArchived.php | 3 +- app/Events/Client/ClientWasCreated.php | 3 +- app/Events/Client/ClientWasDeleted.php | 3 +- app/Events/Client/ClientWasRestored.php | 3 +- app/Events/Client/ClientWasUpdated.php | 3 +- .../Company/CompanyDocumentsDeleted.php | 2 +- app/Events/Contact/ContactLoggedIn.php | 8 +- app/Events/Credit/CreditWasArchived.php | 6 +- app/Events/Credit/CreditWasCreated.php | 6 +- app/Events/Credit/CreditWasDeleted.php | 6 +- app/Events/Credit/CreditWasEmailed.php | 5 +- .../Credit/CreditWasEmailedAndFailed.php | 8 +- app/Events/Credit/CreditWasMarkedSent.php | 5 +- app/Events/Credit/CreditWasRestored.php | 3 +- app/Events/Credit/CreditWasUpdated.php | 5 +- app/Events/Credit/CreditWasViewed.php | 2 +- app/Events/Design/DesignWasArchived.php | 3 +- app/Events/Design/DesignWasCreated.php | 3 +- app/Events/Design/DesignWasDeleted.php | 4 +- app/Events/Design/DesignWasRestored.php | 5 +- app/Events/Design/DesignWasUpdated.php | 5 +- app/Events/Document/DocumentWasArchived.php | 2 +- app/Events/Document/DocumentWasCreated.php | 2 +- app/Events/Document/DocumentWasDeleted.php | 2 +- app/Events/Document/DocumentWasRestored.php | 2 +- app/Events/Document/DocumentWasUpdated.php | 2 +- app/Events/Expense/ExpenseWasArchived.php | 3 +- app/Events/Expense/ExpenseWasCreated.php | 3 +- app/Events/Expense/ExpenseWasDeleted.php | 3 +- app/Events/Expense/ExpenseWasRestored.php | 3 +- app/Events/Expense/ExpenseWasUpdated.php | 3 +- app/Events/Invoice/InvoiceWasArchived.php | 3 +- app/Events/Invoice/InvoiceWasCancelled.php | 3 +- app/Events/Invoice/InvoiceWasCreated.php | 3 +- app/Events/Invoice/InvoiceWasDeleted.php | 3 +- app/Events/Invoice/InvoiceWasEmailed.php | 3 +- .../Invoice/InvoiceWasEmailedAndFailed.php | 7 +- app/Events/Invoice/InvoiceWasMarkedSent.php | 3 +- app/Events/Invoice/InvoiceWasPaid.php | 3 +- app/Events/Invoice/InvoiceWasRestored.php | 5 +- app/Events/Invoice/InvoiceWasReversed.php | 3 +- app/Events/Invoice/InvoiceWasUpdated.php | 3 +- app/Events/Invoice/InvoiceWasViewed.php | 3 +- app/Events/Misc/InvitationWasViewed.php | 3 +- app/Events/Payment/Methods/MethodDeleted.php | 7 +- app/Events/Payment/PaymentCompleted.php | 3 +- app/Events/Payment/PaymentFailed.php | 4 +- app/Events/Payment/PaymentWasArchived.php | 4 +- app/Events/Payment/PaymentWasCreated.php | 3 +- app/Events/Payment/PaymentWasDeleted.php | 4 +- app/Events/Payment/PaymentWasEmailed.php | 4 +- .../Payment/PaymentWasEmailedAndFailed.php | 3 +- app/Events/Payment/PaymentWasRefunded.php | 3 +- app/Events/Payment/PaymentWasRestored.php | 3 +- app/Events/Payment/PaymentWasUpdated.php | 4 +- app/Events/Payment/PaymentWasVoided.php | 4 +- app/Events/Product/ProductWasArchived.php | 3 +- app/Events/Product/ProductWasCreated.php | 5 +- app/Events/Product/ProductWasDeleted.php | 3 +- app/Events/Product/ProductWasUpdated.php | 3 +- app/Events/Quote/QuoteWasApproved.php | 3 +- app/Events/Quote/QuoteWasArchived.php | 5 +- app/Events/Quote/QuoteWasCreated.php | 5 +- app/Events/Quote/QuoteWasDeleted.php | 3 +- app/Events/Quote/QuoteWasEmailed.php | 4 +- app/Events/Quote/QuoteWasEmailedAndFailed.php | 3 +- app/Events/Quote/QuoteWasMarkedApproved.php | 3 +- app/Events/Quote/QuoteWasMarkedSent.php | 3 +- app/Events/Quote/QuoteWasRestored.php | 3 +- app/Events/Quote/QuoteWasUpdated.php | 5 +- app/Events/Quote/QuoteWasViewed.php | 2 +- app/Events/Task/TaskWasArchived.php | 3 +- app/Events/Task/TaskWasCreated.php | 5 +- app/Events/Task/TaskWasDeleted.php | 3 +- app/Events/Task/TaskWasRestored.php | 5 +- app/Events/Task/TaskWasUpdated.php | 3 +- app/Events/User/UserLoggedIn.php | 8 +- app/Events/User/UserWasArchived.php | 8 +- app/Events/User/UserWasCreated.php | 8 +- app/Events/User/UserWasDeleted.php | 8 +- app/Events/User/UserWasRestored.php | 8 +- app/Events/User/UserWasUpdated.php | 9 +- app/Events/Vendor/VendorWasArchived.php | 3 +- app/Events/Vendor/VendorWasCreated.php | 3 +- app/Events/Vendor/VendorWasDeleted.php | 3 +- app/Events/Vendor/VendorWasRestored.php | 4 +- app/Events/Vendor/VendorWasUpdated.php | 3 +- app/Exceptions/Handler.php | 39 +- app/Exceptions/PaymentRefundFailed.php | 40 +- app/Factory/ClientContactFactory.php | 4 +- app/Factory/ClientFactory.php | 4 +- app/Factory/CloneCreditFactory.php | 4 +- app/Factory/CloneCreditToQuoteFactory.php | 2 +- app/Factory/CloneInvoiceFactory.php | 4 +- app/Factory/CloneInvoiceToQuoteFactory.php | 2 +- app/Factory/CloneQuoteFactory.php | 4 +- app/Factory/CloneQuoteToInvoiceFactory.php | 33 +- app/Factory/CompanyFactory.php | 4 +- app/Factory/CompanyGatewayFactory.php | 3 +- app/Factory/CompanyLedgerFactory.php | 2 +- app/Factory/CompanyTokenFactory.php | 2 +- app/Factory/CompanyUserFactory.php | 3 +- app/Factory/CreditFactory.php | 6 +- app/Factory/CreditInvitationFactory.php | 2 +- app/Factory/DesignFactory.php | 4 +- app/Factory/ExpenseFactory.php | 4 +- app/Factory/GroupSettingFactory.php | 4 +- app/Factory/InvoiceFactory.php | 4 +- app/Factory/InvoiceInvitationFactory.php | 2 +- app/Factory/InvoiceItemFactory.php | 18 +- .../InvoiceToRecurringInvoiceFactory.php | 2 +- app/Factory/PaymentFactory.php | 6 +- app/Factory/PaymentTermFactory.php | 2 +- app/Factory/ProductFactory.php | 2 +- app/Factory/QuoteFactory.php | 4 +- app/Factory/QuoteInvitationFactory.php | 2 +- app/Factory/RecurringInvoiceFactory.php | 2 +- .../RecurringInvoiceToInvoiceFactory.php | 4 +- app/Factory/RecurringQuoteFactory.php | 2 +- app/Factory/TaxRateFactory.php | 2 +- app/Factory/UserFactory.php | 4 +- app/Factory/VendorContactFactory.php | 4 +- app/Factory/VendorFactory.php | 4 +- app/Factory/WebhookFactory.php | 2 +- app/Filters/ClientFilters.php | 51 +- app/Filters/CreditFilters.php | 36 +- app/Filters/DesignFilters.php | 32 +- app/Filters/ExpenseFilters.php | 34 +- app/Filters/InvoiceFilters.php | 41 +- app/Filters/PaymentFilters.php | 34 +- app/Filters/ProductFilters.php | 30 +- app/Filters/QueryFilters.php | 20 +- app/Filters/QuoteFilters.php | 30 +- app/Filters/RecurringInvoiceFilters.php | 30 +- app/Filters/RecurringQuoteFilters.php | 30 +- app/Filters/SystemLogFilters.php | 21 +- app/Filters/TokenFilters.php | 35 +- app/Filters/UserFilters.php | 30 +- app/Filters/VendorFilters.php | 36 +- app/Filters/WebhookFilters.php | 35 +- app/Helpers/ClientPortal.php | 2 +- app/Helpers/Email/EmailBuilder.php | 22 +- app/Helpers/Email/InvoiceEmail.php | 17 +- app/Helpers/Email/PaymentEmail.php | 2 +- app/Helpers/Email/QuoteEmail.php | 6 +- app/Helpers/Invoice/Balancer.php | 4 +- app/Helpers/Invoice/CustomValuer.php | 6 +- app/Helpers/Invoice/Discounter.php | 5 +- app/Helpers/Invoice/InvoiceItemSum.php | 31 +- .../Invoice/InvoiceItemSumInclusive.php | 24 +- app/Helpers/Invoice/InvoiceSum.php | 21 +- app/Helpers/Invoice/InvoiceSumInclusive.php | 28 +- app/Helpers/Invoice/Taxer.php | 8 +- app/Helpers/Language/NinjaTranslator.php | 24 +- app/Helpers/Mail/GmailTransport.php | 18 +- app/Helpers/Mail/GmailTransportConfig.php | 5 +- app/Helpers/TranslationHelper.php | 6 +- app/Http/Controllers/AccountController.php | 6 +- app/Http/Controllers/ActivityController.php | 27 +- .../Auth/ContactForgotPasswordController.php | 12 +- .../Auth/ContactLoginController.php | 5 +- .../Auth/ContactRegisterController.php | 2 +- .../Auth/ContactResetPasswordController.php | 2 +- .../Auth/ForgotPasswordController.php | 5 +- app/Http/Controllers/Auth/LoginController.php | 82 +- .../Controllers/Auth/RegisterController.php | 6 +- .../Auth/ResetPasswordController.php | 2 +- .../Auth/VerificationController.php | 4 +- app/Http/Controllers/BaseController.php | 127 +- app/Http/Controllers/ClientController.php | 22 +- .../ClientPortal/DashboardController.php | 4 +- .../ClientPortal/DocumentController.php | 16 +- .../ClientPortal/DownloadController.php | 14 +- .../ClientPortal/EntityViewController.php | 17 +- .../ClientPortal/InvitationController.php | 20 +- .../ClientPortal/InvoiceController.php | 22 +- .../ClientPortal/PaymentController.php | 48 +- .../ClientPortal/PaymentHookController.php | 2 +- .../ClientPortal/PaymentMethodController.php | 3 +- .../ClientPortal/ProfileController.php | 4 +- .../ClientPortal/QuoteController.php | 19 +- .../RecurringInvoiceController.php | 16 +- .../ClientPortal/SwitchCompanyController.php | 3 +- .../ClientPortal/UploadController.php | 8 +- .../Controllers/ClientStatementController.php | 7 +- app/Http/Controllers/CompanyController.php | 33 +- .../Controllers/CompanyGatewayController.php | 28 +- .../Controllers/CompanyLedgerController.php | 4 +- .../Controllers/CompanyUserController.php | 15 +- .../Controllers/Contact/InvoiceController.php | 6 +- .../Controllers/Contact/LoginController.php | 20 +- app/Http/Controllers/Controller.php | 8 +- app/Http/Controllers/CreditController.php | 46 +- app/Http/Controllers/DashboardController.php | 2 +- app/Http/Controllers/DesignController.php | 20 +- app/Http/Controllers/DocumentController.php | 6 +- app/Http/Controllers/EmailController.php | 27 +- app/Http/Controllers/ExpenseController.php | 22 +- .../Controllers/GroupSettingController.php | 21 +- app/Http/Controllers/InvoiceController.php | 74 +- app/Http/Controllers/LicenseController.php | 16 +- app/Http/Controllers/MigrationController.php | 68 +- .../Controllers/OpenAPI/AccountSchema.php | 2 +- .../Controllers/OpenAPI/ActivitySchema.php | 2 +- .../Controllers/OpenAPI/BulkActionSchema.php | 2 +- .../OpenAPI/ClientContactSchema.php | 2 +- .../OpenAPI/ClientGatewayToken.php | 2 +- app/Http/Controllers/OpenAPI/ClientSchema.php | 2 +- .../OpenAPI/CompanyGatewaySchema.php | 2 +- .../OpenAPI/CompanyLedgerSchema.php | 2 +- .../Controllers/OpenAPI/CompanySchema.php | 2 +- .../OpenAPI/CompanySettingsSchema.php | 2 +- .../OpenAPI/CompanyTokenSchema.php | 2 +- .../Controllers/OpenAPI/CompanyUserSchema.php | 2 +- .../OpenAPI/CreditPaymentableSchema.php | 2 +- app/Http/Controllers/OpenAPI/CreditSchema.php | 2 +- app/Http/Controllers/OpenAPI/DesignSchema.php | 2 +- app/Http/Controllers/OpenAPI/ErrorSchema.php | 2 +- .../Controllers/OpenAPI/ExpenseSchema.php | 2 +- .../OpenAPI/FeesAndLimitsSchema.php | 2 +- .../OpenAPI/GroupSettingSchema.php | 2 +- app/Http/Controllers/OpenAPI/Headers.php | 2 +- .../OpenAPI/InvoicePaymentableSchema.php | 2 +- .../Controllers/OpenAPI/InvoiceSchema.php | 2 +- app/Http/Controllers/OpenAPI/Parameters.php | 2 +- .../Controllers/OpenAPI/PaymentSchema.php | 2 +- .../Controllers/OpenAPI/PaymentTermSchema.php | 2 +- .../Controllers/OpenAPI/PaymentableSchema.php | 2 +- .../Controllers/OpenAPI/ProductSchema.php | 2 +- app/Http/Controllers/OpenAPI/QuoteSchema.php | 2 +- .../Controllers/OpenAPI/RecurringInvoice.php | 2 +- .../Controllers/OpenAPI/RecurringQuote.php | 2 +- .../Controllers/OpenAPI/SystemLogSchema.php | 4 +- .../Controllers/OpenAPI/TaxRateSchema.php | 2 +- .../Controllers/OpenAPI/TemplateSchema.php | 2 +- app/Http/Controllers/OpenAPI/UserSchema.php | 2 +- .../OpenAPI/ValidationErrorSchema.php | 2 +- .../Controllers/OpenAPI/VendorContact.php | 2 +- app/Http/Controllers/OpenAPI/VendorSchema.php | 2 +- .../Controllers/OpenAPI/WebhookSchema.php | 2 +- app/Http/Controllers/OpenAPI/swagger-v3.php | 2 +- app/Http/Controllers/PaymentController.php | 38 +- .../Controllers/PaymentTermController.php | 18 +- .../Controllers/PaymentWebhookController.php | 4 +- app/Http/Controllers/PingController.php | 16 +- app/Http/Controllers/PreviewController.php | 18 +- app/Http/Controllers/ProductController.php | 25 +- app/Http/Controllers/QuoteController.php | 54 +- .../RecurringInvoiceController.php | 43 +- .../Controllers/RecurringQuoteController.php | 42 +- app/Http/Controllers/SchedulerController.php | 9 +- app/Http/Controllers/SelfUpdateController.php | 22 +- app/Http/Controllers/SettingsController.php | 7 +- app/Http/Controllers/SetupController.php | 29 +- .../Controllers/Shop/ClientController.php | 14 +- .../Controllers/Shop/InvoiceController.php | 23 +- .../Controllers/Shop/ProductController.php | 16 +- .../Controllers/Shop/ProfileController.php | 10 +- .../Support/Messages/SendingController.php | 4 +- app/Http/Controllers/SystemLogController.php | 22 +- app/Http/Controllers/TaxRateController.php | 20 +- app/Http/Controllers/TemplateController.php | 6 +- app/Http/Controllers/TokenController.php | 20 +- .../Controllers/Traits/VerifiesUserEmail.php | 13 +- .../Controllers/TranslationController.php | 15 +- app/Http/Controllers/UserController.php | 40 +- app/Http/Controllers/VendorController.php | 22 +- app/Http/Controllers/WebhookController.php | 22 +- app/Http/Kernel.php | 5 +- app/Http/Livewire/CreditsTable.php | 2 +- app/Http/Livewire/DownloadsTable.php | 8 +- app/Http/Livewire/InvoicesTable.php | 2 +- app/Http/Livewire/PaymentsTable.php | 2 +- app/Http/Livewire/QuotesTable.php | 2 +- app/Http/Livewire/RecurringInvoicesTable.php | 2 +- app/Http/Middleware/ApiSecretCheck.php | 5 +- app/Http/Middleware/Authenticate.php | 2 +- .../Middleware/CheckForMaintenanceMode.php | 2 +- app/Http/Middleware/ClientPortalEnabled.php | 3 +- app/Http/Middleware/ContactRegister.php | 6 +- app/Http/Middleware/ContactSetDb.php | 5 +- app/Http/Middleware/ContactTokenAuth.php | 15 +- app/Http/Middleware/Cors.php | 9 +- app/Http/Middleware/EncryptCookies.php | 2 +- app/Http/Middleware/PasswordProtection.php | 18 +- app/Http/Middleware/PhantomSecret.php | 10 +- app/Http/Middleware/QueryLogging.php | 13 +- .../Middleware/RedirectIfAuthenticated.php | 3 +- app/Http/Middleware/SetDb.php | 8 +- app/Http/Middleware/SetDbByCompanyKey.php | 8 +- app/Http/Middleware/SetDomainNameDb.php | 5 +- app/Http/Middleware/SetEmailDb.php | 5 +- app/Http/Middleware/SetInviteDb.php | 7 +- app/Http/Middleware/SetWebDb.php | 1 - app/Http/Middleware/StartupCheck.php | 6 +- app/Http/Middleware/TokenAuth.php | 17 +- app/Http/Middleware/TrimStrings.php | 2 +- app/Http/Middleware/TrustProxies.php | 4 +- app/Http/Middleware/UrlSetDb.php | 10 +- app/Http/Middleware/VerifyCsrfToken.php | 2 +- .../Requests/Account/CreateAccountRequest.php | 5 +- .../DownloadHistoricalEntityRequest.php | 3 +- .../Requests/Activity/ShowActivityRequest.php | 3 +- .../Requests/Client/BulkClientRequest.php | 8 +- .../Requests/Client/CreateClientRequest.php | 3 +- .../Requests/Client/DestroyClientRequest.php | 3 +- .../Requests/Client/EditClientRequest.php | 3 +- .../Requests/Client/ShowClientRequest.php | 3 +- .../Requests/Client/StoreClientRequest.php | 50 +- .../Requests/Client/UpdateClientRequest.php | 38 +- .../Payments/PaymentResponseRequest.php | 2 +- .../Requests/ClientPortal/RegisterRequest.php | 2 +- .../ClientPortal/ShowInvoiceRequest.php | 4 +- .../ShowRecurringInvoiceRequest.php | 3 +- .../ClientPortal/StoreDocumentRequest.php | 5 +- .../ClientPortal/UpdateClientRequest.php | 5 +- .../ClientPortal/UpdateContactRequest.php | 7 +- .../Uploads/StoreUploadRequest.php | 4 +- .../Requests/Company/CreateCompanyRequest.php | 3 +- .../Company/DestroyCompanyRequest.php | 3 +- .../Requests/Company/EditCompanyRequest.php | 6 +- .../Requests/Company/ShowCompanyRequest.php | 3 +- .../Requests/Company/StoreCompanyRequest.php | 12 +- .../Requests/Company/UpdateCompanyRequest.php | 33 +- .../CreateCompanyGatewayRequest.php | 3 +- .../DestroyCompanyGatewayRequest.php | 6 +- .../EditCompanyGatewayRequest.php | 6 +- .../ShowCompanyGatewayRequest.php | 6 +- .../StoreCompanyGatewayRequest.php | 19 +- .../UpdateCompanyGatewayRequest.php | 12 +- .../ShowCompanyLedgerRequest.php | 4 +- .../CompanyUser/UpdateCompanyUserRequest.php | 6 +- .../Requests/Credit/StoreCreditRequest.php | 6 +- .../Requests/Credit/UpdateCreditRequest.php | 16 +- .../Requests/Design/CreateDesignRequest.php | 3 +- .../Requests/Design/DestroyDesignRequest.php | 3 +- .../Requests/Design/EditDesignRequest.php | 2 +- .../Requests/Design/ShowDesignRequest.php | 2 +- .../Requests/Design/StoreDesignRequest.php | 7 +- .../Requests/Design/UpdateDesignRequest.php | 8 +- .../Document/CreateDocumentRequest.php | 3 +- .../Document/DestroyDocumentRequest.php | 3 +- .../DownloadMultipleDocumentsRequest.php | 2 +- .../Requests/Document/EditDocumentRequest.php | 2 +- .../Requests/Document/ShowDocumentRequest.php | 2 +- .../Document/StoreDocumentRequest.php | 4 +- .../Document/UpdateDocumentRequest.php | 4 +- app/Http/Requests/Email/SendEmailRequest.php | 16 +- .../CreateGroupSettingRequest.php | 3 +- .../DestroyGroupSettingRequest.php | 3 +- .../GroupSetting/EditGroupSettingRequest.php | 3 +- .../GroupSetting/ShowGroupSettingRequest.php | 3 +- .../GroupSetting/StoreGroupSettingRequest.php | 15 +- .../UpdateGroupSettingRequest.php | 32 +- .../Requests/Invoice/CreateInvoiceRequest.php | 3 +- .../Invoice/DestroyInvoiceRequest.php | 3 +- .../Requests/Invoice/EditInvoiceRequest.php | 3 +- .../Requests/Invoice/ShowInvoiceRequest.php | 3 +- .../Requests/Invoice/StoreInvoiceRequest.php | 9 +- .../Requests/Invoice/UpdateInvoiceRequest.php | 18 +- .../Migration/UploadMigrationFileRequest.php | 2 +- .../Requests/Payment/ActionPaymentRequest.php | 3 +- .../Requests/Payment/CreatePaymentRequest.php | 3 +- .../Payment/DestroyPaymentRequest.php | 3 +- .../Requests/Payment/EditPaymentRequest.php | 6 +- .../Requests/Payment/RefundPaymentRequest.php | 12 +- .../Requests/Payment/ShowPaymentRequest.php | 3 +- .../Requests/Payment/StorePaymentRequest.php | 22 +- .../Requests/Payment/UpdatePaymentRequest.php | 16 +- .../PaymentTerm/ActionPaymentTermRequest.php | 3 +- .../PaymentTerm/CreatePaymentTermRequest.php | 3 +- .../PaymentTerm/DestroyPaymentTermRequest.php | 3 +- .../PaymentTerm/EditPaymentTermRequest.php | 6 +- .../PaymentTerm/ShowPaymentTermRequest.php | 3 +- .../PaymentTerm/StorePaymentTermRequest.php | 5 +- .../PaymentTerm/UpdatePaymentTermRequest.php | 5 +- .../Payments/PaymentWebhookRequest.php | 4 +- .../Requests/Product/CreateProductRequest.php | 3 +- .../Product/DestroyProductRequest.php | 3 +- .../Requests/Product/EditProductRequest.php | 2 +- .../Requests/Product/ShowProductRequest.php | 2 +- .../Requests/Product/StoreProductRequest.php | 11 +- .../Requests/Product/UpdateProductRequest.php | 13 +- .../Requests/Quote/ActionQuoteRequest.php | 3 +- .../Requests/Quote/CreateQuoteRequest.php | 3 +- .../Requests/Quote/DestroyQuoteRequest.php | 3 +- app/Http/Requests/Quote/EditQuoteRequest.php | 3 +- app/Http/Requests/Quote/ShowQuoteRequest.php | 3 +- app/Http/Requests/Quote/StoreQuoteRequest.php | 14 +- .../Requests/Quote/UpdateQuoteRequest.php | 20 +- .../ActionRecurringInvoiceRequest.php | 3 +- .../CreateRecurringInvoiceRequest.php | 3 +- .../DestroyRecurringInvoiceRequest.php | 3 +- .../EditRecurringInvoiceRequest.php | 6 +- .../ShowRecurringInvoiceRequest.php | 3 +- .../StoreRecurringInvoiceRequest.php | 12 +- .../UpdateRecurringInvoiceRequest.php | 18 +- .../ActionRecurringQuoteRequest.php | 3 +- .../CreateRecurringQuoteRequest.php | 3 +- .../DestroyRecurringQuoteRequest.php | 3 +- .../EditRecurringQuoteRequest.php | 6 +- .../ShowRecurringQuoteRequest.php | 3 +- .../StoreRecurringQuoteRequest.php | 9 +- .../UpdateRecurringQuoteRequest.php | 7 +- app/Http/Requests/Request.php | 3 +- .../Requests/Setup/CheckDatabaseRequest.php | 2 +- app/Http/Requests/Setup/CheckMailRequest.php | 2 +- app/Http/Requests/Setup/StoreSetupRequest.php | 8 +- .../Requests/Shop/StoreShopClientRequest.php | 47 +- .../Requests/Shop/StoreShopInvoiceRequest.php | 9 +- .../Requests/TaxRate/CreateTaxRateRequest.php | 3 +- .../TaxRate/DestroyTaxRateRequest.php | 3 +- .../Requests/TaxRate/EditTaxRateRequest.php | 2 +- .../Requests/TaxRate/ShowTaxRateRequest.php | 2 +- .../Requests/TaxRate/StoreTaxRateRequest.php | 3 +- .../Requests/TaxRate/UpdateTaxRateRequest.php | 3 +- .../Requests/Template/ShowTemplateRequest.php | 4 +- app/Http/Requests/Token/BulkTokenRequest.php | 6 +- .../Requests/Token/CreateTokenRequest.php | 3 +- .../Requests/Token/DestroyTokenRequest.php | 3 +- app/Http/Requests/Token/EditTokenRequest.php | 3 +- app/Http/Requests/Token/ShowTokenRequest.php | 3 +- app/Http/Requests/Token/StoreTokenRequest.php | 4 +- .../Requests/Token/UpdateTokenRequest.php | 3 +- .../User/AttachCompanyUserRequest.php | 8 +- app/Http/Requests/User/CreateUserRequest.php | 3 +- app/Http/Requests/User/DestroyUserRequest.php | 3 +- .../User/DetachCompanyUserRequest.php | 4 +- app/Http/Requests/User/EditUserRequest.php | 5 +- app/Http/Requests/User/ShowUserRequest.php | 3 +- app/Http/Requests/User/StoreUserRequest.php | 15 +- app/Http/Requests/User/UpdateUserRequest.php | 7 +- .../Requests/Vendor/BulkVendorRequest.php | 8 +- .../Requests/Vendor/CreateVendorRequest.php | 3 +- .../Requests/Vendor/DestroyVendorRequest.php | 3 +- .../Requests/Vendor/EditVendorRequest.php | 3 +- .../Requests/Vendor/ShowVendorRequest.php | 3 +- .../Requests/Vendor/StoreVendorRequest.php | 9 +- .../Requests/Vendor/UpdateVendorRequest.php | 9 +- .../Requests/Webhook/BulkWebhookRequest.php | 8 +- .../Requests/Webhook/CreateWebhookRequest.php | 3 +- .../Webhook/DestroyWebhookRequest.php | 4 +- .../Requests/Webhook/EditWebhookRequest.php | 3 +- .../Requests/Webhook/ShowWebhookRequest.php | 3 +- .../Requests/Webhook/StoreWebhookRequest.php | 5 +- .../Requests/Webhook/UpdateWebhookRequest.php | 6 +- .../Company/ValidCompanyQuantity.php | 8 +- .../Credit/UniqueCreditNumberRule.php | 15 +- .../Credit/ValidCreditsRules.php | 33 +- .../Invoice/LockedInvoiceRule.php | 14 +- .../Invoice/UniqueInvoiceNumberRule.php | 15 +- .../ValidationRules/NewUniqueUserRule.php | 6 +- .../ValidationRules/Ninja/CanAddUserRule.php | 7 +- .../Ninja/CanStoreClientsRule.php | 7 +- .../Payment/ValidInvoicesRules.php | 26 +- .../Payment/ValidRefundableRequest.php | 50 +- .../PaymentAmountsBalanceRule.php | 10 +- .../PaymentAppliedValidAmount.php | 9 +- .../Quote/UniqueQuoteNumberRule.php | 15 +- app/Http/ValidationRules/UniqueUserRule.php | 9 +- .../ValidClientGroupSettingsRule.php | 9 +- .../ValidCompanyGatewayFeesAndLimitsRule.php | 9 +- .../ValidCreditsPresentRule.php | 9 +- .../ValidPayableInvoicesRule.php | 9 +- .../ValidRefundableInvoices.php | 23 +- .../ValidationRules/ValidSettingsRule.php | 9 +- .../ValidationRules/ValidUserForCompany.php | 6 +- app/Http/ViewComposers/HeaderComposer.php | 10 +- app/Http/ViewComposers/PortalComposer.php | 22 +- app/Jobs/Account/CreateAccount.php | 19 +- app/Jobs/Company/CreateCompany.php | 5 +- .../Company/CreateCompanyPaymentTerms.php | 7 +- app/Jobs/Company/CreateCompanyToken.php | 10 +- app/Jobs/Credit/ApplyCreditPayment.php | 9 +- app/Jobs/Credit/CreateCreditPdf.php | 13 +- app/Jobs/Credit/EmailCredit.php | 16 +- app/Jobs/Cron/RecurringInvoicesCron.php | 10 +- app/Jobs/Invitation/MarkOpened.php | 2 +- app/Jobs/Invoice/CreateInvoicePdf.php | 12 +- app/Jobs/Invoice/CreateUbl.php | 35 +- app/Jobs/Invoice/EmailInvoice.php | 27 +- app/Jobs/Invoice/InjectSignature.php | 2 +- app/Jobs/Invoice/InvoiceWorkflowSettings.php | 4 +- app/Jobs/Invoice/ZipInvoices.php | 13 +- app/Jobs/Mail/BaseMailerJob.php | 14 +- app/Jobs/Mail/EntityPaidMailer.php | 16 +- app/Jobs/Mail/EntitySentMailer.php | 8 +- app/Jobs/Mail/EntityViewedMailer.php | 8 +- app/Jobs/Mail/MailRouter.php | 17 +- app/Jobs/Mail/PaymentFailureMailer.php | 13 +- app/Jobs/Ninja/AdjustEmailQuota.php | 12 +- app/Jobs/Ninja/CheckDbStatus.php | 10 +- app/Jobs/Ninja/CompanySizeCheck.php | 24 +- app/Jobs/Ninja/RefundCancelledAccount.php | 15 +- app/Jobs/Payment/EmailPayment.php | 2 - app/Jobs/Payment/PaymentNotification.php | 3 +- app/Jobs/Product/UpdateOrCreateProduct.php | 12 +- app/Jobs/Quote/ApplyQuoteNumber.php | 11 +- app/Jobs/Quote/CreateQuoteInvitations.php | 6 +- app/Jobs/Quote/CreateQuotePdf.php | 19 +- app/Jobs/Quote/EmailQuote.php | 1 - app/Jobs/Quote/QuoteWorkflowSettings.php | 9 +- app/Jobs/RecurringInvoice/SendRecurring.php | 13 +- app/Jobs/User/CreateUser.php | 7 +- app/Jobs/User/UserEmailChanged.php | 11 +- app/Jobs/Util/Import.php | 33 +- app/Jobs/Util/PreviewPdf.php | 6 +- app/Jobs/Util/ProcessBulk.php | 2 +- app/Jobs/Util/ReminderJob.php | 9 +- app/Jobs/Util/SendFailedEmails.php | 16 +- app/Jobs/Util/StartMigration.php | 27 +- app/Jobs/Util/SystemLogger.php | 4 +- app/Jobs/Util/UnlinkFile.php | 2 +- app/Jobs/Util/UpdateExchangeRates.php | 25 +- app/Jobs/Util/UploadAvatar.php | 16 +- app/Jobs/Util/UploadFile.php | 20 +- app/Jobs/Util/VersionCheck.php | 4 +- app/Jobs/Util/WebhookHandler.php | 24 +- .../Currency/Conversion/CurrencyApi.php | 87 +- .../CurrencyConversionInterface.php | 10 +- app/Libraries/Google/Google.php | 10 +- app/Libraries/MultiDB.php | 40 +- app/Libraries/OAuth/OAuth.php | 17 +- app/Libraries/OAuth/Providers/Google.php | 2 +- app/Libraries/OFX.php | 10 +- .../Activity/ArchivedClientActivity.php | 2 +- .../Activity/CreatedClientActivity.php | 2 +- .../Activity/CreatedCreditActivity.php | 2 +- .../Activity/CreatedQuoteActivity.php | 2 +- .../Activity/CreditArchivedActivity.php | 9 +- .../Activity/DeleteClientActivity.php | 2 +- .../Activity/DeleteCreditActivity.php | 2 +- .../Activity/PaymentArchivedActivity.php | 5 +- .../Activity/PaymentCreatedActivity.php | 5 +- .../Activity/PaymentDeletedActivity.php | 4 +- .../Activity/PaymentRefundedActivity.php | 5 +- .../Activity/PaymentUpdatedActivity.php | 8 +- .../Activity/PaymentVoidedActivity.php | 2 +- .../Activity/QuoteUpdatedActivity.php | 6 +- .../Activity/RestoreClientActivity.php | 2 +- .../Activity/UpdatedCreditActivity.php | 4 +- .../Contact/UpdateContactLastLogin.php | 6 +- .../Credit/CreateCreditInvitation.php | 6 +- .../Credit/CreditRestoredActivity.php | 7 +- app/Listeners/Credit/CreditViewedActivity.php | 3 +- .../Document/DeleteCompanyDocuments.php | 2 - .../Invoice/CreateInvoiceActivity.php | 7 +- .../Invoice/CreateInvoiceInvitation.php | 6 +- app/Listeners/Invoice/CreateInvoicePdf.php | 6 +- .../Invoice/InvoiceArchivedActivity.php | 6 +- .../Invoice/InvoiceCancelledActivity.php | 12 +- .../Invoice/InvoiceDeletedActivity.php | 8 +- .../Invoice/InvoiceEmailActivity.php | 3 +- .../Invoice/InvoiceEmailFailedActivity.php | 3 +- .../Invoice/InvoiceEmailedNotification.php | 8 +- app/Listeners/Invoice/InvoicePaidActivity.php | 3 +- .../Invoice/InvoiceRestoredActivity.php | 8 +- .../Invoice/InvoiceReversedActivity.php | 7 +- .../Invoice/InvoiceViewedActivity.php | 3 +- .../Invoice/UpdateInvoiceActivity.php | 5 +- .../Invoice/UpdateInvoiceInvitations.php | 6 +- .../Misc/InvitationViewedListener.php | 11 +- app/Listeners/Payment/PaymentNotification.php | 21 +- .../Payment/PaymentRestoredActivity.php | 8 +- app/Listeners/Quote/CreateQuoteInvitation.php | 6 +- app/Listeners/Quote/QuoteApprovedActivity.php | 8 +- app/Listeners/Quote/QuoteArchivedActivity.php | 8 +- app/Listeners/Quote/QuoteDeletedActivity.php | 8 +- app/Listeners/Quote/QuoteEmailActivity.php | 7 +- app/Listeners/Quote/QuoteRestoredActivity.php | 8 +- app/Listeners/Quote/QuoteViewedActivity.php | 3 +- .../SendVerificationNotification.php | 10 +- app/Listeners/User/ArchivedUserActivity.php | 5 +- app/Listeners/User/CreatedUserActivity.php | 5 +- app/Listeners/User/DeletedUserActivity.php | 9 +- app/Listeners/User/RestoredUserActivity.php | 5 +- app/Listeners/User/UpdateUserLastLogin.php | 2 +- app/Listeners/User/UpdatedUserActivity.php | 5 +- app/Mail/Admin/EntityNotificationMailer.php | 7 +- app/Mail/Admin/EntityPaidObject.php | 41 +- app/Mail/Admin/EntitySentObject.php | 58 +- app/Mail/Admin/EntityViewedObject.php | 41 +- app/Mail/Admin/PaymentFailureObject.php | 32 +- app/Mail/BouncedEmail.php | 5 +- app/Mail/SupportMessageSent.php | 5 +- app/Mail/TemplateEmail.php | 16 +- app/Mail/TestMailServer.php | 6 +- app/Mail/User/UserNotificationMailer.php | 7 +- app/Models/Account.php | 66 +- app/Models/Activity.php | 125 +- app/Models/Backup.php | 5 +- app/Models/Bank.php | 5 +- app/Models/BankAccount.php | 9 +- app/Models/BankSubaccount.php | 2 +- app/Models/BaseModel.php | 27 +- app/Models/Client.php | 122 +- app/Models/ClientContact.php | 20 +- app/Models/ClientGatewayToken.php | 7 +- app/Models/Company.php | 26 +- app/Models/CompanyGateway.php | 73 +- app/Models/CompanyLedger.php | 6 +- app/Models/CompanyToken.php | 10 +- app/Models/CompanyUser.php | 9 +- app/Models/Country.php | 6 +- app/Models/Credit.php | 31 +- app/Models/CreditInvitation.php | 10 +- app/Models/Currency.php | 2 +- app/Models/DateFormat.php | 1 - app/Models/Design.php | 2 +- app/Models/Document.php | 9 +- app/Models/Expense.php | 7 +- app/Models/ExpenseCategory.php | 6 +- app/Models/Filterable.php | 2 +- app/Models/Gateway.php | 8 +- app/Models/GatewayType.php | 2 +- app/Models/GroupSetting.php | 10 +- app/Models/Industry.php | 2 +- app/Models/Invoice.php | 118 +- app/Models/InvoiceInvitation.php | 16 +- app/Models/Language.php | 2 +- app/Models/Payment.php | 14 +- app/Models/PaymentHash.php | 9 +- app/Models/PaymentLibrary.php | 2 +- app/Models/PaymentTerm.php | 6 +- app/Models/PaymentType.php | 4 +- app/Models/Paymentable.php | 2 +- app/Models/Presenters/AccountPresenter.php | 2 +- .../Presenters/ClientContactPresenter.php | 12 +- app/Models/Presenters/ClientPresenter.php | 47 +- app/Models/Presenters/CompanyPresenter.php | 24 +- app/Models/Presenters/CreditPresenter.php | 5 +- app/Models/Presenters/EntityPresenter.php | 29 +- app/Models/Presenters/InvoicePresenter.php | 7 +- app/Models/Presenters/QuotePresenter.php | 7 +- app/Models/Presenters/UserPresenter.php | 10 +- app/Models/Product.php | 6 +- app/Models/Project.php | 4 +- app/Models/Proposal.php | 4 +- app/Models/Quote.php | 49 +- app/Models/QuoteInvitation.php | 14 +- app/Models/RecurringInvoice.php | 96 +- app/Models/RecurringInvoiceInvitation.php | 4 +- app/Models/RecurringQuote.php | 24 +- app/Models/Size.php | 3 +- app/Models/StaticModel.php | 8 +- app/Models/SystemLog.php | 14 +- app/Models/Task.php | 6 +- app/Models/TaxRate.php | 8 +- app/Models/Timezone.php | 2 +- app/Models/User.php | 56 +- app/Models/Vendor.php | 5 +- app/Models/VendorContact.php | 21 +- app/Models/Webhook.php | 6 +- .../Admin/EntitySentNotification.php | 10 +- .../Admin/EntityViewedNotification.php | 17 +- .../Admin/InvoiceSentNotification.php | 17 +- .../Admin/InvoiceViewedNotification.php | 12 +- .../Admin/NewPartialPaymentNotification.php | 25 +- .../Admin/NewPaymentNotification.php | 29 +- app/Notifications/BaseNotification.php | 12 +- .../ClientContactRequestCancellation.php | 11 +- .../ClientContactResetPassword.php | 8 +- app/Notifications/NewAccountCreated.php | 12 +- app/Notifications/Ninja/NewAccountCreated.php | 16 +- app/Notifications/Ninja/VerifyUser.php | 5 +- app/Notifications/SendGenericNotification.php | 7 +- app/Observers/AccountObserver.php | 2 +- app/Observers/ClientContactObserver.php | 2 +- app/Observers/ClientObserver.php | 5 +- app/Observers/CompanyGatewayObserver.php | 2 +- app/Observers/CompanyObserver.php | 2 +- app/Observers/CompanyTokenObserver.php | 2 +- app/Observers/ExpenseObserver.php | 2 +- app/Observers/InvoiceObserver.php | 2 +- app/Observers/PaymentObserver.php | 2 +- app/Observers/ProductObserver.php | 2 +- app/Observers/ProposalObserver.php | 2 +- app/Observers/QuoteObserver.php | 2 +- app/Observers/TaskObserver.php | 2 +- app/Observers/UserObserver.php | 2 +- app/PaymentDrivers/AbstractPaymentDriver.php | 10 +- .../Authorize/AuthorizeCreateCustomer.php | 43 +- .../Authorize/AuthorizeCreditCard.php | 93 +- .../Authorize/AuthorizePaymentMethod.php | 88 +- .../Authorize/AuthorizeTransactions.php | 61 +- .../Authorize/ChargePaymentProfile.php | 133 +- .../Authorize/RefundTransaction.php | 211 +- app/PaymentDrivers/AuthorizePaymentDriver.php | 36 +- app/PaymentDrivers/BaseDriver.php | 83 +- app/PaymentDrivers/BasePaymentDriver.php | 52 +- app/PaymentDrivers/CheckoutCom/Utilities.php | 4 +- .../CheckoutComPaymentDriver.php | 19 +- app/PaymentDrivers/CustomPaymentDriver.php | 29 +- .../PayPalExpressPaymentDriver.php | 57 +- app/PaymentDrivers/Stripe/ACH.php | 2 +- app/PaymentDrivers/Stripe/Alipay.php | 6 +- app/PaymentDrivers/Stripe/Charge.php | 215 +- app/PaymentDrivers/Stripe/CreditCard.php | 12 +- app/PaymentDrivers/Stripe/SOFORT.php | 8 +- app/PaymentDrivers/Stripe/Utilities.php | 2 +- app/PaymentDrivers/StripePaymentDriver.php | 41 +- app/Policies/ActivityPolicy.php | 5 +- app/Policies/ClientPolicy.php | 7 +- app/Policies/CompanyGatewayPolicy.php | 7 +- app/Policies/CompanyPolicy.php | 16 +- app/Policies/CompanyTokenPolicy.php | 5 +- app/Policies/EntityPolicy.php | 16 +- app/Policies/ExpensePolicy.php | 7 +- app/Policies/GroupSettingPolicy.php | 7 +- app/Policies/InvoicePolicy.php | 7 +- app/Policies/PaymentPolicy.php | 7 +- app/Policies/PaymentTermPolicy.php | 7 +- app/Policies/ProductPolicy.php | 4 +- app/Policies/QuotePolicy.php | 7 +- app/Policies/RecurringInvoicePolicy.php | 7 +- app/Policies/RecurringQuotePolicy.php | 7 +- app/Policies/TaxRatePolicy.php | 5 +- app/Policies/UserPolicy.php | 10 +- app/Policies/VendorPolicy.php | 9 +- app/Policies/WebhookPolicy.php | 5 +- app/Providers/AppServiceProvider.php | 7 +- app/Providers/AuthServiceProvider.php | 7 +- app/Providers/BroadcastServiceProvider.php | 4 +- app/Providers/ComposerServiceProvider.php | 4 +- app/Providers/EventServiceProvider.php | 9 +- app/Providers/MultiDBProvider.php | 3 +- app/Providers/MultiDatabaseUserProvider.php | 10 +- .../NinjaTranslationServiceProvider.php | 15 +- app/Providers/RouteServiceProvider.php | 20 +- app/Repositories/AccountRepository.php | 2 +- app/Repositories/ActivityRepository.php | 22 +- app/Repositories/BaseRepository.php | 74 +- app/Repositories/ClientContactRepository.php | 14 +- app/Repositories/ClientRepository.php | 8 +- app/Repositories/CompanyRepository.php | 8 +- app/Repositories/CreditRepository.php | 10 +- app/Repositories/DesignRepository.php | 2 +- app/Repositories/DocumentRepository.php | 3 +- app/Repositories/ExpenseRepository.php | 6 +- app/Repositories/GroupSettingRepository.php | 3 +- app/Repositories/InvoiceRepository.php | 11 +- .../Migration/InvoiceMigrationRepository.php | 41 +- .../Migration/PaymentMigrationRepository.php | 40 +- app/Repositories/PaymentRepository.php | 38 +- app/Repositories/PaymentTermRepository.php | 5 +- app/Repositories/ProductRepository.php | 7 +- app/Repositories/QuoteRepository.php | 6 +- .../RecurringInvoiceRepository.php | 10 +- app/Repositories/RecurringQuoteRepository.php | 11 +- app/Repositories/TokenRepository.php | 7 +- app/Repositories/UserRepository.php | 20 +- app/Repositories/VendorContactRepository.php | 9 +- app/Repositories/VendorRepository.php | 9 +- app/Services/AbstractService.php | 2 +- app/Services/Client/ClientService.php | 2 +- app/Services/Credit/ApplyNumber.php | 8 +- app/Services/Credit/CreateInvitations.php | 7 +- app/Services/Credit/CreditService.php | 6 +- app/Services/Credit/GetCreditPdf.php | 15 +- app/Services/Credit/MarkSent.php | 3 +- app/Services/Invoice/AddGatewayFee.php | 19 +- app/Services/Invoice/ApplyNumber.php | 6 +- app/Services/Invoice/ApplyPayment.php | 17 +- app/Services/Invoice/AutoBillInvoice.php | 77 +- app/Services/Invoice/CreateInvitations.php | 6 +- app/Services/Invoice/GetInvoicePdf.php | 14 +- app/Services/Invoice/HandleCancellation.php | 27 +- app/Services/Invoice/HandleReversal.php | 32 +- app/Services/Invoice/InvoiceService.php | 46 +- app/Services/Invoice/MarkPaid.php | 13 +- app/Services/Invoice/MarkSent.php | 4 +- app/Services/Invoice/SendEmail.php | 9 +- app/Services/Invoice/TriggeredActions.php | 20 +- app/Services/Invoice/UpdateBalance.php | 3 +- app/Services/Ledger/LedgerService.php | 6 +- .../Notification/NotificationService.php | 6 +- app/Services/Payment/ApplyNumber.php | 4 +- app/Services/Payment/DeletePayment.php | 46 +- app/Services/Payment/PaymentService.php | 9 +- app/Services/Payment/RefundPayment.php | 80 +- app/Services/Payment/SendEmail.php | 5 +- app/Services/Payment/UpdateInvoicePayment.php | 28 +- app/Services/PdfMaker/Design.php | 14 +- .../PdfMaker/Designs/Utilities/BaseDesign.php | 2 +- .../Designs/Utilities/DesignHelpers.php | 34 +- app/Services/PdfMaker/PdfMaker.php | 2 +- app/Services/PdfMaker/PdfMakerUtilities.php | 17 +- app/Services/Quote/ApplyNumber.php | 5 +- app/Services/Quote/ConvertQuote.php | 6 +- app/Services/Quote/CreateInvitations.php | 7 +- app/Services/Quote/GetQuotePdf.php | 14 +- app/Services/Quote/MarkApproved.php | 3 +- app/Services/Quote/MarkSent.php | 3 +- app/Services/Quote/QuoteService.php | 27 +- app/Services/Quote/SendEmail.php | 7 +- app/Services/Recurring/RecurringService.php | 4 +- app/Transformers/AccountTransformer.php | 16 +- app/Transformers/ActivityTransformer.php | 7 +- app/Transformers/ArraySerializer.php | 2 +- .../ClientContactLoginTransformer.php | 10 +- app/Transformers/ClientContactTransformer.php | 13 +- .../ClientGatewayTokenTransformer.php | 17 +- app/Transformers/ClientTransformer.php | 27 +- .../CompanyGatewayTransformer.php | 33 +- app/Transformers/CompanyLedgerTransformer.php | 20 +- .../CompanyTokenHashedTransformer.php | 15 +- app/Transformers/CompanyTokenTransformer.php | 13 +- app/Transformers/CompanyTransformer.php | 51 +- app/Transformers/CompanyUserTransformer.php | 18 +- .../Contact/InvoiceTransformer.php | 4 +- .../CreditInvitationTransformer.php | 10 +- app/Transformers/CreditTransformer.php | 22 +- app/Transformers/DesignTransformer.php | 19 +- app/Transformers/DocumentTransformer.php | 2 +- app/Transformers/EntityTransformer.php | 2 +- app/Transformers/ExpenseTransformer.php | 28 +- app/Transformers/GatewayTransformer.php | 29 +- app/Transformers/GroupSettingTransformer.php | 13 +- .../InvoiceHistoryTransformer.php | 10 +- .../InvoiceInvitationTransformer.php | 10 +- app/Transformers/InvoiceTransformer.php | 26 +- app/Transformers/PaymentTermTransformer.php | 6 +- app/Transformers/PaymentTransformer.php | 11 +- app/Transformers/PaymentableTransformer.php | 8 +- app/Transformers/ProductTransformer.php | 10 +- app/Transformers/ProjectTransformer.php | 10 +- .../QuoteInvitationTransformer.php | 2 +- app/Transformers/QuoteTransformer.php | 32 +- .../RecurringInvoiceTransformer.php | 8 +- .../RecurringQuoteTransformer.php | 8 +- .../Shop/CompanyShopProfileTransformer.php | 8 +- app/Transformers/SystemLogTransformer.php | 4 +- app/Transformers/TaskTransformer.php | 10 +- app/Transformers/TaxRateTransformer.php | 6 +- app/Transformers/UserTransformer.php | 17 +- app/Transformers/VendorContactTransformer.php | 11 +- app/Transformers/VendorTransformer.php | 15 +- app/Transformers/WebhookTransformer.php | 8 +- app/Utils/CurlUtils.php | 4 +- app/Utils/EmailStats.php | 30 +- app/Utils/HtmlEngine.php | 436 ++- app/Utils/Ninja.php | 20 +- app/Utils/Number.php | 18 +- app/Utils/PhantomJS/Phantom.php | 80 +- app/Utils/Statics.php | 15 +- app/Utils/SystemHealth.php | 24 +- app/Utils/TempFile.php | 19 +- app/Utils/TemplateEngine.php | 12 +- app/Utils/Traits/AppSetup.php | 6 +- app/Utils/Traits/BulkOptions.php | 4 +- app/Utils/Traits/ChecksEntityStatus.php | 5 +- app/Utils/Traits/CleanLineItems.php | 13 +- app/Utils/Traits/ClientGroupSettingsSaver.php | 60 +- .../CompanyGatewayFeesAndLimitsSaver.php | 26 +- app/Utils/Traits/CompanySettingsSaver.php | 67 +- app/Utils/Traits/GeneratesCounter.php | 54 +- app/Utils/Traits/Inviteable.php | 16 +- app/Utils/Traits/Invoice/ActionsInvoice.php | 24 +- app/Utils/Traits/InvoiceEmailBuilder.php | 17 +- app/Utils/Traits/MakesDates.php | 21 +- app/Utils/Traits/MakesHash.php | 21 +- app/Utils/Traits/MakesHeaderData.php | 5 +- app/Utils/Traits/MakesInvoiceHtml.php | 28 +- app/Utils/Traits/MakesInvoiceValues.php | 442 ++- app/Utils/Traits/MakesMenu.php | 12 +- app/Utils/Traits/MakesReminders.php | 28 +- app/Utils/Traits/MakesTemplateData.php | 295 +- .../Traits/Notifications/UserNotifies.php | 24 +- app/Utils/Traits/NumberFormatter.php | 8 +- app/Utils/Traits/Payment/Refundable.php | 16 +- app/Utils/Traits/PaymentEmailBuilder.php | 17 +- app/Utils/Traits/Pdf/PdfMaker.php | 22 +- app/Utils/Traits/QuoteEmailBuilder.php | 21 +- app/Utils/Traits/SavesDocuments.php | 4 +- app/Utils/Traits/SettingsSaver.php | 27 +- app/Utils/Traits/SystemLogTrait.php | 5 +- app/Utils/Traits/ThrottlesEmail.php | 11 +- app/Utils/Traits/Uploadable.php | 7 +- app/Utils/Traits/UserSessionAttributes.php | 6 +- app/Utils/Traits/UserSettings.php | 6 +- app/Utils/Traits/WithSorting.php | 4 +- app/Utils/TranslationHelper.php | 7 +- bootstrap/app.php | 2 +- composer.json | 50 +- composer.lock | 2410 +++++++++++------ config/auth.php | 20 + config/beacon.php | 20 +- config/cache.php | 20 +- config/cors.php | 34 + config/css-inliner.php | 26 +- config/filesystems.php | 23 +- config/former.php | 119 +- config/logging.php | 25 +- config/mail.php | 117 +- config/ninja.php | 44 +- config/queue.php | 11 +- config/session.php | 25 +- config/view.php | 5 +- database/factories/ClientFactory.php | 1 - database/factories/ClientLocationFactory.php | 2 +- database/factories/CreditFactory.php | 2 +- database/factories/InvoiceFactory.php | 2 +- database/factories/PaymentFactory.php | 2 +- .../factories/RecurringInvoiceFactory.php | 2 +- .../2014_10_13_000000_create_users_table.php | 75 +- ...deleted_column_to_company_tokens_table.php | 1 - ...dd_google_refresh_token_to_users_table.php | 6 +- ..._05_084934_company_too_large_attribute.php | 2 - ..._065301_add_token_id_to_activity_table.php | 1 - ...21_112424_update_enabled_modules_value.php | 2 +- ...80851_add_is_deleted_to_group_settings.php | 1 - ...ted_flag_to_client_gateway_token_table.php | 1 - .../2020_08_13_095946_remove_photo_design.php | 3 +- ..._reminder_sent_fields_to_entity_tables.php | 2 - ...40557_add_is_public_to_documents_table.php | 11 +- database/seeds/ConstantsSeeder.php | 2 +- database/seeds/CountriesSeeder.php | 1 - database/seeds/DatabaseSeeder.php | 1 + database/seeds/DesignSeeder.php | 4 +- database/seeds/PaymentLibrariesSeeder.php | 8 +- database/seeds/PaymentTermsSeeder.php | 1 - database/seeds/PaymentTypesSeeder.php | 2 +- database/seeds/RandomDataSeeder.php | 45 +- database/seeds/UsersTableSeeder.php | 15 +- phpunit.xml | 2 +- resources/lang/ca/texts.php | 7 +- resources/lang/cs/texts.php | 7 +- resources/lang/da/pagination.php | 4 +- resources/lang/da/reminders.php | 14 +- resources/lang/da/texts.php | 7 +- resources/lang/da/validation.php | 146 +- resources/lang/de/pagination.php | 4 +- resources/lang/de/passwords.php | 10 +- resources/lang/de/reminders.php | 12 +- resources/lang/de/texts.php | 7 +- resources/lang/de/validation.php | 142 +- resources/lang/el/texts.php | 7 +- resources/lang/en/texts.php | 3 - resources/lang/en_GB/pagination.php | 4 +- resources/lang/en_GB/passwords.php | 10 +- resources/lang/en_GB/reminders.php | 12 +- resources/lang/en_GB/texts.php | 7 +- resources/lang/en_GB/validation.php | 134 +- resources/lang/es/pagination.php | 4 +- resources/lang/es/reminders.php | 12 +- resources/lang/es/texts.php | 7 +- resources/lang/es/validation.php | 142 +- resources/lang/es_ES/pagination.php | 4 +- resources/lang/es_ES/reminders.php | 12 +- resources/lang/es_ES/texts.php | 7 +- resources/lang/es_ES/validation.php | 142 +- resources/lang/fi/texts.php | 7 +- resources/lang/fr/pagination.php | 4 +- resources/lang/fr/reminders.php | 12 +- resources/lang/fr/texts.php | 7 +- resources/lang/fr/validation.php | 202 +- resources/lang/fr_CA/pagination.php | 4 +- resources/lang/fr_CA/reminders.php | 12 +- resources/lang/fr_CA/texts.php | 7 +- resources/lang/fr_CA/validation.php | 202 +- resources/lang/hr/texts.php | 7 +- resources/lang/it/pagination.php | 4 +- resources/lang/it/reminders.php | 12 +- resources/lang/it/texts.php | 7 +- resources/lang/it/validation.php | 142 +- resources/lang/ja/pagination.php | 4 +- resources/lang/ja/passwords.php | 10 +- resources/lang/ja/reminders.php | 12 +- resources/lang/ja/texts.php | 7 +- resources/lang/ja/validation.php | 132 +- resources/lang/lt/reminders.php | 10 +- resources/lang/lt/texts.php | 7 +- resources/lang/lt/validation.php | 114 +- resources/lang/mk_MK/texts.php | 7 +- resources/lang/nb_NO/pagination.php | 4 +- resources/lang/nb_NO/reminders.php | 12 +- resources/lang/nb_NO/texts.php | 7 +- resources/lang/nb_NO/validation.php | 128 +- resources/lang/nl/pagination.php | 4 +- resources/lang/nl/passwords.php | 10 +- resources/lang/nl/reminders.php | 12 +- resources/lang/nl/texts.php | 7 +- resources/lang/nl/validation.php | 152 +- resources/lang/pl/pagination.php | 4 +- resources/lang/pl/passwords.php | 10 +- resources/lang/pl/reminders.php | 12 +- resources/lang/pl/texts.php | 7 +- resources/lang/pl/validation.php | 132 +- resources/lang/pt_BR/pagination.php | 4 +- resources/lang/pt_BR/passwords.php | 10 +- resources/lang/pt_BR/reminders.php | 12 +- resources/lang/pt_BR/texts.php | 7 +- resources/lang/pt_BR/validation.php | 132 +- resources/lang/pt_PT/pagination.php | 4 +- resources/lang/pt_PT/passwords.php | 10 +- resources/lang/pt_PT/reminders.php | 12 +- resources/lang/pt_PT/texts.php | 7 +- resources/lang/pt_PT/validation.php | 132 +- resources/lang/ro/texts.php | 7 +- resources/lang/sl/texts.php | 7 +- resources/lang/sq/texts.php | 7 +- resources/lang/sv/passwords.php | 10 +- resources/lang/sv/reminders.php | 12 +- resources/lang/sv/texts.php | 7 +- resources/lang/sv/validation.php | 126 +- resources/lang/th/texts.php | 7 +- resources/lang/tr_TR/texts.php | 7 +- resources/lang/zh_TW/texts.php | 7 +- .../views/vendor/mail/html/button.blade.php | 34 +- .../views/vendor/mail/html/footer.blade.php | 18 +- .../views/vendor/mail/html/header.blade.php | 10 +- .../views/vendor/mail/html/layout.blade.php | 82 +- .../views/vendor/mail/html/message.blade.php | 50 +- .../views/vendor/mail/html/panel.blade.php | 22 +- .../vendor/mail/html/promotion.blade.php | 10 +- .../mail/html/promotion/button.blade.php | 22 +- .../views/vendor/mail/html/subcopy.blade.php | 10 +- .../views/vendor/mail/html/themes/default.css | 304 +-- .../vendor/mail/markdown/message.blade.php | 50 +- .../views/vendor/mail/text/message.blade.php | 50 +- routes/api.php | 44 +- routes/client.php | 9 +- routes/contact.php | 2 +- routes/shop.php | 19 +- routes/web.php | 6 +- tests/DuskTestCase.php | 4 +- tests/Feature/CancelInvoiceTest.php | 1 - tests/Feature/ClientApiTest.php | 25 +- tests/Feature/ClientModelTest.php | 16 +- tests/Feature/ClientPresenterTest.php | 4 +- tests/Feature/ClientTest.php | 80 +- tests/Feature/CompanyGatewayApiTest.php | 75 +- tests/Feature/CompanyGatewayTest.php | 61 +- tests/Feature/CompanySettingsTest.php | 21 +- tests/Feature/CompanyTest.php | 9 +- tests/Feature/CompanyTokenApiTest.php | 16 +- tests/Feature/CreditTest.php | 16 +- tests/Feature/DesignApiTest.php | 43 +- tests/Feature/GroupSettingTest.php | 21 +- tests/Feature/InvitationTest.php | 13 +- tests/Feature/InvoiceEmailTest.php | 13 +- tests/Feature/InvoiceTest.php | 46 +- tests/Feature/LoginTest.php | 13 +- tests/Feature/MigrationTest.php | 2 - tests/Feature/PaymentTermsApiTest.php | 34 +- tests/Feature/PaymentTest.php | 158 +- tests/Feature/PdfMaker/ExampleDesign.php | 2 +- .../PdfMaker/ExampleIntegrationTest.php | 4 +- tests/Feature/PdfMaker/PdfMakerTest.php | 14 +- tests/Feature/ProductTest.php | 9 +- tests/Feature/QuoteTest.php | 8 +- tests/Feature/RecurringInvoiceTest.php | 17 +- tests/Feature/RecurringInvoicesCronTest.php | 3 +- tests/Feature/RecurringQuoteTest.php | 10 +- tests/Feature/RefundTest.php | 73 +- tests/Feature/ReminderTest.php | 3 - tests/Feature/ReverseInvoiceTest.php | 18 +- tests/Feature/Shop/ShopInvoiceTest.php | 58 +- tests/Feature/SystemLogApiTest.php | 44 +- tests/Feature/UpdateExchangeRatesTest.php | 16 +- tests/Feature/UserTest.php | 21 +- tests/Feature/WebhookAPITest.php | 12 +- .../CheckLockedInvoiceValidationTest.php | 20 +- tests/Integration/CompanyLedgerTest.php | 40 +- tests/Integration/ContainerTest.php | 9 - .../DownloadHistoricalInvoiceTest.php | 6 +- tests/Integration/MultiDBUserTest.php | 11 +- .../PaymentDrivers/AuthorizeTest.php | 267 +- tests/Integration/SendFailedEmailsTest.php | 19 +- tests/Integration/SystemHealthTest.php | 5 +- tests/Integration/UniqueEmailTest.php | 12 +- tests/Integration/UpdateCompanyLedgerTest.php | 11 +- tests/Integration/UploadFileTest.php | 3 +- tests/Integration/UploadLogoTest.php | 20 +- tests/MockAccountData.php | 86 +- tests/Pdf/PdfGenerationTest.php | 19 - tests/Unit/BaseSettingsTest.php | 4 +- tests/Unit/CloneQuoteToInvoiceFactoryTest.php | 7 +- tests/Unit/CollectionMergingTest.php | 1 - tests/Unit/CompanyDocumentsTest.php | 1 - tests/Unit/CompanySettingsSaveableTest.php | 30 +- tests/Unit/CompanySettingsTest.php | 2 +- tests/Unit/CompareCollectionTest.php | 12 +- tests/Unit/CompareObjectTest.php | 6 +- tests/Unit/CurrencyApiTest.php | 43 +- tests/Unit/EncryptionSettingsTest.php | 5 +- tests/Unit/EntityTest.php | 7 +- tests/Unit/EvaluateStringTest.php | 1 - tests/Unit/FactoryCreationTest.php | 22 +- tests/Unit/GeneratesCounterTest.php | 21 +- tests/Unit/GoogleAnalyticsTest.php | 15 +- tests/Unit/GroupSettingsTest.php | 11 +- tests/Unit/GroupTest.php | 4 +- tests/Unit/InvitationTest.php | 4 +- tests/Unit/InvoiceActionsTest.php | 5 +- tests/Unit/InvoiceInclusiveTest.php | 34 +- tests/Unit/InvoiceItemInclusiveTest.php | 20 +- tests/Unit/InvoiceItemTest.php | 18 +- tests/Unit/InvoiceItemV2Test.php | 40 +- tests/Unit/InvoiceTest.php | 22 +- tests/Unit/MakesDatesTest.php | 1 - tests/Unit/MakesInvoiceValuesTest.php | 29 +- tests/Unit/Migration/FeesAndLimitsTest.php | 39 +- tests/Unit/Migration/ImportTest.php | 7 +- tests/Unit/NestedCollectionTest.php | 15 +- tests/Unit/NumberTest.php | 12 +- tests/Unit/PdfVariablesTest.php | 2 +- tests/Unit/PrimaryKeyTransformationTest.php | 2 +- tests/Unit/SentryTest.php | 5 +- tests/Unit/Shop/ShopProfileTest.php | 13 +- tests/Unit/SystemHealthTest.php | 3 +- tests/Unit/TranslationTest.php | 12 +- tests/Unit/UBLInvoiceTest.php | 2 +- 1153 files changed, 10632 insertions(+), 11488 deletions(-) create mode 100644 config/cors.php diff --git a/.env.dusk.example b/.env.dusk.example index 5529bb44f721..60dd0ac0e942 100644 --- a/.env.dusk.example +++ b/.env.dusk.example @@ -16,7 +16,7 @@ DB_PASSWORD=ninja DB_CONNECTION=db-ninja-01 DB_DATABASE1=db-ninja-01 DB_DATABASE2=db-ninja-02 -MAIL_DRIVER=log +MAIL_MAILER=log MAIL_PORT=587 MAIL_ENCRYPTION=tls MAIL_HOST= diff --git a/.env.example b/.env.example index ef6a007e6b0a..377939c6d2c9 100644 --- a/.env.example +++ b/.env.example @@ -33,7 +33,7 @@ REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 -MAIL_DRIVER=smtp +MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null diff --git a/.env.travis b/.env.travis index f672e2a58d55..9cb949d2a60d 100644 --- a/.env.travis +++ b/.env.travis @@ -14,7 +14,7 @@ DB_CONNECTION=db-ninja-01 DB_DATABASE1=ninja01 DB_DATABASE2=ninja02 -MAIL_DRIVER=log +MAIL_MAILER=log TRAVIS=true API_SECRET=password TEST_USERNAME=user@example.com diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index fcb09b295f33..9d9ad28ca550 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -70,13 +70,12 @@ class CheckData extends Command public function handle() { - $this->logMessage(date('Y-m-d h:i:s') . ' Running CheckData...'); + $this->logMessage(date('Y-m-d h:i:s').' Running CheckData...'); if ($database = $this->option('database')) { config(['database.default' => $database]); } - $this->checkInvoiceBalances(); $this->checkInvoicePayments(); $this->checkPaidToDates(); @@ -93,25 +92,25 @@ class CheckData extends Command $this->checkFailedJobs(); } - $this->logMessage('Done: ' . strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE)); + $this->logMessage('Done: '.strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE)); $errorEmail = config('ninja.error_email'); if ($errorEmail) { Mail::raw($this->log, function ($message) use ($errorEmail, $database) { $message->to($errorEmail) ->from(config('ninja.error_email')) - ->subject("Check-Data: " . strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE) . " [{$database}]"); + ->subject('Check-Data: '.strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE)." [{$database}]"); }); } elseif (! $this->isValid) { - throw new Exception("Check data failed!!\n" . $this->log); + throw new Exception("Check data failed!!\n".$this->log); } } private function logMessage($str) { - $str = date('Y-m-d h:i:s') . ' ' . $str; + $str = date('Y-m-d h:i:s').' '.$str; $this->info($str); - $this->log .= $str . "\n"; + $this->log .= $str."\n"; } private function checkOAuth() @@ -123,7 +122,7 @@ class CheckData extends Command ->havingRaw('count(users.id) > 1') ->get(['users.oauth_user_id']); - $this->logMessage($users->count() . ' users with duplicate oauth ids'); + $this->logMessage($users->count().' users with duplicate oauth ids'); if ($users->count() > 0) { $this->isValid = false; @@ -132,7 +131,7 @@ class CheckData extends Command if ($this->option('fix') == 'true') { foreach ($users as $user) { $first = true; - $this->logMessage('checking ' . $user->oauth_user_id); + $this->logMessage('checking '.$user->oauth_user_id); $matches = DB::table('users') ->where('oauth_user_id', '=', $user->oauth_user_id) ->orderBy('id') @@ -140,11 +139,11 @@ class CheckData extends Command foreach ($matches as $match) { if ($first) { - $this->logMessage('skipping ' . $match->id); + $this->logMessage('skipping '.$match->id); $first = false; continue; } - $this->logMessage('updating ' . $match->id); + $this->logMessage('updating '.$match->id); DB::table('users') ->where('id', '=', $match->id) @@ -165,7 +164,7 @@ class CheckData extends Command ->whereNull('contact_key') ->orderBy('id') ->get(['id']); - $this->logMessage($contacts->count() . ' contacts without a contact_key'); + $this->logMessage($contacts->count().' contacts without a contact_key'); if ($contacts->count() > 0) { $this->isValid = false; @@ -184,7 +183,7 @@ class CheckData extends Command // check for missing contacts $clients = DB::table('clients') - ->leftJoin('client_contacts', function($join) { + ->leftJoin('client_contacts', function ($join) { $join->on('client_contacts.client_id', '=', 'clients.id') ->whereNull('client_contacts.deleted_at'); }) @@ -196,7 +195,7 @@ class CheckData extends Command } $clients = $clients->get(['clients.id', 'clients.user_id', 'clients.company_id']); - $this->logMessage($clients->count() . ' clients without any contacts'); + $this->logMessage($clients->count().' clients without any contacts'); if ($clients->count() > 0) { $this->isValid = false; @@ -217,7 +216,7 @@ class CheckData extends Command // check for more than one primary contact $clients = DB::table('clients') - ->leftJoin('client_contacts', function($join) { + ->leftJoin('client_contacts', function ($join) { $join->on('client_contacts.client_id', '=', 'clients.id') ->where('client_contacts.is_primary', '=', true) ->whereNull('client_contacts.deleted_at'); @@ -230,7 +229,7 @@ class CheckData extends Command } $clients = $clients->get(['clients.id', DB::raw('count(client_contacts.id)')]); - $this->logMessage($clients->count() . ' clients without a single primary contact'); + $this->logMessage($clients->count().' clients without a single primary contact'); if ($clients->count() > 0) { $this->isValid = false; @@ -250,7 +249,7 @@ class CheckData extends Command $this->isValid = false; } - $this->logMessage($count . ' failed jobs'); + $this->logMessage($count.' failed jobs'); } private function checkInvitations() @@ -264,7 +263,7 @@ class CheckData extends Command ->havingRaw('count(invoice_invitations.id) = 0') ->get(['invoices.id', 'invoices.user_id', 'invoices.company_id', 'invoices.client_id']); - $this->logMessage($invoices->count() . ' invoices without any invitations'); + $this->logMessage($invoices->count().' invoices without any invitations'); if ($invoices->count() > 0) { $this->isValid = false; @@ -285,134 +284,108 @@ class CheckData extends Command private function checkInvoiceBalances() { - $wrong_balances = 0; $wrong_paid_to_dates = 0; - foreach(Client::cursor() as $client) - { + foreach (Client::cursor() as $client) { $invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance'); - + $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first(); - if($ledger && number_format($invoice_balance, 4) != number_format($client->balance, 4)) - { + if ($ledger && number_format($invoice_balance, 4) != number_format($client->balance, 4)) { $wrong_balances++; - $this->logMessage($client->present()->name . " - " . $client->id . " - balances do not match Invoice Balance = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}"); + $this->logMessage($client->present()->name.' - '.$client->id." - balances do not match Invoice Balance = {$invoice_balance} Client Balance = {$client->balance} Ledger Balance = {$ledger->balance}"); $this->isValid = false; - } + } - } - - $this->logMessage("{$wrong_balances} clients with incorrect balances"); - + $this->logMessage("{$wrong_balances} clients with incorrect balances"); } private function checkPaidToDates() { - $wrong_paid_to_dates = 0; - Client::withTrashed()->cursor()->each(function ($client) use($wrong_paid_to_dates){ + Client::withTrashed()->cursor()->each(function ($client) use ($wrong_paid_to_dates) { + $total_invoice_payments = 0; - $total_invoice_payments = 0; - - foreach($client->invoices as $invoice) - { + foreach ($client->invoices as $invoice) { $total_amount = $invoice->payments->sum('pivot.amount'); $total_refund = $invoice->payments->sum('pivot.refunded'); - + $total_invoice_payments += ($total_amount - $total_refund); } - - if(round($total_invoice_payments,2) != round($client->paid_to_date,2)) { + + if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) { $wrong_paid_to_dates++; - $this->logMessage($client->present()->name . " - " . $client->id . " - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_invoice_payments}"); + $this->logMessage($client->present()->name.' - '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_invoice_payments}"); $this->isValid = false; - } - }); $this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid to dates"); - } private function checkInvoicePayments() { $wrong_balances = 0; $wrong_paid_to_dates = 0; - + //todo reversing an invoice breaks the check data at this point; - - Client::cursor()->each(function ($client) use($wrong_balances){ - - $client->invoices->where('is_deleted', false)->each(function ($invoice) use($wrong_balances, $client){ + Client::cursor()->each(function ($client) use ($wrong_balances) { + $client->invoices->where('is_deleted', false)->each(function ($invoice) use ($wrong_balances, $client) { $total_amount = $invoice->payments->sum('pivot.amount'); $total_refund = $invoice->payments->sum('pivot.refunded'); $total_credit = $invoice->credits->sum('amount'); $total_paid = $total_amount - $total_refund; - if($total_paid != ($invoice->amount - $invoice->balance - $total_credit)) { + if ($total_paid != ($invoice->amount - $invoice->balance - $total_credit)) { $wrong_balances++; - $this->logMessage($client->present()->name . " - " . $client->id . " - balances do not match Invoice Amount = {$invoice->amount} - Invoice Balance = {$invoice->balance} Total paid = {$total_paid}"); + $this->logMessage($client->present()->name.' - '.$client->id." - balances do not match Invoice Amount = {$invoice->amount} - Invoice Balance = {$invoice->balance} Total paid = {$total_paid}"); $this->isValid = false; - } - }); - }); - $this->logMessage("{$wrong_balances} clients with incorrect invoice balances"); + $this->logMessage("{$wrong_balances} clients with incorrect invoice balances"); } private function checkClientBalances() { - $wrong_balances = 0; $wrong_paid_to_dates = 0; - foreach(Client::cursor() as $client) - { + foreach (Client::cursor() as $client) { $invoice_balance = $client->invoices->sum('balance'); $invoice_amounts = $client->invoices->sum('amount') - $invoice_balance; $credit_amounts = 0; - foreach($client->invoices as $invoice) - { + foreach ($client->invoices as $invoice) { $credit_amounts += $invoice->credits->sum('amount'); - }; - + } /*To handle invoice reversals, we need to "ADD BACK" the credit amounts here*/ $client_paid_to_date = $client->paid_to_date + $credit_amounts; $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first(); - if($ledger && (string)$invoice_amounts != (string)$client_paid_to_date) - { - + if ($ledger && (string) $invoice_amounts != (string) $client_paid_to_date) { $wrong_paid_to_dates++; - $this->logMessage($client->present()->name . " - " . $client->id . " - client paid to dates do not match {$invoice_amounts} - " .rtrim($client_paid_to_date, "0")); - + $this->logMessage($client->present()->name.' - '.$client->id." - client paid to dates do not match {$invoice_amounts} - ".rtrim($client_paid_to_date, '0')); + $this->isValid = false; - } + } - } - - $this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid_to_dates"); - + $this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid_to_dates"); } private function checkLogoFiles() @@ -460,7 +433,6 @@ class CheckData extends Command ]; } - private function checkCompanyData() { $tables = [ @@ -497,29 +469,24 @@ class CheckData extends Command if ($records->count()) { $this->isValid = false; - $this->logMessage($records->count() . " {$table} records with incorrect {$entityType} company id"); - + $this->logMessage($records->count()." {$table} records with incorrect {$entityType} company id"); } } } - // foreach(User::cursor() as $user) { // $records = Company::where('account_id',) // } - } public function pluralizeEntityType($type) { - if ($type === 'company') { return 'companies'; - } + } - return $type . 's'; - + return $type.'s'; } } diff --git a/app/Console/Commands/CreateTestData.php b/app/Console/Commands/CreateTestData.php index 84400d1a461e..7b04e95db41a 100644 --- a/app/Console/Commands/CreateTestData.php +++ b/app/Console/Commands/CreateTestData.php @@ -81,7 +81,6 @@ class CreateTestData extends Command $this->createLargeAccount(); } - private function createSmallAccount() { $this->info('Creating Small Account and Company'); @@ -92,20 +91,19 @@ class CreateTestData extends Command 'slack_webhook_url' => config('ninja.notification.slack'), ]); - $account->default_company_id = $company->id; $account->save(); $user = User::whereEmail('small@example.com')->first(); - if (!$user) { + if (! $user) { $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'email' => 'small@example.com', - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } - + $company_token = new CompanyToken; $company_token->user_id = $user->id; $company_token->company_id = $company->id; @@ -131,17 +129,16 @@ class CreateTestData extends Command 'company_id' => $company->id, ]); - $this->info('Creating '.$this->count. ' clients'); + $this->info('Creating '.$this->count.' clients'); - for ($x=0; $x<$this->count; $x++) { - $z = $x+1; - $this->info("Creating client # ".$z); + for ($x = 0; $x < $this->count; $x++) { + $z = $x + 1; + $this->info('Creating client # '.$z); $this->createClient($company, $user); } - for($x=0; $x<$this->count; $x++) - { + for ($x = 0; $x < $this->count; $x++) { $client = $company->clients->random(); $this->info('creating invoice for client #'.$client->id); @@ -177,7 +174,6 @@ class CreateTestData extends Command $this->info('creating project for client #'.$client->id); $this->createProject($client); } - } private function createMediumAccount() @@ -195,11 +191,11 @@ class CreateTestData extends Command $user = User::whereEmail('medium@example.com')->first(); - if (!$user) { + if (! $user) { $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'email' => 'medium@example.com', - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } @@ -222,25 +218,23 @@ class CreateTestData extends Command 'settings' => null, ]); - factory(\App\Models\Product::class, 50)->create([ 'user_id' => $user->id, 'company_id' => $company->id, ]); - $this->count = $this->count*10; + $this->count = $this->count * 10; - $this->info('Creating '.$this->count. ' clients'); + $this->info('Creating '.$this->count.' clients'); - for ($x=0; $x<$this->count; $x++) { - $z = $x+1; - $this->info("Creating client # ".$z); + for ($x = 0; $x < $this->count; $x++) { + $z = $x + 1; + $this->info('Creating client # '.$z); $this->createClient($company, $user); } - for($x=0; $x<$this->count*100; $x++) - { + for ($x = 0; $x < $this->count * 100; $x++) { $client = $company->clients->random(); $this->info('creating invoice for client #'.$client->id); @@ -294,11 +288,11 @@ class CreateTestData extends Command $user = User::whereEmail('large@example.com')->first(); - if (!$user) { + if (! $user) { $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'email' => 'large@example.com', - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } @@ -321,26 +315,23 @@ class CreateTestData extends Command 'settings' => null, ]); - factory(\App\Models\Product::class, 15000)->create([ 'user_id' => $user->id, 'company_id' => $company->id, ]); - $this->count = $this->count*100; + $this->count = $this->count * 100; - $this->info('Creating '.$this->count. ' clients'); + $this->info('Creating '.$this->count.' clients'); - - for ($x=0; $x<$this->count*500; $x++) { - $z = $x+1; - $this->info("Creating client # ".$z); + for ($x = 0; $x < $this->count * 500; $x++) { + $z = $x + 1; + $this->info('Creating client # '.$z); $this->createClient($company, $user); } - for($x=0; $x<$this->count; $x++) - { + for ($x = 0; $x < $this->count; $x++) { $client = $company->clients->random(); $this->info('creating invoice for client #'.$client->id); @@ -382,37 +373,36 @@ class CreateTestData extends Command { // dispatch(function () use ($company, $user) { - + // }); $client = factory(\App\Models\Client::class)->create([ 'user_id' => $user->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $client->id, 'company_id' => $company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, rand(1, 5))->create([ 'user_id' => $user->id, 'client_id' => $client->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); $client->id_number = $this->getNextClientNumber($client); $settings = $client->settings; - $settings->currency_id = (string)rand(1,79); + $settings->currency_id = (string) rand(1, 79); $client->settings = $settings; $country = Country::all()->random(); $client->country_id = $country->id; $client->save(); - } private function createExpense($client) @@ -420,7 +410,7 @@ class CreateTestData extends Command factory(\App\Models\Expense::class, rand(1, 5))->create([ 'user_id' => $client->user->id, 'client_id' => $client->id, - 'company_id' => $client->company->id + 'company_id' => $client->company->id, ]); } @@ -428,22 +418,21 @@ class CreateTestData extends Command { $vendor = factory(\App\Models\Vendor::class)->create([ 'user_id' => $client->user->id, - 'company_id' => $client->company->id + 'company_id' => $client->company->id, ]); - factory(\App\Models\VendorContact::class, 1)->create([ 'user_id' => $client->user->id, 'vendor_id' => $vendor->id, 'company_id' => $client->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\VendorContact::class, rand(1, 5))->create([ 'user_id' => $client->user->id, 'vendor_id' => $vendor->id, 'company_id' => $client->company->id, - 'is_primary' => 0 + 'is_primary' => 0, ]); } @@ -451,7 +440,7 @@ class CreateTestData extends Command { $vendor = factory(\App\Models\Task::class)->create([ 'user_id' => $client->user->id, - 'company_id' => $client->company->id + 'company_id' => $client->company->id, ]); } @@ -459,7 +448,7 @@ class CreateTestData extends Command { $vendor = factory(\App\Models\Project::class)->create([ 'user_id' => $client->user->id, - 'company_id' => $client->company->id + 'company_id' => $client->company->id, ]); } @@ -471,7 +460,7 @@ class CreateTestData extends Command $faker = \Faker\Factory::create(); - $invoice = InvoiceFactory::create($client->company->id, $client->user->id);//stub the company and user_id + $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id $invoice->client_id = $client->id; // $invoice->date = $faker->date(); $dateable = Carbon::now()->subDays(rand(0, 90)); @@ -511,9 +500,7 @@ class CreateTestData extends Command $this->invoice_repo->markSent($invoice); if (rand(0, 1)) { - $invoice = $invoice->service()->markPaid()->save(); - } //@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging. event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars())); @@ -572,10 +559,10 @@ class CreateTestData extends Command $faker = \Faker\Factory::create(); //$quote = QuoteFactory::create($client->company->id, $client->user->id);//stub the company and user_id - $quote =factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]); + $quote = factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]); $quote->date = $faker->date(); $quote->client_id = $client->id; - + $quote->setRelation('client', $client); $quote->line_items = $this->buildLineItems(rand(1, 10)); @@ -613,7 +600,7 @@ class CreateTestData extends Command { $line_items = []; - for ($x=0; $x<$count; $x++) { + for ($x = 0; $x < $count; $x++) { $item = InvoiceItemFactory::create(); $item->quantity = 1; //$item->cost = 10; @@ -635,7 +622,7 @@ class CreateTestData extends Command $product = Product::all()->random(); - $item->cost = (float)$product->cost; + $item->cost = (float) $product->cost; $item->product_key = $product->product_key; $item->notes = $product->notes; $item->custom_value1 = $product->custom_value1; @@ -643,8 +630,6 @@ class CreateTestData extends Command $item->custom_value3 = $product->custom_value3; $item->custom_value4 = $product->custom_value4; - - $line_items[] = $item; } diff --git a/app/Console/Commands/DemoMode.php b/app/Console/Commands/DemoMode.php index 35f5bf28ae5c..346ed25d570c 100644 --- a/app/Console/Commands/DemoMode.php +++ b/app/Console/Commands/DemoMode.php @@ -21,8 +21,8 @@ use Carbon\Carbon; use Composer\Composer; use Composer\Console\Application; use Composer\Factory; -use Composer\IO\NullIO; use Composer\Installer; +use Composer\IO\NullIO; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Cache; @@ -53,7 +53,7 @@ class DemoMode extends Command protected $description = 'Setup demo mode'; protected $invoice_repo; - + public function __construct(InvoiceRepository $invoice_repo) { parent::__construct(); @@ -71,7 +71,7 @@ class DemoMode extends Command set_time_limit(0); $cached_tables = config('ninja.cached_tables'); - + foreach ($cached_tables as $name => $class) { if (! Cache::has($name)) { // check that the table exists in case the migration is pending @@ -94,25 +94,20 @@ class DemoMode extends Command } } - - $this->info("Migrating"); + $this->info('Migrating'); Artisan::call('migrate:fresh --force'); - $this->info("Seeding"); + $this->info('Seeding'); Artisan::call('db:seed --force'); - $this->info("Seeding Random Data"); + $this->info('Seeding Random Data'); $this->createSmallAccount(); - + VersionCheck::dispatchNow(); - + CompanySizeCheck::dispatchNow(); - } - - - private function createSmallAccount() { $faker = \Faker\Factory::create(); @@ -127,10 +122,10 @@ class DemoMode extends Command 'slack_webhook_url' => config('ninja.notification.slack'), 'enabled_modules' => 32767, 'company_key' => 'KEY', - 'enable_shop_api' => true + 'enable_shop_api' => true, ]); - $settings = $company->settings; + $settings = $company->settings; $settings->name = $faker->company; $settings->address1 = $faker->buildingNumber; @@ -139,25 +134,25 @@ class DemoMode extends Command $settings->state = $faker->state; $settings->postal_code = $faker->postcode; $settings->website = $faker->url; - $settings->vat_number = (string)$faker->numberBetween(123456789, 987654321); - $settings->phone = (string)$faker->phoneNumber; + $settings->vat_number = (string) $faker->numberBetween(123456789, 987654321); + $settings->phone = (string) $faker->phoneNumber; - $company->settings = $settings; - $company->save(); + $company->settings = $settings; + $company->save(); $account->default_company_id = $company->id; $account->save(); $user = User::whereEmail('small@example.com')->first(); - if (!$user) { + if (! $user) { $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'email' => 'small@example.com', - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } - + $company_token = new CompanyToken; $company_token->user_id = $user->id; $company_token->company_id = $company->id; @@ -165,7 +160,7 @@ class DemoMode extends Command $company_token->name = 'test token'; $company_token->token = Str::random(64); $company_token->is_system = true; - + $company_token->save(); $user->companies()->attach($company->id, [ @@ -180,13 +175,12 @@ class DemoMode extends Command $u2 = User::where('email', 'demo@invoiceninja.com')->first(); - if(!$u2){ - + if (! $u2) { $u2 = factory(\App\Models\User::class)->create([ 'email' => 'demo@invoiceninja.com', 'password' => Hash::make('demo'), 'account_id' => $account->id, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); $company_token = new CompanyToken; @@ -213,43 +207,41 @@ class DemoMode extends Command 'company_id' => $company->id, ]); - $this->info('Creating '.$this->count. ' clients'); + $this->info('Creating '.$this->count.' clients'); - for ($x=0; $x<$this->count; $x++) { - $z = $x+1; - $this->info("Creating client # ".$z); + for ($x = 0; $x < $this->count; $x++) { + $z = $x + 1; + $this->info('Creating client # '.$z); $this->createClient($company, $user, $u2->id); - } - for($x=0; $x<$this->count; $x++) - { + for ($x = 0; $x < $this->count; $x++) { $client = $company->clients->random(); $this->info('creating entities for client #'.$client->id); - $this->createInvoice($client, $u2->id); + $this->createInvoice($client, $u2->id); // for($y=0; $y<($this->count); $y++){ // $this->info("creating invoice #{$y} for client #".$client->id); // } $client = $company->clients->random(); - $this->createCredit($client, $u2->id); + $this->createCredit($client, $u2->id); // for($y=0; $y<($this->count); $y++){ // $this->info("creating credit #{$y} for client #".$client->id); // } $client = $company->clients->random(); - $this->createQuote($client, $u2->id); + $this->createQuote($client, $u2->id); // for($y=0; $y<($this->count); $y++){ // $this->info("creating quote #{$y} for client #".$client->id); // } $client = $company->clients->random(); - $this->createExpense($client, $u2->id); + $this->createExpense($client, $u2->id); //$this->info("creating expense for client #".$client->id); @@ -268,45 +260,44 @@ class DemoMode extends Command // $this->info("creating project for client #".$client->id); } - } private function createClient($company, $user, $assigned_user_id = null) { // dispatch(function () use ($company, $user) { - + // }); $client = factory(\App\Models\Client::class)->create([ 'user_id' => $user->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); factory(\App\Models\ClientContact::class)->create([ 'user_id' => $user->id, 'client_id' => $client->id, 'company_id' => $company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, rand(1, 5))->create([ 'user_id' => $user->id, 'client_id' => $client->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); $client->id_number = $this->getNextClientNumber($client); $settings = $client->settings; - $settings->currency_id = (string)rand(1,3); + $settings->currency_id = (string) rand(1, 3); $client->settings = $settings; - if(rand(0,1)) + if (rand(0, 1)) { $client->assigned_user_id = $assigned_user_id; + } - $client->country_id = array_rand([36,392,840,124,276,826]); + $client->country_id = array_rand([36, 392, 840, 124, 276, 826]); $client->save(); - } private function createExpense($client) @@ -314,7 +305,7 @@ class DemoMode extends Command factory(\App\Models\Expense::class, rand(1, 5))->create([ 'user_id' => $client->user_id, 'client_id' => $client->id, - 'company_id' => $client->company_id + 'company_id' => $client->company_id, ]); } @@ -322,22 +313,21 @@ class DemoMode extends Command { $vendor = factory(\App\Models\Vendor::class)->create([ 'user_id' => $client->user_id, - 'company_id' => $client->company_id + 'company_id' => $client->company_id, ]); - factory(\App\Models\VendorContact::class)->create([ 'user_id' => $client->user->id, 'vendor_id' => $vendor->id, 'company_id' => $client->company_id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\VendorContact::class, rand(1, 5))->create([ 'user_id' => $client->user->id, 'vendor_id' => $vendor->id, 'company_id' => $client->company_id, - 'is_primary' => 0 + 'is_primary' => 0, ]); } @@ -345,7 +335,7 @@ class DemoMode extends Command { $vendor = factory(\App\Models\Task::class)->create([ 'user_id' => $client->user->id, - 'company_id' => $client->company_id + 'company_id' => $client->company_id, ]); } @@ -353,7 +343,7 @@ class DemoMode extends Command { $vendor = factory(\App\Models\Project::class)->create([ 'user_id' => $client->user->id, - 'company_id' => $client->company_id + 'company_id' => $client->company_id, ]); } @@ -365,13 +355,14 @@ class DemoMode extends Command $faker = \Faker\Factory::create(); - $invoice = InvoiceFactory::create($client->company->id, $client->user->id);//stub the company and user_id + $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id $invoice->client_id = $client->id; - if((bool)rand(0,1)) + if ((bool) rand(0, 1)) { $dateable = Carbon::now()->subDays(rand(0, 90)); - else + } else { $dateable = Carbon::now()->addDays(rand(0, 90)); + } $invoice->date = $dateable; @@ -393,8 +384,8 @@ class DemoMode extends Command $invoice->tax_rate3 = 5; } - // $invoice->custom_value1 = $faker->date; - // $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no'; + // $invoice->custom_value1 = $faker->date; + // $invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no'; $invoice->save(); @@ -403,20 +394,20 @@ class DemoMode extends Command $invoice = $invoice_calc->getInvoice(); - if(rand(0,1)) + if (rand(0, 1)) { $invoice->assigned_user_id = $assigned_user_id; + } $invoice->save(); $invoice->service()->createInvitations()->markSent(); $this->invoice_repo->markSent($invoice); - if ((bool)rand(0, 2)) { - + if ((bool) rand(0, 2)) { $invoice = $invoice->service()->markPaid()->save(); - $invoice->payments->each(function ($payment){ - $payment->date = now()->addDays(rand(-30,30)); + $invoice->payments->each(function ($payment) { + $payment->date = now()->addDays(rand(-30, 30)); $payment->save(); }); } @@ -435,10 +426,11 @@ class DemoMode extends Command $credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]); - if((bool)rand(0,1)) + if ((bool) rand(0, 1)) { $dateable = Carbon::now()->subDays(rand(0, 90)); - else + } else { $dateable = Carbon::now()->addDays(rand(0, 90)); + } $credit->date = $dateable; @@ -467,8 +459,9 @@ class DemoMode extends Command $credit = $invoice_calc->getCredit(); - if(rand(0,1)) + if (rand(0, 1)) { $credit->assigned_user_id = $assigned_user_id; + } $credit->save(); $credit->service()->markSent()->save(); @@ -477,16 +470,14 @@ class DemoMode extends Command private function createQuote($client, $assigned_user_id = null) { - $faker = \Faker\Factory::create(); - $quote =factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]); + $quote = factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company_id, 'client_id' => $client->id]); - if((bool)rand(0,1)){ + if ((bool) rand(0, 1)) { $dateable = Carbon::now()->subDays(rand(1, 30)); $dateable_due = $dateable->addDays(rand(1, 30)); - } - else{ + } else { $dateable = Carbon::now()->addDays(rand(1, 30)); $dateable_due = $dateable->addDays(rand(-10, 30)); } @@ -495,7 +486,7 @@ class DemoMode extends Command $quote->due_date = $dateable_due; $quote->client_id = $client->id; - + $quote->setRelation('client', $client); $quote->line_items = $this->buildLineItems(rand(1, 10)); @@ -523,9 +514,10 @@ class DemoMode extends Command $quote = $quote_calc->getQuote(); - if(rand(0,1)) + if (rand(0, 1)) { $quote->assigned_user_id = $assigned_user_id; - + } + $quote->save(); $quote->service()->markSent()->save(); @@ -536,7 +528,7 @@ class DemoMode extends Command { $line_items = []; - for ($x=0; $x<$count; $x++) { + for ($x = 0; $x < $count; $x++) { $item = InvoiceItemFactory::create(); $item->quantity = 1; //$item->cost = 10; @@ -558,7 +550,7 @@ class DemoMode extends Command $product = Product::all()->random(); - $item->cost = (float)$product->cost; + $item->cost = (float) $product->cost; $item->product_key = $product->product_key; $item->notes = $product->notes; $item->custom_value1 = $product->custom_value1; @@ -566,8 +558,6 @@ class DemoMode extends Command $item->custom_value3 = $product->custom_value3; $item->custom_value4 = $product->custom_value4; - - $line_items[] = $item; } diff --git a/app/Console/Commands/ImportMigrations.php b/app/Console/Commands/ImportMigrations.php index 5fd0d2d52234..f15ab1e858cf 100644 --- a/app/Console/Commands/ImportMigrations.php +++ b/app/Console/Commands/ImportMigrations.php @@ -58,7 +58,7 @@ class ImportMigrations extends Command foreach ($directory as $file) { if ($file->getExtension() === 'zip') { - $this->info('Started processing: ' . $file->getBasename() . ' at ' . now()); + $this->info('Started processing: '.$file->getBasename().' at '.now()); StartMigration::dispatch($file->getRealPath(), $this->getUser(), $this->getUser()->companies()->first()); } } @@ -72,7 +72,7 @@ class ImportMigrations extends Command $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'email' => $this->faker->email, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); $company_token = CompanyToken::create([ @@ -107,8 +107,8 @@ class ImportMigrations extends Command 'account_id' => $account->id, ]); - if(!$account->default_company_id){ - $account->default_company_id = $company->id; + if (! $account->default_company_id) { + $account->default_company_id = $company->id; $account->save(); } diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index 0504c59ec053..a675503c709c 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -3,17 +3,16 @@ namespace App\Console\Commands; use Composer\Composer; +use Composer\Console\Application; use Composer\Factory; -use Composer\IO\NullIO; use Composer\Installer; +use Composer\IO\NullIO; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; use Symfony\Component\Console\Input\ArrayInput; -use Composer\Console\Application; class PostUpdate extends Command { - protected $name = 'ninja:post-update'; /** * The name and signature of the console command. @@ -38,10 +37,10 @@ class PostUpdate extends Command { set_time_limit(0); - info("running post update"); + info('running post update'); try { - Artisan::call('migrate',['--force' => true]); + Artisan::call('migrate', ['--force' => true]); } catch (Exception $e) { \Log::error("I wasn't able to migrate the data."); } @@ -52,49 +51,49 @@ class PostUpdate extends Command \Log::error("I wasn't able to optimize."); } - - $composer_data = array( + $composer_data = [ 'url' => 'https://getcomposer.org/composer.phar', 'dir' => __DIR__.'/.code', 'bin' => __DIR__.'/.code/composer.phar', 'json' => __DIR__.'/.code/composer.json', - 'conf' => array( - "autoload" => array( - "psr-4" => array( - "" => "local/" - ) - ) - ) - ); + 'conf' => [ + 'autoload' => [ + 'psr-4' => [ + '' => 'local/', + ], + ], + ], + ]; - if(!is_dir($composer_data['dir'])) - mkdir($composer_data['dir'],0777,true); + if (! is_dir($composer_data['dir'])) { + mkdir($composer_data['dir'], 0777, true); + } - if(!is_dir("{$composer_data['dir']}/local")) - mkdir("{$composer_data['dir']}/local",0777,true); + if (! is_dir("{$composer_data['dir']}/local")) { + mkdir("{$composer_data['dir']}/local", 0777, true); + } - copy($composer_data['url'],$composer_data['bin']); + copy($composer_data['url'], $composer_data['bin']); require_once "phar://{$composer_data['bin']}/src/bootstrap.php"; - $conf_json = json_encode($composer_data['conf'],JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE); - file_put_contents($composer_data['json'],$conf_json); + $conf_json = json_encode($composer_data['conf'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + file_put_contents($composer_data['json'], $conf_json); chdir($composer_data['dir']); putenv("COMPOSER_HOME={$composer_data['dir']}"); - putenv("OSTYPE=OS400"); + putenv('OSTYPE=OS400'); $app = new \Composer\Console\Application(); $factory = new \Composer\Factory(); $output = $factory->createOutput(); - $input = new \Symfony\Component\Console\Input\ArrayInput(array( + $input = new \Symfony\Component\Console\Input\ArrayInput([ 'command' => 'install', - )); + ]); $input->setInteractive(false); - echo "
";
-        $cmdret = $app->doRun($input,$output); 
-        echo "end!";
-
-        \Log::error(print_r($cmdret,1));
+        echo '
';
+        $cmdret = $app->doRun($input, $output);
+        echo 'end!';
 
+        \Log::error(print_r($cmdret, 1));
     }
 }
diff --git a/app/Console/Commands/SendTestEmails.php b/app/Console/Commands/SendTestEmails.php
index 7e25dba03f17..badff65c13d7 100644
--- a/app/Console/Commands/SendTestEmails.php
+++ b/app/Console/Commands/SendTestEmails.php
@@ -70,8 +70,7 @@ class SendTestEmails extends Command
 
         $user = User::whereEmail('user@example.com')->first();
 
-
-        if (!$user) {
+        if (! $user) {
             $account = factory(\App\Models\Account::class)->create();
 
             $user = factory(\App\Models\User::class)->create([
@@ -82,8 +81,6 @@ class SendTestEmails extends Command
                 'last_name' => 'Doe',
             ]);
 
-
-
             $company = factory(\App\Models\Company::class)->create([
                 'account_id' => $account->id,
             ]);
@@ -103,12 +100,9 @@ class SendTestEmails extends Command
             $account = $company->account;
         }
 
-
-
         $client = Client::all()->first();
 
-
-        if (!$client) {
+        if (! $client) {
             $client = ClientFactory::create($company->id, $user->id);
             $client->save();
 
diff --git a/app/Console/Commands/TestData/CreateTestCreditJob.php b/app/Console/Commands/TestData/CreateTestCreditJob.php
index 471e652b3335..4faecae2eac3 100644
--- a/app/Console/Commands/TestData/CreateTestCreditJob.php
+++ b/app/Console/Commands/TestData/CreateTestCreditJob.php
@@ -1,6 +1,6 @@
 client = $client;
@@ -96,12 +94,11 @@ class CreateTestCreditJob implements ShouldQueue
         event(new CreateCreditInvitation($credit, $credit->company, Ninja::eventVars()));
     }
 
-
     private function buildLineItems($count = 1)
     {
         $line_items = [];
 
-        for ($x=0; $x<$count; $x++) {
+        for ($x = 0; $x < $count; $x++) {
             $item = InvoiceItemFactory::create();
             $item->quantity = 1;
             //$item->cost = 10;
@@ -123,7 +120,7 @@ class CreateTestCreditJob implements ShouldQueue
 
             $product = Product::all()->random();
 
-            $item->cost = (float)$product->cost;
+            $item->cost = (float) $product->cost;
             $item->product_key = $product->product_key;
             $item->notes = $product->notes;
             $item->custom_value1 = $product->custom_value1;
@@ -131,8 +128,6 @@ class CreateTestCreditJob implements ShouldQueue
             $item->custom_value3 = $product->custom_value3;
             $item->custom_value4 = $product->custom_value4;
 
-
-
             $line_items[] = $item;
         }
 
diff --git a/app/Console/Commands/TestData/CreateTestInvoiceJob.php b/app/Console/Commands/TestData/CreateTestInvoiceJob.php
index 7e64d4e1150d..c707d621654f 100644
--- a/app/Console/Commands/TestData/CreateTestInvoiceJob.php
+++ b/app/Console/Commands/TestData/CreateTestInvoiceJob.php
@@ -1,6 +1,6 @@
 client = $client;
@@ -57,7 +55,7 @@ class CreateTestInvoiceJob implements ShouldQueue
     {
         $faker = \Faker\Factory::create();
 
-        $invoice = InvoiceFactory::create($this->client->company->id, $this->client->user->id);//stub the company and user_id
+        $invoice = InvoiceFactory::create($this->client->company->id, $this->client->user->id); //stub the company and user_id
         $invoice->client_id = $this->client->id;
 //        $invoice->date = $faker->date();
         $dateable = Carbon::now()->subDays(rand(0, 90));
@@ -97,7 +95,6 @@ class CreateTestInvoiceJob implements ShouldQueue
 
         //$this->invoice_repo->markSent($invoice);
 
-
         if (rand(0, 1)) {
             $payment = PaymentFactory::create($this->client->company->id, $this->client->user->id);
             $payment->date = $dateable;
@@ -121,12 +118,11 @@ class CreateTestInvoiceJob implements ShouldQueue
         event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
     }
 
-
     private function buildLineItems($count = 1)
     {
         $line_items = [];
 
-        for ($x=0; $x<$count; $x++) {
+        for ($x = 0; $x < $count; $x++) {
             $item = InvoiceItemFactory::create();
             $item->quantity = 1;
             //$item->cost = 10;
@@ -148,7 +144,7 @@ class CreateTestInvoiceJob implements ShouldQueue
 
             $product = Product::all()->random();
 
-            $item->cost = (float)$product->cost;
+            $item->cost = (float) $product->cost;
             $item->product_key = $product->product_key;
             $item->notes = $product->notes;
             $item->custom_value1 = $product->custom_value1;
@@ -156,8 +152,6 @@ class CreateTestInvoiceJob implements ShouldQueue
             $item->custom_value3 = $product->custom_value3;
             $item->custom_value4 = $product->custom_value4;
 
-
-
             $line_items[] = $item;
         }
 
diff --git a/app/Console/Commands/TestData/CreateTestQuoteJob.php b/app/Console/Commands/TestData/CreateTestQuoteJob.php
index ad3b81d8c8ab..0fee29ca3477 100644
--- a/app/Console/Commands/TestData/CreateTestQuoteJob.php
+++ b/app/Console/Commands/TestData/CreateTestQuoteJob.php
@@ -1,6 +1,6 @@
 client = $client;
@@ -57,7 +55,7 @@ class CreateTestQuoteJob implements ShouldQueue
     {
         $faker = \Faker\Factory::create();
 
-        $quote =factory(\App\Models\Quote::class)->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
+        $quote = factory(\App\Models\Quote::class)->create(['user_id' => $this->client->user->id, 'company_id' => $this->client->company->id, 'client_id' => $this->client->id]);
         $quote->date = $faker->date();
 
         $quote->line_items = $this->buildLineItems(rand(1, 10));
@@ -89,13 +87,11 @@ class CreateTestQuoteJob implements ShouldQueue
         CreateQuoteInvitations::dispatch($quote, $quote->company);
     }
 
-
-
     private function buildLineItems($count = 1)
     {
         $line_items = [];
 
-        for ($x=0; $x<$count; $x++) {
+        for ($x = 0; $x < $count; $x++) {
             $item = InvoiceItemFactory::create();
             $item->quantity = 1;
             //$item->cost = 10;
@@ -117,7 +113,7 @@ class CreateTestQuoteJob implements ShouldQueue
 
             $product = Product::all()->random();
 
-            $item->cost = (float)$product->cost;
+            $item->cost = (float) $product->cost;
             $item->product_key = $product->product_key;
             $item->notes = $product->notes;
             $item->custom_value1 = $product->custom_value1;
@@ -125,8 +121,6 @@ class CreateTestQuoteJob implements ShouldQueue
             $item->custom_value3 = $product->custom_value3;
             $item->custom_value4 = $product->custom_value4;
 
-
-
             $line_items[] = $item;
         }
 
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 0bd9b3c9611d..94c3bf14393a 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -1,6 +1,6 @@
 job(new RecurringInvoicesCron)->hourly();
         $schedule->job(new VersionCheck)->daily();
 
@@ -54,9 +54,9 @@ class Kernel extends ConsoleKernel
         $schedule->job(new CompanySizeCheck)->daily();
 
         $schedule->job(new UpdateExchangeRates)->daily();
-        
+
         /* Run hosted specific jobs */
-        if(Ninja::isHosted()) {
+        if (Ninja::isHosted()) {
             $schedule->job(new AdjustEmailQuota())->daily();
             $schedule->job(new SendFailedEmails())->daily();
         }
diff --git a/app/DataMapper/Analytics/LoginFailure.php b/app/DataMapper/Analytics/LoginFailure.php
index af9d235e19de..fb2a8acf46ac 100644
--- a/app/DataMapper/Analytics/LoginFailure.php
+++ b/app/DataMapper/Analytics/LoginFailure.php
@@ -4,39 +4,37 @@ namespace App\DataMapper\Analytics;
 
 class LoginFailure
 {
+    /**
+     * The type of Sample.
+     *
+     * Monotonically incrementing counter
+     *
+     * 	- counter
+     *
+     * @var string
+     */
+    public $type = 'counter';
 
-	/**
-	 * The type of Sample
-	 *
-	 * Monotonically incrementing counter
-	 * 
-	 * 	- counter
-	 * 	
-	 * @var string
-	 */
-	public $type = 'counter';
+    /**
+     * The name of the counter.
+     * @var string
+     */
+    public $name = 'login.failure';
 
-	/**
-	 * The name of the counter
-	 * @var string
-	 */
-	public $name = 'login.failure';
+    /**
+     * The datetime of the counter measurement.
+     *
+     * date("Y-m-d H:i:s")
+     *
+     * @var DateTime
+     */
+    public $datetime;
 
-	/**
-	 * The datetime of the counter measurement
-	 *
-	 * date("Y-m-d H:i:s")
-	 * 
-	 * @var DateTime 
-	 */
-	public $datetime;
-
-	/**
-	 * The increment amount... should always be 
-	 * set to 0
-	 * 
-	 * @var integer
-	 */
-	public $metric = 0;
-
-}
\ No newline at end of file
+    /**
+     * The increment amount... should always be
+     * set to 0.
+     *
+     * @var int
+     */
+    public $metric = 0;
+}
diff --git a/app/DataMapper/Analytics/LoginSuccess.php b/app/DataMapper/Analytics/LoginSuccess.php
index 9dd079e4d458..2ae3dbd63c95 100644
--- a/app/DataMapper/Analytics/LoginSuccess.php
+++ b/app/DataMapper/Analytics/LoginSuccess.php
@@ -4,39 +4,37 @@ namespace App\DataMapper\Analytics;
 
 class LoginSuccess
 {
+    /**
+     * The type of Sample.
+     *
+     * Monotonically incrementing counter
+     *
+     * 	- counter
+     *
+     * @var string
+     */
+    public $type = 'counter';
 
-	/**
-	 * The type of Sample
-	 *
-	 * Monotonically incrementing counter
-	 * 
-	 * 	- counter
-	 * 	
-	 * @var string
-	 */
-	public $type = 'counter';
+    /**
+     * The name of the counter.
+     * @var string
+     */
+    public $name = 'login.success';
 
-	/**
-	 * The name of the counter
-	 * @var string
-	 */
-	public $name = 'login.success';
+    /**
+     * The datetime of the counter measurement.
+     *
+     * date("Y-m-d H:i:s")
+     *
+     * @var DateTime
+     */
+    public $datetime;
 
-	/**
-	 * The datetime of the counter measurement
-	 *
-	 * date("Y-m-d H:i:s")
-	 * 
-	 * @var DateTime 
-	 */
-	public $datetime;
-
-	/**
-	 * The increment amount... should always be 
-	 * set to 0
-	 * 
-	 * @var integer
-	 */
-	public $metric = 0;
-
-}
\ No newline at end of file
+    /**
+     * The increment amount... should always be
+     * set to 0.
+     *
+     * @var int
+     */
+    public $metric = 0;
+}
diff --git a/app/DataMapper/BaseSettings.php b/app/DataMapper/BaseSettings.php
index 4559bb9000ad..aea504a44087 100644
--- a/app/DataMapper/BaseSettings.php
+++ b/app/DataMapper/BaseSettings.php
@@ -1,6 +1,6 @@
 {$key} = $value;
         }
     }
-    
+
     public static function setCasts($obj, $casts)
     {
         foreach ($casts as $key => $value) {
@@ -46,7 +46,7 @@ class BaseSettings
                 return is_null($value) ? '' : (string) $value;
             case 'bool':
             case 'boolean':
-                return (bool)($value);
+                return (bool) ($value);
             case 'object':
                 return json_decode($value);
             case 'array':
diff --git a/app/DataMapper/ClientSettings.php b/app/DataMapper/ClientSettings.php
index 2a6cca64d492..6423ef07d140 100644
--- a/app/DataMapper/ClientSettings.php
+++ b/app/DataMapper/ClientSettings.php
@@ -1,6 +1,6 @@
  'string',
         'size_id' => 'string',
     ];
-    
+
     /**
      * Cast object values and return entire class
      * prevents missing properties from not being returned
-     * and always ensure an up to date class is returned
+     * and always ensure an up to date class is returned.
      *
      * @return \stdClass
      */
@@ -54,16 +52,14 @@ class ClientSettings extends BaseSettings
     }
 
     /**
-     *
-     * Default Client Settings scaffold
+     * Default Client Settings scaffold.
      *
      * @return \stdClass
-     *
      */
     public static function defaults() : \stdClass
     {
-        $data = (object)[
-            'entity' => (string)Client::class,
+        $data = (object) [
+            'entity' => (string) Client::class,
             'industry_id' => '',
             'size_id' => '',
         ];
@@ -71,9 +67,8 @@ class ClientSettings extends BaseSettings
         return self::setCasts($data, self::$casts);
     }
 
-
     /**
-     * Merges settings from Company to Client
+     * Merges settings from Company to Client.
      *
      * @param  \stdClass $company_settings
      * @param  \stdClass $client_settings
@@ -81,21 +76,21 @@ class ClientSettings extends BaseSettings
      */
     public static function buildClientSettings($company_settings, $client_settings)
     {
-        if (!$client_settings) {
+        if (! $client_settings) {
             return $company_settings;
         }
-        
+
         foreach ($company_settings as $key => $value) {
             /* pseudo code
                 if the property exists and is a string BUT has no length, treat it as TRUE
             */
-            if (((property_exists($client_settings, $key) && is_string($client_settings->{$key}) && (iconv_strlen($client_settings->{$key}) <1)))
-                || !isset($client_settings->{$key})
+            if (((property_exists($client_settings, $key) && is_string($client_settings->{$key}) && (iconv_strlen($client_settings->{$key}) < 1)))
+                || ! isset($client_settings->{$key})
                 && property_exists($company_settings, $key)) {
                 $client_settings->{$key} = $company_settings->{$key};
             }
         }
-        
+
         return $client_settings;
     }
 }
diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php
index 276cdca50ff2..28f7d06ecf81 100644
--- a/app/DataMapper/CompanySettings.php
+++ b/app/DataMapper/CompanySettings.php
@@ -1,6 +1,6 @@
  'bool',
         'client_portal_allow_over_payment'   => 'bool',
@@ -414,7 +412,6 @@ class CompanySettings extends BaseSettings
         'client_portal_enable_uploads'       => 'bool',
     ];
 
-
     public static $free_plan_casts = [
         'currency_id'                        => 'string',
         'company_gateway_ids'                => 'string',
@@ -453,7 +450,7 @@ class CompanySettings extends BaseSettings
 
     /**
      * Array of variables which
-     * cannot be modified client side
+     * cannot be modified client side.
      */
     public static $protected_fields = [
         //	'credit_number_counter',
@@ -470,7 +467,7 @@ class CompanySettings extends BaseSettings
     /**
      * Cast object values and return entire class
      * prevents missing properties from not being returned
-     * and always ensure an up to date class is returned
+     * and always ensure an up to date class is returned.
      *
      * @return \stdClass
      */
@@ -480,29 +477,29 @@ class CompanySettings extends BaseSettings
     }
 
     /**
-     * Provides class defaults on init
+     * Provides class defaults on init.
      * @return object
      */
     public static function defaults():\stdClass
     {
         $config = json_decode(config('ninja.settings'));
 
-        $data = (object) get_class_vars(CompanySettings::class);
+        $data = (object) get_class_vars(self::class);
 
         unset($data->casts);
         unset($data->protected_fields);
         unset($data->free_plan_casts);
         unset($data->string_casts);
-        
-        $data->timezone_id       = (string) config('ninja.i18n.timezone_id');
-        $data->currency_id       = (string) config('ninja.i18n.currency_id');
-        $data->language_id       = (string) config('ninja.i18n.language_id');
-        $data->payment_terms     = (string) config('ninja.i18n.payment_terms');
-        $data->military_time     = (bool) config('ninja.i18n.military_time');
-        $data->date_format_id    = (string) config('ninja.i18n.date_format_id');
-        $data->country_id        = (string) config('ninja.i18n.country_id');
-        $data->translations      = (object) [];
-        $data->pdf_variables 	 = (object) self::getEntityVariableDefaults();
+
+        $data->timezone_id = (string) config('ninja.i18n.timezone_id');
+        $data->currency_id = (string) config('ninja.i18n.currency_id');
+        $data->language_id = (string) config('ninja.i18n.language_id');
+        $data->payment_terms = (string) config('ninja.i18n.payment_terms');
+        $data->military_time = (bool) config('ninja.i18n.military_time');
+        $data->date_format_id = (string) config('ninja.i18n.date_format_id');
+        $data->country_id = (string) config('ninja.i18n.country_id');
+        $data->translations = (object) [];
+        $data->pdf_variables = (object) self::getEntityVariableDefaults();
 
         return self::setCasts($data, self::$casts);
     }
@@ -516,10 +513,10 @@ class CompanySettings extends BaseSettings
      */
     public static function setProperties($settings):\stdClass
     {
-        $company_settings = (object) get_class_vars(CompanySettings::class);
+        $company_settings = (object) get_class_vars(self::class);
 
         foreach ($company_settings as $key => $value) {
-            if (!property_exists($settings, $key)) {
+            if (! property_exists($settings, $key)) {
                 $settings->{ $key} = self::castAttribute($key, $company_settings->{ $key});
             }
         }
@@ -614,10 +611,10 @@ class CompanySettings extends BaseSettings
                 '$custom_surcharge3',
                 '$custom_surcharge4',
                 '$paid_to_date',
-                '$client.balance'
+                '$client.balance',
             ],
         ];
-        
+
         return json_decode(json_encode($variables));
     }
 }
diff --git a/app/DataMapper/DefaultSettings.php b/app/DataMapper/DefaultSettings.php
index 44f1241823d1..00a0d8a10290 100644
--- a/app/DataMapper/DefaultSettings.php
+++ b/app/DataMapper/DefaultSettings.php
@@ -1,6 +1,6 @@
  self::userSettingsObject(),
         ];
     }
@@ -43,7 +41,7 @@ class DefaultSettings extends BaseSettings
      */
     private static function userSettingsObject() : \stdClass
     {
-        return (object)[
+        return (object) [
         //    'per_page' => self::$per_page,
         ];
     }
diff --git a/app/DataMapper/EmailSpooledForSend.php b/app/DataMapper/EmailSpooledForSend.php
index 06da9560523c..38903d52ec91 100644
--- a/app/DataMapper/EmailSpooledForSend.php
+++ b/app/DataMapper/EmailSpooledForSend.php
@@ -1,6 +1,6 @@
  false,
         ]);
 
-        $invoice_message = '

' . self::transformText('invoice_message') . '



$view_link

'; + $invoice_message = '

'.self::transformText('invoice_message').'



$view_link

'; + return $invoice_message; //return $converter->convertToHtml($invoice_message); - } public static function emailQuoteSubject() @@ -214,9 +214,8 @@ class EmailTemplateDefaults return Parsedown::instance()->line('Statement Templates needs texts record!'); } - private static function transformText($string) { - return str_replace(":", "$", ctrans('texts.'.$string)); + return str_replace(':', '$', ctrans('texts.'.$string)); } } diff --git a/app/DataMapper/FeesAndLimits.php b/app/DataMapper/FeesAndLimits.php index 3f4cc941d09f..f14481d94829 100644 --- a/app/DataMapper/FeesAndLimits.php +++ b/app/DataMapper/FeesAndLimits.php @@ -1,6 +1,6 @@ 'string', @@ -141,7 +138,7 @@ class FreeCompanySettings extends BaseSettings /** * Cast object values and return entire class * prevents missing properties from not being returned - * and always ensure an up to date class is returned + * and always ensure an up to date class is returned. * * @return \stdClass */ @@ -150,7 +147,7 @@ class FreeCompanySettings extends BaseSettings } /** - * Provides class defaults on init + * Provides class defaults on init. * @return object */ public static function defaults():\stdClass @@ -162,18 +159,16 @@ class FreeCompanySettings extends BaseSettings unset($data->casts); unset($data->protected_fields); - $data->timezone_id = (string) config('ninja.i18n.timezone_id'); - $data->currency_id = (string) config('ninja.i18n.currency_id'); - $data->language_id = (string) config('ninja.i18n.language_id'); - $data->payment_terms = (int) config('ninja.i18n.payment_terms'); - $data->military_time = (bool) config('ninja.i18n.military_time'); - $data->date_format_id = (string) config('ninja.i18n.date_format_id'); - $data->country_id = (string) config('ninja.i18n.country_id'); - $data->translations = (object) []; - $data->pdf_variables = (object) self::getEntityVariableDefaults(); + $data->timezone_id = (string) config('ninja.i18n.timezone_id'); + $data->currency_id = (string) config('ninja.i18n.currency_id'); + $data->language_id = (string) config('ninja.i18n.language_id'); + $data->payment_terms = (int) config('ninja.i18n.payment_terms'); + $data->military_time = (bool) config('ninja.i18n.military_time'); + $data->date_format_id = (string) config('ninja.i18n.date_format_id'); + $data->country_id = (string) config('ninja.i18n.country_id'); + $data->translations = (object) []; + $data->pdf_variables = (object) self::getEntityVariableDefaults(); return self::setCasts($data, self::$casts); } - - } diff --git a/app/DataMapper/InvoiceItem.php b/app/DataMapper/InvoiceItem.php index 42fbfea892ae..ccfe5138240e 100644 --- a/app/DataMapper/InvoiceItem.php +++ b/app/DataMapper/InvoiceItem.php @@ -1,6 +1,6 @@ $number @@ -39,7 +38,6 @@ class Clean extends AbstractDesign '; } - public function header() { return '
diff --git a/app/Designs/Creative.php b/app/Designs/Creative.php index e4ad6149435d..1b35a25794f8 100644 --- a/app/Designs/Creative.php +++ b/app/Designs/Creative.php @@ -1,6 +1,6 @@ $number @@ -42,7 +41,6 @@ $custom_css '; } - public function header() { return '
@@ -114,7 +112,6 @@ $custom_css return ''; } - public function product() { return ''; diff --git a/app/Designs/Custom.php b/app/Designs/Custom.php index 6c7d46275fe6..38b600991548 100644 --- a/app/Designs/Custom.php +++ b/app/Designs/Custom.php @@ -1,6 +1,6 @@ includes = $design->design->includes; $this->header = $design->design->header; - + $this->body = $design->design->body; - + $this->product = $design->design->product; - + $this->task = $design->design->task; $this->footer = $design->design->footer; diff --git a/app/Designs/Designer.php b/app/Designs/Designer.php index ea62c407ac64..3db75dd3a4a3 100644 --- a/app/Designs/Designer.php +++ b/app/Designs/Designer.php @@ -1,6 +1,6 @@ setHtml() ->exportVariables() @@ -104,13 +104,12 @@ class Designer
%s %s -
' - ; +
'; $signature = ''; $logo = '
'; - if (!$this->entity->user->account->isPaid()) { + if (! $this->entity->user->account->isPaid()) { $logo = ''; } @@ -129,7 +128,7 @@ class Designer public function setHtml() { - $this->html = ''; + $this->html = ''; return $this; } @@ -158,12 +157,12 @@ class Designer { //$s = microtime(true); $company = $this->entity->company; - - $this->exported_variables['$custom_css'] = $this->entity->generateCustomCSS(); - $this->exported_variables['$app_url'] = $this->entity->generateAppUrl(); - $this->exported_variables['$client_details'] = $this->processVariables($this->input_variables['client_details'], $this->clientDetails($company)); - $this->exported_variables['$company_details'] = $this->processVariables($this->input_variables['company_details'], $this->companyDetails($company)); - $this->exported_variables['$company_address'] = $this->processVariables($this->input_variables['company_address'], $this->companyAddress($company)); + + $this->exported_variables['$custom_css'] = $this->entity->generateCustomCSS(); + $this->exported_variables['$app_url'] = $this->entity->generateAppUrl(); + $this->exported_variables['$client_details'] = $this->processVariables($this->input_variables['client_details'], $this->clientDetails($company)); + $this->exported_variables['$company_details'] = $this->processVariables($this->input_variables['company_details'], $this->companyDetails($company)); + $this->exported_variables['$company_address'] = $this->processVariables($this->input_variables['company_address'], $this->companyAddress($company)); if ($this->entity_string == 'invoice') { //$this->exported_variables['$entity_labels'] = $this->processLabels($this->input_variables['invoice_details'], $this->invoiceDetails($company)); @@ -178,11 +177,10 @@ class Designer $this->exported_variables['$entity_details'] = $this->processVariables($this->input_variables['invoice_details'], $this->quoteDetails($company)); } - - $this->exported_variables['$product_table_header']= $this->entity->buildTableHeader($this->input_variables['product_columns']); - $this->exported_variables['$product_table_body'] = $this->entity->buildTableBody($this->input_variables['product_columns'], $this->design->product, '$product'); - $this->exported_variables['$task_table_header'] = $this->entity->buildTableHeader($this->input_variables['task_columns']); - $this->exported_variables['$task_table_body'] = $this->entity->buildTableBody($this->input_variables['task_columns'], $this->design->task, '$task'); + $this->exported_variables['$product_table_header'] = $this->entity->buildTableHeader($this->input_variables['product_columns']); + $this->exported_variables['$product_table_body'] = $this->entity->buildTableBody($this->input_variables['product_columns'], $this->design->product, '$product'); + $this->exported_variables['$task_table_header'] = $this->entity->buildTableHeader($this->input_variables['task_columns']); + $this->exported_variables['$task_table_body'] = $this->entity->buildTableBody($this->input_variables['task_columns'], $this->design->task, '$task'); if (strlen($this->exported_variables['$task_table_body']) == 0) { $this->exported_variables['$task_table_header'] = ''; @@ -191,6 +189,7 @@ class Designer if (strlen($this->exported_variables['$product_table_body']) == 0) { $this->exported_variables['$product_table_header'] = ''; } + return $this; } @@ -214,7 +213,7 @@ class Designer foreach (array_keys($input_variables) as $value) { if (array_key_exists($value, $variables)) { //$tmp = str_replace("", "_label", $variables[$value]); - $tmp = strtr($variables[$value], "", "_label"); + $tmp = strtr($variables[$value], '', '_label'); $output .= $tmp; } } @@ -357,12 +356,12 @@ class Designer { $custom_fields = $company->custom_fields; - if (!$custom_fields) { + if (! $custom_fields) { return $data; } foreach (self::$custom_fields as $cf) { - if (!property_exists($custom_fields, $cf) || (strlen($custom_fields->{$cf}) == 0)) { + if (! property_exists($custom_fields, $cf) || (strlen($custom_fields->{$cf}) == 0)) { unset($data[$cf]); } } diff --git a/app/Designs/Elegant.php b/app/Designs/Elegant.php index 94b1ff099097..d2b3e18a7889 100644 --- a/app/Designs/Elegant.php +++ b/app/Designs/Elegant.php @@ -1,6 +1,6 @@ $number @@ -39,7 +38,6 @@ class Elegant extends AbstractDesign '; } - public function header() { return '
diff --git a/app/Designs/Hipster.php b/app/Designs/Hipster.php index b9a26ed0b658..ac71ee633f34 100644 --- a/app/Designs/Hipster.php +++ b/app/Designs/Hipster.php @@ -1,6 +1,6 @@ $number @@ -40,7 +39,6 @@ $custom_css '; } - public function header() { return '
diff --git a/app/Designs/Modern.php b/app/Designs/Modern.php index caff3de2e12f..411fd1a34546 100644 --- a/app/Designs/Modern.php +++ b/app/Designs/Modern.php @@ -1,6 +1,6 @@ $number @@ -36,7 +35,6 @@ $custom_css '; } - public function header() { return ' diff --git a/app/Designs/Photo.php b/app/Designs/Photo.php index 31c3c2556118..264c08bc741f 100644 --- a/app/Designs/Photo.php +++ b/app/Designs/Photo.php @@ -1,6 +1,6 @@ $number @@ -43,8 +42,6 @@ $custom_css '; } - - public function header() { return '
diff --git a/app/Designs/Plain.php b/app/Designs/Plain.php index 02c1ae71a43b..016620a7f38a 100644 --- a/app/Designs/Plain.php +++ b/app/Designs/Plain.php @@ -1,6 +1,6 @@ $number diff --git a/app/Designs/Playful.php b/app/Designs/Playful.php index 0e66f78165c9..573f6655fff0 100644 --- a/app/Designs/Playful.php +++ b/app/Designs/Playful.php @@ -1,6 +1,6 @@ $number @@ -39,7 +38,6 @@ $custom_css '; } - public function header() { return '
diff --git a/app/Events/Account/AccountCreated.php b/app/Events/Account/AccountCreated.php index 85aa5f373d74..74b338af9232 100644 --- a/app/Events/Account/AccountCreated.php +++ b/app/Events/Account/AccountCreated.php @@ -1,6 +1,6 @@ client = $client; $this->company = $company; $this->event_vars = $event_vars; - } /** diff --git a/app/Events/Client/ClientWasCreated.php b/app/Events/Client/ClientWasCreated.php index 79434bcde5d6..e61982a89398 100644 --- a/app/Events/Client/ClientWasCreated.php +++ b/app/Events/Client/ClientWasCreated.php @@ -1,6 +1,6 @@ client = $client; $this->company = $company; $this->event_vars = $event_vars; - } } diff --git a/app/Events/Client/ClientWasDeleted.php b/app/Events/Client/ClientWasDeleted.php index 70b9c4027128..9f6348775635 100644 --- a/app/Events/Client/ClientWasDeleted.php +++ b/app/Events/Client/ClientWasDeleted.php @@ -1,6 +1,6 @@ client = $client; $this->company = $company; $this->event_vars = $event_vars; - } } diff --git a/app/Events/Client/ClientWasRestored.php b/app/Events/Client/ClientWasRestored.php index 0bd4e9945b0c..1011a5564613 100644 --- a/app/Events/Client/ClientWasRestored.php +++ b/app/Events/Client/ClientWasRestored.php @@ -1,6 +1,6 @@ client = $client; $this->company = $company; $this->event_vars = $event_vars; - } } diff --git a/app/Events/Client/ClientWasUpdated.php b/app/Events/Client/ClientWasUpdated.php index 0c01aa2e80a8..c7bd39687f52 100644 --- a/app/Events/Client/ClientWasUpdated.php +++ b/app/Events/Client/ClientWasUpdated.php @@ -1,6 +1,6 @@ client = $client; $this->company = $company; $this->event_vars = $event_vars; - } } diff --git a/app/Events/Company/CompanyDocumentsDeleted.php b/app/Events/Company/CompanyDocumentsDeleted.php index 22a6d84717f1..5d66d6476365 100644 --- a/app/Events/Company/CompanyDocumentsDeleted.php +++ b/app/Events/Company/CompanyDocumentsDeleted.php @@ -1,6 +1,6 @@ credit = $credit; - + $this->company = $company; $this->errors = $errors; diff --git a/app/Events/Credit/CreditWasMarkedSent.php b/app/Events/Credit/CreditWasMarkedSent.php index ab792c227b51..6f2d537b2dee 100644 --- a/app/Events/Credit/CreditWasMarkedSent.php +++ b/app/Events/Credit/CreditWasMarkedSent.php @@ -1,6 +1,6 @@ credit = $credit; $this->company = $company; $this->event_vars = $event_vars; - } } diff --git a/app/Events/Credit/CreditWasUpdated.php b/app/Events/Credit/CreditWasUpdated.php index 2a1dc4220d58..3901eec55784 100644 --- a/app/Events/Credit/CreditWasUpdated.php +++ b/app/Events/Credit/CreditWasUpdated.php @@ -1,6 +1,6 @@ event_vars = $event_vars; } + /** * Get the channels the event should broadcast on. * @@ -52,5 +54,4 @@ class DesignWasUpdated { return new PrivateChannel('channel-name'); } - } diff --git a/app/Events/Document/DocumentWasArchived.php b/app/Events/Document/DocumentWasArchived.php index ec6651f43af9..30591ec4f35c 100644 --- a/app/Events/Document/DocumentWasArchived.php +++ b/app/Events/Document/DocumentWasArchived.php @@ -1,6 +1,6 @@ invoice = $invoice; - + $this->company = $company; - + $this->errors = $errors; $this->event_vars = $event_vars; diff --git a/app/Events/Invoice/InvoiceWasMarkedSent.php b/app/Events/Invoice/InvoiceWasMarkedSent.php index 037b3703844a..7c4758ca6e50 100644 --- a/app/Events/Invoice/InvoiceWasMarkedSent.php +++ b/app/Events/Invoice/InvoiceWasMarkedSent.php @@ -1,6 +1,6 @@ payment_method = $payment_method; $this->company = $company; - $this->event_vars = $event_vars; + $this->event_vars = $event_vars; } /** diff --git a/app/Events/Payment/PaymentCompleted.php b/app/Events/Payment/PaymentCompleted.php index 8666891ecf15..931cf1aebffb 100644 --- a/app/Events/Payment/PaymentCompleted.php +++ b/app/Events/Payment/PaymentCompleted.php @@ -1,6 +1,6 @@ product = $product; $this->input = $input; diff --git a/app/Events/Product/ProductWasDeleted.php b/app/Events/Product/ProductWasDeleted.php index 97326b3438e9..a87422feadd4 100644 --- a/app/Events/Product/ProductWasDeleted.php +++ b/app/Events/Product/ProductWasDeleted.php @@ -1,6 +1,6 @@ company = $company; $this->event_vars = $event_vars; } - } diff --git a/app/Events/Quote/QuoteWasEmailedAndFailed.php b/app/Events/Quote/QuoteWasEmailedAndFailed.php index a726bb59cf22..1c6ba385d321 100644 --- a/app/Events/Quote/QuoteWasEmailedAndFailed.php +++ b/app/Events/Quote/QuoteWasEmailedAndFailed.php @@ -1,6 +1,6 @@ company = $company; $this->event_vars = $event_vars; } -} \ No newline at end of file +} diff --git a/app/Events/Quote/QuoteWasViewed.php b/app/Events/Quote/QuoteWasViewed.php index 10b68f756042..725964994ac5 100644 --- a/app/Events/Quote/QuoteWasViewed.php +++ b/app/Events/Quote/QuoteWasViewed.php @@ -1,6 +1,6 @@ company = $company; $this->event_vars = $event_vars; } -} \ No newline at end of file +} diff --git a/app/Events/Task/TaskWasUpdated.php b/app/Events/Task/TaskWasUpdated.php index f22f7b14a384..df3dca410e90 100644 --- a/app/Events/Task/TaskWasUpdated.php +++ b/app/Events/Task/TaskWasUpdated.php @@ -1,6 +1,6 @@ company = $company; $this->event_vars = $event_vars; } + /** * Get the channels the event should broadcast on. * diff --git a/app/Events/Vendor/VendorWasArchived.php b/app/Events/Vendor/VendorWasArchived.php index d8faea7f1af5..3d9518dc35eb 100644 --- a/app/Events/Vendor/VendorWasArchived.php +++ b/app/Events/Vendor/VendorWasArchived.php @@ -1,6 +1,6 @@ company = $company; $this->event_vars = $event_vars; } - } diff --git a/app/Events/Vendor/VendorWasUpdated.php b/app/Events/Vendor/VendorWasUpdated.php index 2b2b29bfbec1..894c5ae29663 100644 --- a/app/Events/Vendor/VendorWasUpdated.php +++ b/app/Events/Vendor/VendorWasUpdated.php @@ -1,6 +1,6 @@ bound('sentry') && $this->shouldReport($exception)) { - app('sentry')->configureScope(function (Scope $scope): void { - if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) { $scope->setUser([ 'id' => auth()->guard('contact')->user()->company->account->key, - 'email' => "anonymous@example.com", - 'name' => "Anonymous User", + 'email' => 'anonymous@example.com', + 'name' => 'Anonymous User', ]); } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) { $scope->setUser([ 'id' => auth()->user()->account->key, - 'email' => "anonymous@example.com", - 'name' => "Anonymous User", + 'email' => 'anonymous@example.com', + 'name' => 'Anonymous User', ]); } }); @@ -95,11 +95,10 @@ class Handler extends ExceptionHandler * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Exception $exception + * @param \Throwable $exception * @return \Illuminate\Http\Response */ - - public function render($request, Exception $exception) + public function render($request, Throwable $exception) { if ($exception instanceof ModelNotFoundException && $request->expectsJson()) { return response()->json(['message'=>$exception->getMessage()], 400); @@ -115,13 +114,14 @@ class Handler extends ExceptionHandler ->withInput($request->except('password', 'password_confirmation', '_token')) ->with([ 'message' => ctrans('texts.token_expired'), - 'message-type' => 'danger']); + 'message-type' => 'danger', ]); } elseif ($exception instanceof NotFoundHttpException && $request->expectsJson()) { return response()->json(['message'=>'Route does not exist'], 404); } elseif ($exception instanceof MethodNotAllowedHttpException && $request->expectsJson()) { return response()->json(['message'=>'Method not support for this route'], 404); } elseif ($exception instanceof ValidationException && $request->expectsJson()) { - info(print_r($exception->validator->getMessageBag(),1)); + info(print_r($exception->validator->getMessageBag(), 1)); + return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422); } elseif ($exception instanceof RelationNotFoundException && $request->expectsJson()) { return response()->json(['message' => $exception->getMessage()], 400); @@ -133,7 +133,6 @@ class Handler extends ExceptionHandler // return view('errors.layout', $data); } - return parent::render($request, $exception); } @@ -156,7 +155,7 @@ class Handler extends ExceptionHandler $login = 'default'; break; } - + return redirect()->guest(route($login)); } } diff --git a/app/Exceptions/PaymentRefundFailed.php b/app/Exceptions/PaymentRefundFailed.php index e74c362da7b7..ee57df35463a 100644 --- a/app/Exceptions/PaymentRefundFailed.php +++ b/app/Exceptions/PaymentRefundFailed.php @@ -5,27 +5,27 @@ namespace App\Exceptions; use Exception; class PaymentRefundFailed extends Exception -{ +{ /** - * Report the exception. - * - * @return void - */ - public function report() - { - // - } + * Report the exception. + * + * @return void + */ + public function report() + { + // + } - /** - * Render the exception into an HTTP response. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function render($request) - { - return response()->json([ - 'message' => 'Unable to refund the transaction' + /** + * Render the exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function render($request) + { + return response()->json([ + 'message' => 'Unable to refund the transaction', ], 401); - } + } } diff --git a/app/Factory/ClientContactFactory.php b/app/Factory/ClientContactFactory.php index 0bcce64257d5..a70f0856d6f4 100644 --- a/app/Factory/ClientContactFactory.php +++ b/app/Factory/ClientContactFactory.php @@ -1,6 +1,6 @@ first_name = ""; + $client_contact->first_name = ''; $client_contact->user_id = $user_id; $client_contact->company_id = $company_id; $client_contact->contact_key = \Illuminate\Support\Str::random(40); diff --git a/app/Factory/ClientFactory.php b/app/Factory/ClientFactory.php index 7f6460ffb8b2..20ee1161f8e4 100644 --- a/app/Factory/ClientFactory.php +++ b/app/Factory/ClientFactory.php @@ -1,6 +1,6 @@ is_deleted = 0; $client->client_hash = Str::random(40); $client->settings = ClientSettings::defaults(); - + // $client_contact = ClientContactFactory::create($company_id, $user_id); // $client->contacts->add($client_contact); diff --git a/app/Factory/CloneCreditFactory.php b/app/Factory/CloneCreditFactory.php index 905292d358af..12f780c32638 100644 --- a/app/Factory/CloneCreditFactory.php +++ b/app/Factory/CloneCreditFactory.php @@ -1,7 +1,7 @@ user_id = $user_id; $clone_credit->balance = $credit->amount; $clone_credit->line_items = $credit->line_items; - + return $clone_credit; } } diff --git a/app/Factory/CloneCreditToQuoteFactory.php b/app/Factory/CloneCreditToQuoteFactory.php index 327d85e0cf8c..6ef12a6985fc 100644 --- a/app/Factory/CloneCreditToQuoteFactory.php +++ b/app/Factory/CloneCreditToQuoteFactory.php @@ -1,6 +1,6 @@ balance = $invoice->amount; $clone_invoice->amount = $invoice->amount; $clone_invoice->line_items = $invoice->line_items; - + return $clone_invoice; } } diff --git a/app/Factory/CloneInvoiceToQuoteFactory.php b/app/Factory/CloneInvoiceToQuoteFactory.php index 6ecd833d12a5..9e3d41788af6 100644 --- a/app/Factory/CloneInvoiceToQuoteFactory.php +++ b/app/Factory/CloneInvoiceToQuoteFactory.php @@ -1,6 +1,6 @@ balance = $quote->amount; $clone_quote->amount = $quote->amount; $clone_quote->line_items = $quote->line_items; - + return $clone_quote; } } diff --git a/app/Factory/CloneQuoteToInvoiceFactory.php b/app/Factory/CloneQuoteToInvoiceFactory.php index 8376d1fdd93b..326c33489822 100644 --- a/app/Factory/CloneQuoteToInvoiceFactory.php +++ b/app/Factory/CloneQuoteToInvoiceFactory.php @@ -1,6 +1,6 @@ toArray(); - $quote_array = $quote->toArray(); + unset($quote_array['client']); + unset($quote_array['company']); + unset($quote_array['hashed_id']); + unset($quote_array['invoice_id']); + unset($quote_array['id']); - unset($quote_array['client']); - unset($quote_array['company']); - unset($quote_array['hashed_id']); - unset($quote_array['invoice_id']); - unset($quote_array['id']); + foreach ($quote_array as $key => $value) { + $invoice->{$key} = $value; + } - foreach($quote_array as $key => $value) - $invoice->{$key} = $value; - - $invoice->status_id = Invoice::STATUS_DRAFT; - $invoice->due_date = null; - $invoice->partial_due_date = null; - $invoice->number = null; - - return $invoice; + $invoice->status_id = Invoice::STATUS_DRAFT; + $invoice->due_date = null; + $invoice->partial_due_date = null; + $invoice->number = null; + return $invoice; } } diff --git a/app/Factory/CompanyFactory.php b/app/Factory/CompanyFactory.php index 38b3f8697c65..edb3e97aaa0f 100644 --- a/app/Factory/CompanyFactory.php +++ b/app/Factory/CompanyFactory.php @@ -1,6 +1,6 @@ custom_fields = (object) ['invoice1' => '1', 'invoice2' => '2', 'client1'=>'3']; $company->custom_fields = (object) []; $company->subdomain = ''; - $company->enabled_modules = config('ninja.enabled_modules'); //32767;//8191; //4095 + $company->enabled_modules = config('ninja.enabled_modules'); //32767;//8191; //4095 return $company; } diff --git a/app/Factory/CompanyGatewayFactory.php b/app/Factory/CompanyGatewayFactory.php index 5d6ebf1e0ee2..f1feceb7da68 100644 --- a/app/Factory/CompanyGatewayFactory.php +++ b/app/Factory/CompanyGatewayFactory.php @@ -1,6 +1,6 @@ company_id = $company_id; $company_gateway->user_id = $user_id; + return $company_gateway; } } diff --git a/app/Factory/CompanyLedgerFactory.php b/app/Factory/CompanyLedgerFactory.php index 0c978894ad56..3c99a0f4d211 100644 --- a/app/Factory/CompanyLedgerFactory.php +++ b/app/Factory/CompanyLedgerFactory.php @@ -1,6 +1,6 @@ company_id = $company_id; $company_user->account_id = $account_id; $company_user->notifications = CompanySettings::notificationDefaults(); + return $company_user; } } diff --git a/app/Factory/CreditFactory.php b/app/Factory/CreditFactory.php index 5b98bf53c112..b6bea1415006 100644 --- a/app/Factory/CreditFactory.php +++ b/app/Factory/CreditFactory.php @@ -1,6 +1,6 @@ status_id = Credit::STATUS_DRAFT; @@ -47,7 +47,7 @@ class CreditFactory $credit->user_id = $user_id; $credit->company_id = $company_id; $credit->recurring_id = null; - + return $credit; } } diff --git a/app/Factory/CreditInvitationFactory.php b/app/Factory/CreditInvitationFactory.php index 181f153f3b3a..1e73748b48f2 100644 --- a/app/Factory/CreditInvitationFactory.php +++ b/app/Factory/CreditInvitationFactory.php @@ -1,6 +1,6 @@ is_custom = true; $design->name = ''; $design->design = ''; - + return $design; } } diff --git a/app/Factory/ExpenseFactory.php b/app/Factory/ExpenseFactory.php index 99a8564130e6..d6bf6701d764 100644 --- a/app/Factory/ExpenseFactory.php +++ b/app/Factory/ExpenseFactory.php @@ -1,6 +1,6 @@ tax_rate3 = 0; $expense->expense_date = null; $expense->payment_date = null; - + return $expense; } } diff --git a/app/Factory/GroupSettingFactory.php b/app/Factory/GroupSettingFactory.php index f39f70328eed..cd6094e88a63 100644 --- a/app/Factory/GroupSettingFactory.php +++ b/app/Factory/GroupSettingFactory.php @@ -1,6 +1,6 @@ company_id = $company_id; $gs->user_id = $user_id; $gs->settings = '{}'; - + return $gs; } } diff --git a/app/Factory/InvoiceFactory.php b/app/Factory/InvoiceFactory.php index 990bb2a52d12..e16f4d58bf37 100644 --- a/app/Factory/InvoiceFactory.php +++ b/app/Factory/InvoiceFactory.php @@ -1,6 +1,6 @@ user_id = $user_id; $invoice->company_id = $company_id; $invoice->recurring_id = null; - + return $invoice; } } diff --git a/app/Factory/InvoiceInvitationFactory.php b/app/Factory/InvoiceInvitationFactory.php index 286204a7b241..e008b234e877 100644 --- a/app/Factory/InvoiceInvitationFactory.php +++ b/app/Factory/InvoiceInvitationFactory.php @@ -1,6 +1,6 @@ quantity = $faker->numberBetween(1, 10); $item->cost = $faker->randomFloat(2, 1, 1000); @@ -68,15 +68,15 @@ class InvoiceItemFactory $item->custom_value4 = $faker->realText(10); $item->tax_name1 = 'GST'; $item->tax_rate1 = 10.00; - + $data[] = $item; } - + return $data; } /** - * Generates an array of dummy data for invoice items + * Generates an array of dummy data for invoice items. * @param int $items Number of line items to create * @return array array of objects */ @@ -86,7 +86,7 @@ class InvoiceItemFactory $data = []; - for ($x=0; $x<$items; $x++) { + for ($x = 0; $x < $items; $x++) { $item = self::create(); $item->quantity = $faker->numberBetween(-1, -10); $item->cost = $faker->randomFloat(2, -1, -1000); @@ -101,10 +101,10 @@ class InvoiceItemFactory $item->custom_value4 = $faker->realText(10); $item->tax_name1 = 'GST'; $item->tax_rate1 = 10.00; - + $data[] = $item; } - + return $data; } } diff --git a/app/Factory/InvoiceToRecurringInvoiceFactory.php b/app/Factory/InvoiceToRecurringInvoiceFactory.php index 3ef61eb6abbe..a16cbeaf93a2 100644 --- a/app/Factory/InvoiceToRecurringInvoiceFactory.php +++ b/app/Factory/InvoiceToRecurringInvoiceFactory.php @@ -1,6 +1,6 @@ company_id = $company_id; $payment->user_id = $user_id; $payment->client_id = 0; @@ -36,7 +36,7 @@ class PaymentFactory $payment->transaction_reference = null; $payment->payer_id = null; $payment->status_id = Payment::STATUS_PENDING; - + return $payment; } } diff --git a/app/Factory/PaymentTermFactory.php b/app/Factory/PaymentTermFactory.php index ec18c4aed9fa..18e2c3e2c2c8 100644 --- a/app/Factory/PaymentTermFactory.php +++ b/app/Factory/PaymentTermFactory.php @@ -1,6 +1,6 @@ partial = 0; $quote->user_id = $user_id; $quote->company_id = $company_id; - + return $quote; } } diff --git a/app/Factory/QuoteInvitationFactory.php b/app/Factory/QuoteInvitationFactory.php index 0e52c54dd58b..6959f89d8577 100644 --- a/app/Factory/QuoteInvitationFactory.php +++ b/app/Factory/QuoteInvitationFactory.php @@ -1,6 +1,6 @@ user_id = $recurring_invoice->user_id; $invoice->company_id = $recurring_invoice->company_id; $invoice->recurring_id = $recurring_invoice->id; - + return $invoice; } } diff --git a/app/Factory/RecurringQuoteFactory.php b/app/Factory/RecurringQuoteFactory.php index 79c9854b530d..4b3d303f3497 100644 --- a/app/Factory/RecurringQuoteFactory.php +++ b/app/Factory/RecurringQuoteFactory.php @@ -1,6 +1,6 @@ failed_logins = 0; $user->signature = ''; $user->theme_id = 0; - + return $user; } } diff --git a/app/Factory/VendorContactFactory.php b/app/Factory/VendorContactFactory.php index 5ba73935eeb3..c33f2f8d0727 100644 --- a/app/Factory/VendorContactFactory.php +++ b/app/Factory/VendorContactFactory.php @@ -1,6 +1,6 @@ first_name = ""; + $vendor_contact->first_name = ''; $vendor_contact->user_id = $user_id; $vendor_contact->company_id = $company_id; $vendor_contact->id = 0; diff --git a/app/Factory/VendorFactory.php b/app/Factory/VendorFactory.php index bc5fb5e56d01..6218200e3232 100644 --- a/app/Factory/VendorFactory.php +++ b/app/Factory/VendorFactory.php @@ -1,6 +1,6 @@ paid_to_date = 0; $vendor->country_id = 4; $vendor->is_deleted = 0; - + $vendor_contact = VendorContactFactory::create($company_id, $user_id); $vendor->contacts->add($vendor_contact); diff --git a/app/Factory/WebhookFactory.php b/app/Factory/WebhookFactory.php index 45b1d1f71b92..b74ebd5902df 100644 --- a/app/Factory/WebhookFactory.php +++ b/app/Factory/WebhookFactory.php @@ -1,6 +1,6 @@ builder->whereBetween('balance', [$parts[0], $parts[1]]); } public function email(string $email):Builder { - return - - $this->builder->whereHas('contacts', function ($query) use ($email) { - - $query->where('email', $email); - - }); + return + $this->builder->whereHas('contacts', function ($query) use ($email) { + $query->where('email', $email); + }); //return $this->builder->where('email', $email); } @@ -69,12 +65,11 @@ class ClientFilters extends QueryFilters } /** - * Filter based on search text + * Filter based on search text. * * @param string query filter * @return Illuminate\Database\Query\Builder * @deprecated - * */ public function filter(string $filter = '') : Builder { @@ -97,7 +92,7 @@ class ClientFilters extends QueryFilters /** * Filters the list based on the status - * archived, active, deleted + * archived, active, deleted. * * @param string filter * @return Illuminate\Database\Query\Builder @@ -112,42 +107,43 @@ class ClientFilters extends QueryFilters $filters = explode(',', $filter); return $this->builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -188,21 +184,20 @@ class ClientFilters extends QueryFilters 'clients.settings' ); - /** + /* * If the user does not have permissions to view all invoices * limit the user to only the invoices they have created */ if (Gate::denies('view-list', Client::class)) { - info("the gate!"); + info('the gate!'); $query->where('clients.user_id', '=', $user->id); } - return $query; } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/CreditFilters.php b/app/Filters/CreditFilters.php index caf946a069c0..dc0549e03ea9 100644 --- a/app/Filters/CreditFilters.php +++ b/app/Filters/CreditFilters.php @@ -1,7 +1,7 @@ builder; } - $status_parameters = explode(",", $value); + $status_parameters = explode(',', $value); if (in_array('all', $status_parameters)) { return $this->builder; } - + if (in_array('draft', $status_parameters)) { $this->builder->where('status_id', Credit::STATUS_DRAFT); } @@ -68,12 +66,11 @@ class CreditFilters extends QueryFilters } /** - * Filter based on search text + * Filter based on search text. * * @param string query filter * @return Illuminate\Database\Query\Builder * @deprecated - * */ public function filter(string $filter = '') : Builder { @@ -96,7 +93,7 @@ class CreditFilters extends QueryFilters /** * Filters the list based on the status - * archived, active, deleted - legacy from V1 + * archived, active, deleted - legacy from V1. * * @param string filter * @return Illuminate\Database\Query\Builder @@ -111,42 +108,43 @@ class CreditFilters extends QueryFilters $filters = explode(',', $filter); return $this->builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -158,7 +156,7 @@ class CreditFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * We need to ensure we are using the correct company ID * as we could be hitting this from either the client or company auth guard @@ -179,7 +177,7 @@ class CreditFilters extends QueryFilters /** * We need additional filters when showing credits for the - * client portal. Need to automatically exclude drafts and cancelled credits + * client portal. Need to automatically exclude drafts and cancelled credits. * * @return Illuminate\Database\Query\Builder */ diff --git a/app/Filters/DesignFilters.php b/app/Filters/DesignFilters.php index 01f90182dcfa..e898006d35aa 100644 --- a/app/Filters/DesignFilters.php +++ b/app/Filters/DesignFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -117,7 +116,7 @@ class DesignFilters extends QueryFilters 'designs.user_id', ); - /** + /* * If the user does not have permissions to view all invoices * limit the user to only the invoices they have created */ @@ -125,12 +124,11 @@ class DesignFilters extends QueryFilters $query->where('designs.user_id', '=', $user->id); } - return $query; } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/ExpenseFilters.php b/app/Filters/ExpenseFilters.php index 3dd97a2e3abd..be9d74a81327 100644 --- a/app/Filters/ExpenseFilters.php +++ b/app/Filters/ExpenseFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -131,7 +130,7 @@ class ExpenseFilters extends QueryFilters 'expenses.user_id', ); - /** + /* * If the user does not have permissions to view all invoices * limit the user to only the invoices they have created */ @@ -139,19 +138,18 @@ class ExpenseFilters extends QueryFilters $query->where('expenses.user_id', '=', $user->id); } - return $query; } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder */ public function entityFilter() { - + //return $this->builder->whereCompanyId(auth()->user()->company()->id); return $this->builder->company(); } diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 9b6aabd97a29..3d9572018955 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -1,6 +1,6 @@ builder; } - $status_parameters = explode(",", $value); + $status_parameters = explode(',', $value); if (in_array('all', $status_parameters)) { return $this->builder; } - + if (in_array('paid', $status_parameters)) { $this->builder->where('status_id', Invoice::STATUS_PAID); } @@ -76,12 +73,11 @@ class InvoiceFilters extends QueryFilters } /** - * Filter based on search text + * Filter based on search text. * * @param string query filter * @return Illuminate\Database\Query\Builder * @deprecated - * */ public function filter(string $filter = '') : Builder { @@ -104,7 +100,7 @@ class InvoiceFilters extends QueryFilters /** * Filters the list based on the status - * archived, active, deleted - legacy from V1 + * archived, active, deleted - legacy from V1. * * @param string filter * @return Illuminate\Database\Query\Builder @@ -119,42 +115,43 @@ class InvoiceFilters extends QueryFilters $filters = explode(',', $filter); return $this->builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -165,7 +162,7 @@ class InvoiceFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * We need to ensure we are using the correct company ID * as we could be hitting this from either the client or company auth guard @@ -178,7 +175,7 @@ class InvoiceFilters extends QueryFilters if (auth('contact')->user()) { return $this->contactViewFilter(); } else { - return $this->builder->company()->with(['invitations.company'],['documents.company']); + return $this->builder->company()->with(['invitations.company'], ['documents.company']); } // return $this->builder->whereCompanyId(auth()->user()->company()->id); @@ -186,7 +183,7 @@ class InvoiceFilters extends QueryFilters /** * We need additional filters when showing invoices for the - * client portal. Need to automatically exclude drafts and cancelled invoices + * client portal. Need to automatically exclude drafts and cancelled invoices. * * @return Illuminate\Database\Query\Builder */ diff --git a/app/Filters/PaymentFilters.php b/app/Filters/PaymentFilters.php index 557486bafd67..902454075873 100644 --- a/app/Filters/PaymentFilters.php +++ b/app/Filters/PaymentFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -109,7 +107,7 @@ class PaymentFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder @@ -123,11 +121,9 @@ class PaymentFilters extends QueryFilters } } - - /** * We need additional filters when showing invoices for the - * client portal. Need to automatically exclude drafts and cancelled invoices + * client portal. Need to automatically exclude drafts and cancelled invoices. * * @return Illuminate\Database\Query\Builder */ diff --git a/app/Filters/ProductFilters.php b/app/Filters/ProductFilters.php index 28740c70e1f7..f783146798dc 100644 --- a/app/Filters/ProductFilters.php +++ b/app/Filters/ProductFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -108,7 +106,7 @@ class ProductFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/QueryFilters.php b/app/Filters/QueryFilters.php index 877aec91ef9d..bf3a36d0a5c9 100644 --- a/app/Filters/QueryFilters.php +++ b/app/Filters/QueryFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } @@ -88,19 +85,20 @@ class QuoteFilters extends QueryFilters } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -111,7 +109,7 @@ class QuoteFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/RecurringInvoiceFilters.php b/app/Filters/RecurringInvoiceFilters.php index 0f53580884ae..204eb3a7ab30 100644 --- a/app/Filters/RecurringInvoiceFilters.php +++ b/app/Filters/RecurringInvoiceFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -106,7 +104,7 @@ class RecurringInvoiceFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/RecurringQuoteFilters.php b/app/Filters/RecurringQuoteFilters.php index 5f2190cb0e73..f9798480195c 100644 --- a/app/Filters/RecurringQuoteFilters.php +++ b/app/Filters/RecurringQuoteFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -106,7 +104,7 @@ class RecurringQuoteFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/SystemLogFilters.php b/app/Filters/SystemLogFilters.php index 57c9f06cd7af..5123f6773b7d 100644 --- a/app/Filters/SystemLogFilters.php +++ b/app/Filters/SystemLogFilters.php @@ -1,6 +1,6 @@ builder->where('type_id', $type_id); @@ -44,12 +43,11 @@ class SystemLogFilters extends QueryFilters } /** - * Filter based on search text + * Filter based on search text. * * @param string query filter * @return Illuminate\Database\Query\Builder * @deprecated - * */ public function filter(string $filter = '') : Builder { @@ -73,19 +71,20 @@ class SystemLogFilters extends QueryFilters } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -96,14 +95,14 @@ class SystemLogFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder */ public function entityFilter() { - + //return $this->builder->whereCompanyId(auth()->user()->company()->id); return $this->builder->company(); } diff --git a/app/Filters/TokenFilters.php b/app/Filters/TokenFilters.php index f49b4fd56f6c..77cbdddf6236 100644 --- a/app/Filters/TokenFilters.php +++ b/app/Filters/TokenFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -117,8 +116,7 @@ class TokenFilters extends QueryFilters 'company_tokens.user_id', ); - - /** + /* * If the user does not have permissions to view all invoices * limit the user to only the invoices they have created */ @@ -126,12 +124,11 @@ class TokenFilters extends QueryFilters $query->where('company_tokens.user_id', '=', $user->id); } - return $query; } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/UserFilters.php b/app/Filters/UserFilters.php index c53102cd4a7b..4619ad72d78e 100644 --- a/app/Filters/UserFilters.php +++ b/app/Filters/UserFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -106,7 +104,7 @@ class UserFilters extends QueryFilters } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Filters/VendorFilters.php b/app/Filters/VendorFilters.php index 769608d49c28..e0a483b96525 100644 --- a/app/Filters/VendorFilters.php +++ b/app/Filters/VendorFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -143,7 +142,7 @@ class VendorFilters extends QueryFilters 'vendors.settings' ); - /** + /* * If the user does not have permissions to view all invoices * limit the user to only the invoices they have created */ @@ -151,19 +150,18 @@ class VendorFilters extends QueryFilters $query->where('vendors.user_id', '=', $user->id); } - return $query; } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder */ public function entityFilter() { - + //return $this->builder->whereCompanyId(auth()->user()->company()->id); return $this->builder->company(); } diff --git a/app/Filters/WebhookFilters.php b/app/Filters/WebhookFilters.php index 8822e334f0a9..157753bb6d2c 100644 --- a/app/Filters/WebhookFilters.php +++ b/app/Filters/WebhookFilters.php @@ -1,6 +1,6 @@ builder->where(function ($query) use ($filters, $table) { - $query->whereNull($table . '.id'); + $query->whereNull($table.'.id'); if (in_array(parent::STATUS_ACTIVE, $filters)) { - $query->orWhereNull($table . '.deleted_at'); + $query->orWhereNull($table.'.deleted_at'); } if (in_array(parent::STATUS_ARCHIVED, $filters)) { $query->orWhere(function ($query) use ($table) { - $query->whereNotNull($table . '.deleted_at'); + $query->whereNotNull($table.'.deleted_at'); if (! in_array($table, ['users'])) { - $query->where($table . '.is_deleted', '=', 0); + $query->where($table.'.is_deleted', '=', 0); } }); } if (in_array(parent::STATUS_DELETED, $filters)) { - $query->orWhere($table . '.is_deleted', '=', 1); + $query->orWhere($table.'.is_deleted', '=', 1); } }); } /** - * Sorts the list based on $sort + * Sorts the list based on $sort. * * @param string sort formatted as column|asc * @return Illuminate\Database\Query\Builder */ public function sort(string $sort) : Builder { - $sort_col = explode("|", $sort); + $sort_col = explode('|', $sort); + return $this->builder->orderBy($sort_col[0], $sort_col[1]); } /** - * Returns the base query + * Returns the base query. * * @param int company_id * @return Illuminate\Database\Query\Builder @@ -117,8 +116,7 @@ class WebhookFilters extends QueryFilters 'webhooks.user_id', ); - - /** + /* * If the user does not have permissions to view all invoices * limit the user to only the invoices they have created */ @@ -126,12 +124,11 @@ class WebhookFilters extends QueryFilters $query->where('webhooks.user_id', '=', $user->id); } - return $query; } /** - * Filters the query by the users company ID + * Filters the query by the users company ID. * * @param $company_id The company Id * @return Illuminate\Database\Query\Builder diff --git a/app/Helpers/ClientPortal.php b/app/Helpers/ClientPortal.php index 00cfe939f2bd..21b010c55c57 100644 --- a/app/Helpers/ClientPortal.php +++ b/app/Helpers/ClientPortal.php @@ -1,7 +1,7 @@ variables)) { + if (! empty($this->variables)) { $data = str_replace(array_keys($this->variables), array_values($this->variables), $data); } @@ -47,12 +47,14 @@ class EmailBuilder public function setFooter($footer) { $this->footer = $footer; + return $this; } public function setVariables($variables) { $this->variables = $variables; + return $this; } @@ -63,6 +65,7 @@ class EmailBuilder public function setContact($contact) { $this->contact = $contact; + return $this; } @@ -73,12 +76,13 @@ class EmailBuilder public function setSubject($subject) { //$this->subject = $this->parseTemplate($subject, false, $this->contact); - - if (!empty($this->variables)) { + + if (! empty($this->variables)) { $subject = str_replace(array_keys($this->variables), array_values($this->variables), $subject); } $this->subject = $subject; + return $this; } @@ -89,13 +93,13 @@ class EmailBuilder public function setBody($body) { //$this->body = $this->parseTemplate($body, true); - - if (!empty($this->variables)) { + + if (! empty($this->variables)) { $body = str_replace(array_keys($this->variables), array_values($this->variables), $body); } - $this->body = $body; + return $this; } @@ -106,24 +110,28 @@ class EmailBuilder public function setTemplate($template_style) { $this->template_style = $template_style; + return $this; } - + public function setAttachments($attachments) { $this->attachments[] = $attachments; + return $this; } public function setViewLink($link) { $this->view_link = $link; + return $this; } public function setViewText($text) { $this->view_text = $text; + return $this; } diff --git a/app/Helpers/Email/InvoiceEmail.php b/app/Helpers/Email/InvoiceEmail.php index 49c7630bbe06..68fe303e56fa 100644 --- a/app/Helpers/Email/InvoiceEmail.php +++ b/app/Helpers/Email/InvoiceEmail.php @@ -3,7 +3,7 @@ * Created by PhpStorm. * User: michael.hampton * Date: 14/02/2020 - * Time: 19:51 + * Time: 19:51. */ namespace App\Helpers\Email; @@ -20,11 +20,11 @@ class InvoiceEmail extends EmailBuilder $invoice = $invitation->invoice; $contact = $invitation->contact; - if (!$reminder_template) { + if (! $reminder_template) { $reminder_template = $invoice->calculateTemplate(); } - $body_template = $client->getSetting('email_template_' . $reminder_template); + $body_template = $client->getSetting('email_template_'.$reminder_template); /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { @@ -40,7 +40,7 @@ class InvoiceEmail extends EmailBuilder ); } - $subject_template = $client->getSetting('email_subject_' . $reminder_template); + $subject_template = $client->getSetting('email_subject_'.$reminder_template); if (iconv_strlen($subject_template) == 0) { if ($reminder_template == 'quote') { @@ -48,7 +48,7 @@ class InvoiceEmail extends EmailBuilder 'texts.quote_subject', [ 'number' => $invoice->number, - 'account' => $invoice->company->present()->name() + 'account' => $invoice->company->present()->name(), ], null, $invoice->client->locale() @@ -58,26 +58,27 @@ class InvoiceEmail extends EmailBuilder 'texts.invoice_subject', [ 'number' => $invoice->number, - 'account' => $invoice->company->present()->name() + 'account' => $invoice->company->present()->name(), ], null, $invoice->client->locale() ); } } - + $this->setTemplate($client->getSetting('email_style')) ->setContact($contact) ->setVariables($invoice->makeValues($contact)) ->setSubject($subject_template) ->setBody($body_template) - ->setFooter("".ctrans('texts.view_invoice')."") + ->setFooter("".ctrans('texts.view_invoice').'') ->setViewLink($invitation->getLink()) ->setViewText(ctrans('texts.view_invoice')); if ($client->getSetting('pdf_email_attachment') !== false) { $this->setAttachments($invitation->pdf_file_path()); } + return $this; } } diff --git a/app/Helpers/Email/PaymentEmail.php b/app/Helpers/Email/PaymentEmail.php index 12fb79ffab68..0e96d2dc35f7 100644 --- a/app/Helpers/Email/PaymentEmail.php +++ b/app/Helpers/Email/PaymentEmail.php @@ -3,7 +3,7 @@ * Created by PhpStorm. * User: michael.hampton * Date: 14/02/2020 - * Time: 19:51 + * Time: 19:51. */ namespace App\Helpers\Email; diff --git a/app/Helpers/Email/QuoteEmail.php b/app/Helpers/Email/QuoteEmail.php index 3696eb6ea3dd..a1f91da900f2 100644 --- a/app/Helpers/Email/QuoteEmail.php +++ b/app/Helpers/Email/QuoteEmail.php @@ -3,7 +3,7 @@ * Created by PhpStorm. * User: michael.hampton * Date: 14/02/2020 - * Time: 19:51 + * Time: 19:51. */ namespace App\Helpers\Email; @@ -21,7 +21,7 @@ class QuoteEmail extends EmailBuilder $this->template_style = $client->getSetting('email_style'); - $body_template = $client->getSetting('email_template_' . $reminder_template); + $body_template = $client->getSetting('email_template_'.$reminder_template); /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { @@ -33,7 +33,7 @@ class QuoteEmail extends EmailBuilder ); } - $subject_template = $client->getSetting('email_subject_' . $reminder_template); + $subject_template = $client->getSetting('email_subject_'.$reminder_template); if (iconv_strlen($subject_template) == 0) { if ($reminder_template == 'quote') { diff --git a/app/Helpers/Invoice/Balancer.php b/app/Helpers/Invoice/Balancer.php index be9b11c33497..9a4122d41c35 100644 --- a/app/Helpers/Invoice/Balancer.php +++ b/app/Helpers/Invoice/Balancer.php @@ -1,6 +1,6 @@ invoice->tax_rate1/100), 2) + round($custom_value * ($this->invoice->tax_rate2/100), 2) + round($custom_value * ($this->invoice->tax_rate3/100), 2); + return round($custom_value * ($this->invoice->tax_rate1 / 100), 2) + round($custom_value * ($this->invoice->tax_rate2 / 100), 2) + round($custom_value * ($this->invoice->tax_rate3 / 100), 2); } return 0; diff --git a/app/Helpers/Invoice/Discounter.php b/app/Helpers/Invoice/Discounter.php index c5be188736e8..20626d7b8acc 100644 --- a/app/Helpers/Invoice/Discounter.php +++ b/app/Helpers/Invoice/Discounter.php @@ -1,6 +1,6 @@ invoice->discount; } - return round($amount * ($this->invoice->discount / 100), 2); } } diff --git a/app/Helpers/Invoice/InvoiceItemSum.php b/app/Helpers/Invoice/InvoiceItemSum.php index b3f3312ae049..eaecb3338c42 100644 --- a/app/Helpers/Invoice/InvoiceItemSum.php +++ b/app/Helpers/Invoice/InvoiceItemSum.php @@ -1,6 +1,6 @@ invoice->line_items || !isset($this->invoice->line_items) || !is_array($this->invoice->line_items) || count($this->invoice->line_items) == 0) { + if (! $this->invoice->line_items || ! isset($this->invoice->line_items) || ! is_array($this->invoice->line_items) || count($this->invoice->line_items) == 0) { $this->items = []; + return $this; } @@ -93,6 +94,7 @@ class InvoiceItemSum private function sumLineItem() { //todo need to support quantities less than the precision amount $this->setLineTotal($this->formatValue($this->item->cost, $this->currency->precision) * $this->formatValue($this->item->quantity, $this->currency->precision)); + return $this; } @@ -113,7 +115,7 @@ class InvoiceItemSum { $item_tax = 0; - $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount/100)); + $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / 100)); $item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount); $item_tax += $item_tax_rate1_total; @@ -121,7 +123,7 @@ class InvoiceItemSum if ($item_tax_rate1_total > 0) { $this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total); } - + $item_tax_rate2_total = $this->calcAmountLineTax($this->item->tax_rate2, $amount); $item_tax += $item_tax_rate2_total; @@ -138,7 +140,6 @@ class InvoiceItemSum $this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total); } - $this->setTotalTaxes($this->formatValue($item_tax, $this->currency->precision)); return $this; @@ -148,9 +149,9 @@ class InvoiceItemSum { $group_tax = []; - $key = str_replace(" ", "", $tax_name.$tax_rate); + $key = str_replace(' ', '', $tax_name.$tax_rate); - $group_tax = ['key' => $key, 'total' => $tax_total, 'tax_name' => $tax_name . ' ' . $tax_rate.'%']; + $group_tax = ['key' => $key, 'total' => $tax_total, 'tax_name' => $tax_name.' '.$tax_rate.'%']; $this->tax_collection->push(collect($group_tax)); } @@ -204,12 +205,12 @@ class InvoiceItemSum public function setSubTotal($value) { $this->sub_total = $value; + return $this; } - /** - * Invoice Amount Discount + * Invoice Amount Discount. * * The problem, when calculating invoice level discounts, * the tax collected changes. @@ -218,7 +219,6 @@ class InvoiceItemSum * and recalculate the taxes and then pass back * the updated map */ - public function calcTaxesWithAmountDiscount() { $this->setGroupedTaxes(collect([])); @@ -230,7 +230,7 @@ class InvoiceItemSum continue; } - $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount/$this->sub_total)); + $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total)); $item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount); $item_tax += $item_tax_rate1_total; @@ -238,7 +238,7 @@ class InvoiceItemSum if ($item_tax_rate1_total > 0) { $this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total); } - + $item_tax_rate2_total = $this->calcAmountLineTax($this->item->tax_rate2, $amount); $item_tax += $item_tax_rate2_total; @@ -260,22 +260,21 @@ class InvoiceItemSum } /** - * Sets default values for the line_items + * Sets default values for the line_items. * @return $this */ private function cleanLineItem() { - $invoice_item = (object)get_class_vars(InvoiceItem::class); + $invoice_item = (object) get_class_vars(InvoiceItem::class); unset($invoice_item->casts); foreach ($invoice_item as $key => $value) { - if (!property_exists($this->item, $key) || !isset($this->item->{$key})) { + if (! property_exists($this->item, $key) || ! isset($this->item->{$key})) { $this->item->{$key} = $value; $this->item->{$key} = BaseSettings::castAttribute(InvoiceItem::$casts[$key], $value); } } - return $this; } } diff --git a/app/Helpers/Invoice/InvoiceItemSumInclusive.php b/app/Helpers/Invoice/InvoiceItemSumInclusive.php index 2621387cd058..9e54081955d1 100644 --- a/app/Helpers/Invoice/InvoiceItemSumInclusive.php +++ b/app/Helpers/Invoice/InvoiceItemSumInclusive.php @@ -1,6 +1,6 @@ invoice->line_items || !is_array($this->invoice->line_items) || count($this->invoice->line_items) == 0) { + if (! $this->invoice->line_items || ! is_array($this->invoice->line_items) || count($this->invoice->line_items) == 0) { $this->items = []; + return $this; } @@ -88,7 +88,6 @@ class InvoiceItemSumInclusive return $this; } - private function sumLineItem() { $this->setLineTotal($this->formatValue($this->item->cost, $this->currency->precision) * $this->formatValue($this->item->quantity, $this->currency->precision)); @@ -112,13 +111,12 @@ class InvoiceItemSumInclusive /** * Taxes effect the line totals and item costs. we decrement both on * application of inclusive tax rates. - * */ private function calcTaxes() { $item_tax = 0; - $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount/100)); + $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / 100)); $item_tax_rate1_total = $this->calcInclusiveLineTax($this->item->tax_rate1, $amount); @@ -127,7 +125,7 @@ class InvoiceItemSumInclusive if ($item_tax_rate1_total > 0) { $this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total); } - + $item_tax_rate2_total = $this->calcInclusiveLineTax($this->item->tax_rate2, $amount); $item_tax += $this->formatValue($item_tax_rate2_total, $this->currency->precision); @@ -153,9 +151,9 @@ class InvoiceItemSumInclusive { $group_tax = []; - $key = str_replace(" ", "", $tax_name.$tax_rate); + $key = str_replace(' ', '', $tax_name.$tax_rate); - $group_tax = ['key' => $key, 'total' => $tax_total, 'tax_name' => $tax_name . ' ' . $tax_rate.'%']; + $group_tax = ['key' => $key, 'total' => $tax_total, 'tax_name' => $tax_name.' '.$tax_rate.'%']; $this->tax_collection->push(collect($group_tax)); } @@ -209,11 +207,12 @@ class InvoiceItemSumInclusive public function setSubTotal($value) { $this->sub_total = $value; + return $this; } /** - * Invoice Amount Discount + * Invoice Amount Discount. * * The problem, when calculating invoice level discounts, * the tax collected changes. @@ -222,7 +221,6 @@ class InvoiceItemSumInclusive * and recalculate the taxes and then pass back * the updated map */ - public function calcTaxesWithAmountDiscount() { $this->setGroupedTaxes(collect([])); @@ -230,7 +228,7 @@ class InvoiceItemSumInclusive $item_tax = 0; foreach ($this->line_items as $this->item) { - $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount/$this->sub_total)); + $amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total)); $item_tax_rate1_total = $this->calcInclusiveLineTax($this->item->tax_rate1, $amount); $item_tax += $item_tax_rate1_total; @@ -238,7 +236,7 @@ class InvoiceItemSumInclusive if ($item_tax_rate1_total > 0) { $this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total); } - + $item_tax_rate2_total = $this->calcInclusiveLineTax($this->item->tax_rate2, $amount); $item_tax += $item_tax_rate2_total; diff --git a/app/Helpers/Invoice/InvoiceSum.php b/app/Helpers/Invoice/InvoiceSum.php index 5c3809183047..cde944a98828 100644 --- a/app/Helpers/Invoice/InvoiceSum.php +++ b/app/Helpers/Invoice/InvoiceSum.php @@ -1,6 +1,6 @@ invoice->tax_rate1 > 0) { $tax = $this->taxer($this->total, $this->invoice->tax_rate1); $this->total_taxes += $tax; - $this->total_tax_map[] = ['name' => $this->invoice->tax_name1 . ' ' . $this->invoice->tax_rate1.'%', 'total' => $tax]; + $this->total_tax_map[] = ['name' => $this->invoice->tax_name1.' '.$this->invoice->tax_rate1.'%', 'total' => $tax]; } if ($this->invoice->tax_rate2 > 0) { $tax = $this->taxer($this->total, $this->invoice->tax_rate2); $this->total_taxes += $tax; - $this->total_tax_map[] = ['name' => $this->invoice->tax_name2. ' ' . $this->invoice->tax_rate2.'%', 'total' => $tax]; + $this->total_tax_map[] = ['name' => $this->invoice->tax_name2.' '.$this->invoice->tax_rate2.'%', 'total' => $tax]; } if ($this->invoice->tax_rate3 > 0) { $tax = $this->taxer($this->total, $this->invoice->tax_rate3); $this->total_taxes += $tax; - $this->total_tax_map[] = ['name' => $this->invoice->tax_name3 . ' ' . $this->invoice->tax_rate3.'%', 'total' => $tax]; + $this->total_tax_map[] = ['name' => $this->invoice->tax_name3.' '.$this->invoice->tax_rate3.'%', 'total' => $tax]; } return $this; @@ -148,7 +148,7 @@ class InvoiceSum private function calculatePartial() { - if (!isset($this->invoice->id) && isset($this->invoice->partial)) { + if (! isset($this->invoice->id) && isset($this->invoice->partial)) { $this->invoice->partial = max(0, min($this->formatValue($this->invoice->partial, 2), $this->invoice->balance)); } @@ -167,7 +167,7 @@ class InvoiceSum //Build invoice values here and return Invoice $this->setCalculatedAttributes(); $this->invoice->save(); - + return $this->invoice; } @@ -175,7 +175,7 @@ class InvoiceSum { $this->setCalculatedAttributes(); $this->invoice->save(); - + return $this->invoice; } @@ -183,7 +183,7 @@ class InvoiceSum { $this->setCalculatedAttributes(); $this->invoice->save(); - + return $this->invoice; } @@ -218,6 +218,7 @@ class InvoiceSum public function setSubTotal($value) { $this->sub_total = $value; + return $this; } diff --git a/app/Helpers/Invoice/InvoiceSumInclusive.php b/app/Helpers/Invoice/InvoiceSumInclusive.php index 46948fb4f734..924fb7098e36 100644 --- a/app/Helpers/Invoice/InvoiceSumInclusive.php +++ b/app/Helpers/Invoice/InvoiceSumInclusive.php @@ -1,6 +1,6 @@ invoice = $invoice; - $this->tax_map = new Collection; } @@ -120,28 +119,27 @@ class InvoiceSumInclusive $amount = $this->formatValue(($this->sub_total - $this->invoice->discount), 2); } - if ($this->invoice->discount > 0 && !$this->invoice->is_amount_discount) { - $amount = $this->formatValue(($this->sub_total - ($this->sub_total * ($this->invoice->discount/100))), 2); + if ($this->invoice->discount > 0 && ! $this->invoice->is_amount_discount) { + $amount = $this->formatValue(($this->sub_total - ($this->sub_total * ($this->invoice->discount / 100))), 2); } if ($this->invoice->tax_rate1 > 0) { $tax = $this->calcInclusiveLineTax($this->invoice->tax_rate1, $amount); $this->total_taxes += $tax; - $this->total_tax_map[] = ['name' => $this->invoice->tax_name1 . ' ' . $this->invoice->tax_rate1.'%', 'total' => $tax]; + $this->total_tax_map[] = ['name' => $this->invoice->tax_name1.' '.$this->invoice->tax_rate1.'%', 'total' => $tax]; } - if ($this->invoice->tax_rate2 > 0) { $tax = $this->calcInclusiveLineTax($this->invoice->tax_rate2, $amount); $this->total_taxes += $tax; - $this->total_tax_map[] = ['name' => $this->invoice->tax_name2. ' ' . $this->invoice->tax_rate2.'%', 'total' => $tax]; + $this->total_tax_map[] = ['name' => $this->invoice->tax_name2.' '.$this->invoice->tax_rate2.'%', 'total' => $tax]; } if ($this->invoice->tax_rate3 > 0) { $tax = $this->calcInclusiveLineTax($this->invoice->tax_rate3, $amount); $this->total_taxes += $tax; - $this->total_tax_map[] = ['name' => $this->invoice->tax_name3 . ' ' . $this->invoice->tax_rate3.'%', 'total' => $tax]; + $this->total_tax_map[] = ['name' => $this->invoice->tax_name3.' '.$this->invoice->tax_rate3.'%', 'total' => $tax]; } return $this; @@ -162,7 +160,7 @@ class InvoiceSumInclusive private function calculatePartial() { - if (!isset($this->invoice->id) && isset($this->invoice->partial)) { + if (! isset($this->invoice->id) && isset($this->invoice->partial)) { $this->invoice->partial = max(0, min($this->formatValue($this->invoice->partial, 2), $this->invoice->balance)); } @@ -181,7 +179,7 @@ class InvoiceSumInclusive //Build invoice values here and return Invoice $this->setCalculatedAttributes(); $this->invoice->save(); - + return $this->invoice; } @@ -190,7 +188,7 @@ class InvoiceSumInclusive //Build invoice values here and return Invoice $this->setCalculatedAttributes(); $this->invoice->save(); - + return $this->invoice; } @@ -199,11 +197,10 @@ class InvoiceSumInclusive //Build invoice values here and return Invoice $this->setCalculatedAttributes(); $this->invoice->save(); - + return $this->invoice; } - /** * Build $this->invoice variables after * calculations have been performed. @@ -235,6 +232,7 @@ class InvoiceSumInclusive public function setSubTotal($value) { $this->sub_total = $value; + return $this; } diff --git a/app/Helpers/Invoice/Taxer.php b/app/Helpers/Invoice/Taxer.php index 68c46fd4da6c..fea6b4636638 100644 --- a/app/Helpers/Invoice/Taxer.php +++ b/app/Helpers/Invoice/Taxer.php @@ -1,6 +1,6 @@ formatValue(($amount * $tax_rate/100), 2); + return $this->formatValue(($amount * $tax_rate / 100), 2); } public function calcInclusiveLineTax($tax_rate, $amount) { - return $this->formatValue($amount - ($amount / (1 + ($tax_rate/100))), 2); + return $this->formatValue($amount - ($amount / (1 + ($tax_rate / 100))), 2); } } diff --git a/app/Helpers/Language/NinjaTranslator.php b/app/Helpers/Language/NinjaTranslator.php index 0387a31b1f62..992156e2551b 100644 --- a/app/Helpers/Language/NinjaTranslator.php +++ b/app/Helpers/Language/NinjaTranslator.php @@ -19,8 +19,9 @@ class NinjaTranslator extends Translator { list($namespace, $group, $item) = $this->parseKey($key); - if(null === $locale) + if (null === $locale) { $locale = $this->locale; + } // Load given group defaults if exists $this->load($namespace, $group, $locale); @@ -30,19 +31,16 @@ class NinjaTranslator extends Translator public function replace($items, $locale = null) { - - if(null === $locale) + if (null === $locale) { $locale = $this->locale; - - foreach($items as $key => $value) - { - - list($namespace, $group, $item) = $this->parseKey($key); - - $this->load($namespace, $group, $locale); - - Arr::set($this->loaded[$namespace][$group][$locale], $item, $value); } + foreach ($items as $key => $value) { + list($namespace, $group, $item) = $this->parseKey($key); + + $this->load($namespace, $group, $locale); + + Arr::set($this->loaded[$namespace][$group][$locale], $item, $value); + } } -} \ No newline at end of file +} diff --git a/app/Helpers/Mail/GmailTransport.php b/app/Helpers/Mail/GmailTransport.php index c39723124bbc..cd0347c56514 100644 --- a/app/Helpers/Mail/GmailTransport.php +++ b/app/Helpers/Mail/GmailTransport.php @@ -1,6 +1,6 @@ token = $token; } - public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) { /*We should nest the token in the message and then discard it as needed*/ - + $this->beforeSendPerformed($message); $this->gmail->using($this->token); @@ -62,14 +62,14 @@ class GmailTransport extends Transport $this->gmail->cc($message->getCc()); $this->gmail->bcc($message->getBcc()); -\Log::error(print_r($message->getChildren(),1)); + \Log::error(print_r($message->getChildren(), 1)); - foreach($message->getChildren() as $child) - $this->gmail->attach($child); //todo this should 'just work' + foreach ($message->getChildren() as $child) { + $this->gmail->attach($child); + } //todo this should 'just work' $this->gmail->send(); - $this->sendPerformed($message); return $this->numberOfRecipients($message); diff --git a/app/Helpers/Mail/GmailTransportConfig.php b/app/Helpers/Mail/GmailTransportConfig.php index 759b040e7c38..450b462c5543 100644 --- a/app/Helpers/Mail/GmailTransportConfig.php +++ b/app/Helpers/Mail/GmailTransportConfig.php @@ -1,6 +1,6 @@ oauth_user_token); (new MailServiceProvider(app()))->register(); - Mail::to('david@romulus.com.au') ->send(new SupportMessageSent('a cool message')); } diff --git a/app/Helpers/TranslationHelper.php b/app/Helpers/TranslationHelper.php index ff9e2afddffa..8b8691a3dda9 100644 --- a/app/Helpers/TranslationHelper.php +++ b/app/Helpers/TranslationHelper.php @@ -1,6 +1,6 @@ all()); - - if (!($account instanceof Account)) { + + if (! ($account instanceof Account)) { return $account; } diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 90634f50dd9b..369076ef0bbd 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -1,6 +1,6 @@ backup; - if(!$backup || !$backup->html_backup) + if (! $backup || ! $backup->html_backup) { return response()->json(['message'=> 'No backup exists for this activity', 'errors' => new \stdClass], 404); + } $pdf = $this->makePdf(null, null, $backup->html_backup); - if(isset($activity->invoice_id)) - $filename = $activity->invoice->number . ".pdf"; - elseif(isset($activity->quote_id)) - $filename = $activity->quote->number . ".pdf"; - elseif(isset($activity->credit_id)) - $filename = $activity->credit->number . ".pdf"; - else - $filename = "backup.pdf"; + if (isset($activity->invoice_id)) { + $filename = $activity->invoice->number.'.pdf'; + } elseif (isset($activity->quote_id)) { + $filename = $activity->quote->number.'.pdf'; + } elseif (isset($activity->credit_id)) { + $filename = $activity->credit->number.'.pdf'; + } else { + $filename = 'backup.pdf'; + } - return response()->streamDownload(function () use($pdf) { + return response()->streamDownload(function () use ($pdf) { echo $pdf; }, $filename); } - } diff --git a/app/Http/Controllers/Auth/ContactForgotPasswordController.php b/app/Http/Controllers/Auth/ContactForgotPasswordController.php index 7ab781ca661d..c2ced92394cd 100644 --- a/app/Http/Controllers/Auth/ContactForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ContactForgotPasswordController.php @@ -1,6 +1,6 @@ render('auth.passwords.request', [ 'title' => 'Client Password Reset', - 'passwordEmailRoute' => 'client.password.email' + 'passwordEmailRoute' => 'client.password.email', ]); } diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index 41643128b433..8168052aab85 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -1,6 +1,6 @@ render('auth.login'); } - public function login(Request $request) { Auth::shouldUse('contact'); @@ -48,6 +47,7 @@ class ContactLoginController extends Controller if (method_exists($this, 'hasTooManyLoginAttempts') && $this->hasTooManyLoginAttempts($request)) { $this->fireLockoutEvent($request); + return $this->sendLockoutResponse($request); } if ($this->attemptLogin($request)) { @@ -57,6 +57,7 @@ class ContactLoginController extends Controller // to login and redirect the user back to the login form. Of course, when this // user surpasses their maximum number of attempts they will get locked out. $this->incrementLoginAttempts($request); + return $this->sendFailedLoginResponse($request); } diff --git a/app/Http/Controllers/Auth/ContactRegisterController.php b/app/Http/Controllers/Auth/ContactRegisterController.php index 0ead02cb4b7f..750d0d12b458 100644 --- a/app/Http/Controllers/Auth/ContactRegisterController.php +++ b/app/Http/Controllers/Auth/ContactRegisterController.php @@ -56,7 +56,7 @@ class ContactRegisterController extends Controller $client_contact->client_id = $client->id; $client_contact->is_primary = true; $client_contact->password = Hash::make($data['password']); - + $client_contact->save(); return $client_contact; diff --git a/app/Http/Controllers/Auth/ContactResetPasswordController.php b/app/Http/Controllers/Auth/ContactResetPasswordController.php index 4ac6eeae6728..d16c1123ab40 100644 --- a/app/Http/Controllers/Auth/ContactResetPasswordController.php +++ b/app/Http/Controllers/Auth/ContactResetPasswordController.php @@ -1,6 +1,6 @@ setCurrentCompanyId($user->companies()->first()->account->default_company_id); } - /** - * Login via API + * Login via API. * * @param \Illuminate\Http\Request $request The request * @@ -154,9 +153,7 @@ class LoginController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ - public function apiLogin(Request $request) { $this->forced_includes = ['company_users']; @@ -173,20 +170,18 @@ class LoginController extends BaseController } if ($this->attemptLogin($request)) { - LightLogs::create(new LoginSuccess()) ->increment() ->batch(); $user = $this->guard()->user(); - + $user->setCompany($user->company_user->account->default_company); $ct = CompanyUser::whereUserId($user->id); return $this->listResponse($ct); } else { - LightLogs::create(new LoginFailure()) ->increment() ->batch(); @@ -201,7 +196,7 @@ class LoginController extends BaseController } /** - * Refreshes the data feed with the current Company User + * Refreshes the data feed with the current Company User. * * @return CompanyUser Refresh Feed. * @@ -238,15 +233,14 @@ class LoginController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function refresh(Request $request) { - $company_token = CompanyToken::whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])->first(); + $company_token = CompanyToken::whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')])->first(); $cu = CompanyUser::query() ->where('user_id', $company_token->user_id); - //->where('company_id', $company_token->company_id); + //->where('company_id', $company_token->company_id); //$ct = CompanyUser::whereUserId(auth()->user()->id); return $this->refreshResponse($cu); @@ -266,9 +260,9 @@ class LoginController extends BaseController */ public function oauthApiLogin() { - - if(request()->input('provider') == 'google') + if (request()->input('provider') == 'google') { return $this->handleGoogleOauth(); + } return response() ->json(['message' => 'Provider not supported'], 400) @@ -284,42 +278,37 @@ class LoginController extends BaseController $user = $google->getTokenResponse(request()->input('id_token')); - if(is_array($user)) - { + if (is_array($user)) { $query = [ 'oauth_user_id' => $google->harvestSubField($user), - 'oauth_provider_id'=> 'google' + 'oauth_provider_id'=> 'google', ]; - if ($existing_user = MultiDB::hasUser($query)) - { - + if ($existing_user = MultiDB::hasUser($query)) { Auth::login($existing_user, true); $existing_user->setCompany($existing_user->account->default_company); $ct = CompanyUser::whereUserId(auth()->user()->id); - return $this->listResponse($ct); + return $this->listResponse($ct); + } + } + + if ($user) { + $client = new \Google_Client(); + $client->setClientId(config('ninja.auth.google.client_id')); + $client->setClientSecret(config('ninja.auth.google.client_secret')); + + $token = $client->authenticate(request()->input('server_auth_code')); + + $refresh_token = ''; + + if (array_key_exists('refresh_token', $token)) { + $refresh_token = $token['refresh_token']; } - - } - - if($user){ - - $client = new \Google_Client(); - $client->setClientId(config('ninja.auth.google.client_id')); - $client->setClientSecret(config('ninja.auth.google.client_secret')); - - $token = $client->authenticate(request()->input('server_auth_code')); - - $refresh_token = ''; - - if(array_key_exists('refresh_token', $token)) - $refresh_token = $token['refresh_token']; - //$access_token = $token['access_token']; - + $name = OAuth::splitName($google->harvestName($user)); $new_account = [ @@ -330,11 +319,11 @@ class LoginController extends BaseController 'oauth_user_id' => $google->harvestSubField($user), 'oauth_user_token' => $token, 'oauth_user_refresh_token' => $refresh_token, - 'oauth_provider_id' => 'google' + 'oauth_provider_id' => 'google', ]; MultiDB::setDefaultDatabase(); - + $account = CreateAccount::dispatchNow($new_account); Auth::login($account->default_company->owner(), true); @@ -343,16 +332,13 @@ class LoginController extends BaseController auth()->user()->save(); $ct = CompanyUser::whereUserId(auth()->user()->id); + return $this->listResponse($ct); } - return response() ->json(['message' => ctrans('texts.invalid_credentials')], 401) ->header('X-App-Version', config('ninja.app_version')) ->header('X-Api-Version', config('ninja.minimum_client_version')); - - } - } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index db715d45cee1..2c97cddfa54e 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -1,6 +1,6 @@ has('first_load') && request()->input('first_load') == 'true') { - $include = implode(",", array_merge($this->forced_includes, $this->getRequestIncludes([]))); + $include = implode(',', array_merge($this->forced_includes, $this->getRequestIncludes([]))); } elseif (request()->input('include') !== null) { - $include = array_merge($this->forced_includes, explode(",", request()->input('include'))); + $include = array_merge($this->forced_includes, explode(',', request()->input('include'))); - $include = implode(",", $include); + $include = implode(',', $include); } elseif (count($this->forced_includes) >= 1) { - $include = implode(",", $this->forced_includes); + $include = implode(',', $this->forced_includes); } $this->manager->parseIncludes($include); - + $this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY; if ($this->serializer === EntityTransformer::API_SERIALIZER_JSON) { @@ -137,7 +137,7 @@ class BaseController extends Controller /** * Catch all fallback route - * for non-existant route + * for non-existant route. */ public function notFound() { @@ -147,7 +147,7 @@ class BaseController extends Controller } /** - * 404 for the client portal + * 404 for the client portal. * @return Response 404 response */ public function notFoundClient() @@ -156,9 +156,9 @@ class BaseController extends Controller } /** - * API Error response + * API Error response. * @param string $message The return error message - * @param integer $httpErrorCode 404/401/403 etc + * @param int $httpErrorCode 404/401/403 etc * @return Response The JSON response */ protected function errorResponse($message, $httpErrorCode = 400) @@ -174,7 +174,6 @@ class BaseController extends Controller protected function refreshResponse($query) { - $this->manager->parseIncludes($this->first_load); $this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY; @@ -188,65 +187,65 @@ class BaseController extends Controller $transformer = new $this->entity_transformer($this->serializer); $updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0; - if(auth()->user()->getCompany()->is_large && !request()->has('updated_at')) - return response()->json(['message' => 'Cannot load a large account without a updated_at parameter','errors' =>[]],401); + if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) { + return response()->json(['message' => 'Cannot load a large account without a updated_at parameter', 'errors' =>[]], 401); + } $updated_at = date('Y-m-d H:i:s', $updated_at); $query->with( [ - 'company' => function ($query) use($updated_at){ - $query->whereNotNull('updated_at'); + 'company' => function ($query) use ($updated_at) { + $query->whereNotNull('updated_at'); }, - 'company.clients' => function ($query) use($updated_at){ - $query->where('clients.updated_at', '>=', $updated_at)->with('contacts'); + 'company.clients' => function ($query) use ($updated_at) { + $query->where('clients.updated_at', '>=', $updated_at)->with('contacts'); }, - 'company.tax_rates' => function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.tax_rates' => function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.groups' => function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.groups' => function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.company_gateways' => function ($query){ - $query->whereNotNull('updated_at'); + 'company.company_gateways' => function ($query) { + $query->whereNotNull('updated_at'); }, - 'company.products' => function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.products' => function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.invoices'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at)->with('invitations','company','documents'); + 'company.invoices'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at)->with('invitations', 'company', 'documents'); }, - 'company.payments'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at)->with('paymentables'); + 'company.payments'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at)->with('paymentables'); }, - 'company.quotes'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at)->with('invitations','documents'); + 'company.quotes'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents'); }, - 'company.credits'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at)->with('invitations','documents'); + 'company.credits'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents'); }, - 'company.payment_terms'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.payment_terms'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.vendors'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at)->with('contacts'); + 'company.vendors'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at)->with('contacts'); }, - 'company.expenses'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.expenses'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.tasks'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.tasks'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.projects'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.projects'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, - 'company.designs'=> function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at); + 'company.designs'=> function ($query) use ($updated_at) { + $query->where('updated_at', '>=', $updated_at); }, ] ); - if (is_a($query, "Illuminate\Database\Eloquent\Builder")) { $limit = Input::get('per_page', 20); @@ -259,8 +258,6 @@ class BaseController extends Controller } return $this->response($this->manager->createData($resource)->toArray()); - - } protected function listResponse($query) @@ -275,7 +272,7 @@ class BaseController extends Controller $query->with($includes); - if (auth()->user() && !auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) { + if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) { $query->where('user_id', '=', auth()->user()->id); } @@ -296,7 +293,6 @@ class BaseController extends Controller if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) { $entity_type = null; } - if (is_a($query, "Illuminate\Database\Eloquent\Builder")) { $limit = Input::get('per_page', 20); @@ -333,13 +329,13 @@ class BaseController extends Controller $response['static'] = Statics::company(auth()->user()->getCompany()->getLocale()); } } - + ksort($response); $response = json_encode($response, JSON_PRETTY_PRINT); $headers = self::getApiHeaders(); - + return response()->make($response, 200, $headers); } @@ -354,7 +350,7 @@ class BaseController extends Controller if (auth()->user() && request()->include_static) { $data['static'] = Statics::company(auth()->user()->getCompany()->getLocale()); } - + return $this->response($data); } @@ -363,7 +359,7 @@ class BaseController extends Controller if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) { $entity_type = null; } - + $resource = new Item($data, $transformer, $entity_type); return $this->manager->createData($resource)->toArray(); @@ -378,11 +374,10 @@ class BaseController extends Controller ]; } - protected function getRequestIncludes($data) { - /** + /* * Thresholds for displaying large account on first load */ if (request()->has('first_load') && request()->input('first_load') == 'true') { @@ -406,15 +401,13 @@ class BaseController extends Controller return $data; } - + public function flutterRoute() { - - if ((bool)$this->checkAppSetup() !== false && Schema::hasTable('accounts') && $account = Account::first()) { - - if (config('ninja.require_https') && !request()->isSecure()) { - return redirect()->secure(request()->getRequestUri()); - } + if ((bool) $this->checkAppSetup() !== false && Schema::hasTable('accounts') && $account = Account::first()) { + if (config('ninja.require_https') && ! request()->isSecure()) { + return redirect()->secure(request()->getRequestUri()); + } $data = []; diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 0a17a3c0a147..f98bd6240955 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -1,6 +1,6 @@ input('action'); - + $ids = request()->input('ids'); $clients = Client::withTrashed()->find($this->transformKeys($ids)); - + $clients->each(function ($client, $key) use ($action) { if (auth()->user()->can('edit', $client)) { $this->client_repo->{$action}($client); } }); - + return $this->listResponse(Client::withTrashed()->whereIn('id', $this->transformKeys($ids))); } /** - * Returns a client statement + * Returns a client statement. * * @return [type] [description] */ diff --git a/app/Http/Controllers/ClientPortal/DashboardController.php b/app/Http/Controllers/ClientPortal/DashboardController.php index 1d2b4f04c987..8976af431fcb 100644 --- a/app/Http/Controllers/ClientPortal/DashboardController.php +++ b/app/Http/Controllers/ClientPortal/DashboardController.php @@ -1,6 +1,6 @@ user(); - - Storage::makeDirectory('public/' . $contact->client->client_hash, 0775); - $path = Storage::putFile('public/' . $contact->client->client_hash, $request->file('file')); + Storage::makeDirectory('public/'.$contact->client->client_hash, 0775); + + $path = Storage::putFile('public/'.$contact->client->client_hash, $request->file('file')); $contact = auth()->user(); $contact->avatar_size = $request->file('file')->getSize(); $contact->avatar_type = $request->file('file')->getClientOriginalExtension(); $contact->avatar = Storage::url($path); $contact->save(); - - return response()->json($contact); + return response()->json($contact); /* [2019-08-07 05:50:23] local.ERROR: array ( @@ -123,10 +121,10 @@ class DocumentController extends Controller $contact = auth()->user(); $file = basename($contact->avatar); - $image_path = 'public/' . $contact->client->client_hash . '/' . $file; + $image_path = 'public/'.$contact->client->client_hash.'/'.$file; Storage::delete($image_path); - + $contact->avatar = ''; $contact->avatar_type = ''; $contact->avatar_size = ''; diff --git a/app/Http/Controllers/ClientPortal/DownloadController.php b/app/Http/Controllers/ClientPortal/DownloadController.php index b338e6436b63..01ec13c1712c 100644 --- a/app/Http/Controllers/ClientPortal/DownloadController.php +++ b/app/Http/Controllers/ClientPortal/DownloadController.php @@ -1,7 +1,7 @@ entity_types)) { + if (! in_array($entity_type, $this->entity_types)) { abort(404); } $invitation_entity = sprintf('App\\Models\\%sInvitation', ucfirst($entity_type)); - $key = $entity_type . '_id'; + $key = $entity_type.'_id'; - $invitation = $invitation_entity::whereRaw("BINARY `key`= ?", [$invitation_key])->firstOrFail(); + $invitation = $invitation_entity::whereRaw('BINARY `key`= ?', [$invitation_key])->firstOrFail(); $contact = $invitation->contact; @@ -48,7 +48,7 @@ class EntityViewController extends Controller session()->flash("{$entity_type}_VIEW_{$entity->hashed_id}", true); } - if (!session("{$entity_type}_VIEW_{$entity->hashed_id}")) { + if (! session("{$entity_type}_VIEW_{$entity->hashed_id}")) { return redirect()->route('client.entity_view.password', compact('entity_type', 'invitation_key')); } @@ -84,15 +84,15 @@ class EntityViewController extends Controller */ public function handlePassword(string $entity_type, string $invitation_key) { - if (!in_array($entity_type, $this->entity_types)) { + if (! in_array($entity_type, $this->entity_types)) { abort(404); } $invitation_entity = sprintf('App\\Models\\%sInvitation', ucfirst($entity_type)); - $key = $entity_type . '_id'; + $key = $entity_type.'_id'; - $invitation = $invitation_entity::whereRaw("BINARY `key`= ?", [$invitation_key])->firstOrFail(); + $invitation = $invitation_entity::whereRaw('BINARY `key`= ?', [$invitation_key])->firstOrFail(); $contact = $invitation->contact; @@ -109,6 +109,7 @@ class EntityViewController extends Controller } session()->flash('PASSWORD_FAILED', true); + return back(); } } diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php index 8a25ccc32005..aba552eed1b0 100644 --- a/app/Http/Controllers/ClientPortal/InvitationController.php +++ b/app/Http/Controllers/ClientPortal/InvitationController.php @@ -1,6 +1,6 @@ first(); + $invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key])->first(); if ($invitation) { - - if ((bool)$invitation->contact->client->getSetting('enable_client_portal_password') !== false) { + if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) { $this->middleware('auth:contact'); } else { auth()->guard('contact')->login($invitation->contact, true); } - if (!request()->has('silent') && !$invitation->viewed_date) { + if (! request()->has('silent') && ! $invitation->viewed_date) { // if (!request()->has('silent')) { - + $invitation->markViewed(); event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars())); @@ -67,7 +64,6 @@ class InvitationController extends Controller private function fireEntityViewedEvent($invitation, $entity_string) { - switch ($entity_string) { case 'invoice': event(new InvoiceWasViewed($invitation, $invitation->company, Ninja::eventVars())); @@ -77,9 +73,9 @@ class InvitationController extends Controller break; case 'credit': event(new CreditWasViewed($invitation, $invitation->company, Ninja::eventVars())); - break; + break; default: - # code... + // code... break; } } diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index cc70d46692b1..3d3b51f9a194 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -1,6 +1,6 @@ render('invoices.index'); } - + /** * Show specific invoice. * @@ -70,15 +70,14 @@ class InvoiceController extends Controller $transformed_ids = $this->transformKeys($request->invoices); if ($request->input('action') == 'payment') { - return $this->makePayment((array)$transformed_ids); + return $this->makePayment((array) $transformed_ids); } elseif ($request->input('action') == 'download') { - return $this->downloadInvoicePDF((array)$transformed_ids); + return $this->downloadInvoicePDF((array) $transformed_ids); } return redirect()->back(); } - private function makePayment(array $ids) { $invoices = Invoice::whereIn('id', $ids) @@ -98,6 +97,7 @@ class InvoiceController extends Controller $invoices->map(function ($invoice) { $invoice->balance = Number::formatValue($invoice->balance, $invoice->client->currency()); $invoice->partial = Number::formatValue($invoice->partial, $invoice->client->currency()); + return $invoice; }); @@ -133,30 +133,30 @@ class InvoiceController extends Controller ->get(); //generate pdf's of invoices locally - if (!$invoices || $invoices->count() == 0) { + if (! $invoices || $invoices->count() == 0) { return back()->with(['message' => ctrans('texts.no_items_selected')]); } //if only 1 pdf, output to buffer for download if ($invoices->count() == 1) { - return response()->streamDownload(function () use($invoices) { + return response()->streamDownload(function () use ($invoices) { echo file_get_contents($invoices->first()->pdf_file_path()); }, basename($invoices->first()->pdf_file_path())); //return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($invoices->first()->pdf_file_path())); } - # enable output of HTTP headers + // enable output of HTTP headers $options = new Archive(); $options->setSendHttpHeaders(true); - # create a new zipstream object - $zip = new ZipStream(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoices')).".zip", $options); + // create a new zipstream object + $zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options); foreach ($invoices as $invoice) { $zip->addFileFromPath(basename($invoice->pdf_file_path()), TempFile::path($invoice->pdf_file_path())); } - # finish the zip stream + // finish the zip stream $zip->finish(); } } diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 03d59ebe1c22..9a2815e52304 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -1,7 +1,7 @@ isPayable(); }); - /*return early if no invoices*/ if ($invoices->count() == 0) { return redirect() @@ -101,29 +98,27 @@ class PaymentController extends Controller } /*iterate through invoices and add gateway fees and other payment metadata*/ - - foreach($payable_invoices as $key => $payable_invoice) - { + foreach ($payable_invoices as $key => $payable_invoice) { $payable_invoices[$key]['amount'] = Number::parseFloat($payable_invoice['amount']); $payable_invoice['amount'] = $payable_invoices[$key]['amount']; - $invoice = $invoices->first(function ($inv) use($payable_invoice) { - return $payable_invoice['invoice_id'] == $inv->hashed_id; - }); - + $invoice = $invoices->first(function ($inv) use ($payable_invoice) { + return $payable_invoice['invoice_id'] == $inv->hashed_id; + }); + $payable_invoices[$key]['due_date'] = $this->formatDate($invoice->due_date, $invoice->client->date_format()); $payable_invoices[$key]['invoice_number'] = $invoice->number; - if(isset($invoice->po_number)) + if (isset($invoice->po_number)) { $additional_info = $invoice->po_number; - elseif(isset($invoice->public_notes)) + } elseif (isset($invoice->public_notes)) { $additional_info = $invoice->public_notes; - else + } else { $additional_info = $invoice->date; + } $payable_invoices[$key]['additional_info'] = $additional_info; - } if ((bool) request()->signature) { @@ -135,17 +130,16 @@ class PaymentController extends Controller $payment_methods = auth()->user()->client->getPaymentMethods(array_sum(array_column($payable_invoices, 'amount_with_fee'))); $payment_method_id = request()->input('payment_method_id'); - $invoice_totals = array_sum(array_column($payable_invoices,'amount')); + $invoice_totals = array_sum(array_column($payable_invoices, 'amount')); $first_invoice = $invoices->first(); $fee_totals = round($gateway->calcGatewayFee($invoice_totals, true), $first_invoice->client->currency()->precision); - if(!$first_invoice->uses_inclusive_taxes) { - + if (! $first_invoice->uses_inclusive_taxes) { $fee_tax = 0; - $fee_tax += round(($first_invoice->tax_rate1/100)*$fee_totals, $first_invoice->client->currency()->precision); - $fee_tax += round(($first_invoice->tax_rate2/100)*$fee_totals, $first_invoice->client->currency()->precision); - $fee_tax += round(($first_invoice->tax_rate3/100)*$fee_totals, $first_invoice->client->currency()->precision); + $fee_tax += round(($first_invoice->tax_rate1 / 100) * $fee_totals, $first_invoice->client->currency()->precision); + $fee_tax += round(($first_invoice->tax_rate2 / 100) * $fee_totals, $first_invoice->client->currency()->precision); + $fee_tax += round(($first_invoice->tax_rate3 / 100) * $fee_totals, $first_invoice->client->currency()->precision); $fee_totals += $fee_tax; } @@ -188,18 +182,18 @@ class PaymentController extends Controller //REFACTOR - Entry point for the gateway response - we don't need to do anything at this point. // // - Inside each gateway driver, we should use have a generic code path (in BaseDriver.php)for successful/failed payment - // + // // Success workflow - // + // // - Rehydrate the hash and iterate through the invoices and update the balances // - Update the type_id of the gateway fee to type_id 4 // - Link invoices to payment - // + // // Failure workflow - // + // // - Rehydrate hash, iterate through invoices and remove type_id 3's // - Recalcuate invoice totals - + return $gateway ->driver(auth()->user()->client) ->setPaymentMethod($request->input('payment_method_id')) diff --git a/app/Http/Controllers/ClientPortal/PaymentHookController.php b/app/Http/Controllers/ClientPortal/PaymentHookController.php index 18f4f49d4a88..59a70bc18d6b 100644 --- a/app/Http/Controllers/ClientPortal/PaymentHookController.php +++ b/app/Http/Controllers/ClientPortal/PaymentHookController.php @@ -1,6 +1,6 @@ delete(); } catch (\Exception $e) { Log::error(json_encode($e)); + return back(); } diff --git a/app/Http/Controllers/ClientPortal/ProfileController.php b/app/Http/Controllers/ClientPortal/ProfileController.php index f33f6a96717c..1ea7caeec6f5 100644 --- a/app/Http/Controllers/ClientPortal/ProfileController.php +++ b/app/Http/Controllers/ClientPortal/ProfileController.php @@ -1,6 +1,6 @@ render('quotes.index'); } - /** * Display the specified resource. * @@ -54,11 +53,11 @@ class QuoteController extends Controller $transformed_ids = $this->transformKeys($request->quotes); if ($request->action == 'download') { - return $this->downloadQuotePdf((array)$transformed_ids); + return $this->downloadQuotePdf((array) $transformed_ids); } if ($request->action = 'approve') { - return $this->approve((array)$transformed_ids, $request->has('process')); + return $this->approve((array) $transformed_ids, $request->has('process')); } return back(); @@ -70,29 +69,29 @@ class QuoteController extends Controller ->whereClientId(auth()->user()->client->id) ->get(); - if (!$quotes || $quotes->count() == 0) { + if (! $quotes || $quotes->count() == 0) { return; } if ($quotes->count() == 1) { - return response()->streamDownload(function () use($invoices) { + return response()->streamDownload(function () use ($invoices) { echo file_get_contents($invoices->first()->pdf_file_path()); }, basename($invoices->first()->pdf_file_path())); //return response()->download(TempFile::path($invoices->first()->pdf_file_path()), basename($quotes->first()->pdf_file_path())); } - # enable output of HTTP headers + // enable output of HTTP headers $options = new Archive(); $options->setSendHttpHeaders(true); - # create a new zipstream object - $zip = new ZipStream(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoices')) . ".zip", $options); + // create a new zipstream object + $zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options); foreach ($quotes as $quote) { $zip->addFileFromPath(basename($quote->pdf_file_path()), TempFile::path($quote->pdf_file_path())); } - # finish the zip stream + // finish the zip stream $zip->finish(); } @@ -102,7 +101,7 @@ class QuoteController extends Controller ->whereClientId(auth()->user()->client->id) ->get(); - if (!$quotes || $quotes->count() == 0) { + if (! $quotes || $quotes->count() == 0) { return redirect()->route('client.quotes.index'); } diff --git a/app/Http/Controllers/ClientPortal/RecurringInvoiceController.php b/app/Http/Controllers/ClientPortal/RecurringInvoiceController.php index dc98faf11244..43336a80ba94 100644 --- a/app/Http/Controllers/ClientPortal/RecurringInvoiceController.php +++ b/app/Http/Controllers/ClientPortal/RecurringInvoiceController.php @@ -1,6 +1,6 @@ user()->email) ->where('id', $this->transformKeys($contact)) ->first(); diff --git a/app/Http/Controllers/ClientPortal/UploadController.php b/app/Http/Controllers/ClientPortal/UploadController.php index e736b7a03d98..dc6d60031b12 100644 --- a/app/Http/Controllers/ClientPortal/UploadController.php +++ b/app/Http/Controllers/ClientPortal/UploadController.php @@ -1,7 +1,7 @@ user()->company()->account->id); - + return $this->itemResponse($company); } @@ -198,7 +195,6 @@ class CompanyController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreCompanyRequest $request) { @@ -207,7 +203,7 @@ class CompanyController extends BaseController $company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account); CreateCompanyPaymentTerms::dispatchNow($company, auth()->user()); - + $company = $this->company_repo->save($request->all(), $company); $this->uploadLogo($request->file('company_logo'), $company, $company); @@ -237,9 +233,9 @@ class CompanyController extends BaseController $this->entity_transformer = CompanyUserTransformer::class; $this->entity_type = CompanyUser::class; - + $ct = CompanyUser::whereUserId(auth()->user()->id)->whereCompanyId($company->id); - + return $this->listResponse($ct); } @@ -291,7 +287,6 @@ class CompanyController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowCompanyRequest $request, Company $company) { @@ -346,7 +341,6 @@ class CompanyController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditCompanyRequest $request, Company $company) { @@ -402,7 +396,6 @@ class CompanyController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateCompanyRequest $request, Company $company) { @@ -462,33 +455,28 @@ class CompanyController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyCompanyRequest $request, Company $company) { - $company_count = $company->account->companies->count(); $account = $company->account; - + if ($company_count == 1) { - $company->company_users->each(function ($company_user) { $company_user->user->forceDelete(); }); - if(Ninja::isHosted()) + if (Ninja::isHosted()) { RefundCancelledAccount::dispatchNow($account); + } $account->delete(); - } else { - $company_id = $company->id; $company->delete(); //If we are deleting the default companies, we'll need to make a new company the default. if ($account->default_company_id == $company_id) { - $new_default_company = Company::whereAccountId($account->id)->first(); $account->default_company_id = $new_default_company->id; $account->save(); @@ -497,5 +485,4 @@ class CompanyController extends BaseController return response()->json(['message' => 'success'], 200); } - } diff --git a/app/Http/Controllers/CompanyGatewayController.php b/app/Http/Controllers/CompanyGatewayController.php index 58a4d5bd33c7..79568d73eb67 100644 --- a/app/Http/Controllers/CompanyGatewayController.php +++ b/app/Http/Controllers/CompanyGatewayController.php @@ -1,6 +1,6 @@ user()->company()->id, auth()->user()->id); - + return $this->itemResponse($company_gateway); } @@ -184,7 +181,6 @@ class CompanyGatewayController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreCompanyGatewayRequest $request) { @@ -243,7 +239,6 @@ class CompanyGatewayController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowCompanyGatewayRequest $request, CompanyGateway $company_gateway) { @@ -298,7 +293,6 @@ class CompanyGatewayController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditCompanyGatewayRequest $request, CompanyGateway $company_gateway) { @@ -354,13 +348,12 @@ class CompanyGatewayController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateCompanyGatewayRequest $request, CompanyGateway $company_gateway) { $company_gateway->fill($request->all()); - if (!$request->has('fees_and_limits')) { + if (! $request->has('fees_and_limits')) { $company_gateway->fees_and_limits = ''; } @@ -416,7 +409,6 @@ class CompanyGatewayController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyCompanyGatewayRequest $request, CompanyGateway $company_gateway) { @@ -425,8 +417,8 @@ class CompanyGatewayController extends BaseController return response()->json([], 200); } - /** - * Perform bulk actions on the list view + /** + * Perform bulk actions on the list view. * * @param BulkCompanyGatewayRequest $request * @return \Illuminate\Http\Response @@ -480,17 +472,17 @@ class CompanyGatewayController extends BaseController public function bulk() { $action = request()->input('action'); - + $ids = request()->input('ids'); - + $company_gateways = CompanyGateway::withTrashed()->find($this->transformKeys($ids)); - + $company_gateways->each(function ($company_gateway, $key) use ($action) { if (auth()->user()->can('edit', $company_gateway)) { $this->company_repo->{$action}($company_gateway); } }); - + return $this->listResponse(CompanyGateway::withTrashed()->whereIn('id', $this->transformKeys($ids))); } } diff --git a/app/Http/Controllers/CompanyLedgerController.php b/app/Http/Controllers/CompanyLedgerController.php index faecd4d0fc48..a7ffb9de58cd 100644 --- a/app/Http/Controllers/CompanyLedgerController.php +++ b/app/Http/Controllers/CompanyLedgerController.php @@ -1,6 +1,6 @@ user()->company(); - + $company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first(); - if (!$company_user) { - throw new ModelNotFoundException("Company User record not found"); + if (! $company_user) { + throw new ModelNotFoundException('Company User record not found'); + return; } @@ -126,11 +124,10 @@ class CompanyUserController extends BaseController $company_user->fill($request->input('company_user')['settings']); $company_user->fill($request->input('company_user')['notifications']); } - + $company_user->save(); return $this->itemResponse($company_user->fresh()); - } /** diff --git a/app/Http/Controllers/Contact/InvoiceController.php b/app/Http/Controllers/Contact/InvoiceController.php index b034f85d9880..fc69dd1e51af 100644 --- a/app/Http/Controllers/Contact/InvoiceController.php +++ b/app/Http/Controllers/Contact/InvoiceController.php @@ -1,6 +1,6 @@ listResponse($invoices); } } diff --git a/app/Http/Controllers/Contact/LoginController.php b/app/Http/Controllers/Contact/LoginController.php index 792b5119168d..3525f83bd43d 100644 --- a/app/Http/Controllers/Contact/LoginController.php +++ b/app/Http/Controllers/Contact/LoginController.php @@ -1,6 +1,6 @@ has('code')) { return $this->handleProviderCallbackAndCreate($provider); @@ -113,7 +112,6 @@ class LoginController extends BaseController } } - /* public function handleProviderCallbackAndCreate(string $provider) { @@ -157,9 +155,9 @@ class LoginController extends BaseController } */ - + /** - * We use this function when OAUTHING via the web interface + * We use this function when OAUTHING via the web interface. * * @return redirect @@ -204,7 +202,8 @@ class LoginController extends BaseController } } - */ + */ + /** * A client side authentication has taken place. * We now digest the token and confirm authentication with @@ -232,8 +231,7 @@ class LoginController extends BaseController } } - - /** + /* * Received the returning object from the provider * which we will use to resolve the user, we return the response in JSON format * diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 2d5031252030..ef8dc54d57d1 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,6 +1,6 @@ listResponse($credits); } @@ -135,7 +131,6 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateCreditRequest $request) { @@ -182,7 +177,6 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreCreditRequest $request) { @@ -247,7 +241,6 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowCreditRequest $request, Credit $credit) { @@ -303,7 +296,6 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditCreditRequest $request, Credit $credit) { @@ -360,7 +352,6 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateCreditRequest $request, Credit $credit) { @@ -423,7 +414,6 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyCreditRequest $request, Credit $credit) { @@ -433,7 +423,7 @@ class CreditController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -481,17 +471,16 @@ class CreditController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { $action = request()->input('action'); - + $ids = request()->input('ids'); $credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids)); - if (!$credits) { + if (! $credits) { return response()->json(['message' => 'No Credits Found']); } @@ -515,48 +504,49 @@ class CreditController extends BaseController switch ($action) { case 'clone_to_credit': $credit = CloneCreditFactory::create($credit, auth()->user()->id); + return $this->itemResponse($credit); break; case 'history': - # code... + // code... break; case 'mark_sent': $credit->service()->markSent()->save(); - if (!$bulk) { + if (! $bulk) { return $this->itemResponse($credit); } break; case 'download': - return response()->streamDownload(function () use($credit) { + return response()->streamDownload(function () use ($credit) { echo file_get_contents($credit->pdf_file_path()); }, basename($credit->pdf_file_path())); - //return response()->download(TempFile::path($credit->pdf_file_path()), basename($credit->pdf_file_path())); + //return response()->download(TempFile::path($credit->pdf_file_path()), basename($credit->pdf_file_path())); break; case 'archive': $this->credit_repository->archive($credit); - if (!$bulk) { + if (! $bulk) { return $this->listResponse($credit); } break; case 'restore': $this->credit_repository->restore($credit); - if (!$bulk) { + if (! $bulk) { return $this->listResponse($credit); } break; case 'delete': $this->credit_repository->delete($credit); - if (!$bulk) { + if (! $bulk) { return $this->listResponse($credit); } break; case 'email': EmailCredit::dispatch($credit, $credit->company); - if (!$bulk) { + if (! $bulk) { return response()->json(['message'=>'email sent'], 200); } break; @@ -570,11 +560,11 @@ class CreditController extends BaseController public function downloadPdf($invitation_key) { $invitation = $this->credit_repository->getInvitationByKey($invitation_key); - $contact = $invitation->contact; - $credit = $invitation->credit; + $contact = $invitation->contact; + $credit = $invitation->credit; $file_path = $credit->service()->getCreditPdf($contact); - + return response()->download($file_path); } } diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index ecb3acc5bf74..b45ae4a4a56c 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -1,6 +1,6 @@ input('action'); - + $ids = request()->input('ids'); $designs = Design::withTrashed()->find($this->transformKeys($ids)); - + $designs->each(function ($design, $key) use ($action) { if (auth()->user()->can('edit', $design)) { $this->design_repo->{$action}($design); } }); - + return $this->listResponse(Design::withTrashed()->whereIn('id', $this->transformKeys($ids))); } } diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index a1b3a832556d..337c0394f9ed 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -83,7 +83,7 @@ class DocumentController extends BaseController public function download(ShowDocumentRequest $request, Document $document) { - return response()->streamDownload(function () use($document) { + return response()->streamDownload(function () use ($document) { echo file_get_contents($document->generateUrl()); }, basename($document->generateUrl())); } @@ -119,7 +119,6 @@ class DocumentController extends BaseController */ public function destroy(DestroyDocumentRequest $request, Document $document) { - $this->document_repo->delete($document); return response()->json(['message'=>'success']); @@ -127,14 +126,13 @@ class DocumentController extends BaseController public function bulk() { - $action = request()->input('action'); $ids = request()->input('ids'); $documents = Document::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); - if (!$invoices) { + if (! $invoices) { return response()->json(['message' => 'No Documents Found']); } diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index 8bfa7ffef5c4..6f60ef64765e 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -1,6 +1,6 @@ invitations->each(function ($invitation) use ($subject, $body, $entity_string, $entity_obj) { - if ($invitation->contact->send_email && $invitation->contact->email) { - $when = now()->addSeconds(1); $invitation->contact->notify((new SendGenericNotification($invitation, $entity_string, $subject, $body))->delay($when)); - } - }); /*Only notify the admin ONCE, not once per contact/invite*/ $invitation = $entity_obj->invitations->first(); - EntitySentMailer::dispatch($invitation, $entity_string, $entity_obj->user, $invitation->company); + EntitySentMailer::dispatch($invitation, $entity_string, $entity_obj->user, $invitation->company); - if ($this instanceof Invoice) { - $this->entity_type = Invoice::class ; - $this->entity_transformer = InvoiceTransformer::class ; + $this->entity_type = Invoice::class; + $this->entity_transformer = InvoiceTransformer::class; } if ($this instanceof Quote) { - $this->entity_type = Quote::class ; - $this->entity_transformer = QuoteTransformer::class ; + $this->entity_type = Quote::class; + $this->entity_transformer = QuoteTransformer::class; } if ($this instanceof Credit) { - $this->entity_type = Credit::class ; - $this->entity_transformer = CreditTransformer::class ; + $this->entity_type = Credit::class; + $this->entity_transformer = CreditTransformer::class; } $entity_obj->service()->markSent()->save(); diff --git a/app/Http/Controllers/ExpenseController.php b/app/Http/Controllers/ExpenseController.php index 487b15fe86d5..09653dfb5bd0 100644 --- a/app/Http/Controllers/ExpenseController.php +++ b/app/Http/Controllers/ExpenseController.php @@ -1,6 +1,6 @@ input('action'); - + $ids = request()->input('ids'); $expenses = Expense::withTrashed()->find($this->transformKeys($ids)); - + $expenses->each(function ($expense, $key) use ($action) { if (auth()->user()->can('edit', $expense)) { $this->client_repo->{$action}($expense); } }); - + return $this->listResponse(Expense::withTrashed()->whereIn('id', $this->transformKeys($ids))); } /** - * Returns a client statement + * Returns a client statement. * * @return [type] [description] */ diff --git a/app/Http/Controllers/GroupSettingController.php b/app/Http/Controllers/GroupSettingController.php index a69fc61b2e9b..02adbd95b5af 100644 --- a/app/Http/Controllers/GroupSettingController.php +++ b/app/Http/Controllers/GroupSettingController.php @@ -1,6 +1,6 @@ user()->company()->id, auth()->user()->id); $group_setting = $this->group_setting_repo->save($request->all(), $group_setting); - + $this->uploadLogo($request->file('company_logo'), $group_setting->company, $group_setting); return $this->itemResponse($group_setting); @@ -240,7 +237,6 @@ class GroupSettingController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowGroupSettingRequest $request, GroupSetting $group_setting) { @@ -295,7 +291,6 @@ class GroupSettingController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditGroupSettingRequest $request, GroupSetting $group_setting) { @@ -351,12 +346,11 @@ class GroupSettingController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateGroupSettingRequest $request, GroupSetting $group_setting) { $group_setting = $this->group_setting_repo->save($request->all(), $group_setting); - + $this->uploadLogo($request->file('company_logo'), $group_setting->company, $group_setting); return $this->itemResponse($group_setting); @@ -409,7 +403,6 @@ class GroupSettingController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyGroupSettingRequest $request, GroupSetting $group_setting) { @@ -419,7 +412,7 @@ class GroupSettingController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -467,18 +460,16 @@ class GroupSettingController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { - $action = request()->input('action'); $ids = request()->input('ids'); $group_settings = GroupSetting::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); - if (!$group_settings) { + if (! $group_settings) { return response()->json(['message' => 'No Group Settings Found']); } diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 2e5aedba901a..97cdf2b47193 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -1,7 +1,7 @@ company, Ninja::eventVars())); $invoice = $invoice->service()->triggeredActions($request)->save(); - + return $this->itemResponse($invoice); } @@ -272,7 +267,6 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowInvoiceRequest $request, Invoice $invoice) { @@ -328,7 +322,6 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditInvoiceRequest $request, Invoice $invoice) { @@ -385,7 +378,6 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateInvoiceRequest $request, Invoice $invoice) { @@ -393,8 +385,9 @@ class InvoiceController extends BaseController return $request->disallowUpdate(); } - if($invoice->isLocked()) + if ($invoice->isLocked()) { return response()->json(['message' => 'Invoice is locked, no modifications allowed']); + } $invoice = $this->invoice_repo->save($request->all(), $invoice); @@ -451,7 +444,6 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyInvoiceRequest $request, Invoice $invoice) { @@ -461,7 +453,7 @@ class InvoiceController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -509,7 +501,6 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { @@ -523,7 +514,7 @@ class InvoiceController extends BaseController $invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); - if (!$invoices) { + if (! $invoices) { return response()->json(['message' => 'No Invoices Found']); } @@ -534,7 +525,7 @@ class InvoiceController extends BaseController if ($action == 'download' && $invoices->count() > 1) { $invoices->each(function ($invoice) { if (auth()->user()->cannot('view', $invoice)) { - return response()->json(['message' => 'Insufficient privileges to access invoice ' . $invoice->number]); + return response()->json(['message' => 'Insufficient privileges to access invoice '.$invoice->number]); } }); @@ -557,9 +548,7 @@ class InvoiceController extends BaseController return $this->listResponse(Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()); } - /** - * * @OA\Get( * path="/api/v1/invoices/{id}/{action}", * operationId="actionInvoice", @@ -623,7 +612,6 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function action(ActionInvoiceRequest $request, Invoice $invoice, $action) { @@ -636,6 +624,7 @@ class InvoiceController extends BaseController switch ($action) { case 'clone_to_invoice': $invoice = CloneInvoiceFactory::create($invoice, auth()->user()->id); + return $this->itemResponse($invoice); break; case 'clone_to_quote': @@ -643,10 +632,10 @@ class InvoiceController extends BaseController // todo build the quote transformer and return response here break; case 'history': - # code... + // code... break; case 'delivery_note': - # code... + // code... break; case 'mark_paid': if ($invoice->balance < 0 || $invoice->status_id == Invoice::STATUS_PAID || $invoice->is_deleted === true) { @@ -655,19 +644,19 @@ class InvoiceController extends BaseController $invoice = $invoice->service()->markPaid(); - if (!$bulk) { + if (! $bulk) { return $this->itemResponse($invoice); } break; case 'mark_sent': $invoice->service()->markSent()->save(); - if (!$bulk) { + if (! $bulk) { return $this->itemResponse($invoice); } break; case 'download': - return response()->streamDownload(function () use($invoice) { + return response()->streamDownload(function () use ($invoice) { echo file_get_contents($invoice->pdf_file_path()); }, basename($invoice->pdf_file_path())); //return response()->download(TempFile::path($invoice->pdf_file_path()), basename($invoice->pdf_file_path())); @@ -675,61 +664,60 @@ class InvoiceController extends BaseController case 'restore': $this->invoice_repo->restore($invoice); - if (!$bulk) { + if (! $bulk) { return $this->listResponse($invoice); } break; case 'archive': $this->invoice_repo->archive($invoice); - if (!$bulk) { + if (! $bulk) { return $this->listResponse($invoice); } break; case 'delete': //need to make sure the invoice is cancelled first!! $invoice->service()->handleCancellation()->save(); - + $this->invoice_repo->delete($invoice); - if (!$bulk) { + if (! $bulk) { return $this->listResponse($invoice); } break; case 'cancel': $invoice = $invoice->service()->handleCancellation()->save(); - if (!$bulk) { + if (! $bulk) { $this->itemResponse($invoice); } break; case 'reverse': $invoice = $invoice->service()->handleReversal()->save(); - if (!$bulk) { + if (! $bulk) { $this->itemResponse($invoice); } break; case 'email': //check query paramater for email_type and set the template else use calculateTemplate - if(request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) + if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) { $this->reminder_template = $invoice->client->getSetting(request()->input('email_type')); - else + } else { $this->reminder_template = $invoice->calculateTemplate(); + } //touch reminder1,2,3_sent + last_sent here if the email is a reminder. - - $invoice->service()->touchReminder($this->reminder_template)->save(); - - $invoice->invitations->load('contact.client.country','invoice.client.country','invoice.company')->each(function ($invitation) use ($invoice) { + $invoice->service()->touchReminder($this->reminder_template)->save(); + + $invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($invoice) { $email_builder = (new InvoiceEmail())->build($invitation, $this->reminder_template); EmailInvoice::dispatch($email_builder, $invitation, $invoice->company); - }); - if (!$bulk) { + if (! $bulk) { return response()->json(['message' => 'email sent'], 200); } break; @@ -741,7 +729,6 @@ class InvoiceController extends BaseController } /** - * * @OA\Get( * path="/api/v1/invoice/{invitation_key}/download", * operationId="downloadInvoice", @@ -782,13 +769,12 @@ class InvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function downloadPdf($invitation_key) { $invitation = $this->invoice_repo->getInvitationByKey($invitation_key); - $contact = $invitation->contact; - $invoice = $invitation->invoice; + $contact = $invitation->contact; + $invoice = $invitation->invoice; $file_path = $invoice->service()->getInvoicePdf($contact); diff --git a/app/Http/Controllers/LicenseController.php b/app/Http/Controllers/LicenseController.php index 3aee65e23e79..73c194f41426 100644 --- a/app/Http/Controllers/LicenseController.php +++ b/app/Http/Controllers/LicenseController.php @@ -1,6 +1,6 @@ input('license_key'); $product_id = 3; - $url = config('ninja.license_url') . "/claim_license?license_key={$license_key}&product_id={$product_id}&get_date=true"; + $url = config('ninja.license_url')."/claim_license?license_key={$license_key}&product_id={$product_id}&get_date=true"; $data = trim(CurlUtils::get($url)); if ($data == Account::RESULT_FAILURE) { $error = [ 'message' => trans('texts.invalid_white_label_license'), - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 400); @@ -103,7 +103,7 @@ class LicenseController extends BaseController if ($date < date_create()) { $error = [ 'message' => trans('texts.invalid_white_label_license'), - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 400); @@ -118,7 +118,7 @@ class LicenseController extends BaseController $error = [ 'message' => trans('texts.bought_white_label'), - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 200); @@ -126,7 +126,7 @@ class LicenseController extends BaseController } else { $error = [ 'message' => trans('texts.white_label_license_error'), - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 400); @@ -134,8 +134,8 @@ class LicenseController extends BaseController } $error = [ - 'message' => "Invalid license, or invalid environment ".config('ninja.environment'), - 'errors' => new \stdClass + 'message' => 'Invalid license, or invalid environment '.config('ninja.environment'), + 'errors' => new \stdClass, ]; return response()->json($error, 400); diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index cf931a19026b..beaf53a6143a 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -1,6 +1,6 @@ account; $company_id = $company->id; $company->delete(); /*Update the new default company if necessary*/ - if($company_id == $account->default_company_id && $account->companies->count() >= 1) - { - + if ($company_id == $account->default_company_id && $account->companies->count() >= 1) { $new_default_company = $account->companies->first(); - if($new_default_company){ + if ($new_default_company) { $account->default_company_id = $new_default_company->id; $account->save(); } - } return response()->json(['message' => 'Company purged'], 200); } - /** - * - * Purge Company but save settings + * Purge Company but save settings. * * @OA\Post( * path="/api/v1/migration/purge_save_settings/{company}", @@ -144,18 +137,16 @@ class MigrationController extends BaseController */ public function purgeCompanySaveSettings(Request $request, Company $company) { - $company->clients()->forceDelete(); $company->products()->forceDelete(); - + $company->save(); return response()->json(['message' => 'Settings preserved'], 200); } /** - * - * Start the migration from V1 + * Start the migration from V1. * * @OA\Post( * path="/api/v1/migration/start", @@ -213,15 +204,16 @@ class MigrationController extends BaseController $checks = [ 'same_keys' => $request->company_key == $company->company_key, 'existing_company' => (bool) $existing_company, - 'with_force' => (bool) ($request->has('force') && !empty($request->force)), + 'with_force' => (bool) ($request->has('force') && ! empty($request->force)), ]; // If same company keys, and force provided. - if ($checks['same_keys'] && $checks['with_force']) { + if ($checks['same_keys'] && $checks['with_force']) { info('Migrating: Same company keys, with force.'); - if($company) + if ($company) { $this->purgeCompany($company); + } $account = auth()->user()->account; $company = (new ImportMigrations())->getCompany($account); @@ -250,7 +242,7 @@ class MigrationController extends BaseController } // If keys are same and no force has been provided. - if ($checks['same_keys'] && !$checks['with_force']) { + if ($checks['same_keys'] && ! $checks['with_force']) { info('Migrating: Same company keys, no force provided.'); Mail::to($user)->send(new ExistingMigration()); @@ -263,7 +255,7 @@ class MigrationController extends BaseController } // If keys ain't same, but existing company without force. - if (!$checks['same_keys'] && $checks['existing_company'] && !$checks['with_force']) { + if (! $checks['same_keys'] && $checks['existing_company'] && ! $checks['with_force']) { info('Migrating: Different keys, existing company with the key without the force option.'); Mail::to($user)->send(new ExistingMigration()); @@ -276,18 +268,18 @@ class MigrationController extends BaseController } // If keys ain't same, but existing company with force. - if (!$checks['same_keys'] && $checks['existing_company'] && $checks['with_force']) { + if (! $checks['same_keys'] && $checks['existing_company'] && $checks['with_force']) { info('Migrating: Different keys, exisiting company with force option.'); - if($company) + if ($company) { $this->purgeCompany($company); + } $account = auth()->user()->account; $company = (new ImportMigrations())->getCompany($account); $account->default_company_id = $company->id; $account->save(); - $company_token = new CompanyToken(); $company_token->user_id = $user->id; @@ -295,7 +287,7 @@ class MigrationController extends BaseController $company_token->account_id = $account->id; $company_token->name = $request->token_name ?? Str::random(12); $company_token->token = $request->token ?? \Illuminate\Support\Str::random(64); - $company_token->is_system = true; + $company_token->is_system = true; $company_token->save(); @@ -311,26 +303,26 @@ class MigrationController extends BaseController } // If keys ain't same, but with force. - if (!$checks['same_keys'] && $checks['with_force']) { + if (! $checks['same_keys'] && $checks['with_force']) { info('Migrating: Different keys with force.'); - if($existing_company) + if ($existing_company) { $this->purgeCompany($existing_company); + } $account = auth()->user()->account; $company = (new ImportMigrations())->getCompany($account); $account->default_company_id = $company->id; $account->save(); - - + $company_token = new CompanyToken(); $company_token->user_id = $user->id; $company_token->company_id = $company->id; $company_token->account_id = $account->id; $company_token->name = $request->token_name ?? Str::random(12); $company_token->token = $request->token ?? \Illuminate\Support\Str::random(64); - $company_token->is_system = true; + $company_token->is_system = true; $company_token->save(); @@ -346,7 +338,7 @@ class MigrationController extends BaseController } // If keys ain't same, fresh migrate. - if (!$checks['same_keys'] && !$checks['with_force']) { + if (! $checks['same_keys'] && ! $checks['with_force']) { info('Migrating: Vanilla, fresh migrate.'); $account = auth()->user()->account; @@ -358,7 +350,7 @@ class MigrationController extends BaseController $company_token->account_id = $account->id; $company_token->name = $request->token_name ?? Str::random(12); $company_token->token = $request->token ?? \Illuminate\Support\Str::random(64); - $company_token->is_system = true; + $company_token->is_system = true; $company_token->save(); @@ -379,7 +371,7 @@ class MigrationController extends BaseController if (app()->environment() == 'testing') { return; } - + StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $company)->delay(now()->addSeconds(60)); return response()->json([ diff --git a/app/Http/Controllers/OpenAPI/AccountSchema.php b/app/Http/Controllers/OpenAPI/AccountSchema.php index b78df617bf6a..79400ecb6e91 100644 --- a/app/Http/Controllers/OpenAPI/AccountSchema.php +++ b/app/Http/Controllers/OpenAPI/AccountSchema.php @@ -1,5 +1,5 @@ itemResponse($payment); } - /** * Store a newly created resource in storage. * @@ -204,7 +198,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StorePaymentRequest $request) { @@ -263,7 +256,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowPaymentRequest $request, Payment $payment) { @@ -320,7 +312,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditPaymentRequest $request, Payment $payment) { @@ -377,7 +368,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdatePaymentRequest $request, Payment $payment) { @@ -439,12 +429,11 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyPaymentRequest $request, Payment $payment) { $payment->service()->reversePayment(); - + $payment->is_deleted = true; $payment->save(); $payment->delete(); @@ -453,7 +442,7 @@ class PaymentController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -503,7 +492,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { @@ -523,7 +511,7 @@ class PaymentController extends BaseController } /** - * Payment Actions + * Payment Actions. * * * @OA\Get( @@ -589,7 +577,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function action(ActionPaymentRequest $request, Payment $payment, $action) { @@ -603,26 +590,26 @@ class PaymentController extends BaseController // todo build the quote transformer and return response here break; case 'history': - # code... + // code... break; case 'delivery_note': - # code... + // code... break; case 'mark_paid': - # code... + // code... break; case 'archive': - # code... + // code... break; case 'delete': - # code... + // code... break; case 'email': //dispatch email to queue break; default: - # code... + // code... break; } } @@ -671,7 +658,6 @@ class PaymentController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function refund(RefundPaymentRequest $request) { diff --git a/app/Http/Controllers/PaymentTermController.php b/app/Http/Controllers/PaymentTermController.php index 5d1ec101aaef..150e75ceb58d 100644 --- a/app/Http/Controllers/PaymentTermController.php +++ b/app/Http/Controllers/PaymentTermController.php @@ -27,7 +27,6 @@ class PaymentTermController extends BaseController */ protected $payment_term_repo; - /** * PaymentTermController constructor. * @@ -72,14 +71,13 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function index() { $payment_terms = PaymentTerm::whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null); return $this->listResponse($payment_terms); - } + } /** * Show the form for creating a new resource. @@ -120,7 +118,6 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreatePaymentTermRequest $request) { @@ -173,7 +170,6 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StorePaymentTermRequest $request) { @@ -226,14 +222,12 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowPaymentTermRequest $request, PaymentTerm $payment_term) { return $this->itemResponse($payment_term); } - /** * @OA\Get( * path="/api/v1/payment_terms/{id}/edit", @@ -276,7 +270,6 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditPaymentRequest $request, Payment $payment) { @@ -333,7 +326,6 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdatePaymentTermRequest $request, PaymentTerm $payment_term) { @@ -392,19 +384,16 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyPaymentTermRequest $request, PaymentTerm $payment_term) { - $payment_term->delete(); return response()->json([], 200); } - /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -454,7 +443,6 @@ class PaymentTermController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { @@ -472,6 +460,4 @@ class PaymentTermController extends BaseController return $this->listResponse(PaymentTerm::withTrashed()->whereIn('id', $this->transformKeys($ids))); } - - } diff --git a/app/Http/Controllers/PaymentWebhookController.php b/app/Http/Controllers/PaymentWebhookController.php index caaea2c3f047..23e8184ec141 100644 --- a/app/Http/Controllers/PaymentWebhookController.php +++ b/app/Http/Controllers/PaymentWebhookController.php @@ -1,7 +1,7 @@ first(); if (is_null($payment)) { - return response([], 404); /** Record event, throw an exception.. */ + return response([], 404); /* Record event, throw an exception.. */ } return $request diff --git a/app/Http/Controllers/PingController.php b/app/Http/Controllers/PingController.php index cd827e0dddc9..f98f8cfff015 100644 --- a/app/Http/Controllers/PingController.php +++ b/app/Http/Controllers/PingController.php @@ -1,6 +1,6 @@ json( - ['company_name' => auth()->user()->getCompany()->present()->name(), - 'user_name' => auth()->user()->present()->name(), - ], 200); + ['company_name' => auth()->user()->getCompany()->present()->name(), + 'user_name' => auth()->user()->present()->name(), + ], 200); } /** - * Get a health check of the system + * Get a health check of the system. * * @return \Illuminate\Http\Response * @@ -72,9 +71,10 @@ class PingController extends BaseController */ public function health() { - if(Ninja::isNinja()) + if (Ninja::isNinja()) { return response()->json(['message' => 'Route not available', 'errors'=>[]], 403); + } - return response()->json(SystemHealth::check(),200); + return response()->json(SystemHealth::check(), 200); } } diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index c76152059250..f228e300e742 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -1,6 +1,6 @@ has('entity') && request()->has('entity_id') && - !empty(request()->input('entity')) && - !empty(request()->input('entity_id')) && + ! empty(request()->input('entity')) && + ! empty(request()->input('entity_id')) && request()->has('body')) { $design_object = json_decode(json_encode(request()->input('design'))); - if (!is_object($design_object)) { + if (! is_object($design_object)) { return response()->json(['message' => 'Invalid custom design object'], 400); } @@ -89,7 +89,7 @@ class PreviewController extends BaseController $entity_obj = $class::whereId($this->decodePrimaryKey(request()->input('entity_id')))->company()->first(); - if (!$entity_obj) { + if (! $entity_obj) { return $this->blankEntity(); } @@ -97,7 +97,7 @@ class PreviewController extends BaseController $html = new HtmlEngine(null, $entity_obj->invitations()->first(), request()->entity_type); - $design_namespace = 'App\Services\PdfMaker\Designs\\' . request()->design['name']; + $design_namespace = 'App\Services\PdfMaker\Designs\\'.request()->design['name']; $design_class = new $design_namespace(); @@ -163,11 +163,11 @@ class PreviewController extends BaseController $invoice->setRelation('company', auth()->user()->company()); $invoice->load('client'); -// info(print_r($invoice->toArray(),1)); + // info(print_r($invoice->toArray(),1)); $design_object = json_decode(json_encode(request()->input('design'))); - if (!is_object($design_object)) { + if (! is_object($design_object)) { return response()->json(['message' => 'Invalid custom design object'], 400); } diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 4e2efb746934..2aabc168e9fa 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -1,6 +1,6 @@ listResponse($products); } - /** * Show the form for creating a new resource. * @@ -128,7 +124,6 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateProductRequest $request) { @@ -175,7 +170,6 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreProductRequest $request) { @@ -232,7 +226,6 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowProductRequest $request, Product $product) { @@ -286,7 +279,6 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditProductRequest $request, Product $product) { @@ -342,14 +334,13 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateProductRequest $request, Product $product) { if ($request->entityIsDeleted($product)) { return $request->disallowUpdate(); } - + $product = $this->product_repo->save($request->all(), $product); return $this->itemResponse($product); @@ -402,7 +393,6 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyProductRequest $request, Product $product) { @@ -412,7 +402,7 @@ class ProductController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -462,12 +452,11 @@ class ProductController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { $action = request()->input('action'); - + $ids = request()->input('ids'); $products = Product::withTrashed()->find($this->transformKeys($ids)); diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index b1d58bab6abc..a2903d3ede48 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -1,6 +1,6 @@ listResponse($quotes); } @@ -152,7 +148,6 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateQuoteRequest $request) { @@ -200,7 +195,6 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreQuoteRequest $request) { @@ -261,7 +255,6 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowQuoteRequest $request, Quote $quote) { @@ -318,13 +311,12 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditQuoteRequest $request, Quote $quote) { return $this->itemResponse($quote); } - + /** * Update the specified resource in storage. * @@ -375,14 +367,13 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateQuoteRequest $request, Quote $quote) { if ($request->entityIsDeleted($quote)) { return $request->disallowUpdate(); } - + $quote = $this->quote_repo->save($request->all(), $quote); return $this->itemResponse($quote); @@ -437,7 +428,6 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyQuoteRequest $request, Quote $quote) { @@ -447,7 +437,7 @@ class QuoteController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -497,18 +487,16 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { - $action = request()->input('action'); $ids = request()->input('ids'); $quotes = Quote::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); - if (!$quotes) { + if (! $quotes) { return response()->json(['message' => 'No Quote/s Found']); } @@ -519,7 +507,7 @@ class QuoteController extends BaseController if ($action == 'download' && $quotes->count() >= 1) { $quotes->each(function ($quote) { if (auth()->user()->cannot('view', $quote)) { - return response()->json(['message'=>'Insufficient privileges to access quote '. $quote->number]); + return response()->json(['message'=>'Insufficient privileges to access quote '.$quote->number]); } }); @@ -528,8 +516,7 @@ class QuoteController extends BaseController return response()->json(['message' => 'Email Sent!'], 200); } - if($action == 'convert') { - + if ($action == 'convert') { $this->entity_type = Quote::class; $this->entity_transformer = QuoteTransformer::class; @@ -555,10 +542,9 @@ class QuoteController extends BaseController return $this->listResponse(Quote::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()); } - /** - * Quote Actions + * Quote Actions. * * * @@ -625,15 +611,12 @@ class QuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ - public function action(ActionQuoteRequest $request, Quote $quote, $action) { return $this->performAction($quote, $action); } - private function performAction(Quote $quote, $action, $bulk = false) { switch ($action) { @@ -643,10 +626,12 @@ class QuoteController extends BaseController $this->entity_transformer = InvoiceTransformer::class; $invoice = CloneQuoteToInvoiceFactory::create($quote, auth()->user()->id); + return $this->itemResponse($invoice); break; case 'clone_to_quote': $quote = CloneQuoteFactory::create($quote, auth()->user()->id); + return $this->itemResponse($quote); break; case 'approve': @@ -654,34 +639,37 @@ class QuoteController extends BaseController if ($quote->status_id != Quote::STATUS_SENT) { return response()->json(['message' => 'Unable to approve this quote as it has expired.'], 400); } - + return $this->itemResponse($quote->service()->approve()->save()); break; case 'history': - # code... + // code... break; case 'download': - return response()->streamDownload(function () use($quote) { + return response()->streamDownload(function () use ($quote) { echo file_get_contents($quote->pdf_file_path()); }, basename($quote->pdf_file_path())); //return response()->download(TempFile::path($quote->pdf_file_path()), basename($quote->pdf_file_path())); break; case 'archive': $this->quote_repo->archive($quote); + return $this->listResponse($quote); break; case 'delete': $this->quote_repo->delete($quote); + return $this->listResponse($quote); break; case 'email': $quote->service()->sendEmail(); + return response()->json(['message'=>'email sent'], 200); break; case 'mark_sent': $quote->service()->markSent()->save(); - if (!$bulk) { + if (! $bulk) { return $this->itemResponse($quote); } // no break @@ -694,8 +682,8 @@ class QuoteController extends BaseController public function downloadPdf($invitation_key) { $invitation = $this->quote_repo->getInvitationByKey($invitation_key); - $contact = $invitation->contact; - $quote = $invitation->quote; + $contact = $invitation->contact; + $quote = $invitation->quote; $file_path = $quote->service()->getQuotePdf($contact); diff --git a/app/Http/Controllers/RecurringInvoiceController.php b/app/Http/Controllers/RecurringInvoiceController.php index acb3544c4b0d..233a8942aa9c 100644 --- a/app/Http/Controllers/RecurringInvoiceController.php +++ b/app/Http/Controllers/RecurringInvoiceController.php @@ -1,6 +1,6 @@ listResponse($recurring_invoices); } @@ -151,7 +148,6 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateRecurringInvoiceRequest $request) { @@ -160,7 +156,6 @@ class RecurringInvoiceController extends BaseController return $this->itemResponse($recurring_invoice); } - /** * Store a newly created resource in storage. * @@ -200,7 +195,6 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreRecurringInvoiceRequest $request) { @@ -259,7 +253,6 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice) { @@ -316,13 +309,12 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice) { return $this->itemResponse($recurring_invoice); } - + /** * Update the specified resource in storage. * @@ -373,14 +365,13 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice) { if ($request->entityIsDeleted($recurring_invoice)) { return $request->disallowUpdate(); } - + $recurring_invoice = $this->recurring_invoice_repo->save($request->all(), $recurring_invoice); return $this->itemResponse($recurring_invoice); @@ -435,7 +426,6 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice) { @@ -445,7 +435,7 @@ class RecurringInvoiceController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -495,12 +485,11 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { $action = request()->input('action'); - + $ids = request()->input('ids'); $recurring_invoices = RecurringInvoice::withTrashed()->find($this->transformKeys($ids)); @@ -515,7 +504,7 @@ class RecurringInvoiceController extends BaseController } /** - * Recurring Invoice Actions + * Recurring Invoice Actions. * * * @OA\Get( @@ -581,9 +570,7 @@ class RecurringInvoiceController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ - public function action(ActionRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice, $action) { switch ($action) { @@ -596,26 +583,26 @@ class RecurringInvoiceController extends BaseController // todo build the quote transformer and return response here break; case 'history': - # code... + // code... break; case 'delivery_note': - # code... + // code... break; case 'mark_paid': - # code... + // code... break; case 'archive': - # code... + // code... break; case 'delete': - # code... + // code... break; case 'email': //dispatch email to queue break; default: - # code... + // code... break; } } diff --git a/app/Http/Controllers/RecurringQuoteController.php b/app/Http/Controllers/RecurringQuoteController.php index 2cceb31d17a0..7f2db92efd46 100644 --- a/app/Http/Controllers/RecurringQuoteController.php +++ b/app/Http/Controllers/RecurringQuoteController.php @@ -1,6 +1,6 @@ listResponse($recurring_quotes); } @@ -150,7 +147,6 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateRecurringQuoteRequest $request) { @@ -159,7 +155,6 @@ class RecurringQuoteController extends BaseController return $this->itemResponse($recurring_quote); } - /** * Store a newly created resource in storage. * @@ -198,7 +193,6 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreRecurringQuoteRequest $request) { @@ -257,7 +251,6 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowRecurringQuoteRequest $request, RecurringQuote $recurring_quote) { @@ -314,13 +307,12 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditRecurringQuoteRequest $request, RecurringQuote $recurring_quote) { return $this->itemResponse($recurring_quote); } - + /** * Update the specified resource in storage. * @@ -371,14 +363,13 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateRecurringQuoteRequest $request, RecurringQuote $recurring_quote) { if ($request->entityIsDeleted($recurring_quote)) { return $request->disallowUpdate(); } - + $recurring_quote = $this->recurring_quote_repo->save(request(), $recurring_quote); return $this->itemResponse($recurring_quote); @@ -433,7 +424,6 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyRecurringQuoteRequest $request, RecurringQuote $recurring_quote) { @@ -443,7 +433,7 @@ class RecurringQuoteController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -493,12 +483,11 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { $action = request()->input('action'); - + $ids = request()->input('ids'); $recurring_quotes = RecurringQuote::withTrashed()->find($this->transformKeys($ids)); @@ -513,7 +502,7 @@ class RecurringQuoteController extends BaseController } /** - * Recurring Quote Actions + * Recurring Quote Actions. * * * @@ -580,7 +569,6 @@ class RecurringQuoteController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function action(ActionRecurringQuoteRequest $request, RecurringQuote $recurring_quote, $action) { @@ -594,26 +582,26 @@ class RecurringQuoteController extends BaseController // todo build the quote transformer and return response here break; case 'history': - # code... + // code... break; case 'delivery_note': - # code... + // code... break; case 'mark_paid': - # code... + // code... break; case 'archive': - # code... + // code... break; case 'delete': - # code... + // code... break; case 'email': //dispatch email to queue break; default: - # code... + // code... break; } } diff --git a/app/Http/Controllers/SchedulerController.php b/app/Http/Controllers/SchedulerController.php index 0470913e9c7f..2a4ff549ca0d 100644 --- a/app/Http/Controllers/SchedulerController.php +++ b/app/Http/Controllers/SchedulerController.php @@ -8,9 +8,10 @@ class SchedulerController extends Controller { public function index() { - if(auth()->user()->company()->account->latest_version == '0.0.0') - return response()->json(['message' => 'Scheduler has never run'], 400); - else - return response()->json(['message' => 'Scheduler has run'], 200); + if (auth()->user()->company()->account->latest_version == '0.0.0') { + return response()->json(['message' => 'Scheduler has never run'], 400); + } else { + return response()->json(['message' => 'Scheduler has run'], 200); + } } } diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index a50e553b9a3d..322a8c6a2c65 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -1,6 +1,6 @@ json(['message' => 'Self update not available on this system.'], 403); @@ -72,17 +69,16 @@ class SelfUpdateController extends BaseController /* .git MUST be owned/writable by the webserver user */ $repo = new GitRepository(base_path()); - info("Are there changes to pull? " . $repo->hasChanges()); + info('Are there changes to pull? '.$repo->hasChanges()); - try{ - $res = $repo->pull(); - } - catch(GitException $e) { + try { + $res = $repo->pull(); + } catch (GitException $e) { info($e->getMessage()); - return response()->json(['message'=>$e->getMessage()], 500); + return response()->json(['message'=>$e->getMessage()], 500); } - info("Are there any changes to pull? " . $repo->hasChanges()); + info('Are there any changes to pull? '.$repo->hasChanges()); Artisan::call('ninja:post-update'); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 7a11e93b6516..ad4ba65e8297 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -1,6 +1,6 @@ first()) { + if ($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::all()->first()) { return redirect('/'); } @@ -53,19 +53,20 @@ class SetupController extends Controller if ($check['system_health'] === false) { info($check); - return response('Oops, something went wrong. Check your logs.'); /** We should never reach this block, but jic. */ + return response('Oops, something went wrong. Check your logs.'); /* We should never reach this block, but jic. */ } $mail_driver = $request->input('mail_driver'); - if (!$this->failsafeMailCheck($request)) { + if (! $this->failsafeMailCheck($request)) { $mail_driver = 'log'; } $url = $request->input('url'); - if(substr($url, -1) != '/') - $url = $url . '/'; + if (substr($url, -1) != '/') { + $url = $url.'/'; + } $_ENV['APP_KEY'] = config('app.key'); $_ENV['APP_URL'] = $url; @@ -76,7 +77,7 @@ class SetupController extends Controller $_ENV['DB_DATABASE1'] = $request->input('database'); $_ENV['DB_USERNAME1'] = $request->input('db_username'); $_ENV['DB_PASSWORD1'] = $request->input('db_password'); - $_ENV['MAIL_DRIVER'] = $mail_driver; + $_ENV['MAIL_MAILER'] = $mail_driver; $_ENV['MAIL_PORT'] = $request->input('mail_port'); $_ENV['MAIL_ENCRYPTION'] = $request->input('encryption'); $_ENV['MAIL_HOST'] = $request->input('mail_host'); @@ -124,7 +125,6 @@ class SetupController extends Controller Storage::disk('local')->delete('test.pdf'); - /* Create the first account. */ if (Account::count() == 0) { $account = CreateAccount::dispatchNow($request->all()); @@ -185,7 +185,6 @@ class SetupController extends Controller if ($response_array instanceof Response) { return true; } - return false; } @@ -193,12 +192,10 @@ class SetupController extends Controller public function checkPdf(Request $request) { try { - - if(config('ninja.phantomjs_key')){ + if (config('ninja.phantomjs_key')) { return $this->testPhantom(); } - Browsershot::url('https://www.invoiceninja.com')->savePdf( // Browsershot::html('If you see this text, generating PDF works! Thanks for using Invoice Ninja!')->savePdf( public_path('test.pdf') @@ -214,9 +211,7 @@ class SetupController extends Controller private function testPhantom() { - try { - $key = config('ninja.phantomjs_key'); $url = 'https://www.invoiceninja.org/'; @@ -227,14 +222,8 @@ class SetupController extends Controller Storage::disk('local')->put('test.pdf', $pdf); return response(['url' => Storage::disk('local')->url('test.pdf')], 200); - - } - catch(\Exception $e){ - + } catch (\Exception $e) { return response([], 500); - } - } - } diff --git a/app/Http/Controllers/Shop/ClientController.php b/app/Http/Controllers/Shop/ClientController.php index d7342384b71e..ded535c1f4d0 100644 --- a/app/Http/Controllers/Shop/ClientController.php +++ b/app/Http/Controllers/Shop/ClientController.php @@ -1,6 +1,6 @@ header('X-API-COMPANY-KEY'))->first(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } $contact = ClientContact::with('client') ->where('company_id', $company->id) @@ -71,9 +72,10 @@ class ClientController extends BaseController { $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); - + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } + app('queue')->createPayloadUsing(function () use ($company) { return ['db' => $company->db]; }); diff --git a/app/Http/Controllers/Shop/InvoiceController.php b/app/Http/Controllers/Shop/InvoiceController.php index af90ef67a1e5..182f02ae33ab 100644 --- a/app/Http/Controllers/Shop/InvoiceController.php +++ b/app/Http/Controllers/Shop/InvoiceController.php @@ -1,6 +1,6 @@ header('X-API-COMPANY-KEY'))->first(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } $invitation = InvoiceInvitation::with(['invoice']) ->where('company_id', $company->id) - ->where('key',$invitation_key) + ->where('key', $invitation_key) ->firstOrFail(); return $this->itemResponse($invitation->invoice); } - public function store(StoreShopInvoiceRequest $request) { - $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->first(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } app('queue')->createPayloadUsing(function () use ($company) { return ['db' => $company->db]; }); - + $client = Client::find($request->input('client_id')); $invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create($company->id, $company->owner()->id)); @@ -87,8 +87,7 @@ class InvoiceController extends BaseController event(new InvoiceWasCreated($invoice, $company, Ninja::eventVars())); $invoice = $invoice->service()->triggeredActions($request)->save(); - + return $this->itemResponse($invoice); } - } diff --git a/app/Http/Controllers/Shop/ProductController.php b/app/Http/Controllers/Shop/ProductController.php index 70434ad9140c..5e7f2dd6f742 100644 --- a/app/Http/Controllers/Shop/ProductController.php +++ b/app/Http/Controllers/Shop/ProductController.php @@ -1,6 +1,6 @@ header('X-API-COMPANY-KEY'))->firstOrFail(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } $products = Product::where('company_id', $company->id); @@ -48,9 +49,10 @@ class ProductController extends BaseController { $company = Company::where('company_key', $request->header('X-API-COMPANY-KEY'))->firstOrFail(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); - + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } + $product = Product::where('company_id', $company->id) ->where('product_key', $product_key) ->first(); diff --git a/app/Http/Controllers/Shop/ProfileController.php b/app/Http/Controllers/Shop/ProfileController.php index 6d16d6b7bca3..5b31726da6de 100644 --- a/app/Http/Controllers/Shop/ProfileController.php +++ b/app/Http/Controllers/Shop/ProfileController.php @@ -1,6 +1,6 @@ header('X-API-COMPANY-KEY'))->first(); - if(!$company->enable_shop_api) - return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass],403); + if (! $company->enable_shop_api) { + return response()->json(['message' => 'Shop is disabled', 'errors' => new \stdClass], 403); + } return $this->itemResponse($company); } diff --git a/app/Http/Controllers/Support/Messages/SendingController.php b/app/Http/Controllers/Support/Messages/SendingController.php index 41daf53d02d9..90c53727614a 100644 --- a/app/Http/Controllers/Support/Messages/SendingController.php +++ b/app/Http/Controllers/Support/Messages/SendingController.php @@ -9,7 +9,6 @@ use Illuminate\Support\Facades\Mail; class SendingController extends Controller { - /** * Send a support message. * @@ -61,7 +60,6 @@ class SendingController extends Controller * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function __invoke(Request $request) { @@ -79,7 +77,7 @@ class SendingController extends Controller ->send(new SupportMessageSent($request->message, $send_logs)); return response()->json([ - 'success' => true + 'success' => true, ], 200); } } diff --git a/app/Http/Controllers/SystemLogController.php b/app/Http/Controllers/SystemLogController.php index 1b7a0b5e6ff9..3023b6623351 100644 --- a/app/Http/Controllers/SystemLogController.php +++ b/app/Http/Controllers/SystemLogController.php @@ -10,7 +10,6 @@ use Illuminate\Http\Request; class SystemLogController extends BaseController { - use MakesHash; protected $entity_type = SystemLog::class; @@ -18,7 +17,7 @@ class SystemLogController extends BaseController protected $entity_transformer = SystemLogTransformer::class; /** - * Show the list of Invoices + * Show the list of Invoices. * * @param \App\Filters\InvoiceFilters $filters The filters * @@ -56,7 +55,6 @@ class SystemLogController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function index(SystemLogFilters $filters) { @@ -74,10 +72,9 @@ class SystemLogController extends BaseController { $error = [ 'message' => 'Cannot create system log', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - return response()->json($error, 400); } @@ -89,15 +86,12 @@ class SystemLogController extends BaseController */ public function store(Request $request) { - $error = [ 'message' => 'Cannot store system log', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - return response()->json($error, 400); - } /** @@ -150,7 +144,6 @@ class SystemLogController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(Request $request, SystemLog $system_log) { @@ -167,10 +160,9 @@ class SystemLogController extends BaseController { $error = [ 'message' => 'Cannot edit system log', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - return response()->json($error, 400); } @@ -185,10 +177,9 @@ class SystemLogController extends BaseController { $error = [ 'message' => 'Cannot update system log', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - return response()->json($error, 400); } @@ -202,10 +193,9 @@ class SystemLogController extends BaseController { $error = [ 'message' => 'Cannot destroy system log', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - return response()->json($error, 400); } } diff --git a/app/Http/Controllers/TaxRateController.php b/app/Http/Controllers/TaxRateController.php index a6ecae0da6c7..5ae705fdc7b5 100644 --- a/app/Http/Controllers/TaxRateController.php +++ b/app/Http/Controllers/TaxRateController.php @@ -1,6 +1,6 @@ base_repo = $base_repo; } - + /** * @OA\Get( * path="/api/v1/tax_rates", @@ -122,11 +121,11 @@ class TaxRateController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateTaxRateRequest $request) { $tax_rate = TaxRateFactory::create(auth()->user()->company()->id, auth()->user()->id); + return $this->itemResponse($tax_rate); } @@ -141,7 +140,7 @@ class TaxRateController extends BaseController $tax_rate = TaxRateFactory::create(auth()->user()->company()->id, auth()->user()->id); $tax_rate->fill($request->all()); $tax_rate->save(); - + return $this->itemResponse($tax_rate); } @@ -192,7 +191,6 @@ class TaxRateController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowTaxRateRequest $request, TaxRate $tax_rate) { @@ -246,7 +244,6 @@ class TaxRateController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditTaxRateRequest $request, TaxRate $tax_rate) { @@ -302,7 +299,6 @@ class TaxRateController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateTaxRateRequest $request, TaxRate $tax_rate) { @@ -358,7 +354,6 @@ class TaxRateController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyTaxRateRequest $request, TaxRate $tax_rate) { @@ -369,9 +364,8 @@ class TaxRateController extends BaseController return $this->itemResponse($tax_rate); } - /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @param BulkTaxRateRequest $request * @return \Illuminate\Http\Response @@ -430,7 +424,6 @@ class TaxRateController extends BaseController $tax_rates = TaxRate::withTrashed()->find($this->transformKeys($ids)); - $tax_rates->each(function ($tax_rate, $key) use ($action) { if (auth()->user()->can('edit', $tax_rate)) { $this->base_repo->{$action}($tax_rate); @@ -439,5 +432,4 @@ class TaxRateController extends BaseController return $this->listResponse(TaxRate::withTrashed()->whereIn('id', $this->transformKeys($ids))); } - } diff --git a/app/Http/Controllers/TemplateController.php b/app/Http/Controllers/TemplateController.php index 1f492c3eb488..ab01fb431edb 100644 --- a/app/Http/Controllers/TemplateController.php +++ b/app/Http/Controllers/TemplateController.php @@ -1,6 +1,6 @@ has('template') ? request()->input('template') : ''; $data = (new TemplateEngine($body, $subject, $entity, $entity_id, $template))->build(); - return response()->json($data, 200); } - } diff --git a/app/Http/Controllers/TokenController.php b/app/Http/Controllers/TokenController.php index c18625ff7e48..a43ead9a7180 100644 --- a/app/Http/Controllers/TokenController.php +++ b/app/Http/Controllers/TokenController.php @@ -1,6 +1,6 @@ input('action'); - + $ids = request()->input('ids'); $tokens = CompanyToken::withTrashed()->find($this->transformKeys($ids)); - + $tokens->each(function ($token, $key) use ($action) { if (auth()->user()->can('edit', $token)) { $this->token_repo->{$action}($token); } }); - + return $this->listResponse(CompanyToken::withTrashed()->whereIn('id', $this->transformKeys($ids))); } } diff --git a/app/Http/Controllers/Traits/VerifiesUserEmail.php b/app/Http/Controllers/Traits/VerifiesUserEmail.php index 5e34fc587e5d..0757b53a7017 100644 --- a/app/Http/Controllers/Traits/VerifiesUserEmail.php +++ b/app/Http/Controllers/Traits/VerifiesUserEmail.php @@ -1,7 +1,7 @@ confirmation_code)->first(); - + // if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->input('confirmation_code'))->first()) { - if (!$user) { + if (! $user) { return $this->render('auth.confirmed', ['root' => 'themes', 'message' => ctrans('texts.wrong_confirmation')]); } @@ -57,10 +56,10 @@ trait VerifiesUserEmail { $user = User::where('confirmation_code', request()->confirmation_code)->first(); - if (!$user) { + if (! $user) { return $this->render('auth.confirmed', ['root' => 'themes', 'message' => ctrans('texts.wrong_confirmation')]); } - + request()->validate([ 'password' => ['required', 'min:6', 'confirmed'], ]); diff --git a/app/Http/Controllers/TranslationController.php b/app/Http/Controllers/TranslationController.php index a2741ab11ee7..f24129fe58d4 100644 --- a/app/Http/Controllers/TranslationController.php +++ b/app/Http/Controllers/TranslationController.php @@ -1,6 +1,6 @@ easyMinify(json_encode($strings)) . ';'); + echo 'i18n = '.$this->easyMinify(json_encode($strings)).';'; exit(); } private function easyMinify($javascript) { - return preg_replace(array("/\s+\n/", "/\n\s+/", "/ +/"), array("\n", "\n ", " "), $javascript); + return preg_replace(["/\s+\n/", "/\n\s+/", '/ +/'], ["\n", "\n ", ' '], $javascript); } /** diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index ea6495b06775..32d28e405066 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1,6 +1,6 @@ user_repo = $user_repo; } - + /** * Display a listing of the resource. * @@ -104,13 +102,11 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ - public function index(UserFilters $filters) { $users = User::filter($filters); - + return $this->listResponse($users); } @@ -151,7 +147,6 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function create(CreateUserRequest $request) { @@ -198,7 +193,6 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreUserRequest $request) { @@ -261,7 +255,6 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function show(ShowUserRequest $request, User $user) { @@ -316,7 +309,6 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function edit(EditUserRequest $request, User $user) { @@ -367,7 +359,6 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function update(UpdateUserRequest $request, User $user) { @@ -376,8 +367,9 @@ class UserController extends BaseController $user = $this->user_repo->save($request->all(), $user); - if($user) + if ($user) { UserEmailChanged::dispatch($new_email, $old_email, auth()->user()->company()); + } return $this->itemResponse($user); } @@ -440,18 +432,17 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyUserRequest $request, User $user) { /* If the user passes the company user we archive the company user */ $user = $this->user_repo->destroy($request->all(), $user); - + return $this->itemResponse($user->fresh()); } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @return Collection * @@ -502,12 +493,11 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function bulk() { $action = request()->input('action'); - + $ids = request()->input('ids'); $users = User::withTrashed()->find($this->transformKeys($ids)); @@ -517,13 +507,13 @@ class UserController extends BaseController * each user through the Policy sieve and only return users that they * have access to */ - + $return_user_collection = collect(); $users->each(function ($user, $key) use ($action, $return_user_collection) { if (auth()->user()->can('edit', $user)) { $this->user_repo->{$action}($user); - + $return_user_collection->push($user->id); } }); @@ -531,8 +521,6 @@ class UserController extends BaseController return $this->listResponse(User::withTrashed()->whereIn('id', $return_user_collection)); } - - /** * Attach an existing user to a company. * @@ -582,7 +570,6 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function attach(AttachCompanyUserRequest $request, User $user) { @@ -647,13 +634,12 @@ class UserController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function detach(DetachCompanyUserRequest $request, User $user) { $company_user = CompanyUser::whereUserId($user->id) ->whereCompanyId(auth()->user()->companyId())->first(); - + $token = $company_user->token->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first(); if ($token) { diff --git a/app/Http/Controllers/VendorController.php b/app/Http/Controllers/VendorController.php index aff6e2d9f8e2..495eab8eff41 100644 --- a/app/Http/Controllers/VendorController.php +++ b/app/Http/Controllers/VendorController.php @@ -1,6 +1,6 @@ input('action'); - + $ids = request()->input('ids'); $vendors = Vendor::withTrashed()->find($this->transformKeys($ids)); - + $vendors->each(function ($vendor, $key) use ($action) { if (auth()->user()->can('edit', $vendor)) { $this->client_repo->{$action}($vendor); } }); - + return $this->listResponse(Vendor::withTrashed()->whereIn('id', $this->transformKeys($ids))); } /** - * Returns a client statement + * Returns a client statement. * * @return [type] [description] */ diff --git a/app/Http/Controllers/WebhookController.php b/app/Http/Controllers/WebhookController.php index 8ae5f6103e4a..02c02892c7f6 100644 --- a/app/Http/Controllers/WebhookController.php +++ b/app/Http/Controllers/WebhookController.php @@ -1,7 +1,7 @@ user()->company()->id, auth()->user()->id); $webhook->fill($request->all()); $webhook->save(); - + return $this->itemResponse($webhook); } @@ -346,15 +341,14 @@ class WebhookController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function store(StoreWebhookRequest $request) { $event_id = $request->input('event_id'); $target_url = $request->input('target_url'); - if (!in_array($event_id, Webhook::$valid_events)) { - return response()->json("Invalid event", 400); + if (! in_array($event_id, Webhook::$valid_events)) { + return response()->json('Invalid event', 400); } $webhook = new Webhook; @@ -364,7 +358,7 @@ class WebhookController extends BaseController $webhook->target_url = $target_url; $webhook->save(); - if (!$webhook->id) { + if (! $webhook->id) { return response()->json('Failed to create Webhook', 400); } @@ -418,7 +412,6 @@ class WebhookController extends BaseController * @OA\JsonContent(ref="#/components/schemas/Error"), * ), * ) - * */ public function destroy(DestroyWebhookRequest $request, Webhook $webhook) { @@ -429,7 +422,7 @@ class WebhookController extends BaseController } /** - * Perform bulk actions on the list view + * Perform bulk actions on the list view. * * @param BulkWebhookRequest $request * @return \Illuminate\Http\Response @@ -488,7 +481,6 @@ class WebhookController extends BaseController $webhooks = Webhook::withTrashed()->find($this->transformKeys($ids)); - $webhooks->each(function ($webhook, $key) use ($action) { if (auth()->user()->can('edit', $webhook)) { $this->base_repo->{$action}($webhook); @@ -497,6 +489,4 @@ class WebhookController extends BaseController return $this->listResponse(Webhook::withTrashed()->whereIn('id', $this->transformKeys($ids))); } - - } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index daae0df3cff4..9365e1d547bc 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -1,6 +1,6 @@ [ 'throttle:60,1', diff --git a/app/Http/Livewire/CreditsTable.php b/app/Http/Livewire/CreditsTable.php index a2b2205aa04a..148e4bf847f1 100644 --- a/app/Http/Livewire/CreditsTable.php +++ b/app/Http/Livewire/CreditsTable.php @@ -22,7 +22,7 @@ class CreditsTable extends Component ->paginate($this->per_page); return render('components.livewire.credits-table', [ - 'credits' => $query + 'credits' => $query, ]); } } diff --git a/app/Http/Livewire/DownloadsTable.php b/app/Http/Livewire/DownloadsTable.php index 227247e4356a..2e8e99776938 100644 --- a/app/Http/Livewire/DownloadsTable.php +++ b/app/Http/Livewire/DownloadsTable.php @@ -31,12 +31,12 @@ class DownloadsTable extends Component // $query = auth('contact')->user()->client->documents(); $query = Document::query(); - if (in_array('resources', $this->status) && !in_array('client', $this->status)) { - $query = $query->where('documentable_type', '!=', 'App\Models\Client'); + if (in_array('resources', $this->status) && ! in_array('client', $this->status)) { + $query = $query->where('documentable_type', '!=', \App\Models\Client::class); } - if (in_array('client', $this->status) && !in_array('resources', $this->status)) { - $query = $query->where('documentable_type', 'App\Models\Client'); + if (in_array('client', $this->status) && ! in_array('resources', $this->status)) { + $query = $query->where('documentable_type', \App\Models\Client::class); } $query = $query diff --git a/app/Http/Livewire/InvoicesTable.php b/app/Http/Livewire/InvoicesTable.php index ea0682d9d2c9..70e73fcb90c0 100644 --- a/app/Http/Livewire/InvoicesTable.php +++ b/app/Http/Livewire/InvoicesTable.php @@ -64,7 +64,7 @@ class InvoicesTable extends Component ->filter(function ($invoice) { $invoice['line_items'] = collect($invoice->line_items) ->filter(function ($item) { - return $item->type_id == "4" || $item->type_id == 4; + return $item->type_id == '4' || $item->type_id == 4; }); return count($invoice['line_items']); diff --git a/app/Http/Livewire/PaymentsTable.php b/app/Http/Livewire/PaymentsTable.php index a72612850265..cc7e90c493ae 100644 --- a/app/Http/Livewire/PaymentsTable.php +++ b/app/Http/Livewire/PaymentsTable.php @@ -29,7 +29,7 @@ class PaymentsTable extends Component ->paginate($this->per_page); return render('components.livewire.payments-table', [ - 'payments' => $query + 'payments' => $query, ]); } } diff --git a/app/Http/Livewire/QuotesTable.php b/app/Http/Livewire/QuotesTable.php index 356e552a99d8..485f0a3c327e 100644 --- a/app/Http/Livewire/QuotesTable.php +++ b/app/Http/Livewire/QuotesTable.php @@ -30,7 +30,7 @@ class QuotesTable extends Component ->paginate($this->per_page); return render('components.livewire.quotes-table', [ - 'quotes' => $query + 'quotes' => $query, ]); } } diff --git a/app/Http/Livewire/RecurringInvoicesTable.php b/app/Http/Livewire/RecurringInvoicesTable.php index 68f83c4f6a32..725e861bc4d4 100644 --- a/app/Http/Livewire/RecurringInvoicesTable.php +++ b/app/Http/Livewire/RecurringInvoicesTable.php @@ -26,7 +26,7 @@ class RecurringInvoicesTable extends Component ->paginate($this->per_page); return render('components.livewire.recurring-invoices-table', [ - 'invoices' => $query + 'invoices' => $query, ]); } } diff --git a/app/Http/Middleware/ApiSecretCheck.php b/app/Http/Middleware/ApiSecretCheck.php index a2e377fff1e7..e5b28b899d09 100644 --- a/app/Http/Middleware/ApiSecretCheck.php +++ b/app/Http/Middleware/ApiSecretCheck.php @@ -1,6 +1,6 @@ 'Invalid secret', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; + return response() ->json($error, 403) ->header('X-App-Version', config('ninja.app_version')) diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index a319ce0e402c..a8951d70933a 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -1,6 +1,6 @@ to('client/dashboard'); } - return $next($request); } } diff --git a/app/Http/Middleware/ContactRegister.php b/app/Http/Middleware/ContactRegister.php index bbe584cbfaaa..3f164baed9f2 100644 --- a/app/Http/Middleware/ContactRegister.php +++ b/app/Http/Middleware/ContactRegister.php @@ -16,16 +16,16 @@ class ContactRegister */ public function handle($request, Closure $next) { - /** + /* * Notes: - * + * * 1. If request supports subdomain (for hosted) check domain and continue request. * 2. If request doesn't support subdomain and doesn' have company_key, abort * 3. firstOrFail() will abort with 404 if company with company_key wasn't found. * 4. Abort if setting isn't enabled. */ - if ($request->subdomain) { + if ($request->subdomain) { $company = Company::where('subdomain', $request->subdomain)->firstOrFail(); abort_unless($company->getSetting('enable_client_registration'), 404); diff --git a/app/Http/Middleware/ContactSetDb.php b/app/Http/Middleware/ContactSetDb.php index 43e44728389c..a147c9a91b80 100644 --- a/app/Http/Middleware/ContactSetDb.php +++ b/app/Http/Middleware/ContactSetDb.php @@ -1,6 +1,6 @@ 'Invalid Token', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; if ($request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled')) { diff --git a/app/Http/Middleware/ContactTokenAuth.php b/app/Http/Middleware/ContactTokenAuth.php index e058a61678af..56cf788b8d0b 100644 --- a/app/Http/Middleware/ContactTokenAuth.php +++ b/app/Http/Middleware/ContactTokenAuth.php @@ -1,6 +1,6 @@ header('X-API-TOKEN') && ($client_contact = ClientContact::with(['company'])->whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])->first())) { + if ($request->header('X-API-TOKEN') && ($client_contact = ClientContact::with(['company'])->whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')])->first())) { $error = [ 'message' => 'Authentication disabled for user.', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; //client_contact who once existed, but has been soft deleted - if (!$client_contact) { + if (! $client_contact) { return response()->json($error, 403); } - $error = [ 'message' => 'Access is locked.', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; //client_contact who has been disabled @@ -53,12 +52,12 @@ class ContactTokenAuth //stateless, don't remember the contact. auth()->guard('contact')->login($client_contact, false); - + event(new ContactLoggedIn($client_contact, $client_contact->company, Ninja::eventVars())); //todo } else { $error = [ 'message' => 'Invalid token', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 403); diff --git a/app/Http/Middleware/Cors.php b/app/Http/Middleware/Cors.php index 09586788e635..d471371215bb 100644 --- a/app/Http/Middleware/Cors.php +++ b/app/Http/Middleware/Cors.php @@ -10,19 +10,18 @@ class Cors { public function handle($request, Closure $next) { - if ($request->getMethod() == "OPTIONS") { - header("Access-Control-Allow-Origin: *"); + if ($request->getMethod() == 'OPTIONS') { + header('Access-Control-Allow-Origin: *'); // ALLOW OPTIONS METHOD $headers = [ 'Access-Control-Allow-Methods'=> 'POST, GET, OPTIONS, PUT, DELETE', - 'Access-Control-Allow-Headers'=> 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' + 'Access-Control-Allow-Headers'=> 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range', ]; return Response::make('OK', 200, $headers); } - /* Work around for file downloads where the response cannot contain have headers set */ // if($request instanceOf BinaryFileResponse) // return $next($request); @@ -40,7 +39,7 @@ class Cors $response->headers->set('Access-Control-Expose-Headers', 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION'); $response->headers->set('X-APP-VERSION', config('ninja.app_version')); $response->headers->set('X-MINIMUM-CLIENT-VERSION', config('ninja.minimum_client_version')); - + return $response; } } diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 400e0af7f715..074f613c68cf 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -1,6 +1,6 @@ 'Invalid Password', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; if ($request->header('X-API-PASSWORD')) { - if (!Hash::check($request->header('X-API-PASSWORD'), auth()->user()->password)) { + if (! Hash::check($request->header('X-API-PASSWORD'), auth()->user()->password)) { return response()->json($error, 403); } - } elseif (Cache::get(auth()->user()->email."_logged_in")) { - Cache::pull(auth()->user()->email."_logged_in"); - Cache::add(auth()->user()->email."_logged_in", Str::random(64), now()->addMinutes(30)); + } elseif (Cache::get(auth()->user()->email.'_logged_in')) { + Cache::pull(auth()->user()->email.'_logged_in'); + Cache::add(auth()->user()->email.'_logged_in', Str::random(64), now()->addMinutes(30)); return $next($request); } else { $error = [ 'message' => 'Access denied', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; + return response()->json($error, 412); } - Cache::add(auth()->user()->email."_logged_in", Str::random(64), now()->addMinutes(30)); + Cache::add(auth()->user()->email.'_logged_in', Str::random(64), now()->addMinutes(30)); return $next($request); } diff --git a/app/Http/Middleware/PhantomSecret.php b/app/Http/Middleware/PhantomSecret.php index 70180351920a..d9508a93c57d 100644 --- a/app/Http/Middleware/PhantomSecret.php +++ b/app/Http/Middleware/PhantomSecret.php @@ -1,6 +1,6 @@ has('phantomjs_secret') && (config('ninja.phantomjs_secret') == $request->input('phantomjs_secret')) ) - { + if (config('ninja.phantomjs_secret') && $request->has('phantomjs_secret') && (config('ninja.phantomjs_secret') == $request->input('phantomjs_secret'))) { return $next($request); } - return redirect('/'); - + return redirect('/'); } - } diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index 0b7f62af8fd5..64f8742da083 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -1,6 +1,6 @@ method() . ' - ' . $request->url() . ": $count queries - " . $time); - - // if($count > 100) + + Log::info($request->method().' - '.$request->url().": $count queries - ".$time); + + // if($count > 100) // Log::info($queries); - } } - + return $response; } } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index b8ced8331e86..ddbef9f71d70 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -1,6 +1,6 @@ 'Invalid Token', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - if ($request->header('X-API-TOKEN') && config('ninja.db.multi_db_enabled')) { if (! MultiDB::findAndSetDb($request->header('X-API-TOKEN'))) { return response()->json($error, 403); } - } elseif (!config('ninja.db.multi_db_enabled')) { + } elseif (! config('ninja.db.multi_db_enabled')) { return $next($request); } else { return response()->json($error, 403); diff --git a/app/Http/Middleware/SetDbByCompanyKey.php b/app/Http/Middleware/SetDbByCompanyKey.php index 6832e9150699..eab7294cfc89 100644 --- a/app/Http/Middleware/SetDbByCompanyKey.php +++ b/app/Http/Middleware/SetDbByCompanyKey.php @@ -1,6 +1,6 @@ 'Invalid Token', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; - if ($request->header('X-API-COMPANY-KEY') && config('ninja.db.multi_db_enabled')) { if (! MultiDB::findAndSetDbByCompanyKey($request->header('X-API-COMPANY-KEY'))) { return response()->json($error, 403); } - } elseif (!config('ninja.db.multi_db_enabled')) { + } elseif (! config('ninja.db.multi_db_enabled')) { return $next($request); } else { return response()->json($error, 403); diff --git a/app/Http/Middleware/SetDomainNameDb.php b/app/Http/Middleware/SetDomainNameDb.php index 397096415403..629c56d030fd 100644 --- a/app/Http/Middleware/SetDomainNameDb.php +++ b/app/Http/Middleware/SetDomainNameDb.php @@ -1,6 +1,6 @@ 'Invalid token', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; /* * Use the host name to set the active DB diff --git a/app/Http/Middleware/SetEmailDb.php b/app/Http/Middleware/SetEmailDb.php index 318d0b56bb5c..4cbe484f7b0f 100644 --- a/app/Http/Middleware/SetEmailDb.php +++ b/app/Http/Middleware/SetEmailDb.php @@ -1,6 +1,6 @@ 'Email not set or not found', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; if ($request->input('email') && config('ninja.db.multi_db_enabled')) { diff --git a/app/Http/Middleware/SetInviteDb.php b/app/Http/Middleware/SetInviteDb.php index d392342d8e33..b9494c60cb65 100644 --- a/app/Http/Middleware/SetInviteDb.php +++ b/app/Http/Middleware/SetInviteDb.php @@ -1,6 +1,6 @@ 'Invalid URL', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; /* * Use the host name to set the active DB **/ $entity = null; - if (!$request->route('entity')) { + if (! $request->route('entity')) { $entity = $request->segment(2); } else { $entity = $request->route('entity'); diff --git a/app/Http/Middleware/SetWebDb.php b/app/Http/Middleware/SetWebDb.php index 5b8da4165cdf..ae68adf17636 100644 --- a/app/Http/Middleware/SetWebDb.php +++ b/app/Http/Middleware/SetWebDb.php @@ -21,7 +21,6 @@ class SetWebDb MultiDB::setDB(Cookie::get('db')); } - return $next($request); } } diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index c37fd2fa012e..acb9e53e0486 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -1,6 +1,6 @@ $class) { if ($request->has('clear_cache') || ! Cache::has($name)) { // check that the table exists in case the migration is pending diff --git a/app/Http/Middleware/TokenAuth.php b/app/Http/Middleware/TokenAuth.php index b8ebedc57fcb..14df06465543 100644 --- a/app/Http/Middleware/TokenAuth.php +++ b/app/Http/Middleware/TokenAuth.php @@ -1,6 +1,6 @@ header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user','company'])->whereRaw("BINARY `token`= ?", [$request->header('X-API-TOKEN')])->first())) { - + if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user', 'company'])->whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')])->first())) { $user = $company_token->user; $error = [ 'message' => 'User inactive', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; //user who once existed, but has been soft deleted - if (!$user) { + if (! $user) { return response()->json($error, 403); } @@ -49,7 +48,7 @@ class TokenAuth | */ $user->setCompany($company_token->company); - + config(['ninja.company_id' => $company_token->company->id]); app('queue')->createPayloadUsing(function () use ($company_token) { @@ -60,12 +59,12 @@ class TokenAuth if ($user->company_user->is_locked) { $error = [ 'message' => 'User access locked', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 403); } - + //stateless, don't remember the user. auth()->login($user, false); @@ -73,7 +72,7 @@ class TokenAuth } else { $error = [ 'message' => 'Invalid token', - 'errors' => new \stdClass + 'errors' => new \stdClass, ]; return response()->json($error, 403); diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index a398e4c12f0a..61e523914ab6 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -1,6 +1,6 @@ route('confirmation_code')); + $segments = explode('-', $request->route('confirmation_code')); $hashed_db = $hashids->decode($segments[0]); - MultiDB::setDB(MultiDB::DB_PREFIX . str_pad($hashed_db[0], 2, "0", STR_PAD_LEFT)); + MultiDB::setDB(MultiDB::DB_PREFIX.str_pad($hashed_db[0], 2, '0', STR_PAD_LEFT)); } return $next($request); diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 89fd64e33951..d2ba3f0ff67f 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -1,6 +1,6 @@ 'bail|required|email', 'email' => new NewUniqueUserRule(), 'privacy_policy' => 'required', - 'terms_of_service' => 'required' + 'terms_of_service' => 'required', ]; } diff --git a/app/Http/Requests/Activity/DownloadHistoricalEntityRequest.php b/app/Http/Requests/Activity/DownloadHistoricalEntityRequest.php index 5502361d2c8e..53aca056b769 100644 --- a/app/Http/Requests/Activity/DownloadHistoricalEntityRequest.php +++ b/app/Http/Requests/Activity/DownloadHistoricalEntityRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->activity); diff --git a/app/Http/Requests/Activity/ShowActivityRequest.php b/app/Http/Requests/Activity/ShowActivityRequest.php index 959bb51209db..e9c7e65c1b1c 100644 --- a/app/Http/Requests/Activity/ShowActivityRequest.php +++ b/app/Http/Requests/Activity/ShowActivityRequest.php @@ -1,6 +1,6 @@ user()->can('view', Activity::class); diff --git a/app/Http/Requests/Client/BulkClientRequest.php b/app/Http/Requests/Client/BulkClientRequest.php index f1db1ddfa9c3..7ebe32087817 100644 --- a/app/Http/Requests/Client/BulkClientRequest.php +++ b/app/Http/Requests/Client/BulkClientRequest.php @@ -2,9 +2,9 @@ namespace App\Http\Requests\Client; +use App\Models\Client; use App\Utils\Traits\BulkOptions; use Illuminate\Foundation\Http\FormRequest; -use App\Models\Client; class BulkClientRequest extends FormRequest { @@ -17,11 +17,11 @@ class BulkClientRequest extends FormRequest */ public function authorize() { - if (!$this->has('action')) { + if (! $this->has('action')) { return false; } - if (!in_array($this->action, $this->getBulkOptions(), true)) { + if (! in_array($this->action, $this->getBulkOptions(), true)) { return false; } @@ -37,7 +37,7 @@ class BulkClientRequest extends FormRequest { $rules = $this->getGlobalRules(); - /** We don't require IDs on bulk storing. */ + /* We don't require IDs on bulk storing. */ if ($this->action !== self::$STORE_METHOD) { $rules['ids'] = ['required']; } diff --git a/app/Http/Requests/Client/CreateClientRequest.php b/app/Http/Requests/Client/CreateClientRequest.php index f66679c00506..4d0f747539cd 100644 --- a/app/Http/Requests/Client/CreateClientRequest.php +++ b/app/Http/Requests/Client/CreateClientRequest.php @@ -1,6 +1,6 @@ user()->can('create', Client::class); diff --git a/app/Http/Requests/Client/DestroyClientRequest.php b/app/Http/Requests/Client/DestroyClientRequest.php index ecdbf6919443..d640d531c717 100644 --- a/app/Http/Requests/Client/DestroyClientRequest.php +++ b/app/Http/Requests/Client/DestroyClientRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->client); diff --git a/app/Http/Requests/Client/EditClientRequest.php b/app/Http/Requests/Client/EditClientRequest.php index df08ada7f438..93cdd1856bdc 100644 --- a/app/Http/Requests/Client/EditClientRequest.php +++ b/app/Http/Requests/Client/EditClientRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->client); diff --git a/app/Http/Requests/Client/ShowClientRequest.php b/app/Http/Requests/Client/ShowClientRequest.php index 2012ee8a49dd..d862dcfdee35 100644 --- a/app/Http/Requests/Client/ShowClientRequest.php +++ b/app/Http/Requests/Client/ShowClientRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->client); diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 3bda4d98fb38..1b8bba5dde70 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -1,6 +1,6 @@ user()->can('create', Client::class); @@ -38,20 +37,19 @@ class StoreClientRequest extends Request public function rules() { - if ($this->input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } - + /* Ensure we have a client name, and that all emails are unique*/ //$rules['name'] = 'required|min:1'; - $rules['id_number'] = 'unique:clients,id_number,' . $this->id . ',id,company_id,' . $this->company_id; + $rules['id_number'] = 'unique:clients,id_number,'.$this->id.',id,company_id,'.$this->company_id; $rules['settings'] = new ValidClientGroupSettingsRule(); $rules['contacts.*.email'] = 'nullable|distinct'; $rules['contacts.*.password'] = [ @@ -65,13 +63,13 @@ class StoreClientRequest extends Request //'regex:/[@$!%*#?&.]/', // must contain a special character ]; - if(auth()->user()->company()->account->isFreeHostedClient()) + if (auth()->user()->company()->account->isFreeHostedClient()) { $rules['hosted_clients'] = new CanStoreClientsRule($this->company_id); + } return $rules; } - protected function prepareForValidation() { $input = $this->all(); @@ -79,8 +77,8 @@ class StoreClientRequest extends Request //@todo implement feature permissions for > 100 clients // $settings = ClientSettings::defaults(); - - if (array_key_exists('settings', $input) && !empty($input['settings'])) { + + if (array_key_exists('settings', $input) && ! empty($input['settings'])) { foreach ($input['settings'] as $key => $value) { $settings->{$key} = $value; } @@ -89,20 +87,20 @@ class StoreClientRequest extends Request if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + //is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!! - if (!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { + if (! property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); $group_settings = GroupSetting::find($input['group_settings_id']); if ($group_settings && property_exists($group_settings->settings, 'currency_id') && isset($group_settings->settings->currency_id)) { - $settings->currency_id = (string)$group_settings->settings->currency_id; + $settings->currency_id = (string) $group_settings->settings->currency_id; } else { - $settings->currency_id = (string)auth()->user()->company()->settings->currency_id; + $settings->currency_id = (string) auth()->user()->company()->settings->currency_id; } - } elseif (!property_exists($settings, 'currency_id')) { - $settings->currency_id = (string)auth()->user()->company()->settings->currency_id; - } + } elseif (! property_exists($settings, 'currency_id')) { + $settings->currency_id = (string) auth()->user()->company()->settings->currency_id; + } if (isset($input['currency_code'])) { $settings->currency_id = $this->getCurrencyCode($input['currency_code']); @@ -118,13 +116,12 @@ class StoreClientRequest extends Request $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); } - //Filter the client contact password - if it is sent with ***** we should ignore it! if (isset($contact['password'])) { if (strlen($contact['password']) == 0) { $input['contacts'][$key]['password'] = ''; } else { - $contact['password'] = str_replace("*", "", $contact['password']); + $contact['password'] = str_replace('*', '', $contact['password']); if (strlen($contact['password']) == 0) { unset($input['contacts'][$key]['password']); @@ -134,11 +131,11 @@ class StoreClientRequest extends Request } } - if(isset($input['country_code'])) { + if (isset($input['country_code'])) { $input['country_id'] = $this->getCountryCode($input['country_code']); } - if(isset($input['shipping_country_code'])) { + if (isset($input['shipping_country_code'])) { $input['shipping_country_id'] = $this->getCountryCode($input['shipping_country_code']); } @@ -157,8 +154,8 @@ class StoreClientRequest extends Request private function getCountryCode($country_code) { $countries = Cache::get('countries'); - - $country = $countries->filter(function ($item) use($country_code) { + + $country = $countries->filter(function ($item) use ($country_code) { return $item->iso_3166_2 == $country_code || $item->iso_3166_3 == $country_code; })->first(); @@ -168,12 +165,11 @@ class StoreClientRequest extends Request private function getCurrencyCode($code) { $currencies = Cache::get('currencies'); - - $currency = $currencies->filter(function ($item) use($code){ + + $currency = $currencies->filter(function ($item) use ($code) { return $item->code == $code; })->first(); return (string) $currency->id; } - } diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index d36ae72ab873..42a05dd6db6e 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->client); @@ -45,19 +45,19 @@ class UpdateClientRequest extends Request $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } - + $rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; $rules['industry_id'] = 'integer|nullable'; $rules['size_id'] = 'integer|nullable'; $rules['country_id'] = 'integer|nullable'; $rules['shipping_country_id'] = 'integer|nullable'; //$rules['id_number'] = 'unique:clients,id_number,,id,company_id,' . auth()->user()->company()->id; - $rules['id_number'] = 'unique:clients,id_number,' . $this->id . ',id,company_id,' . $this->company_id; + $rules['id_number'] = 'unique:clients,id_number,'.$this->id.',id,company_id,'.$this->company_id; $rules['settings'] = new ValidClientGroupSettingsRule(); $rules['contacts.*.email'] = 'nullable|distinct'; $rules['contacts.*.password'] = [ @@ -87,7 +87,7 @@ class UpdateClientRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + if (isset($input['group_settings_id'])) { $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); } @@ -104,13 +104,12 @@ class UpdateClientRequest extends Request $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); } - //Filter the client contact password - if it is sent with ***** we should ignore it! if (isset($contact['password'])) { if (strlen($contact['password']) == 0) { $input['contacts'][$key]['password'] = ''; } else { - $contact['password'] = str_replace("*", "", $contact['password']); + $contact['password'] = str_replace('*', '', $contact['password']); if (strlen($contact['password']) == 0) { unset($input['contacts'][$key]['password']); @@ -120,20 +119,20 @@ class UpdateClientRequest extends Request } } - if(array_key_exists('settings', $input)) + if (array_key_exists('settings', $input)) { $input['settings'] = $this->filterSaveableSettings($input['settings']); + } $this->replace($input); } - /** * For the hosted platform, we restrict the feature settings. * - * This method will trim the company settings object - * down to the free plan setting properties which + * This method will trim the company settings object + * down to the free plan setting properties which * are saveable - * + * * @param object $settings * @return object $settings */ @@ -141,19 +140,18 @@ class UpdateClientRequest extends Request { $account = $this->client->company->account; - if(!$account->isFreeHostedClient()) + if (! $account->isFreeHostedClient()) { return $settings; + } $saveable_casts = CompanySettings::$free_plan_casts; - foreach($settings as $key => $value){ - - if(!array_key_exists($key, $saveable_casts)) + foreach ($settings as $key => $value) { + if (! array_key_exists($key, $saveable_casts)) { unset($settings->{$key}); - + } } - - return $settings; + return $settings; } } diff --git a/app/Http/Requests/ClientPortal/Payments/PaymentResponseRequest.php b/app/Http/Requests/ClientPortal/Payments/PaymentResponseRequest.php index 0302bf7dd1b9..d37a42a1b756 100644 --- a/app/Http/Requests/ClientPortal/Payments/PaymentResponseRequest.php +++ b/app/Http/Requests/ClientPortal/Payments/PaymentResponseRequest.php @@ -34,6 +34,6 @@ class PaymentResponseRequest extends FormRequest { $input = $this->all(); - return PaymentHash::whereRaw("BINARY `hash`= ?", [$input['payment_hash']])->first(); + return PaymentHash::whereRaw('BINARY `hash`= ?', [$input['payment_hash']])->first(); } } diff --git a/app/Http/Requests/ClientPortal/RegisterRequest.php b/app/Http/Requests/ClientPortal/RegisterRequest.php index 52bac1abd763..39808840aed7 100644 --- a/app/Http/Requests/ClientPortal/RegisterRequest.php +++ b/app/Http/Requests/ClientPortal/RegisterRequest.php @@ -38,7 +38,7 @@ class RegisterRequest extends FormRequest if ($this->subdomain) { return Company::where('subdomain', $this->subdomain)->firstOrFail(); } - + if ($this->company_key) { return Company::where('company_key', $this->company_key)->firstOrFail(); } diff --git a/app/Http/Requests/ClientPortal/ShowInvoiceRequest.php b/app/Http/Requests/ClientPortal/ShowInvoiceRequest.php index 277ebe16f4b6..0c9a317a1f14 100644 --- a/app/Http/Requests/ClientPortal/ShowInvoiceRequest.php +++ b/app/Http/Requests/ClientPortal/ShowInvoiceRequest.php @@ -1,6 +1,6 @@ user()->client->id === $this->invoice->client_id; } } diff --git a/app/Http/Requests/ClientPortal/ShowRecurringInvoiceRequest.php b/app/Http/Requests/ClientPortal/ShowRecurringInvoiceRequest.php index 62dae137725a..5526480176d2 100644 --- a/app/Http/Requests/ClientPortal/ShowRecurringInvoiceRequest.php +++ b/app/Http/Requests/ClientPortal/ShowRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->client->id === $this->recurring_invoice->client_id; diff --git a/app/Http/Requests/ClientPortal/StoreDocumentRequest.php b/app/Http/Requests/ClientPortal/StoreDocumentRequest.php index 9ccdd18a8de8..92ef78102dae 100644 --- a/app/Http/Requests/ClientPortal/StoreDocumentRequest.php +++ b/app/Http/Requests/ClientPortal/StoreDocumentRequest.php @@ -1,6 +1,6 @@ 'required|max:10000|mimes:png,svg,jpeg,gif,jpg,bmp' + 'file' => 'required|max:10000|mimes:png,svg,jpeg,gif,jpg,bmp', ]; } diff --git a/app/Http/Requests/ClientPortal/UpdateClientRequest.php b/app/Http/Requests/ClientPortal/UpdateClientRequest.php index 069d93c98979..1e9ef364694c 100644 --- a/app/Http/Requests/ClientPortal/UpdateClientRequest.php +++ b/app/Http/Requests/ClientPortal/UpdateClientRequest.php @@ -1,6 +1,6 @@ encodePrimaryKey(auth()->user()->id) === request()->segment(3); @@ -33,7 +32,7 @@ class UpdateClientRequest extends Request { return [ 'name' => 'sometimes|required', - 'file' => 'sometimes|nullable|max:100000|mimes:png,svg,jpeg,gif,jpg,bmp' + 'file' => 'sometimes|nullable|max:100000|mimes:png,svg,jpeg,gif,jpg,bmp', ]; } } diff --git a/app/Http/Requests/ClientPortal/UpdateContactRequest.php b/app/Http/Requests/ClientPortal/UpdateContactRequest.php index 282b55abc7d6..de9e61df9ab2 100644 --- a/app/Http/Requests/ClientPortal/UpdateContactRequest.php +++ b/app/Http/Requests/ClientPortal/UpdateContactRequest.php @@ -1,6 +1,6 @@ encodePrimaryKey(auth()->user()->id) === request()->segment(3); @@ -35,7 +34,7 @@ class UpdateContactRequest extends Request return [ 'first_name' => 'required', 'last_name' => 'required', - 'email' => 'required|email|unique:client_contacts,email,' . auth()->user()->id, + 'email' => 'required|email|unique:client_contacts,email,'.auth()->user()->id, 'password' => 'sometimes|nullable|min:6|confirmed', ]; } diff --git a/app/Http/Requests/ClientPortal/Uploads/StoreUploadRequest.php b/app/Http/Requests/ClientPortal/Uploads/StoreUploadRequest.php index f3432b0989a4..5dfe26098b61 100644 --- a/app/Http/Requests/ClientPortal/Uploads/StoreUploadRequest.php +++ b/app/Http/Requests/ClientPortal/Uploads/StoreUploadRequest.php @@ -31,8 +31,8 @@ class StoreUploadRequest extends FormRequest /** * Since saveDocuments() expects an array of uploaded files, * we need to convert it to an array before uploading. - * - * @return mixed + * + * @return mixed */ public function getFile() { diff --git a/app/Http/Requests/Company/CreateCompanyRequest.php b/app/Http/Requests/Company/CreateCompanyRequest.php index c7fc0df2bcc5..49366303c0ce 100644 --- a/app/Http/Requests/Company/CreateCompanyRequest.php +++ b/app/Http/Requests/Company/CreateCompanyRequest.php @@ -1,6 +1,6 @@ user()->can('create', Company::class); diff --git a/app/Http/Requests/Company/DestroyCompanyRequest.php b/app/Http/Requests/Company/DestroyCompanyRequest.php index 879810928e4b..5dc36fe1c50f 100644 --- a/app/Http/Requests/Company/DestroyCompanyRequest.php +++ b/app/Http/Requests/Company/DestroyCompanyRequest.php @@ -1,6 +1,6 @@ user()->isOwner(); diff --git a/app/Http/Requests/Company/EditCompanyRequest.php b/app/Http/Requests/Company/EditCompanyRequest.php index 28befc00a638..61fe10825f7e 100644 --- a/app/Http/Requests/Company/EditCompanyRequest.php +++ b/app/Http/Requests/Company/EditCompanyRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->company); @@ -30,11 +29,10 @@ class EditCompanyRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/Company/ShowCompanyRequest.php b/app/Http/Requests/Company/ShowCompanyRequest.php index affd4f7d4590..f8d384eb4a36 100644 --- a/app/Http/Requests/Company/ShowCompanyRequest.php +++ b/app/Http/Requests/Company/ShowCompanyRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->company); diff --git a/app/Http/Requests/Company/StoreCompanyRequest.php b/app/Http/Requests/Company/StoreCompanyRequest.php index 5f482cba6881..4d4ec7794a99 100644 --- a/app/Http/Requests/Company/StoreCompanyRequest.php +++ b/app/Http/Requests/Company/StoreCompanyRequest.php @@ -1,6 +1,6 @@ user()->can('create', Company::class); @@ -40,13 +40,13 @@ class StoreCompanyRequest extends Request $rules['name'] = new ValidCompanyQuantity(); $rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb $rules['settings'] = new ValidSettingsRule(); - + if (isset($rules['portal_mode']) && ($rules['portal_mode'] == 'domain' || $rules['portal_mode'] == 'iframe')) { $rules['portal_domain'] = 'sometimes|url'; } else { $rules['portal_domain'] = 'nullable|alpha_num'; } - + return $rules; } @@ -60,12 +60,12 @@ class StoreCompanyRequest extends Request $company_settings = CompanySettings::defaults(); - if (array_key_exists('settings', $input) && !empty($input['settings'])) { + if (array_key_exists('settings', $input) && ! empty($input['settings'])) { foreach ($input['settings'] as $key => $value) { $company_settings->{$key} = $value; } } - + $this->replace($input); } } diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index 6ee9886c593a..e1b3b32b37ef 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->company); } - public function rules() { $rules = []; @@ -60,11 +59,11 @@ class UpdateCompanyRequest extends Request protected function prepareForValidation() { - $input = $this->all(); - - if(array_key_exists('settings', $input)) - $input['settings'] = $this->filterSaveableSettings($input['settings']); + + if (array_key_exists('settings', $input)) { + $input['settings'] = $this->filterSaveableSettings($input['settings']); + } $this->replace($input); } @@ -72,10 +71,10 @@ class UpdateCompanyRequest extends Request /** * For the hosted platform, we restrict the feature settings. * - * This method will trim the company settings object - * down to the free plan setting properties which + * This method will trim the company settings object + * down to the free plan setting properties which * are saveable - * + * * @param object $settings * @return object $settings */ @@ -83,20 +82,18 @@ class UpdateCompanyRequest extends Request { $account = $this->company->account; - if(!$account->isFreeHostedClient()) + if (! $account->isFreeHostedClient()) { return $settings; + } $saveable_casts = CompanySettings::$free_plan_casts; - foreach($settings as $key => $value){ - - if(!array_key_exists($key, $saveable_casts)) + foreach ($settings as $key => $value) { + if (! array_key_exists($key, $saveable_casts)) { unset($settings->{$key}); - + } } - + return $settings; - } - } diff --git a/app/Http/Requests/CompanyGateway/CreateCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/CreateCompanyGatewayRequest.php index 65316a38bff6..0efb4bce2657 100644 --- a/app/Http/Requests/CompanyGateway/CreateCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/CreateCompanyGatewayRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php index 015ee90708e2..5536510e14f3 100644 --- a/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/DestroyCompanyGatewayRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -30,11 +29,10 @@ class DestroyCompanyGatewayRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php index 0bc18c7427d6..ca0ed422fe78 100644 --- a/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/EditCompanyGatewayRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -30,11 +29,10 @@ class EditCompanyGatewayRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php index c2bdc0eb2e69..5684885b9c15 100644 --- a/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/ShowCompanyGatewayRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -30,11 +29,10 @@ class ShowCompanyGatewayRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php index 050bcd6a9de9..65ad9eb5e8ff 100644 --- a/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/StoreCompanyGatewayRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -36,7 +36,7 @@ class StoreCompanyGatewayRequest extends Request 'gateway_key' => 'required', 'fees_and_limits' => new ValidCompanyGatewayFeesAndLimitsRule(), ]; - + return $rules; } @@ -44,22 +44,18 @@ class StoreCompanyGatewayRequest extends Request { $input = $this->all(); $gateway = Gateway::where('key', $input['gateway_key'])->first(); - + $default_gateway_fields = json_decode($gateway->fields); - + /*Force gateway properties */ - if(isset($input['config']) && is_object(json_decode($input['config']))) - { - foreach(json_decode($input['config']) as $key => $value) { - + if (isset($input['config']) && is_object(json_decode($input['config']))) { + foreach (json_decode($input['config']) as $key => $value) { $default_gateway_fields->{$key} = $value; - } $input['config'] = json_encode($default_gateway_fields); } - if (isset($input['config'])) { $input['config'] = encrypt($input['config']); } @@ -68,7 +64,6 @@ class StoreCompanyGatewayRequest extends Request $input['fees_and_limits'] = $this->cleanFeesAndLimits($input['fees_and_limits']); } - $this->replace($input); } } diff --git a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php index 4c9974658312..6f86a96a2a55 100644 --- a/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php +++ b/app/Http/Requests/CompanyGateway/UpdateCompanyGatewayRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -37,7 +36,7 @@ class UpdateCompanyGatewayRequest extends Request $rules = [ 'fees_and_limits' => new ValidCompanyGatewayFeesAndLimitsRule(), ]; - + return $rules; } @@ -46,15 +45,12 @@ class UpdateCompanyGatewayRequest extends Request $input = $this->all(); /*Force gateway properties */ - if(isset($input['config']) && is_object(json_decode($input['config'])) && array_key_exists('gateway_key', $input)) - { + if (isset($input['config']) && is_object(json_decode($input['config'])) && array_key_exists('gateway_key', $input)) { $gateway = Gateway::where('key', $input['gateway_key'])->first(); $default_gateway_fields = json_decode($gateway->fields); - foreach(json_decode($input['config']) as $key => $value) { - + foreach (json_decode($input['config']) as $key => $value) { $default_gateway_fields->{$key} = $value; - } $input['config'] = json_encode($default_gateway_fields); diff --git a/app/Http/Requests/CompanyLedger/ShowCompanyLedgerRequest.php b/app/Http/Requests/CompanyLedger/ShowCompanyLedgerRequest.php index 3b6ba1930bf3..4eaecd85bf35 100644 --- a/app/Http/Requests/CompanyLedger/ShowCompanyLedgerRequest.php +++ b/app/Http/Requests/CompanyLedger/ShowCompanyLedgerRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php b/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php index 97aafe839080..21e3ae44d597 100644 --- a/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php +++ b/app/Http/Requests/CompanyUser/UpdateCompanyUserRequest.php @@ -1,6 +1,6 @@ user()->isAdmin() || (auth()->user()->id == $this->user->id); } - public function rules() { return []; diff --git a/app/Http/Requests/Credit/StoreCreditRequest.php b/app/Http/Requests/Credit/StoreCreditRequest.php index 4b18e185affc..5c16189330f7 100644 --- a/app/Http/Requests/Credit/StoreCreditRequest.php +++ b/app/Http/Requests/Credit/StoreCreditRequest.php @@ -36,14 +36,14 @@ class StoreCreditRequest extends FormRequest $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id; - + $rules['number'] = new UniqueCreditNumberRule($this->all()); return $rules; @@ -67,7 +67,7 @@ class StoreCreditRequest extends FormRequest if (isset($input['client_contacts'])) { foreach ($input['client_contacts'] as $key => $contact) { - if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { unset($input['client_contacts'][$key]); } } diff --git a/app/Http/Requests/Credit/UpdateCreditRequest.php b/app/Http/Requests/Credit/UpdateCreditRequest.php index 97a951df955b..03e7ca722116 100644 --- a/app/Http/Requests/Credit/UpdateCreditRequest.php +++ b/app/Http/Requests/Credit/UpdateCreditRequest.php @@ -36,19 +36,19 @@ class UpdateCreditRequest extends FormRequest $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } - if($this->input('number')) - $rules['number'] = 'unique:credits,number,' . $this->id . ',id,company_id,' . $this->credit->company_id; - + if ($this->input('number')) { + $rules['number'] = 'unique:credits,number,'.$this->id.',id,company_id,'.$this->credit->company_id; + } + return $rules; } - protected function prepareForValidation() { $input = $this->all(); @@ -56,7 +56,7 @@ class UpdateCreditRequest extends FormRequest if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - + if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } @@ -64,7 +64,7 @@ class UpdateCreditRequest extends FormRequest if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + if (isset($input['invitations'])) { foreach ($input['invitations'] as $key => $value) { if (is_numeric($input['invitations'][$key]['id'])) { @@ -80,7 +80,7 @@ class UpdateCreditRequest extends FormRequest } } } - + $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; $input['id'] = $this->credit->id; diff --git a/app/Http/Requests/Design/CreateDesignRequest.php b/app/Http/Requests/Design/CreateDesignRequest.php index 9865821437d2..d2ae4b64ee77 100644 --- a/app/Http/Requests/Design/CreateDesignRequest.php +++ b/app/Http/Requests/Design/CreateDesignRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Design/DestroyDesignRequest.php b/app/Http/Requests/Design/DestroyDesignRequest.php index 4a357e4cedb5..dd55733f51cf 100644 --- a/app/Http/Requests/Design/DestroyDesignRequest.php +++ b/app/Http/Requests/Design/DestroyDesignRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Design/EditDesignRequest.php b/app/Http/Requests/Design/EditDesignRequest.php index 8d1a480d3fe1..b952e9840c7a 100644 --- a/app/Http/Requests/Design/EditDesignRequest.php +++ b/app/Http/Requests/Design/EditDesignRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -40,11 +39,11 @@ class StoreDesignRequest extends Request { $input = $this->all(); - if (!array_key_exists('product', $input['design']) || is_null($input['design']['product'])) { + if (! array_key_exists('product', $input['design']) || is_null($input['design']['product'])) { $input['design']['product'] = ''; } - if (!array_key_exists('task', $input['design']) || is_null($input['design']['task'])) { + if (! array_key_exists('task', $input['design']) || is_null($input['design']['task'])) { $input['design']['task'] = ''; } diff --git a/app/Http/Requests/Design/UpdateDesignRequest.php b/app/Http/Requests/Design/UpdateDesignRequest.php index d08fabf743ec..e042a4b366a9 100644 --- a/app/Http/Requests/Design/UpdateDesignRequest.php +++ b/app/Http/Requests/Design/UpdateDesignRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -39,11 +39,11 @@ class UpdateDesignRequest extends Request { $input = $this->all(); - if (!array_key_exists('product', $input['design']) || is_null($input['design']['product'])) { + if (! array_key_exists('product', $input['design']) || is_null($input['design']['product'])) { $input['design']['product'] = ''; } - if (!array_key_exists('task', $input['design']) || is_null($input['design']['task'])) { + if (! array_key_exists('task', $input['design']) || is_null($input['design']['task'])) { $input['design']['task'] = ''; } diff --git a/app/Http/Requests/Document/CreateDocumentRequest.php b/app/Http/Requests/Document/CreateDocumentRequest.php index 8ced17f27f8c..56b19d8b6ccf 100644 --- a/app/Http/Requests/Document/CreateDocumentRequest.php +++ b/app/Http/Requests/Document/CreateDocumentRequest.php @@ -1,6 +1,6 @@ user()->can('create', Document::class); diff --git a/app/Http/Requests/Document/DestroyDocumentRequest.php b/app/Http/Requests/Document/DestroyDocumentRequest.php index ace927265763..20c5fc19726e 100644 --- a/app/Http/Requests/Document/DestroyDocumentRequest.php +++ b/app/Http/Requests/Document/DestroyDocumentRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->document); diff --git a/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php b/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php index e2018a6d38ec..ffe8cd68064c 100644 --- a/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php +++ b/app/Http/Requests/Document/DownloadMultipleDocumentsRequest.php @@ -1,7 +1,7 @@ user()->can('create', Document::class); @@ -37,7 +36,6 @@ class StoreDocumentRequest extends Request { $input = $this->all(); - $this->replace($input); } } diff --git a/app/Http/Requests/Document/UpdateDocumentRequest.php b/app/Http/Requests/Document/UpdateDocumentRequest.php index e707791a5439..9557e80d3098 100644 --- a/app/Http/Requests/Document/UpdateDocumentRequest.php +++ b/app/Http/Requests/Document/UpdateDocumentRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->document); diff --git a/app/Http/Requests/Email/SendEmailRequest.php b/app/Http/Requests/Email/SendEmailRequest.php index e0a2a5bfbea0..6b573d030607 100644 --- a/app/Http/Requests/Email/SendEmailRequest.php +++ b/app/Http/Requests/Email/SendEmailRequest.php @@ -1,6 +1,6 @@ "required", - "entity" => "required", - "entity_id" => "required", - "subject" => "required", - "body" => "required", + 'template' => 'required', + 'entity' => 'required', + 'entity_id' => 'required', + 'subject' => 'required', + 'body' => 'required', ]; } @@ -54,12 +54,12 @@ class SendEmailRequest extends Request $input['template'] = ''; } - if (!property_exists($settings, $input['template'])) { + if (! property_exists($settings, $input['template'])) { unset($input['template']); } $input['entity_id'] = $this->decodePrimaryKey($input['entity_id']); - $input['entity'] = "App\Models\\". ucfirst($input['entity']); + $input['entity'] = "App\Models\\".ucfirst($input['entity']); $this->replace($input); } diff --git a/app/Http/Requests/GroupSetting/CreateGroupSettingRequest.php b/app/Http/Requests/GroupSetting/CreateGroupSettingRequest.php index f9ddb53ebc14..43197401d78b 100644 --- a/app/Http/Requests/GroupSetting/CreateGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/CreateGroupSettingRequest.php @@ -1,6 +1,6 @@ user()->can('create', GroupSetting::class); diff --git a/app/Http/Requests/GroupSetting/DestroyGroupSettingRequest.php b/app/Http/Requests/GroupSetting/DestroyGroupSettingRequest.php index 903c682f8b06..daff63dacec7 100644 --- a/app/Http/Requests/GroupSetting/DestroyGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/DestroyGroupSettingRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->group_setting); diff --git a/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php b/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php index 1a63aad84df1..7581f5a33708 100644 --- a/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/EditGroupSettingRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->group_setting); diff --git a/app/Http/Requests/GroupSetting/ShowGroupSettingRequest.php b/app/Http/Requests/GroupSetting/ShowGroupSettingRequest.php index 4405d70bcc31..661639d89bba 100644 --- a/app/Http/Requests/GroupSetting/ShowGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/ShowGroupSettingRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->group_setting); diff --git a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php index 32cdfe87d898..3a70da5fc97f 100644 --- a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php @@ -1,6 +1,6 @@ user()->can('create', GroupSetting::class); @@ -41,26 +40,24 @@ class StoreGroupSettingRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + $group_settings = ClientSettings::defaults(); - - if (array_key_exists('settings', $input) && !empty($input['settings'])) { + + if (array_key_exists('settings', $input) && ! empty($input['settings'])) { foreach ($input['settings'] as $key => $value) { $group_settings->{$key} = $value; } } - - $input['settings'] = $group_settings; + $input['settings'] = $group_settings; $this->replace($input); } - public function messages() { return [ - 'settings' => 'settings must be a valid json structure' + 'settings' => 'settings must be a valid json structure', ]; } } diff --git a/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php b/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php index 4389d419aab6..f442508832ef 100644 --- a/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/UpdateGroupSettingRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->group_setting); @@ -34,7 +33,7 @@ class UpdateGroupSettingRequest extends Request public function rules() { $rules['settings'] = new ValidClientGroupSettingsRule(); - + return $rules; } @@ -42,19 +41,20 @@ class UpdateGroupSettingRequest extends Request { $input = $this->all(); - if(array_key_exists('settings', $input)) - $input['settings'] = $this->filterSaveableSettings($input['settings']); - + if (array_key_exists('settings', $input)) { + $input['settings'] = $this->filterSaveableSettings($input['settings']); + } + $this->replace($input); } /** * For the hosted platform, we restrict the feature settings. * - * This method will trim the company settings object - * down to the free plan setting properties which + * This method will trim the company settings object + * down to the free plan setting properties which * are saveable - * + * * @param object $settings * @return object $settings */ @@ -62,20 +62,18 @@ class UpdateGroupSettingRequest extends Request { $account = $this->group_setting->company->account; - if(!$account->isFreeHostedClient()) + if (! $account->isFreeHostedClient()) { return $settings; + } $saveable_casts = CompanySettings::$free_plan_casts; - foreach($settings as $key => $value){ - - if(!array_key_exists($key, $saveable_casts)) + foreach ($settings as $key => $value) { + if (! array_key_exists($key, $saveable_casts)) { unset($settings->{$key}); - + } } - + return $settings; - } - } diff --git a/app/Http/Requests/Invoice/CreateInvoiceRequest.php b/app/Http/Requests/Invoice/CreateInvoiceRequest.php index f80abbea2f7c..314ee47c68ed 100644 --- a/app/Http/Requests/Invoice/CreateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/CreateInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('create', Invoice::class); diff --git a/app/Http/Requests/Invoice/DestroyInvoiceRequest.php b/app/Http/Requests/Invoice/DestroyInvoiceRequest.php index 2a7455ead7fc..a7fcdff45089 100644 --- a/app/Http/Requests/Invoice/DestroyInvoiceRequest.php +++ b/app/Http/Requests/Invoice/DestroyInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->invoice); diff --git a/app/Http/Requests/Invoice/EditInvoiceRequest.php b/app/Http/Requests/Invoice/EditInvoiceRequest.php index 03809bb7ae00..89b918c46a2a 100644 --- a/app/Http/Requests/Invoice/EditInvoiceRequest.php +++ b/app/Http/Requests/Invoice/EditInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->invoice); diff --git a/app/Http/Requests/Invoice/ShowInvoiceRequest.php b/app/Http/Requests/Invoice/ShowInvoiceRequest.php index 4121dd12aaec..1ed386c5c180 100644 --- a/app/Http/Requests/Invoice/ShowInvoiceRequest.php +++ b/app/Http/Requests/Invoice/ShowInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->invoice); diff --git a/app/Http/Requests/Invoice/StoreInvoiceRequest.php b/app/Http/Requests/Invoice/StoreInvoiceRequest.php index dfcc0ba9ca7d..5d8555bd9530 100644 --- a/app/Http/Requests/Invoice/StoreInvoiceRequest.php +++ b/app/Http/Requests/Invoice/StoreInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('create', Invoice::class); @@ -42,7 +41,7 @@ class StoreInvoiceRequest extends Request $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -53,7 +52,7 @@ class StoreInvoiceRequest extends Request $rules['invitations.*.client_contact_id'] = 'distinct'; $rules['number'] = new UniqueInvoiceNumberRule($this->all()); - + return $rules; } @@ -75,7 +74,7 @@ class StoreInvoiceRequest extends Request if (isset($input['client_contacts'])) { foreach ($input['client_contacts'] as $key => $contact) { - if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { unset($input['client_contacts'][$key]); } } diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index a78cb6626a4c..a38cbe90f14d 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->invoice); } - public function rules() { - $rules = []; if ($this->input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -54,8 +51,9 @@ class UpdateInvoiceRequest extends Request $rules['id'] = new LockedInvoiceRule($this->invoice); - if($this->input('number')) - $rules['number'] = 'unique:invoices,number,' . $this->id . ',id,company_id,' . $this->invoice->company_id; + if ($this->input('number')) { + $rules['number'] = 'unique:invoices,number,'.$this->id.',id,company_id,'.$this->invoice->company_id; + } return $rules; } @@ -63,11 +61,11 @@ class UpdateInvoiceRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - + if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } diff --git a/app/Http/Requests/Migration/UploadMigrationFileRequest.php b/app/Http/Requests/Migration/UploadMigrationFileRequest.php index f630f9e991d5..0900f634a34c 100644 --- a/app/Http/Requests/Migration/UploadMigrationFileRequest.php +++ b/app/Http/Requests/Migration/UploadMigrationFileRequest.php @@ -27,7 +27,7 @@ class UploadMigrationFileRequest extends FormRequest 'migration' => [], ]; - /** We'll skip mime validation while running tests. */ + /* We'll skip mime validation while running tests. */ if (app()->environment() !== 'testing') { $rules['migration'] = ['required', 'file', 'mimes:zip']; } diff --git a/app/Http/Requests/Payment/ActionPaymentRequest.php b/app/Http/Requests/Payment/ActionPaymentRequest.php index d0aacd23f4ba..de1110778ae6 100644 --- a/app/Http/Requests/Payment/ActionPaymentRequest.php +++ b/app/Http/Requests/Payment/ActionPaymentRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->payment); diff --git a/app/Http/Requests/Payment/CreatePaymentRequest.php b/app/Http/Requests/Payment/CreatePaymentRequest.php index 0cca1ff08331..ba659de71ad7 100644 --- a/app/Http/Requests/Payment/CreatePaymentRequest.php +++ b/app/Http/Requests/Payment/CreatePaymentRequest.php @@ -1,6 +1,6 @@ user()->can('create', Payment::class); diff --git a/app/Http/Requests/Payment/DestroyPaymentRequest.php b/app/Http/Requests/Payment/DestroyPaymentRequest.php index f1bf3122ed95..6bc33ccc3f88 100644 --- a/app/Http/Requests/Payment/DestroyPaymentRequest.php +++ b/app/Http/Requests/Payment/DestroyPaymentRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->payment) && $this->payment->is_deleted === false; diff --git a/app/Http/Requests/Payment/EditPaymentRequest.php b/app/Http/Requests/Payment/EditPaymentRequest.php index 374bc5d267f4..db6c0e3dd5de 100644 --- a/app/Http/Requests/Payment/EditPaymentRequest.php +++ b/app/Http/Requests/Payment/EditPaymentRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->payment); @@ -30,11 +29,10 @@ class EditPaymentRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/Payment/RefundPaymentRequest.php b/app/Http/Requests/Payment/RefundPaymentRequest.php index 7a586e2f0efe..5d4f9285c2e3 100644 --- a/app/Http/Requests/Payment/RefundPaymentRequest.php +++ b/app/Http/Requests/Payment/RefundPaymentRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); } - + protected function prepareForValidation() { $input = $this->all(); - - if (!isset($input['gateway_refund'])) { + + if (! isset($input['gateway_refund'])) { $input['gateway_refund'] = false; } - if (!isset($input['send_email'])) { + if (! isset($input['send_email'])) { $input['send_email'] = false; } diff --git a/app/Http/Requests/Payment/ShowPaymentRequest.php b/app/Http/Requests/Payment/ShowPaymentRequest.php index 80541d34f937..3f8b5f6a714d 100644 --- a/app/Http/Requests/Payment/ShowPaymentRequest.php +++ b/app/Http/Requests/Payment/ShowPaymentRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->payment); diff --git a/app/Http/Requests/Payment/StorePaymentRequest.php b/app/Http/Requests/Payment/StorePaymentRequest.php index 9194aff53356..60e178160c25 100644 --- a/app/Http/Requests/Payment/StorePaymentRequest.php +++ b/app/Http/Requests/Payment/StorePaymentRequest.php @@ -1,6 +1,6 @@ user()->can('create', Payment::class); @@ -51,7 +50,7 @@ class StorePaymentRequest extends Request if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + if (isset($input['invoices']) && is_array($input['invoices']) !== false) { foreach ($input['invoices'] as $key => $value) { $input['invoices'][$key]['invoice_id'] = $this->decodePrimaryKey($value['invoice_id']); @@ -76,17 +75,17 @@ class StorePaymentRequest extends Request $input['credits'] = null; } - if (!isset($input['amount']) || $input['amount'] == 0) { + if (! isset($input['amount']) || $input['amount'] == 0) { //$input['amount'] = $invoices_total - $credits_total; $input['amount'] = $invoices_total; } $input['is_manual'] = true; - - if(!isset($input['date'])) { + + if (! isset($input['date'])) { $input['date'] = now()->format('Y-m-d'); } - + $this->replace($input); } @@ -94,7 +93,7 @@ class StorePaymentRequest extends Request { $rules = [ 'amount' => 'numeric|required', - 'amount' => [new PaymentAmountsBalanceRule(),new ValidCreditsPresentRule()], + 'amount' => [new PaymentAmountsBalanceRule(), new ValidCreditsPresentRule()], //'date' => 'required', 'client_id' => 'bail|required|exists:clients,id', 'invoices.*.invoice_id' => 'required|distinct|exists:invoices,id', @@ -104,16 +103,15 @@ class StorePaymentRequest extends Request 'credits.*.credit_id' => new ValidCreditsRules($this->all()), 'credits.*.amount' => 'required', 'invoices' => new ValidPayableInvoicesRule(), - 'number' => 'nullable|unique:payments,number,' . $this->id . ',id,company_id,' . $this->company_id, + 'number' => 'nullable|unique:payments,number,'.$this->id.',id,company_id,'.$this->company_id, //'number' => 'nullable', ]; - if ($this->input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; diff --git a/app/Http/Requests/Payment/UpdatePaymentRequest.php b/app/Http/Requests/Payment/UpdatePaymentRequest.php index 801c55654a32..910ef9002d1f 100644 --- a/app/Http/Requests/Payment/UpdatePaymentRequest.php +++ b/app/Http/Requests/Payment/UpdatePaymentRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->payment); } - public function rules() {//min:1 removed, 'required' $rules = [ - 'invoices' => ['array',new PaymentAppliedValidAmount,new ValidCreditsPresentRule], + 'invoices' => ['array', new PaymentAppliedValidAmount, new ValidCreditsPresentRule], 'invoices.*.invoice_id' => 'distinct', 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', - 'number' => 'nullable|unique:payments,number,' . $this->id . ',id,company_id,' . $this->company_id, + 'number' => 'nullable|unique:payments,number,'.$this->id.',id,company_id,'.$this->company_id, ]; if ($this->input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } - return $rules; } @@ -64,11 +62,11 @@ class UpdatePaymentRequest extends Request if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + if (isset($input['client_id'])) { unset($input['client_id']); } - + if (isset($input['amount'])) { unset($input['amount']); } diff --git a/app/Http/Requests/PaymentTerm/ActionPaymentTermRequest.php b/app/Http/Requests/PaymentTerm/ActionPaymentTermRequest.php index 6f0dbd5b1900..9e181b701802 100644 --- a/app/Http/Requests/PaymentTerm/ActionPaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/ActionPaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/PaymentTerm/CreatePaymentTermRequest.php b/app/Http/Requests/PaymentTerm/CreatePaymentTermRequest.php index afdeb2fdfc3a..5cb29f5cdcf0 100644 --- a/app/Http/Requests/PaymentTerm/CreatePaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/CreatePaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/PaymentTerm/DestroyPaymentTermRequest.php b/app/Http/Requests/PaymentTerm/DestroyPaymentTermRequest.php index b7d271d2cf2d..a16b8d314cf2 100644 --- a/app/Http/Requests/PaymentTerm/DestroyPaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/DestroyPaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/PaymentTerm/EditPaymentTermRequest.php b/app/Http/Requests/PaymentTerm/EditPaymentTermRequest.php index 3c9049c930a0..4d2f55a09530 100644 --- a/app/Http/Requests/PaymentTerm/EditPaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/EditPaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -30,11 +29,10 @@ class EditPaymentTermRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/PaymentTerm/ShowPaymentTermRequest.php b/app/Http/Requests/PaymentTerm/ShowPaymentTermRequest.php index 22bb184a4bcd..66bfe05f4b6e 100644 --- a/app/Http/Requests/PaymentTerm/ShowPaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/ShowPaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/PaymentTerm/StorePaymentTermRequest.php b/app/Http/Requests/PaymentTerm/StorePaymentTermRequest.php index 56c89ea67394..c1ea8f6b8b7c 100644 --- a/app/Http/Requests/PaymentTerm/StorePaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/StorePaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -33,7 +32,7 @@ class StorePaymentTermRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + $this->replace($input); } diff --git a/app/Http/Requests/PaymentTerm/UpdatePaymentTermRequest.php b/app/Http/Requests/PaymentTerm/UpdatePaymentTermRequest.php index b6e6c2f40bef..73760fac0977 100644 --- a/app/Http/Requests/PaymentTerm/UpdatePaymentTermRequest.php +++ b/app/Http/Requests/PaymentTerm/UpdatePaymentTermRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); } - public function rules() { return [ diff --git a/app/Http/Requests/Payments/PaymentWebhookRequest.php b/app/Http/Requests/Payments/PaymentWebhookRequest.php index 324bbedfd8ca..48896cd418d1 100644 --- a/app/Http/Requests/Payments/PaymentWebhookRequest.php +++ b/app/Http/Requests/Payments/PaymentWebhookRequest.php @@ -22,7 +22,7 @@ class PaymentWebhookRequest extends FormRequest public function company() { - if (!$this->company_key) { + if (! $this->company_key) { return false; } @@ -33,7 +33,7 @@ class PaymentWebhookRequest extends FormRequest public function companyGateway() { - if (!$this->gateway_key || !$this->company_key) { + if (! $this->gateway_key || ! $this->company_key) { return false; } diff --git a/app/Http/Requests/Product/CreateProductRequest.php b/app/Http/Requests/Product/CreateProductRequest.php index df9ee2938d4d..12b5a7a3c92a 100644 --- a/app/Http/Requests/Product/CreateProductRequest.php +++ b/app/Http/Requests/Product/CreateProductRequest.php @@ -1,6 +1,6 @@ user()->can('create', Product::class); diff --git a/app/Http/Requests/Product/DestroyProductRequest.php b/app/Http/Requests/Product/DestroyProductRequest.php index c6bf3665eef2..060c83caf5f4 100644 --- a/app/Http/Requests/Product/DestroyProductRequest.php +++ b/app/Http/Requests/Product/DestroyProductRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->product); diff --git a/app/Http/Requests/Product/EditProductRequest.php b/app/Http/Requests/Product/EditProductRequest.php index 8fa07d752d36..baafaa485745 100644 --- a/app/Http/Requests/Product/EditProductRequest.php +++ b/app/Http/Requests/Product/EditProductRequest.php @@ -1,6 +1,6 @@ user()->can('create', Product::class); @@ -29,12 +28,11 @@ class StoreProductRequest extends Request public function rules() { - if ($this->input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -45,21 +43,20 @@ class StoreProductRequest extends Request $rules['quantity'] = 'numeric'; return $rules; - } protected function prepareForValidation() { $input = $this->all(); - if (!isset($input['quantity']) || $input['quantity'] < 1) { + if (! isset($input['quantity']) || $input['quantity'] < 1) { $input['quantity'] = 1; } if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + $this->replace($input); } } diff --git a/app/Http/Requests/Product/UpdateProductRequest.php b/app/Http/Requests/Product/UpdateProductRequest.php index d735a2653ded..c8bdfe25c58d 100644 --- a/app/Http/Requests/Product/UpdateProductRequest.php +++ b/app/Http/Requests/Product/UpdateProductRequest.php @@ -1,6 +1,6 @@ user()->can('create', Product::class); @@ -32,12 +32,11 @@ class UpdateProductRequest extends Request public function rules() { - if ($this->input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -48,22 +47,20 @@ class UpdateProductRequest extends Request $rules['quantity'] = 'numeric'; return $rules; - } - protected function prepareForValidation() { $input = $this->all(); - if (!isset($input['quantity']) || $input['quantity'] < 1) { + if (! isset($input['quantity']) || $input['quantity'] < 1) { $input['quantity'] = 1; } if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + $this->replace($input); } } diff --git a/app/Http/Requests/Quote/ActionQuoteRequest.php b/app/Http/Requests/Quote/ActionQuoteRequest.php index befb247f2e72..6300619f706f 100644 --- a/app/Http/Requests/Quote/ActionQuoteRequest.php +++ b/app/Http/Requests/Quote/ActionQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->quote); diff --git a/app/Http/Requests/Quote/CreateQuoteRequest.php b/app/Http/Requests/Quote/CreateQuoteRequest.php index d0fae300a8ac..4a70c2a1ea28 100644 --- a/app/Http/Requests/Quote/CreateQuoteRequest.php +++ b/app/Http/Requests/Quote/CreateQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('create', Quote::class); diff --git a/app/Http/Requests/Quote/DestroyQuoteRequest.php b/app/Http/Requests/Quote/DestroyQuoteRequest.php index 88d93663b5c8..67f4fb755e3f 100644 --- a/app/Http/Requests/Quote/DestroyQuoteRequest.php +++ b/app/Http/Requests/Quote/DestroyQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->quote); diff --git a/app/Http/Requests/Quote/EditQuoteRequest.php b/app/Http/Requests/Quote/EditQuoteRequest.php index 5fbb75b281e9..5f1b7e335e21 100644 --- a/app/Http/Requests/Quote/EditQuoteRequest.php +++ b/app/Http/Requests/Quote/EditQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->quote); diff --git a/app/Http/Requests/Quote/ShowQuoteRequest.php b/app/Http/Requests/Quote/ShowQuoteRequest.php index 7940868b37d2..f9be441c66c0 100644 --- a/app/Http/Requests/Quote/ShowQuoteRequest.php +++ b/app/Http/Requests/Quote/ShowQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->quote); diff --git a/app/Http/Requests/Quote/StoreQuoteRequest.php b/app/Http/Requests/Quote/StoreQuoteRequest.php index a51f44042e76..deb37f70be50 100644 --- a/app/Http/Requests/Quote/StoreQuoteRequest.php +++ b/app/Http/Requests/Quote/StoreQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('create', Quote::class); @@ -40,7 +39,7 @@ class StoreQuoteRequest extends Request if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - + if ($input['client_id']) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } @@ -48,10 +47,10 @@ class StoreQuoteRequest extends Request if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + if (isset($input['client_contacts'])) { foreach ($input['client_contacts'] as $key => $contact) { - if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { unset($input['client_contacts'][$key]); } } @@ -88,7 +87,7 @@ class StoreQuoteRequest extends Request $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -97,6 +96,5 @@ class StoreQuoteRequest extends Request $rules['number'] = new UniqueQuoteNumberRule($this->all()); return $rules; - } } diff --git a/app/Http/Requests/Quote/UpdateQuoteRequest.php b/app/Http/Requests/Quote/UpdateQuoteRequest.php index 93eac1f51289..1af628725493 100644 --- a/app/Http/Requests/Quote/UpdateQuoteRequest.php +++ b/app/Http/Requests/Quote/UpdateQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->quote); } - public function rules() { $rules = []; @@ -44,15 +42,15 @@ class UpdateQuoteRequest extends Request $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } - - if($this->input('number')) - $rules['number'] = 'unique:quotes,number,' . $this->id . ',id,company_id,' . $this->quote->company_id; + if ($this->input('number')) { + $rules['number'] = 'unique:quotes,number,'.$this->id.',id,company_id,'.$this->quote->company_id; + } return $rules; } @@ -60,11 +58,11 @@ class UpdateQuoteRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - + if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } @@ -76,7 +74,7 @@ class UpdateQuoteRequest extends Request if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + $input['id'] = $this->quote->id; $this->replace($input); diff --git a/app/Http/Requests/RecurringInvoice/ActionRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/ActionRecurringInvoiceRequest.php index 7521ef3a1258..0cb811d5a727 100644 --- a/app/Http/Requests/RecurringInvoice/ActionRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/ActionRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_invoice); diff --git a/app/Http/Requests/RecurringInvoice/CreateRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/CreateRecurringInvoiceRequest.php index b2bc25a757f2..30d159376ef3 100644 --- a/app/Http/Requests/RecurringInvoice/CreateRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/CreateRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('create', RecurringInvoice::class); diff --git a/app/Http/Requests/RecurringInvoice/DestroyRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/DestroyRecurringInvoiceRequest.php index 7ab727210f7c..e58d7d7dee1d 100644 --- a/app/Http/Requests/RecurringInvoice/DestroyRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/DestroyRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_invoice); diff --git a/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php index 3d3e9aadcc62..fff1183dd475 100644 --- a/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/EditRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_invoice); @@ -30,11 +29,10 @@ class EditRecurringInvoiceRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/RecurringInvoice/ShowRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/ShowRecurringInvoiceRequest.php index 8a4a9a69a5c4..8397115535df 100644 --- a/app/Http/Requests/RecurringInvoice/ShowRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/ShowRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->recurring_invoice); diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index b5dd220a68b3..99413a9a991f 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('create', RecurringInvoice::class); } - public function rules() { $rules = []; @@ -41,7 +39,7 @@ class StoreRecurringInvoiceRequest extends Request $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -56,8 +54,6 @@ class StoreRecurringInvoiceRequest extends Request return $rules; } - - protected function prepareForValidation() { $input = $this->all(); @@ -76,7 +72,7 @@ class StoreRecurringInvoiceRequest extends Request if (isset($input['client_contacts'])) { foreach ($input['client_contacts'] as $key => $contact) { - if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { unset($input['client_contacts'][$key]); } } diff --git a/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php index 41517772f86e..48cdae76c6ef 100644 --- a/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/UpdateRecurringInvoiceRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_invoice); } - public function rules() { $rules = []; @@ -43,7 +42,7 @@ class UpdateRecurringInvoiceRequest extends Request $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -55,11 +54,11 @@ class UpdateRecurringInvoiceRequest extends Request protected function prepareForValidation() { $input = $this->all(); -info($input); + info($input); if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { $input['design_id'] = $this->decodePrimaryKey($input['design_id']); } - + if (isset($input['client_id'])) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } @@ -67,12 +66,11 @@ info($input); if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + if (isset($input['invitations'])) { foreach ($input['invitations'] as $key => $value) { if (is_numeric($input['invitations'][$key]['id'])) { unset($input['invitations'][$key]['id']); - } if (array_key_exists('id', $input['invitations'][$key]) && is_string($input['invitations'][$key]['id'])) { @@ -84,7 +82,7 @@ info($input); } } } - + $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; $this->replace($input); diff --git a/app/Http/Requests/RecurringQuote/ActionRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/ActionRecurringQuoteRequest.php index 405bcbc3bce2..9cecff60901f 100644 --- a/app/Http/Requests/RecurringQuote/ActionRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/ActionRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_quote); diff --git a/app/Http/Requests/RecurringQuote/CreateRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/CreateRecurringQuoteRequest.php index dc7218f8d999..1d413a2de53c 100644 --- a/app/Http/Requests/RecurringQuote/CreateRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/CreateRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('create', RecurringQuote::class); diff --git a/app/Http/Requests/RecurringQuote/DestroyRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/DestroyRecurringQuoteRequest.php index 07286d37bccf..14e16893d180 100644 --- a/app/Http/Requests/RecurringQuote/DestroyRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/DestroyRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_quote); diff --git a/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php index bfbf0294744f..2efd6e7e14dc 100644 --- a/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/EditRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_quote); @@ -30,11 +29,10 @@ class EditRecurringQuoteRequest extends Request public function rules() { $rules = []; - + return $rules; } - protected function prepareForValidation() { $input = $this->all(); diff --git a/app/Http/Requests/RecurringQuote/ShowRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/ShowRecurringQuoteRequest.php index 0d28df3d89bf..b2b3046ee320 100644 --- a/app/Http/Requests/RecurringQuote/ShowRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/ShowRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->recurring_quote); diff --git a/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php index ad3aeaf5e192..a09c7b401118 100644 --- a/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/StoreRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('create', RecurringQuote::class); @@ -47,11 +46,11 @@ class StoreRecurringQuoteRequest extends Request if ($input['client_id']) { $input['client_id'] = $this->decodePrimaryKey($input['client_id']); } - + if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; //$input['line_items'] = json_encode($input['line_items']); $this->replace($input); diff --git a/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php b/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php index 0e6719fa1b94..3053887ec7a3 100644 --- a/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php +++ b/app/Http/Requests/RecurringQuote/UpdateRecurringQuoteRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->recurring_quote); } - public function rules() { return [ @@ -51,7 +49,6 @@ class UpdateRecurringQuoteRequest extends Request $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; - $this->replace($input); } } diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php index 4857b087450c..9517e75fd9cb 100644 --- a/app/Http/Requests/Request.php +++ b/app/Http/Requests/Request.php @@ -1,6 +1,6 @@ 'required', 'last_name' => 'required', 'email' => 'required', - 'password' => 'required' + 'password' => 'required', ]; } protected function prepareForValidation() { $input = $this->all(); - + $input['user_agent'] = request()->server('HTTP_USER_AGENT'); $this->replace($input); diff --git a/app/Http/Requests/Shop/StoreShopClientRequest.php b/app/Http/Requests/Shop/StoreShopClientRequest.php index c7ee2497df2f..fa199ad00139 100644 --- a/app/Http/Requests/Shop/StoreShopClientRequest.php +++ b/app/Http/Requests/Shop/StoreShopClientRequest.php @@ -1,6 +1,6 @@ input('documents') && is_array($this->input('documents'))) { $documents = count($this->input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } - + /* Ensure we have a client name, and that all emails are unique*/ //$rules['name'] = 'required|min:1'; - $rules['id_number'] = 'unique:clients,id_number,' . $this->id . ',id,company_id,' . $this->company_id; + $rules['id_number'] = 'unique:clients,id_number,'.$this->id.',id,company_id,'.$this->company_id; $rules['settings'] = new ValidClientGroupSettingsRule(); $rules['contacts.*.email'] = 'nullable|distinct'; $rules['contacts.*.password'] = [ @@ -67,13 +66,13 @@ class StoreShopClientRequest extends Request //'regex:/[@$!%*#?&.]/', // must contain a special character ]; - if($this->company->account->isFreeHostedClient()) + if ($this->company->account->isFreeHostedClient()) { $rules['hosted_clients'] = new CanStoreClientsRule($this->company->id); + } return $rules; } - protected function prepareForValidation() { $this->company = Company::where('company_key', request()->header('X-API-COMPANY-KEY'))->firstOrFail(); @@ -83,8 +82,8 @@ class StoreShopClientRequest extends Request //@todo implement feature permissions for > 100 clients // $settings = ClientSettings::defaults(); - - if (array_key_exists('settings', $input) && !empty($input['settings'])) { + + if (array_key_exists('settings', $input) && ! empty($input['settings'])) { foreach ($input['settings'] as $key => $value) { $settings->{$key} = $value; } @@ -93,20 +92,20 @@ class StoreShopClientRequest extends Request if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); } - + //is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!! - if (!property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { + if (! property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); $group_settings = GroupSetting::find($input['group_settings_id']); if ($group_settings && property_exists($group_settings->settings, 'currency_id') && isset($group_settings->settings->currency_id)) { - $settings->currency_id = (string)$group_settings->settings->currency_id; + $settings->currency_id = (string) $group_settings->settings->currency_id; } else { - $settings->currency_id = (string)$this->company->settings->currency_id; + $settings->currency_id = (string) $this->company->settings->currency_id; } - } elseif (!property_exists($settings, 'currency_id')) { - $settings->currency_id = (string)$this->company->settings->currency_id; - } + } elseif (! property_exists($settings, 'currency_id')) { + $settings->currency_id = (string) $this->company->settings->currency_id; + } if (isset($input['currency_code'])) { $settings->currency_id = $this->getCurrencyCode($input['currency_code']); @@ -122,13 +121,12 @@ class StoreShopClientRequest extends Request $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); } - //Filter the client contact password - if it is sent with ***** we should ignore it! if (isset($contact['password'])) { if (strlen($contact['password']) == 0) { $input['contacts'][$key]['password'] = ''; } else { - $contact['password'] = str_replace("*", "", $contact['password']); + $contact['password'] = str_replace('*', '', $contact['password']); if (strlen($contact['password']) == 0) { unset($input['contacts'][$key]['password']); @@ -138,11 +136,11 @@ class StoreShopClientRequest extends Request } } - if(isset($input['country_code'])) { + if (isset($input['country_code'])) { $input['country_id'] = $this->getCountryCode($input['country_code']); } - if(isset($input['shipping_country_code'])) { + if (isset($input['shipping_country_code'])) { $input['shipping_country_id'] = $this->getCountryCode($input['shipping_country_code']); } @@ -161,8 +159,8 @@ class StoreShopClientRequest extends Request private function getCountryCode($country_code) { $countries = Cache::get('countries'); - - $country = $countries->filter(function ($item) use($country_code) { + + $country = $countries->filter(function ($item) use ($country_code) { return $item->iso_3166_2 == $country_code || $item->iso_3166_3 == $country_code; })->first(); @@ -172,12 +170,11 @@ class StoreShopClientRequest extends Request private function getCurrencyCode($code) { $currencies = Cache::get('currencies'); - - $currency = $currencies->filter(function ($item) use($code){ + + $currency = $currencies->filter(function ($item) use ($code) { return $item->code == $code; })->first(); return (string) $currency->id; } - } diff --git a/app/Http/Requests/Shop/StoreShopInvoiceRequest.php b/app/Http/Requests/Shop/StoreShopInvoiceRequest.php index 4b895a5e63b4..cb389cb82f7e 100644 --- a/app/Http/Requests/Shop/StoreShopInvoiceRequest.php +++ b/app/Http/Requests/Shop/StoreShopInvoiceRequest.php @@ -1,6 +1,6 @@ input('documents')); foreach (range(0, $documents) as $index) { - $rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; + $rules['documents.'.$index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; } } elseif ($this->input('documents')) { $rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000'; @@ -56,7 +55,7 @@ class StoreShopInvoiceRequest extends Request $rules['invitations.*.client_contact_id'] = 'distinct'; $rules['number'] = new UniqueInvoiceNumberRule($this->all()); - + return $rules; } @@ -80,7 +79,7 @@ class StoreShopInvoiceRequest extends Request if (isset($input['client_contacts'])) { foreach ($input['client_contacts'] as $key => $contact) { - if (!array_key_exists('send_email', $contact) || !array_key_exists('id', $contact)) { + if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { unset($input['client_contacts'][$key]); } } diff --git a/app/Http/Requests/TaxRate/CreateTaxRateRequest.php b/app/Http/Requests/TaxRate/CreateTaxRateRequest.php index 464b867281ed..f33d0c920242 100644 --- a/app/Http/Requests/TaxRate/CreateTaxRateRequest.php +++ b/app/Http/Requests/TaxRate/CreateTaxRateRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/TaxRate/DestroyTaxRateRequest.php b/app/Http/Requests/TaxRate/DestroyTaxRateRequest.php index 2ac6a7396f0e..885be5dba479 100644 --- a/app/Http/Requests/TaxRate/DestroyTaxRateRequest.php +++ b/app/Http/Requests/TaxRate/DestroyTaxRateRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/TaxRate/EditTaxRateRequest.php b/app/Http/Requests/TaxRate/EditTaxRateRequest.php index ecfdec9cde28..18eac898d8b1 100644 --- a/app/Http/Requests/TaxRate/EditTaxRateRequest.php +++ b/app/Http/Requests/TaxRate/EditTaxRateRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/TaxRate/UpdateTaxRateRequest.php b/app/Http/Requests/TaxRate/UpdateTaxRateRequest.php index 5e6a1927d120..a27ebb8257e6 100644 --- a/app/Http/Requests/TaxRate/UpdateTaxRateRequest.php +++ b/app/Http/Requests/TaxRate/UpdateTaxRateRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Template/ShowTemplateRequest.php b/app/Http/Requests/Template/ShowTemplateRequest.php index 7dcbbc00b08f..002c8409cd6e 100644 --- a/app/Http/Requests/Template/ShowTemplateRequest.php +++ b/app/Http/Requests/Template/ShowTemplateRequest.php @@ -1,6 +1,6 @@ "sometimes", + 'template' => 'sometimes', ]; } diff --git a/app/Http/Requests/Token/BulkTokenRequest.php b/app/Http/Requests/Token/BulkTokenRequest.php index 4d111ffafa03..e63a588479bb 100644 --- a/app/Http/Requests/Token/BulkTokenRequest.php +++ b/app/Http/Requests/Token/BulkTokenRequest.php @@ -16,11 +16,11 @@ class BulkTokenRequest extends FormRequest */ public function authorize() { - if (!$this->has('action')) { + if (! $this->has('action')) { return false; } - if (!in_array($this->action, $this->getBulkOptions(), true)) { + if (! in_array($this->action, $this->getBulkOptions(), true)) { return false; } @@ -36,7 +36,7 @@ class BulkTokenRequest extends FormRequest { $rules = $this->getGlobalRules(); - /** We don't require IDs on bulk storing. */ + /* We don't require IDs on bulk storing. */ if ($this->action !== self::$STORE_METHOD) { $rules['ids'] = ['required']; } diff --git a/app/Http/Requests/Token/CreateTokenRequest.php b/app/Http/Requests/Token/CreateTokenRequest.php index 2eefc1cd5f2c..215fcf065272 100644 --- a/app/Http/Requests/Token/CreateTokenRequest.php +++ b/app/Http/Requests/Token/CreateTokenRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Token/DestroyTokenRequest.php b/app/Http/Requests/Token/DestroyTokenRequest.php index 90c09721ad0d..0b87d2e284c9 100644 --- a/app/Http/Requests/Token/DestroyTokenRequest.php +++ b/app/Http/Requests/Token/DestroyTokenRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Token/EditTokenRequest.php b/app/Http/Requests/Token/EditTokenRequest.php index b4f89fb93075..ab454c27726f 100644 --- a/app/Http/Requests/Token/EditTokenRequest.php +++ b/app/Http/Requests/Token/EditTokenRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Token/ShowTokenRequest.php b/app/Http/Requests/Token/ShowTokenRequest.php index b608284d5b3d..e09b108ea353 100644 --- a/app/Http/Requests/Token/ShowTokenRequest.php +++ b/app/Http/Requests/Token/ShowTokenRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Token/StoreTokenRequest.php b/app/Http/Requests/Token/StoreTokenRequest.php index 4a4ee182fa98..d588b1f8e27e 100644 --- a/app/Http/Requests/Token/StoreTokenRequest.php +++ b/app/Http/Requests/Token/StoreTokenRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Token/UpdateTokenRequest.php b/app/Http/Requests/Token/UpdateTokenRequest.php index 35363d4228cb..8a262cad1d68 100644 --- a/app/Http/Requests/Token/UpdateTokenRequest.php +++ b/app/Http/Requests/Token/UpdateTokenRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/User/AttachCompanyUserRequest.php b/app/Http/Requests/User/AttachCompanyUserRequest.php index 7cf74cb0931a..f03d9cdf964a 100644 --- a/app/Http/Requests/User/AttachCompanyUserRequest.php +++ b/app/Http/Requests/User/AttachCompanyUserRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -35,8 +35,8 @@ class AttachCompanyUserRequest extends Request $is_admin = request()->has('is_admin') ? request()->input('is_admin') : false; $permissions = request()->has('permissions') ? request()->input('permissions') : ''; $settings = request()->has('settings') ? request()->input('settings') : json_encode(DefaultSettings::userSettings()); - $is_locked =request()->has('is_locked') ? request()->input('is_locked') : false; - + $is_locked = request()->has('is_locked') ? request()->input('is_locked') : false; + $this->replace([ 'is_admin' => $is_admin, 'permissions' => $permissions, diff --git a/app/Http/Requests/User/CreateUserRequest.php b/app/Http/Requests/User/CreateUserRequest.php index df7c8325ebd1..9188c8dfc3e4 100644 --- a/app/Http/Requests/User/CreateUserRequest.php +++ b/app/Http/Requests/User/CreateUserRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/User/DestroyUserRequest.php b/app/Http/Requests/User/DestroyUserRequest.php index b917f6331edf..36cc4ebac598 100644 --- a/app/Http/Requests/User/DestroyUserRequest.php +++ b/app/Http/Requests/User/DestroyUserRequest.php @@ -1,6 +1,6 @@ user()->isOwner(); diff --git a/app/Http/Requests/User/DetachCompanyUserRequest.php b/app/Http/Requests/User/DetachCompanyUserRequest.php index 75b53c293ba4..400e6af7eb15 100644 --- a/app/Http/Requests/User/DetachCompanyUserRequest.php +++ b/app/Http/Requests/User/DetachCompanyUserRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/User/EditUserRequest.php b/app/Http/Requests/User/EditUserRequest.php index 9d82de76739c..baed9889ef39 100644 --- a/app/Http/Requests/User/EditUserRequest.php +++ b/app/Http/Requests/User/EditUserRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->user); @@ -30,7 +29,7 @@ class EditUserRequest extends Request public function rules() { $rules = []; - + return $rules; } } diff --git a/app/Http/Requests/User/ShowUserRequest.php b/app/Http/Requests/User/ShowUserRequest.php index 66108c985090..f89daaa5ea27 100644 --- a/app/Http/Requests/User/ShowUserRequest.php +++ b/app/Http/Requests/User/ShowUserRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->user); diff --git a/app/Http/Requests/User/StoreUserRequest.php b/app/Http/Requests/User/StoreUserRequest.php index c362839509ac..921868ec3e4a 100644 --- a/app/Http/Requests/User/StoreUserRequest.php +++ b/app/Http/Requests/User/StoreUserRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); } @@ -43,7 +42,7 @@ class StoreUserRequest extends Request $rules['email'] = new ValidUserForCompany(); } - if(auth()->user()->company()->account->isFreeHostedClient()){ + if (auth()->user()->company()->account->isFreeHostedClient()) { $rules['hosted_users'] = new CanAddUserRule(auth()->user()->company()->account); } @@ -55,15 +54,15 @@ class StoreUserRequest extends Request $input = $this->all(); if (isset($input['company_user'])) { - if (!isset($input['company_user']['is_admin'])) { + if (! isset($input['company_user']['is_admin'])) { $input['company_user']['is_admin'] = false; } - if (!isset($input['company_user']['permissions'])) { + if (! isset($input['company_user']['permissions'])) { $input['company_user']['permissions'] = ''; } - if (!isset($input['company_user']['settings'])) { + if (! isset($input['company_user']['settings'])) { //$input['company_user']['settings'] = DefaultSettings::userSettings(); $input['company_user']['settings'] = null; } @@ -83,7 +82,7 @@ class StoreUserRequest extends Request { $user = MultiDB::hasUser(['email' => $this->input('email')]); - if (!$user) { + if (! $user) { $user = UserFactory::create(auth()->user()->account->id); } diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index 580bdeef765d..bff4a46c0ab7 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -1,6 +1,6 @@ user()->id === $this->id || auth()->user()->isAdmin(); } - public function rules() { $input = $this->all(); @@ -44,10 +42,9 @@ class UpdateUserRequest extends Request { $input = $this->all(); - if (isset($input['company_user']) && !auth()->user()->isAdmin()) { + if (isset($input['company_user']) && ! auth()->user()->isAdmin()) { unset($input['company_user']); } - $this->replace($input); } diff --git a/app/Http/Requests/Vendor/BulkVendorRequest.php b/app/Http/Requests/Vendor/BulkVendorRequest.php index b71d6216089c..b576d75c0254 100644 --- a/app/Http/Requests/Vendor/BulkVendorRequest.php +++ b/app/Http/Requests/Vendor/BulkVendorRequest.php @@ -2,9 +2,9 @@ namespace App\Http\Requests\Vendor; +use App\Models\Vendor; use App\Utils\Traits\BulkOptions; use Illuminate\Foundation\Http\FormRequest; -use App\Models\Vendor; class BulkVendorRequest extends FormRequest { @@ -17,11 +17,11 @@ class BulkVendorRequest extends FormRequest */ public function authorize() { - if (!$this->has('action')) { + if (! $this->has('action')) { return false; } - if (!in_array($this->action, $this->getBulkOptions(), true)) { + if (! in_array($this->action, $this->getBulkOptions(), true)) { return false; } @@ -37,7 +37,7 @@ class BulkVendorRequest extends FormRequest { $rules = $this->getGlobalRules(); - /** We don't require IDs on bulk storing. */ + /* We don't require IDs on bulk storing. */ if ($this->action !== self::$STORE_METHOD) { $rules['ids'] = ['required']; } diff --git a/app/Http/Requests/Vendor/CreateVendorRequest.php b/app/Http/Requests/Vendor/CreateVendorRequest.php index 67aaad1555f4..9450c78bc340 100644 --- a/app/Http/Requests/Vendor/CreateVendorRequest.php +++ b/app/Http/Requests/Vendor/CreateVendorRequest.php @@ -1,6 +1,6 @@ user()->can('create', Vendor::class); diff --git a/app/Http/Requests/Vendor/DestroyVendorRequest.php b/app/Http/Requests/Vendor/DestroyVendorRequest.php index 7ae60f72f66b..8963f68296a9 100644 --- a/app/Http/Requests/Vendor/DestroyVendorRequest.php +++ b/app/Http/Requests/Vendor/DestroyVendorRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->vendor); diff --git a/app/Http/Requests/Vendor/EditVendorRequest.php b/app/Http/Requests/Vendor/EditVendorRequest.php index 3acf0fd9440d..efaa22870230 100644 --- a/app/Http/Requests/Vendor/EditVendorRequest.php +++ b/app/Http/Requests/Vendor/EditVendorRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->vendor); diff --git a/app/Http/Requests/Vendor/ShowVendorRequest.php b/app/Http/Requests/Vendor/ShowVendorRequest.php index 85382e611678..501fcc341933 100644 --- a/app/Http/Requests/Vendor/ShowVendorRequest.php +++ b/app/Http/Requests/Vendor/ShowVendorRequest.php @@ -1,6 +1,6 @@ user()->can('view', $this->vendor); diff --git a/app/Http/Requests/Vendor/StoreVendorRequest.php b/app/Http/Requests/Vendor/StoreVendorRequest.php index 8dc87c66a089..c92c52d65c4a 100644 --- a/app/Http/Requests/Vendor/StoreVendorRequest.php +++ b/app/Http/Requests/Vendor/StoreVendorRequest.php @@ -1,6 +1,6 @@ user()->can('create', Vendor::class); @@ -39,7 +38,7 @@ class StoreVendorRequest extends Request /* Ensure we have a client name, and that all emails are unique*/ //$rules['name'] = 'required|min:1'; - $rules['id_number'] = 'unique:vendors,id_number,' . $this->id . ',id,company_id,' . $this->company_id; + $rules['id_number'] = 'unique:vendors,id_number,'.$this->id.',id,company_id,'.$this->company_id; //$rules['settings'] = new ValidVendorGroupSettingsRule(); $rules['contacts.*.email'] = 'nullable|distinct'; @@ -55,16 +54,14 @@ class StoreVendorRequest extends Request return $rules; } - protected function prepareForValidation() { $input = $this->all(); - if (!isset($input['settings'])) { + if (! isset($input['settings'])) { $input['settings'] = VendorSettings::defaults(); } - $this->replace($input); } diff --git a/app/Http/Requests/Vendor/UpdateVendorRequest.php b/app/Http/Requests/Vendor/UpdateVendorRequest.php index 20e1209a326e..bd8b44d6966b 100644 --- a/app/Http/Requests/Vendor/UpdateVendorRequest.php +++ b/app/Http/Requests/Vendor/UpdateVendorRequest.php @@ -1,6 +1,6 @@ user()->can('edit', $this->vendor); @@ -40,7 +40,7 @@ class UpdateVendorRequest extends Request $rules['country_id'] = 'integer|nullable'; //$rules['id_number'] = 'unique:clients,id_number,,id,company_id,' . auth()->user()->company()->id; - $rules['id_number'] = 'unique:clients,id_number,' . $this->id . ',id,company_id,' . $this->company_id; + $rules['id_number'] = 'unique:clients,id_number,'.$this->id.',id,company_id,'.$this->company_id; $rules['contacts.*.email'] = 'nullable|distinct'; $contacts = request('contacts'); @@ -51,6 +51,7 @@ class UpdateVendorRequest extends Request // //$rules['contacts.' . $i . '.email'] = 'nullable|email'; // } } + return $rules; } @@ -67,7 +68,7 @@ class UpdateVendorRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + $this->replace($input); } } diff --git a/app/Http/Requests/Webhook/BulkWebhookRequest.php b/app/Http/Requests/Webhook/BulkWebhookRequest.php index ade367a2d055..aa178f22f266 100644 --- a/app/Http/Requests/Webhook/BulkWebhookRequest.php +++ b/app/Http/Requests/Webhook/BulkWebhookRequest.php @@ -2,9 +2,9 @@ namespace App\Http\Requests\Webhook; +use App\Models\Vendor; use App\Utils\Traits\BulkOptions; use Illuminate\Foundation\Http\FormRequest; -use App\Models\Vendor; class BulkWebhookRequest extends FormRequest { @@ -17,11 +17,11 @@ class BulkWebhookRequest extends FormRequest */ public function authorize() { - if (!$this->has('action')) { + if (! $this->has('action')) { return false; } - if (!in_array($this->action, $this->getBulkOptions(), true)) { + if (! in_array($this->action, $this->getBulkOptions(), true)) { return false; } @@ -37,7 +37,7 @@ class BulkWebhookRequest extends FormRequest { $rules = $this->getGlobalRules(); - /** We don't require IDs on bulk storing. */ + /* We don't require IDs on bulk storing. */ if ($this->action !== self::$STORE_METHOD) { $rules['ids'] = ['required']; } diff --git a/app/Http/Requests/Webhook/CreateWebhookRequest.php b/app/Http/Requests/Webhook/CreateWebhookRequest.php index 3ded7925dd66..e9630dfbe67b 100644 --- a/app/Http/Requests/Webhook/CreateWebhookRequest.php +++ b/app/Http/Requests/Webhook/CreateWebhookRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Webhook/DestroyWebhookRequest.php b/app/Http/Requests/Webhook/DestroyWebhookRequest.php index 99c50c5cd877..76899c61acdd 100644 --- a/app/Http/Requests/Webhook/DestroyWebhookRequest.php +++ b/app/Http/Requests/Webhook/DestroyWebhookRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Webhook/EditWebhookRequest.php b/app/Http/Requests/Webhook/EditWebhookRequest.php index 473f91e1254b..3560108e4c43 100644 --- a/app/Http/Requests/Webhook/EditWebhookRequest.php +++ b/app/Http/Requests/Webhook/EditWebhookRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Webhook/ShowWebhookRequest.php b/app/Http/Requests/Webhook/ShowWebhookRequest.php index 7915a4170474..4d7572f84274 100644 --- a/app/Http/Requests/Webhook/ShowWebhookRequest.php +++ b/app/Http/Requests/Webhook/ShowWebhookRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); diff --git a/app/Http/Requests/Webhook/StoreWebhookRequest.php b/app/Http/Requests/Webhook/StoreWebhookRequest.php index 8ac21eeda971..4c6c275f34dd 100644 --- a/app/Http/Requests/Webhook/StoreWebhookRequest.php +++ b/app/Http/Requests/Webhook/StoreWebhookRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -38,7 +36,6 @@ class StoreWebhookRequest extends Request protected function prepareForValidation() { $input = $this->all(); - $this->replace($input); } diff --git a/app/Http/Requests/Webhook/UpdateWebhookRequest.php b/app/Http/Requests/Webhook/UpdateWebhookRequest.php index 622955894995..97f0ecbe723c 100644 --- a/app/Http/Requests/Webhook/UpdateWebhookRequest.php +++ b/app/Http/Requests/Webhook/UpdateWebhookRequest.php @@ -1,6 +1,6 @@ user()->isAdmin(); @@ -41,7 +41,7 @@ class UpdateWebhookRequest extends Request protected function prepareForValidation() { $input = $this->all(); - + $this->replace($input); } } diff --git a/app/Http/ValidationRules/Company/ValidCompanyQuantity.php b/app/Http/ValidationRules/Company/ValidCompanyQuantity.php index b27741f4b223..4d332345a7eb 100644 --- a/app/Http/ValidationRules/Company/ValidCompanyQuantity.php +++ b/app/Http/ValidationRules/Company/ValidCompanyQuantity.php @@ -1,6 +1,6 @@ input = $input; } - /** + /** * @param string $attribute * @param mixed $value * @return bool @@ -44,26 +43,26 @@ class UniqueCreditNumberRule implements Rule */ public function message() { - return "Credit number already taken"; + return 'Credit number already taken'; } /** * @param $email * * //off,when_sent,when_paid - * + * * @return bool */ private function checkIfCreditNumberUnique() : bool { - $credit = Credit::where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); - if($credit) + if ($credit) { return false; + } return true; } diff --git a/app/Http/ValidationRules/Credit/ValidCreditsRules.php b/app/Http/ValidationRules/Credit/ValidCreditsRules.php index 98abcebc9ed1..e261278de1eb 100644 --- a/app/Http/ValidationRules/Credit/ValidCreditsRules.php +++ b/app/Http/ValidationRules/Credit/ValidCreditsRules.php @@ -1,6 +1,6 @@ input = $input; @@ -49,8 +47,9 @@ class ValidCreditsRules implements Rule private function checkCreditsAreHomogenous() { - if (!array_key_exists('client_id', $this->input)) { - $this->error_msg = "Client id is required"; + if (! array_key_exists('client_id', $this->input)) { + $this->error_msg = 'Client id is required'; + return false; } @@ -61,29 +60,32 @@ class ValidCreditsRules implements Rule $cred = Credit::find($this->decodePrimaryKey($credit['credit_id'])); - if (!$cred) { - $this->error_msg = "Credit not found "; + if (! $cred) { + $this->error_msg = 'Credit not found '; + return false; } if ($cred->client_id != $this->input['client_id']) { - $this->error_msg = "Selected invoices are not from a single client"; + $this->error_msg = 'Selected invoices are not from a single client'; + return false; } } - if (!(array_unique($unique_array) == $unique_array)) { - $this->error_msg = "Duplicate credits submitted."; + if (! (array_unique($unique_array) == $unique_array)) { + $this->error_msg = 'Duplicate credits submitted.'; + return false; } + if (count($this->input['credits']) >= 1 && count($this->input['invoices']) == 0) { + $this->error_msg = 'You must have an invoice set when using a credit in a payment'; - if(count($this->input['credits']) >=1 && count($this->input['invoices']) == 0){ - $this->error_msg = "You must have an invoice set when using a credit in a payment"; return false; } - if(count($this->input['credits']) >=1){ + if (count($this->input['credits']) >= 1) { // $total_payments = $this->input['amount'] + array_sum(array_column($this->input['credits'], 'amount')); @@ -97,13 +99,10 @@ class ValidCreditsRules implements Rule // $this->error_msg = "Sum of total payments and credits is greater than the total of invoices"; // return false; // } - } - return true; } - /** * @return string diff --git a/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php b/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php index e547f68b0fee..dcf534b7c294 100644 --- a/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php +++ b/app/Http/ValidationRules/Invoice/LockedInvoiceRule.php @@ -1,6 +1,6 @@ invoice->status_id == Invoice::STATUS_SENT) + if ($this->invoice->status_id == Invoice::STATUS_SENT) { return false; + } return true; break; case 'when_paid': - if($this->invoice->status_id == Invoice::STATUS_PAID) + if ($this->invoice->status_id == Invoice::STATUS_PAID) { return false; + } return true; break; @@ -79,6 +80,5 @@ class LockedInvoiceRule implements Rule return true; break; } - } } diff --git a/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php b/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php index 96190d4ff71a..15523687bc40 100644 --- a/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php +++ b/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php @@ -1,6 +1,6 @@ input = $input; } - /** + /** * @param string $attribute * @param mixed $value * @return bool @@ -44,26 +43,26 @@ class UniqueInvoiceNumberRule implements Rule */ public function message() { - return "Invoice number already taken"; + return 'Invoice number already taken'; } /** * @param $email * * //off,when_sent,when_paid - * + * * @return bool */ private function checkIfInvoiceNumberUnique() : bool { - $invoice = Invoice::where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); - if($invoice) + if ($invoice) { return false; + } return true; } diff --git a/app/Http/ValidationRules/NewUniqueUserRule.php b/app/Http/ValidationRules/NewUniqueUserRule.php index c8165ed32c96..f6823dca02c8 100644 --- a/app/Http/ValidationRules/NewUniqueUserRule.php +++ b/app/Http/ValidationRules/NewUniqueUserRule.php @@ -1,6 +1,6 @@ $this->account->num_users]); } - } diff --git a/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php b/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php index 0079d9e728e7..f0c700a1c28a 100644 --- a/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php +++ b/app/Http/ValidationRules/Ninja/CanStoreClientsRule.php @@ -1,6 +1,6 @@ config('ninja.quotas.free.clients')]); } - } diff --git a/app/Http/ValidationRules/Payment/ValidInvoicesRules.php b/app/Http/ValidationRules/Payment/ValidInvoicesRules.php index 69644dcc8bb6..8eb726237620 100644 --- a/app/Http/ValidationRules/Payment/ValidInvoicesRules.php +++ b/app/Http/ValidationRules/Payment/ValidInvoicesRules.php @@ -1,6 +1,6 @@ input = $input; @@ -49,8 +47,9 @@ class ValidInvoicesRules implements Rule private function checkInvoicesAreHomogenous() { - if (!array_key_exists('client_id', $this->input)) { - $this->error_msg = "Client id is required"; + if (! array_key_exists('client_id', $this->input)) { + $this->error_msg = 'Client id is required'; + return false; } @@ -61,26 +60,27 @@ class ValidInvoicesRules implements Rule $inv = Invoice::whereId($invoice['invoice_id'])->first(); - if (!$inv) { - $this->error_msg = "Invoice not found "; + if (! $inv) { + $this->error_msg = 'Invoice not found '; + return false; } if ($inv->client_id != $this->input['client_id']) { - $this->error_msg = "Selected invoices are not from a single client"; + $this->error_msg = 'Selected invoices are not from a single client'; + return false; } } - if (!(array_unique($unique_array) == $unique_array)) { - $this->error_msg = "Duplicate invoices submitted."; + if (! (array_unique($unique_array) == $unique_array)) { + $this->error_msg = 'Duplicate invoices submitted.'; + return false; } - return true; } - /** * @return string diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index 19c42084da21..e73a039ab7f9 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -1,6 +1,6 @@ input = $input; @@ -44,15 +42,17 @@ class ValidRefundableRequest implements Rule public function passes($attribute, $value) { - if (!array_key_exists('id', $this->input)) { - $this->error_msg = "Payment `id` required."; + if (! array_key_exists('id', $this->input)) { + $this->error_msg = 'Payment `id` required.'; + return false; } $payment = Payment::whereId($this->input['id'])->first(); - if (!$payment) { - $this->error_msg = "Unable to retrieve specified payment"; + if (! $payment) { + $this->error_msg = 'Unable to retrieve specified payment'; + return false; } @@ -65,7 +65,6 @@ class ValidRefundableRequest implements Rule // foreach($request_credits as $key => $value) // $request_credits[$key]['credit_id'] = $this->decodePrimaryKey($value['credit_id']); - if ($payment->invoices()->exists()) { foreach ($payment->invoices as $paymentable_invoice) { $this->checkInvoice($paymentable_invoice, $request_invoices); @@ -99,12 +98,14 @@ class ValidRefundableRequest implements Rule if ($payment->invoices()->exists()) { $paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first(); - if (!$paymentable_invoice) { - $this->error_msg = "Invoice id ".$invoice->hashed_id." is not related to this payment"; + if (! $paymentable_invoice) { + $this->error_msg = 'Invoice id '.$invoice->hashed_id.' is not related to this payment'; + return false; } } else { - $this->error_msg = "Invoice id ".$invoice->hashed_id." is not related to this payment"; + $this->error_msg = 'Invoice id '.$invoice->hashed_id.' is not related to this payment'; + return false; } } @@ -116,12 +117,14 @@ class ValidRefundableRequest implements Rule if ($payment->credits()->exists()) { $paymentable_credit = $payment->credits->where('id', $credit->id)->first(); - if (!$paymentable_invoice) { - $this->error_msg = "Credit id ".$credit->hashed_id." is not related to this payment"; + if (! $paymentable_invoice) { + $this->error_msg = 'Credit id '.$credit->hashed_id.' is not related to this payment'; + return false; } } else { - $this->error_msg = "Credit id ".$credit->hashed_id." is not related to this payment"; + $this->error_msg = 'Credit id '.$credit->hashed_id.' is not related to this payment'; + return false; } } @@ -139,19 +142,20 @@ class ValidRefundableRequest implements Rule if ($request_invoice['amount'] > $refundable_amount) { $invoice = $paymentable; - $this->error_msg = "Attempting to refund more than allowed for invoice id ".$invoice->hashed_id.", maximum refundable amount is ". $refundable_amount; + $this->error_msg = 'Attempting to refund more than allowed for invoice id '.$invoice->hashed_id.', maximum refundable amount is '.$refundable_amount; + return false; } } } - if (!$record_found) { - $this->error_msg = "Attempting to refund a payment with invoices attached, please specify valid invoice/s to be refunded."; + if (! $record_found) { + $this->error_msg = 'Attempting to refund a payment with invoices attached, please specify valid invoice/s to be refunded.'; + return false; } } - private function checkCredit($paymentable, $request_credits) { $record_found = null; @@ -165,14 +169,16 @@ class ValidRefundableRequest implements Rule if ($request_credit['amount'] > $refundable_amount) { $credit = $paymentable; - $this->error_msg = "Attempting to refund more than allowed for credit ".$credit->number.", maximum refundable amount is ". $refundable_amount; + $this->error_msg = 'Attempting to refund more than allowed for credit '.$credit->number.', maximum refundable amount is '.$refundable_amount; + return false; } } } - if (!$record_found) { - $this->error_msg = "Attempting to refund a payment with credits attached, please specify valid credit/s to be refunded."; + if (! $record_found) { + $this->error_msg = 'Attempting to refund a payment with credits attached, please specify valid credit/s to be refunded.'; + return false; } } diff --git a/app/Http/ValidationRules/PaymentAmountsBalanceRule.php b/app/Http/ValidationRules/PaymentAmountsBalanceRule.php index be6ce7a0c99c..47305a2e964f 100644 --- a/app/Http/ValidationRules/PaymentAmountsBalanceRule.php +++ b/app/Http/ValidationRules/PaymentAmountsBalanceRule.php @@ -1,6 +1,6 @@ has('amount')) { + if (! request()->has('amount')) { return true; } diff --git a/app/Http/ValidationRules/PaymentAppliedValidAmount.php b/app/Http/ValidationRules/PaymentAppliedValidAmount.php index c796bd2ff797..1aedf49ca5e3 100644 --- a/app/Http/ValidationRules/PaymentAppliedValidAmount.php +++ b/app/Http/ValidationRules/PaymentAppliedValidAmount.php @@ -1,6 +1,6 @@ decodePrimaryKey(request()->segment(4)))->company()->first(); - if (!$payment) { + if (! $payment) { return false; } - + $payment_amounts = 0; $invoice_amounts = 0; diff --git a/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php b/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php index 31821683daca..03da60408946 100644 --- a/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php +++ b/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php @@ -1,6 +1,6 @@ input = $input; } - /** + /** * @param string $attribute * @param mixed $value * @return bool @@ -44,26 +43,26 @@ class UniqueQuoteNumberRule implements Rule */ public function message() { - return "Quote number already taken"; + return 'Quote number already taken'; } /** * @param $email * * //off,when_sent,when_paid - * + * * @return bool */ private function checkIfQuoteNumberUnique() : bool { - $quote = Quote::where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); - if($quote) + if ($quote) { return false; + } return true; } diff --git a/app/Http/ValidationRules/UniqueUserRule.php b/app/Http/ValidationRules/UniqueUserRule.php index d038b7870e6e..bc176685118d 100644 --- a/app/Http/ValidationRules/UniqueUserRule.php +++ b/app/Http/ValidationRules/UniqueUserRule.php @@ -1,6 +1,6 @@ user= $user; - + $this->user = $user; + $this->new_email = $new_email; } diff --git a/app/Http/ValidationRules/ValidClientGroupSettingsRule.php b/app/Http/ValidationRules/ValidClientGroupSettingsRule.php index 006b06784843..1a0c25d186df 100644 --- a/app/Http/ValidationRules/ValidClientGroupSettingsRule.php +++ b/app/Http/ValidationRules/ValidClientGroupSettingsRule.php @@ -1,6 +1,6 @@ return_data = $data; + return false; } else { return true; @@ -48,6 +47,6 @@ class ValidClientGroupSettingsRule implements Rule */ public function message() { - return $this->return_data[0]." is not a valid ".$this->return_data[1]; + return $this->return_data[0].' is not a valid '.$this->return_data[1]; } } diff --git a/app/Http/ValidationRules/ValidCompanyGatewayFeesAndLimitsRule.php b/app/Http/ValidationRules/ValidCompanyGatewayFeesAndLimitsRule.php index fcc7ea6b3429..f1446db279e7 100644 --- a/app/Http/ValidationRules/ValidCompanyGatewayFeesAndLimitsRule.php +++ b/app/Http/ValidationRules/ValidCompanyGatewayFeesAndLimitsRule.php @@ -1,6 +1,6 @@ return_data = $data; + return false; } else { return true; @@ -47,6 +46,6 @@ class ValidCompanyGatewayFeesAndLimitsRule implements Rule */ public function message() { - return $this->return_data[0]." is not a valid ".$this->return_data[1]; + return $this->return_data[0].' is not a valid '.$this->return_data[1]; } } diff --git a/app/Http/ValidationRules/ValidCreditsPresentRule.php b/app/Http/ValidationRules/ValidCreditsPresentRule.php index bdf8ec23b0c8..db9c7b2bb92e 100644 --- a/app/Http/ValidationRules/ValidCreditsPresentRule.php +++ b/app/Http/ValidationRules/ValidCreditsPresentRule.php @@ -1,6 +1,6 @@ input('credits') && is_array(request()->input('credits'))) { foreach (request()->input('credits') as $credit) { $cred = Credit::find($this->decodePrimaryKey($credit['credit_id'])); - if (!$cred || $cred->balance == 0) { + if (! $cred || $cred->balance == 0) { return false; } } diff --git a/app/Http/ValidationRules/ValidPayableInvoicesRule.php b/app/Http/ValidationRules/ValidPayableInvoicesRule.php index 80fe1f7a9473..b8d266be5156 100644 --- a/app/Http/ValidationRules/ValidPayableInvoicesRule.php +++ b/app/Http/ValidationRules/ValidPayableInvoicesRule.php @@ -1,6 +1,6 @@ isPayable()) { - $this->error_msg = "One or more of these invoices have been paid"; + $this->error_msg = 'One or more of these invoices have been paid'; + return false; } } diff --git a/app/Http/ValidationRules/ValidRefundableInvoices.php b/app/Http/ValidationRules/ValidRefundableInvoices.php index b6644f08e2aa..f52d6eb1689e 100644 --- a/app/Http/ValidationRules/ValidRefundableInvoices.php +++ b/app/Http/ValidationRules/ValidRefundableInvoices.php @@ -1,6 +1,6 @@ input = $input; } - - public function passes($attribute, $value) { - if (!array_key_exists('id', $this->input)) { - $this->error_msg = "Payment `id` required."; + if (! array_key_exists('id', $this->input)) { + $this->error_msg = 'Payment `id` required.'; + return false; } $payment = Payment::whereId($this->input['id'])->first(); - if (!$payment) { + if (! $payment) { $this->error_msg = "Payment couldn't be retrieved cannot be refunded "; + return false; } @@ -72,11 +70,11 @@ class ValidRefundableInvoices implements Rule foreach ($invoices as $invoice) { if (! $invoice->isRefundable()) { - $this->error_msg = "Invoice id ".$invoice->hashed_id ." cannot be refunded"; + $this->error_msg = 'Invoice id '.$invoice->hashed_id.' cannot be refunded'; + return false; } - foreach ($this->input['invoices'] as $val) { if ($val['invoice_id'] == $invoice->id) { @@ -84,7 +82,8 @@ class ValidRefundableInvoices implements Rule $pivot_record = $payment->paymentables->where('paymentable_id', $invoice->id)->first(); if ($val['amount'] > ($pivot_record->amount - $pivot_record->refunded)) { - $this->error_msg = "Attempting to refund ". $val['amount'] ." only ".($pivot_record->amount - $pivot_record->refunded)." available for refund"; + $this->error_msg = 'Attempting to refund '.$val['amount'].' only '.($pivot_record->amount - $pivot_record->refunded).' available for refund'; + return false; } } diff --git a/app/Http/ValidationRules/ValidSettingsRule.php b/app/Http/ValidationRules/ValidSettingsRule.php index db44959162b5..481a421ce4e6 100644 --- a/app/Http/ValidationRules/ValidSettingsRule.php +++ b/app/Http/ValidationRules/ValidSettingsRule.php @@ -1,6 +1,6 @@ return_data = $data; + return false; } else { return true; @@ -48,6 +47,6 @@ class ValidSettingsRule implements Rule */ public function message() { - return $this->return_data[0]." is not a valid ".$this->return_data[1]. " ( ".$this->return_data[2]." )"; + return $this->return_data[0].' is not a valid '.$this->return_data[1].' ( '.$this->return_data[2].' )'; } } diff --git a/app/Http/ValidationRules/ValidUserForCompany.php b/app/Http/ValidationRules/ValidUserForCompany.php index 398d9e8dfa3c..51f41d64b88d 100644 --- a/app/Http/ValidationRules/ValidUserForCompany.php +++ b/app/Http/ValidationRules/ValidUserForCompany.php @@ -1,6 +1,6 @@ user()) { + if (! auth()->user()) { return []; } - + $companies = auth()->user()->companies; //companies diff --git a/app/Http/ViewComposers/PortalComposer.php b/app/Http/ViewComposers/PortalComposer.php index e999395b3b0a..904e711926b3 100644 --- a/app/Http/ViewComposers/PortalComposer.php +++ b/app/Http/ViewComposers/PortalComposer.php @@ -1,6 +1,6 @@ user()) { + if (! auth()->user()) { return []; } @@ -61,13 +59,13 @@ class PortalComposer $data = []; // $data[] = [ 'title' => ctrans('texts.dashboard'), 'url' => 'client.dashboard', 'icon' => 'activity']; - $data[] = [ 'title' => ctrans('texts.invoices'), 'url' => 'client.invoices.index', 'icon' => 'file-text']; - $data[] = [ 'title' => ctrans('texts.recurring_invoices'), 'url' => 'client.recurring_invoices.index', 'icon' => 'file']; - $data[] = [ 'title' => ctrans('texts.payments'), 'url' => 'client.payments.index', 'icon' => 'credit-card']; - $data[] = [ 'title' => ctrans('texts.quotes'), 'url' => 'client.quotes.index', 'icon' => 'align-left']; - $data[] = [ 'title' => ctrans('texts.credits'), 'url' => 'client.credits.index', 'icon' => 'credit-card']; - $data[] = [ 'title' => ctrans('texts.payment_methods'), 'url' => 'client.payment_methods.index', 'icon' => 'shield']; - $data[] = [ 'title' => ctrans('texts.downloads'), 'url' => 'client.downloads.index', 'icon' => 'download']; + $data[] = ['title' => ctrans('texts.invoices'), 'url' => 'client.invoices.index', 'icon' => 'file-text']; + $data[] = ['title' => ctrans('texts.recurring_invoices'), 'url' => 'client.recurring_invoices.index', 'icon' => 'file']; + $data[] = ['title' => ctrans('texts.payments'), 'url' => 'client.payments.index', 'icon' => 'credit-card']; + $data[] = ['title' => ctrans('texts.quotes'), 'url' => 'client.quotes.index', 'icon' => 'align-left']; + $data[] = ['title' => ctrans('texts.credits'), 'url' => 'client.credits.index', 'icon' => 'credit-card']; + $data[] = ['title' => ctrans('texts.payment_methods'), 'url' => 'client.payment_methods.index', 'icon' => 'shield']; + $data[] = ['title' => ctrans('texts.downloads'), 'url' => 'client.downloads.index', 'icon' => 'download']; return $data; } diff --git a/app/Jobs/Account/CreateAccount.php b/app/Jobs/Account/CreateAccount.php index 10826f35b40b..794a2753077d 100644 --- a/app/Jobs/Account/CreateAccount.php +++ b/app/Jobs/Account/CreateAccount.php @@ -1,4 +1,5 @@ request = $sp660339; @@ -35,9 +36,9 @@ class CreateAccount if (config('ninja.environment') == 'selfhost' && Account::all()->count() == 0) { return $this->create(); } elseif (config('ninja.environment') == 'selfhost' && Account::all()->count() > 1) { - return response()->json(array('message' => Ninja::selfHostedMessage()), 400); - } elseif (!Ninja::boot()) { - return response()->json(array('message' => Ninja::parse()), 401); + return response()->json(['message' => Ninja::selfHostedMessage()], 400); + } elseif (! Ninja::boot()) { + return response()->json(['message' => Ninja::parse()], 401); } return $this->create(); @@ -48,7 +49,7 @@ class CreateAccount $sp794f3f = Account::create($this->request); $sp794f3f->referral_code = Str::random(32); - if (!$sp794f3f->key) { + if (! $sp794f3f->key) { $sp794f3f->key = Str::random(32); } @@ -62,7 +63,7 @@ class CreateAccount $spaa9f78 = CreateUser::dispatchNow($this->request, $sp794f3f, $sp035a66, true); CreateCompanyPaymentTerms::dispatchNow($sp035a66, $spaa9f78); - + if ($spaa9f78) { auth()->login($spaa9f78, false); } @@ -74,11 +75,11 @@ class CreateAccount if ($spaa9f78) { event(new AccountCreated($spaa9f78, $sp035a66, Ninja::eventVars())); } - + $spaa9f78->fresh(); $sp035a66->notification(new NewAccountCreated($spaa9f78, $sp035a66))->ninja(); - + return $sp794f3f; } } diff --git a/app/Jobs/Company/CreateCompany.php b/app/Jobs/Company/CreateCompany.php index a1e017117fca..e97289929a08 100644 --- a/app/Jobs/Company/CreateCompany.php +++ b/app/Jobs/Company/CreateCompany.php @@ -1,6 +1,6 @@ request = $request; @@ -49,7 +48,7 @@ class CreateCompany { $settings = CompanySettings::defaults(); - $settings->name = isset($this->request['name']) ? $this->request['name'] : ''; + $settings->name = isset($this->request['name']) ? $this->request['name'] : ''; $company = new Company(); $company->account_id = $this->account->id; diff --git a/app/Jobs/Company/CreateCompanyPaymentTerms.php b/app/Jobs/Company/CreateCompanyPaymentTerms.php index 7547a147e6a1..27249585b923 100644 --- a/app/Jobs/Company/CreateCompanyPaymentTerms.php +++ b/app/Jobs/Company/CreateCompanyPaymentTerms.php @@ -1,6 +1,6 @@ company = $company; @@ -48,7 +47,6 @@ class CreateCompanyPaymentTerms */ public function handle() { - $paymentTerms = [ ['num_days' => 0, 'name' => 'Net 0', 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], ['num_days' => 7, 'name' => '', 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], @@ -59,8 +57,7 @@ class CreateCompanyPaymentTerms ['num_days' => 60, 'name' => '', 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], ['num_days' => 90, 'name' => '', 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], ]; - - PaymentTerm::insert($paymentTerms); + PaymentTerm::insert($paymentTerms); } } diff --git a/app/Jobs/Company/CreateCompanyToken.php b/app/Jobs/Company/CreateCompanyToken.php index da8a07d3e2c2..1111f9035895 100644 --- a/app/Jobs/Company/CreateCompanyToken.php +++ b/app/Jobs/Company/CreateCompanyToken.php @@ -1,6 +1,6 @@ company = $company; - + $this->user = $user; $this->custom_token_name = $custom_token_name; @@ -51,19 +52,18 @@ class CreateCompanyToken implements ShouldQueue */ public function handle() : ?CompanyToken { - $this->custom_token_name = $this->custom_token_name ?: $this->user->first_name. ' '. $this->user->last_name; + $this->custom_token_name = $this->custom_token_name ?: $this->user->first_name.' '.$this->user->last_name; $company_token = new CompanyToken; $company_token->user_id = $this->user->id; $company_token->company_id = $this->company->id; $company_token->account_id = $this->user->account->id; - $company_token->name = $this->custom_token_name ?: $this->user->first_name. ' '. $this->user->last_name; + $company_token->name = $this->custom_token_name ?: $this->user->first_name.' '.$this->user->last_name; $company_token->token = Str::random(64); $company_token->is_system = true; $company_token->save(); - return $company_token; } } diff --git a/app/Jobs/Credit/ApplyCreditPayment.php b/app/Jobs/Credit/ApplyCreditPayment.php index 74d89f001337..996f4babe286 100644 --- a/app/Jobs/Credit/ApplyCreditPayment.php +++ b/app/Jobs/Credit/ApplyCreditPayment.php @@ -1,6 +1,6 @@ amount == $credit_balance) { //total credit applied. $this->credit->setStatus(Credit::STATUS_APPLIED); - $this->credit->updateBalance($this->amount*-1); + $this->credit->updateBalance($this->amount * -1); } elseif ($this->amount < $credit_balance) { //compare number appropriately $this->credit->setStatus(Credit::STATUS_PARTIAL); - $this->credit->updateBalance($this->amount*-1); + $this->credit->updateBalance($this->amount * -1); } - + /* Update Payment Applied Amount*/ $this->payment->save(); } diff --git a/app/Jobs/Credit/CreateCreditPdf.php b/app/Jobs/Credit/CreateCreditPdf.php index c1aa569b200b..27ba0a9413a6 100644 --- a/app/Jobs/Credit/CreateCreditPdf.php +++ b/app/Jobs/Credit/CreateCreditPdf.php @@ -1,6 +1,6 @@ generate($this->invitation); + } $this->credit->load('client'); App::setLocale($this->contact->preferredLocale()); - $path = $this->credit->client->credit_filepath(); + $path = $this->credit->client->credit_filepath(); - $file_path = $path . $this->credit->number . '.pdf'; + $file_path = $path.$this->credit->number.'.pdf'; $credit_design_id = $this->credit->design_id ? $this->credit->design_id : $this->decodePrimaryKey($this->credit->client->getSetting('credit_design_id')); $design = Design::find($credit_design_id); - + $designer = new Designer($this->credit, $design, $this->credit->client->getSetting('pdf_variables'), 'credit'); $html = (new HtmlEngine($designer, $this->invitation, 'credit'))->build(); Storage::makeDirectory($path, 0775); - $pdf = $this->makePdf(null, null, $html); + $pdf = $this->makePdf(null, null, $html); $instance = Storage::disk($this->disk)->put($file_path, $pdf); diff --git a/app/Jobs/Credit/EmailCredit.php b/app/Jobs/Credit/EmailCredit.php index fafb4982c4da..588b31d6cd19 100644 --- a/app/Jobs/Credit/EmailCredit.php +++ b/app/Jobs/Credit/EmailCredit.php @@ -1,6 +1,6 @@ credit->client->getSetting('email_style'); - + $this->setMailDriver(); $this->credit->invitations->each(function ($invitation) use ($template_style) { - if ($invitation->contact->send_email && $invitation->contact->email) { - $message_array = $this->credit->getEmailData('', $invitation->contact); $message_array['title'] = &$message_array['subject']; - $message_array['footer'] = "Sent to ".$invitation->contact->present()->name(); - + $message_array['footer'] = 'Sent to '.$invitation->contact->present()->name(); + //send message Mail::to($invitation->contact->email, $invitation->contact->present()->name()) ->send(new TemplateEmail($message_array, $template_style, $invitation->contact->user, $invitation->contact->client)); if (count(Mail::failures()) > 0) { event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures(), Ninja::eventVars())); - - return $this->logMailError(Mail::failures(), $this->credit->client); + return $this->logMailError(Mail::failures(), $this->credit->client); } //fire any events diff --git a/app/Jobs/Cron/RecurringInvoicesCron.php b/app/Jobs/Cron/RecurringInvoicesCron.php index da876aeb9eb8..c6d693c70b74 100644 --- a/app/Jobs/Cron/RecurringInvoicesCron.php +++ b/app/Jobs/Cron/RecurringInvoicesCron.php @@ -1,6 +1,6 @@ addMinutes(30))->get(); - Log::info(Carbon::now()->addMinutes(30) . ' Sending Recurring Invoices. Count = '. $recurring_invoices->count()); + Log::info(Carbon::now()->addMinutes(30).' Sending Recurring Invoices. Count = '.$recurring_invoices->count()); $recurring_invoices->each(function ($recurring_invoice, $key) { SendRecurring::dispatch($recurring_invoice, $recurring_invoice->company->db); @@ -55,7 +53,7 @@ class RecurringInvoicesCron $recurring_invoices = RecurringInvoice::where('next_send_date', '<=', Carbon::now()->addMinutes(30))->get(); - Log::info(Carbon::now()->addMinutes(30) . ' Sending Recurring Invoices. Count = '. $recurring_invoices->count() . 'On Database # '. $db); + Log::info(Carbon::now()->addMinutes(30).' Sending Recurring Invoices. Count = '.$recurring_invoices->count().'On Database # '.$db); $recurring_invoices->each(function ($recurring_invoice, $key) { SendRecurring::dispatch($recurring_invoice, $recurring_invoice->company->db); diff --git a/app/Jobs/Invitation/MarkOpened.php b/app/Jobs/Invitation/MarkOpened.php index 688a2dbeb0b8..182ccd89a7f2 100644 --- a/app/Jobs/Invitation/MarkOpened.php +++ b/app/Jobs/Invitation/MarkOpened.php @@ -1,6 +1,6 @@ contact->preferredLocale()); - $path = $this->invoice->client->invoice_filepath(); + $path = $this->invoice->client->invoice_filepath(); - $file_path = $path . $this->invoice->number . '.pdf'; + $file_path = $path.$this->invoice->number.'.pdf'; $invoice_design_id = $this->invoice->design_id ? $this->invoice->design_id : $this->decodePrimaryKey($this->invoice->client->getSetting('invoice_design_id')); - $design = Design::find($invoice_design_id); + $design = Design::find($invoice_design_id); $html = new HtmlEngine(null, $this->invitation, 'invoice'); @@ -93,7 +93,7 @@ class CreateInvoicePdf implements ShouldQueue 'template' => $template->elements([ 'client' => $this->invoice->client, 'entity' => $this->invoice, - 'pdf_variables' => (array)$this->invoice->company->settings->pdf_variables, + 'pdf_variables' => (array) $this->invoice->company->settings->pdf_variables, ]), 'variables' => $html->generateLabelsAndValues(), 'options' => [ @@ -115,7 +115,7 @@ class CreateInvoicePdf implements ShouldQueue $pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true)); - $instance = Storage::disk($this->disk)->put($file_path, $pdf); + $instance = Storage::disk($this->disk)->put($file_path, $pdf); return $file_path; } diff --git a/app/Jobs/Invoice/CreateUbl.php b/app/Jobs/Invoice/CreateUbl.php index b9f14203a65d..71e8a2038bc3 100644 --- a/app/Jobs/Invoice/CreateUbl.php +++ b/app/Jobs/Invoice/CreateUbl.php @@ -1,6 +1,6 @@ invoice; @@ -100,7 +99,6 @@ class CreateUbl implements ShouldQueue try { return Generator::invoice($ubl_invoice, $invoice->client->getCurrencyCode()); } catch (\Exception $exception) { - return false; } } @@ -179,33 +177,6 @@ class CreateUbl implements ShouldQueue return $taxAmount; } - - - - - - - - - - - - - - - - - - - - - - - - - - - /** * @param $invoiceItem * @param $invoiceTotal @@ -270,22 +241,18 @@ class CreateUbl implements ShouldQueue if ($this->invoice->custom_surcharge1 && $this->invoice->custom_surcharge_tax1) { $total += $this->invoice->custom_surcharge1; } - if ($this->invoice->custom_surcharge2 && $this->invoice->custom_surcharge_tax2) { $total += $this->invoice->custom_surcharge2; } - if ($this->invoice->custom_surcharge3 && $this->invoice->custom_surcharge_tax3) { $total += $this->invoice->custom_surcharge3; } - if ($this->invoice->custom_surcharge4 && $this->invoice->custom_surcharge_tax4) { $total += $this->invoice->custom_surcharge4; } - return $total; } diff --git a/app/Jobs/Invoice/EmailInvoice.php b/app/Jobs/Invoice/EmailInvoice.php index 93b9b04239f7..3e8180d068f0 100644 --- a/app/Jobs/Invoice/EmailInvoice.php +++ b/app/Jobs/Invoice/EmailInvoice.php @@ -1,6 +1,6 @@ company = $company; @@ -60,7 +59,6 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue $this->email_builder = $email_builder; $this->settings = $invoice_invitation->contact->client->getMergedSettings(); - } /** @@ -69,15 +67,13 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue * * @return void */ - public function handle() - { + { MultiDB::setDB($this->company->db); - + $this->setMailDriver(); try { - Mail::to($this->invoice_invitation->contact->email, $this->invoice_invitation->contact->present()->name()) ->send( new TemplateEmail( @@ -86,26 +82,17 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue $this->invoice_invitation->contact->client ) ); - - } - catch (\Swift_TransportException $e) { - + } catch (\Swift_TransportException $e) { event(new InvoiceWasEmailedAndFailed($this->invoice_invitation->invoice, $this->company, $e->getMessage(), Ninja::eventVars())); - - } + } if (count(Mail::failures()) > 0) { $this->logMailError(Mail::failures(), $this->invoice->client); - } - else{ + } else { event(new InvoiceWasEmailed($this->invoice_invitation, $this->company, Ninja::eventVars())); } /* Mark invoice sent */ $this->invoice_invitation->invoice->service()->markSent()->save(); - - } - - } diff --git a/app/Jobs/Invoice/InjectSignature.php b/app/Jobs/Invoice/InjectSignature.php index 5e2f7636425e..cd93d07c7704 100644 --- a/app/Jobs/Invoice/InjectSignature.php +++ b/app/Jobs/Invoice/InjectSignature.php @@ -44,7 +44,7 @@ class InjectSignature implements ShouldQueue { $invitation = $this->invoice->invitations->whereNotNull('signature_base64')->first(); - if (!$invitation) { + if (! $invitation) { return; } diff --git a/app/Jobs/Invoice/InvoiceWorkflowSettings.php b/app/Jobs/Invoice/InvoiceWorkflowSettings.php index b12bf333af94..886472b65e8f 100644 --- a/app/Jobs/Invoice/InvoiceWorkflowSettings.php +++ b/app/Jobs/Invoice/InvoiceWorkflowSettings.php @@ -1,7 +1,7 @@ client->getSetting('auto_archive_invoice')) { - /** Throws: Payment amount xxx does not match invoice totals. */ + /* Throws: Payment amount xxx does not match invoice totals. */ $this->base_repository->archive($this->invoice); } diff --git a/app/Jobs/Invoice/ZipInvoices.php b/app/Jobs/Invoice/ZipInvoices.php index 787975508fce..8842064cf3f7 100644 --- a/app/Jobs/Invoice/ZipInvoices.php +++ b/app/Jobs/Invoice/ZipInvoices.php @@ -1,6 +1,6 @@ setOutputStream($tempStream); - # create a new zipstream object - $file_name = date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoices')).".zip"; + // create a new zipstream object + $file_name = date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip'; $path = $this->invoices->first()->client->invoice_filepath(); @@ -82,15 +83,15 @@ class ZipInvoices extends BaseMailerJob implements ShouldQueue $zip->finish(); - Storage::disk(config('filesystems.default'))->put($path . $file_name, $tempStream); + Storage::disk(config('filesystems.default'))->put($path.$file_name, $tempStream); fclose($tempStream); $this->setMailDriver(); Mail::to($this->email) - ->send(new DownloadInvoices(Storage::disk(config('filesystems.default'))->url($path . $file_name), $this->company)); + ->send(new DownloadInvoices(Storage::disk(config('filesystems.default'))->url($path.$file_name), $this->company)); - UnlinkFile::dispatch(config('filesystems.default'), $path . $file_name)->delay(now()->addHours(1)); + UnlinkFile::dispatch(config('filesystems.default'), $path.$file_name)->delay(now()->addHours(1)); } } diff --git a/app/Jobs/Mail/BaseMailerJob.php b/app/Jobs/Mail/BaseMailerJob.php index 5f0188d1fe38..a05283344e04 100644 --- a/app/Jobs/Mail/BaseMailerJob.php +++ b/app/Jobs/Mail/BaseMailerJob.php @@ -1,6 +1,6 @@ settings->email_sending_method) { @@ -40,7 +39,6 @@ class BaseMailerJob implements ShouldQueue default: break; } - } public function setGmailMailer() @@ -56,20 +54,18 @@ class BaseMailerJob implements ShouldQueue $google->refreshToken($user); } - /* - * Now that our token is refresh and valid we can boot the + /* + * Now that our token is refresh and valid we can boot the * mail driver at runtime and also set the token which will persist * just for this request. */ - + Config::set('mail.driver', 'gmail'); Config::set('services.gmail.token', $user->oauth_user_token->access_token); (new MailServiceProvider(app()))->register(); - } - public function logMailError($errors, $recipient_object) { SystemLogger::dispatch( @@ -80,4 +76,4 @@ class BaseMailerJob implements ShouldQueue $recipient_object ); } -} \ No newline at end of file +} diff --git a/app/Jobs/Mail/EntityPaidMailer.php b/app/Jobs/Mail/EntityPaidMailer.php index 6e840ecea700..9b361d837362 100644 --- a/app/Jobs/Mail/EntityPaidMailer.php +++ b/app/Jobs/Mail/EntityPaidMailer.php @@ -1,6 +1,6 @@ payment = $payment; $this->settings = $payment->client->getMergedSettings(); - } /** @@ -73,15 +73,16 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue MultiDB::setDb($this->company->db); /*If we are migrating data we don't want to fire these notification*/ - if($this->company->company_users->first()->is_migrating) + if ($this->company->company_users->first()->is_migrating) { return true; - + } + //if we need to set an email driver do it now $this->setMailDriver(); $mail_obj = (new EntityPaidObject($this->payment))->build(); $mail_obj->from = [$this->payment->user->email, $this->payment->user->present()->name()]; - + //send email Mail::to($this->user->email) ->send(new EntityNotificationMailer($mail_obj)); @@ -90,10 +91,5 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures(), $this->payment->client); } - } - - - - } diff --git a/app/Jobs/Mail/EntitySentMailer.php b/app/Jobs/Mail/EntitySentMailer.php index 5dd4118aee05..c01fa4e6bd4d 100644 --- a/app/Jobs/Mail/EntitySentMailer.php +++ b/app/Jobs/Mail/EntitySentMailer.php @@ -1,6 +1,6 @@ invitation, $this->entity_type))->build(); $mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()]; - + //send email Mail::to($this->user->email) ->send(new EntityNotificationMailer($mail_obj)); @@ -89,9 +89,5 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures(), $this->entity->client); } - } - - - } diff --git a/app/Jobs/Mail/EntityViewedMailer.php b/app/Jobs/Mail/EntityViewedMailer.php index 32043e6de0f3..222fff83e77c 100644 --- a/app/Jobs/Mail/EntityViewedMailer.php +++ b/app/Jobs/Mail/EntityViewedMailer.php @@ -1,6 +1,6 @@ entity_type = $entity_type; $this->settings = $invitation->contact->client->getMergedSettings(); - } /** @@ -90,9 +90,5 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures(), $this->invoice->client); } - } - - - } diff --git a/app/Jobs/Mail/MailRouter.php b/app/Jobs/Mail/MailRouter.php index e484621a86c5..6051d09b9352 100644 --- a/app/Jobs/Mail/MailRouter.php +++ b/app/Jobs/Mail/MailRouter.php @@ -1,6 +1,6 @@ mailable = $mailable; @@ -58,19 +58,20 @@ class MailRouter extends BaseMailerJob implements ShouldQueue $this->sending_method = $sending_method; - if($to_user instanceof ClientContact) + if ($to_user instanceof ClientContact) { $this->settings = $to_user->client->getMergedSettings(); - else + } else { $this->settings = $this->company->settings; + } } public function handle() { - MultiDB::setDb($this->company->db); - + MultiDB::setDb($this->company->db); + //if we need to set an email driver do it now $this->setMailDriver(); - + //send email Mail::to($this->to_user->email) ->send($this->mailable); @@ -80,4 +81,4 @@ class MailRouter extends BaseMailerJob implements ShouldQueue $this->logMailError(Mail::failures(), $this->to_user); } } -} \ No newline at end of file +} diff --git a/app/Jobs/Mail/PaymentFailureMailer.php b/app/Jobs/Mail/PaymentFailureMailer.php index d54257b3c64f..d309415f4b8b 100644 --- a/app/Jobs/Mail/PaymentFailureMailer.php +++ b/app/Jobs/Mail/PaymentFailureMailer.php @@ -1,6 +1,6 @@ company->db); @@ -79,7 +79,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue $this->setMailDriver(); //iterate through company_users - $this->company->company_users->each(function ($company_user){ + $this->company->company_users->each(function ($company_user) { //determine if this user has the right permissions $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure']); @@ -90,7 +90,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue $mail_obj = (new PaymentFailureObject($this->client, $this->message, $this->amount, $this->company))->build(); $mail_obj->from = [$this->company->owner()->email, $this->company->owner()->present()->name()]; - + //send email Mail::to($company_user->user->email) ->send(new EntityNotificationMailer($mail_obj)); @@ -99,12 +99,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures(), $this->client); } - } - }); - } - - } diff --git a/app/Jobs/Ninja/AdjustEmailQuota.php b/app/Jobs/Ninja/AdjustEmailQuota.php index 1f5d04c70b9c..1fecd1bbdd01 100644 --- a/app/Jobs/Ninja/AdjustEmailQuota.php +++ b/app/Jobs/Ninja/AdjustEmailQuota.php @@ -1,6 +1,6 @@ adjust(); } else { //multiDB environment, need to foreach (MultiDB::$dbs as $db) { - MultiDB::setDB($db); $this->adjust(); } } - } public function adjust() { - - foreach(Account::cursor() as $account){ - //@TODO once we add in the two columns daily_emails_quota daily_emails_sent_ + foreach (Account::cursor() as $account) { + //@TODO once we add in the two columns daily_emails_quota daily_emails_sent_ } - } - } diff --git a/app/Jobs/Ninja/CheckDbStatus.php b/app/Jobs/Ninja/CheckDbStatus.php index fb51c56bac76..a573cff8c219 100644 --- a/app/Jobs/Ninja/CheckDbStatus.php +++ b/app/Jobs/Ninja/CheckDbStatus.php @@ -1,6 +1,6 @@ check(); } else { //multiDB environment, need to foreach (MultiDB::$dbs as $db) { - MultiDB::setDB($db); $this->check(); } } - } private function check() { - - Company::cursor()->each(function ($company) - { - - if($company->invoices->count() > 1000 || $company->products->count() > 1000 || $company->clients->count() > 1000) - { - $company->is_large = true; - $company->save(); - } - - }); - + Company::cursor()->each(function ($company) { + if ($company->invoices->count() > 1000 || $company->products->count() > 1000 || $company->clients->count() > 1000) { + $company->is_large = true; + $company->save(); + } + }); } - } diff --git a/app/Jobs/Ninja/RefundCancelledAccount.php b/app/Jobs/Ninja/RefundCancelledAccount.php index a9d86fce04cb..ebadef7e54df 100644 --- a/app/Jobs/Ninja/RefundCancelledAccount.php +++ b/app/Jobs/Ninja/RefundCancelledAccount.php @@ -16,6 +16,7 @@ class RefundCancelledAccount implements ShouldQueue use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public $account; + /** * Create a new job instance. * @@ -34,18 +35,21 @@ class RefundCancelledAccount implements ShouldQueue public function handle() { // if free plan, return - if(Ninja::isSelfHost() || $this->account->isFreeHostedClient()) + if (Ninja::isSelfHost() || $this->account->isFreeHostedClient()) { return; - + } + $plan_details = $this->account->getPlanDetails(); /* Trial user cancelling early.... */ - if($plan_details['trial_active']) + if ($plan_details['trial_active']) { return; - + } + /* Is the plan Active? */ - if(!$plan_details['active']) + if (! $plan_details['active']) { return; + } /* Refundable client! */ @@ -74,5 +78,4 @@ class RefundCancelledAccount implements ShouldQueue return $pro_rata_refund; } - } diff --git a/app/Jobs/Payment/EmailPayment.php b/app/Jobs/Payment/EmailPayment.php index 6a7266fd8165..7af54d382df3 100644 --- a/app/Jobs/Payment/EmailPayment.php +++ b/app/Jobs/Payment/EmailPayment.php @@ -31,7 +31,6 @@ class EmailPayment implements ShouldQueue private $contact; - /** * Create a new job instance. * @@ -44,7 +43,6 @@ class EmailPayment implements ShouldQueue $this->contact = $contact; } - /** * Execute the job. * diff --git a/app/Jobs/Payment/PaymentNotification.php b/app/Jobs/Payment/PaymentNotification.php index 5dc96af556de..431aad65c2f9 100644 --- a/app/Jobs/Payment/PaymentNotification.php +++ b/app/Jobs/Payment/PaymentNotification.php @@ -1,6 +1,6 @@ products = $products; - + $this->invoice = $invoice; $this->company = $company; @@ -58,19 +58,19 @@ class UpdateOrCreateProduct implements ShouldQueue MultiDB::setDB($this->company->db); foreach ($this->products as $item) { - - if(empty($item->product_key)) + if (empty($item->product_key)) { continue; + } $product = Product::firstOrNew(['product_key' => $item->product_key, 'company_id' => $this->invoice->company->id]); - + $product->product_key = $item->product_key; $product->notes = isset($item->notes) ? $item->notes : ''; //$product->cost = isset($item->cost) ? $item->cost : 0; //this value shouldn't be updated. $product->price = isset($item->cost) ? $item->cost : 0; $product->quantity = isset($item->quantity) ? $item->quantity : 0; $product->tax_name1 = isset($item->tax_name1) ? $item->tax_name1 : ''; - $product->tax_rate1 = isset($item->tax_rate1) ? $item->tax_rate1 : 0 ; + $product->tax_rate1 = isset($item->tax_rate1) ? $item->tax_rate1 : 0; $product->tax_name2 = isset($item->tax_name2) ? $item->tax_name2 : ''; $product->tax_rate2 = isset($item->tax_rate2) ? $item->tax_rate2 : 0; $product->tax_name3 = isset($item->tax_name3) ? $item->tax_name3 : ''; diff --git a/app/Jobs/Quote/ApplyQuoteNumber.php b/app/Jobs/Quote/ApplyQuoteNumber.php index 7660cdcde55b..10e38cc9c255 100644 --- a/app/Jobs/Quote/ApplyQuoteNumber.php +++ b/app/Jobs/Quote/ApplyQuoteNumber.php @@ -1,6 +1,6 @@ quote->number = $this->getNextQuoteNumber($this->quote->client); } break; - + default: - # code... + // code... break; } - + $this->quote->save(); - + return $this->quote; } } diff --git a/app/Jobs/Quote/CreateQuoteInvitations.php b/app/Jobs/Quote/CreateQuoteInvitations.php index f460945176ea..b939b2324941 100644 --- a/app/Jobs/Quote/CreateQuoteInvitations.php +++ b/app/Jobs/Quote/CreateQuoteInvitations.php @@ -1,6 +1,6 @@ whereQuoteId($this->quote->id) ->first(); - if (!$invitation && $contact->send) { + if (! $invitation && $contact->send) { $ii = QuoteInvitationFactory::create($this->quote->company_id, $this->quote->user_id); $ii->quote_id = $this->quote->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send) { + } elseif ($invitation && ! $contact->send) { $invitation->delete(); } }); diff --git a/app/Jobs/Quote/CreateQuotePdf.php b/app/Jobs/Quote/CreateQuotePdf.php index 4c63eacb1a9e..4e94cd81c4d9 100644 --- a/app/Jobs/Quote/CreateQuotePdf.php +++ b/app/Jobs/Quote/CreateQuotePdf.php @@ -1,6 +1,6 @@ generate($this->invitation); + } $this->quote->load('client'); App::setLocale($this->contact->preferredLocale()); - $path = $this->quote->client->quote_filepath(); + $path = $this->quote->client->quote_filepath(); $quote_design_id = $this->quote->design_id ? $this->quote->design_id : $this->decodePrimaryKey($this->quote->client->getSetting('quote_design_id')); - $design = Design::find($quote_design_id); + $design = Design::find($quote_design_id); $html = new HtmlEngine(null, $this->invitation, 'quote'); - $design_namespace = 'App\Services\PdfMaker\Designs\\' . $design->name; + $design_namespace = 'App\Services\PdfMaker\Designs\\'.$design->name; $design_class = new $design_namespace(); @@ -94,7 +95,7 @@ class CreateQuotePdf implements ShouldQueue 'template' => $design_class->elements([ 'client' => $this->quote->client, 'entity' => $this->quote, - 'pdf_variables' => (array)$this->quote->company->settings->pdf_variables, + 'pdf_variables' => (array) $this->quote->company->settings->pdf_variables, ]), 'variables' => $html->generateLabelsAndValues(), 'options' => [ @@ -111,10 +112,10 @@ class CreateQuotePdf implements ShouldQueue //todo - move this to the client creation stage so we don't keep hitting this unnecessarily Storage::makeDirectory($path, 0775); - - $pdf = $this->makePdf(null, null, $maker->getCompiledHTML()); - $file_path = $path . $this->quote->number . '.pdf'; + $pdf = $this->makePdf(null, null, $maker->getCompiledHTML()); + + $file_path = $path.$this->quote->number.'.pdf'; $instance = Storage::disk($this->disk)->put($file_path, $pdf); diff --git a/app/Jobs/Quote/EmailQuote.php b/app/Jobs/Quote/EmailQuote.php index 407157a4ad40..c6322fd83a29 100644 --- a/app/Jobs/Quote/EmailQuote.php +++ b/app/Jobs/Quote/EmailQuote.php @@ -61,7 +61,6 @@ class EmailQuote implements ShouldQueue } $this->quote_invitation->quote->service()->markSent()->save(); - } private function logMailError($errors) diff --git a/app/Jobs/Quote/QuoteWorkflowSettings.php b/app/Jobs/Quote/QuoteWorkflowSettings.php index cd155cc498ae..fd5129eef5cb 100644 --- a/app/Jobs/Quote/QuoteWorkflowSettings.php +++ b/app/Jobs/Quote/QuoteWorkflowSettings.php @@ -1,7 +1,7 @@ client->getSetting('auto_email_quote')) { $this->quote->invitations->each(function ($invitation, $key) { $this->quote->service()->sendEmail($invitation->contact); - }); + }); } - + if ($this->client->getSetting('auto_archive_quote')) { $this->base_repository->archive($this->quote); } diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index dfbbd55f133a..2486ad3a8181 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -1,6 +1,6 @@ recurring_invoice = $recurring_invoice; @@ -60,13 +59,13 @@ class SendRecurring implements ShouldQueue // Queue: Emails for invoice // foreach invoice->invitations - + // Fire Payment if auto-bill is enabled if ($this->recurring_invoice->settings->auto_bill) { //PAYMENT ACTION HERE TODO // Clean up recurring invoice object - + $this->recurring_invoice->remaining_cycles = $this->recurring_invoice->remainingCycles(); } $this->recurring_invoice->last_sent_date = date('Y-m-d'); @@ -76,7 +75,7 @@ class SendRecurring implements ShouldQueue } else { $this->recurring_invoice->setCompleted(); } - + $this->recurring_invoice->save(); } } diff --git a/app/Jobs/User/CreateUser.php b/app/Jobs/User/CreateUser.php index e49f2de86310..8d8a0e74effc 100644 --- a/app/Jobs/User/CreateUser.php +++ b/app/Jobs/User/CreateUser.php @@ -1,6 +1,6 @@ request = $request; @@ -62,7 +61,7 @@ class CreateUser $user->accepted_terms_version = config('ninja.terms_version'); $user->confirmation_code = $this->createDbHash(config('database.default')); $user->fill($this->request); - $user->email = $this->request['email'];//todo need to remove this in production + $user->email = $this->request['email']; //todo need to remove this in production $user->last_login = now(); $user->ip = request()->ip(); $user->save(); @@ -77,7 +76,7 @@ class CreateUser //'settings' => DefaultSettings::userSettings(), 'settings' => null, ]); - + event(new UserWasCreated($user, $this->company, Ninja::eventVars())); return $user; diff --git a/app/Jobs/User/UserEmailChanged.php b/app/Jobs/User/UserEmailChanged.php index 39d03b7d6995..6c3cb939b036 100644 --- a/app/Jobs/User/UserEmailChanged.php +++ b/app/Jobs/User/UserEmailChanged.php @@ -1,6 +1,6 @@ new_email = $new_email; $this->old_email = $old_email; $this->company = $company; $this->settings = $this->company->settings; - } - public function handle() + public function handle() { //Set DB MultiDB::setDb($this->company->db); @@ -77,7 +76,6 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue if (count(Mail::failures()) > 0) { return $this->logMailError(Mail::failures(), $this->company); } - } private function getData() @@ -96,5 +94,4 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue 'logo' => $this->company->present()->logo(), ]; } - } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 34ce39061bad..5b805ae05ba2 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1,6 +1,6 @@ data as $key => $resource) { @@ -188,9 +187,7 @@ class Import implements ShouldQueue private function setInitialCompanyLedgerBalances() { - - Client::cursor()->each(function ($client){ - + Client::cursor()->each(function ($client) { $company_ledger = CompanyLedgerFactory::create($client->company_id, $client->user_id); $company_ledger->client_id = $client->id; $company_ledger->adjustment = $client->balance; @@ -200,9 +197,7 @@ class Import implements ShouldQueue $company_ledger->save(); $client->company_ledger()->save($company_ledger); - }); - } /** @@ -227,7 +222,7 @@ class Import implements ShouldQueue unset($data['account_id']); } - if(isset($data['referral_code'])) { + if (isset($data['referral_code'])) { $account = $this->company->account; $account->referral_code = $data['referral_code']; $account->save(); @@ -388,7 +383,7 @@ class Import implements ShouldQueue $modified['user_id'] = $this->processUserId($resource); $modified['balance'] = $modified['balance'] ?: 0; $modified['paid_to_date'] = $modified['paid_to_date'] ?: 0; - + unset($modified['id']); unset($modified['contacts']); @@ -413,11 +408,9 @@ class Import implements ShouldQueue unset($modified_contacts[$key]['id']); } - $saveable_contacts['contacts'] = $modified_contacts; $contact_repository->save($saveable_contacts, $client); - } $key = "clients_{$resource['id']}"; @@ -495,15 +488,14 @@ class Import implements ShouldQueue $invoice_repository = new InvoiceMigrationRepository(); foreach ($data as $key => $resource) { - $modified = $resource; if (array_key_exists('client_id', $resource) && ! array_key_exists('clients', $this->ids)) { throw new ResourceDependencyMissing('Processing invoices failed, because of missing dependency - clients.'); } - $modified['client_id'] = $this->transformId('clients', $resource['client_id']); - $modified['user_id'] = $this->processUserId($resource); + $modified['client_id'] = $this->transformId('clients', $resource['client_id']); + $modified['user_id'] = $this->processUserId($resource); $modified['company_id'] = $this->company->id; $modified['line_items'] = $this->cleanItems($modified['line_items']); @@ -524,7 +516,6 @@ class Import implements ShouldQueue Invoice::reguard(); - /*Improve memory handling by setting everything to null when we have finished*/ $data = null; $invoice_repository = null; @@ -664,7 +655,6 @@ class Import implements ShouldQueue unset($modified['invoice_id']); if (isset($modified['invoices'])) { - foreach ($modified['invoices'] as $key => $invoice) { $modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']); } @@ -714,12 +704,12 @@ class Import implements ShouldQueue if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && array_key_exists('invoices', $this->ids)) { $modified['documentable_id'] = $this->transformId('invoices', $resource['invoice_id']); - $modified['documentable_type'] = 'App\\Models\\Invoice'; + $modified['documentable_type'] = \App\Models\Invoice::class; } if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) { $modified['documentable_id'] = $this->transformId('expenses', $resource['expense_id']); - $modified['documentable_type'] = 'App\\Models\\Expense'; + $modified['documentable_type'] = \App\Models\Expense::class; } $modified['user_id'] = $this->processUserId($resource); @@ -748,22 +738,19 @@ class Import implements ShouldQueue private function processPaymentTerms(array $data) :void { - PaymentTerm::unguard(); - $modified = collect($data)->map(function ($item){ - + $modified = collect($data)->map(function ($item) { $item['user_id'] = $this->user->id; $item['company_id'] = $this->company->id; return $item; - })->toArray(); PaymentTerm::insert($modified); PaymentTerm::reguard(); - + /*Improve memory handling by setting everything to null when we have finished*/ $data = null; } diff --git a/app/Jobs/Util/PreviewPdf.php b/app/Jobs/Util/PreviewPdf.php index 298bb61ca5ea..952198f8af40 100644 --- a/app/Jobs/Util/PreviewPdf.php +++ b/app/Jobs/Util/PreviewPdf.php @@ -1,6 +1,6 @@ makePdf(null, null, $this->design_string); - } } diff --git a/app/Jobs/Util/ProcessBulk.php b/app/Jobs/Util/ProcessBulk.php index d9614a1b4236..a37fe198dfef 100644 --- a/app/Jobs/Util/ProcessBulk.php +++ b/app/Jobs/Util/ProcessBulk.php @@ -1,6 +1,6 @@ each(function ($invoice) { if ($invoice->isPayable()) { - $invoice->invitations->each(function ($invitation) use ($invoice) { $email_builder = (new InvoiceEmail())->build($invitation); EmailInvoice::dispatch($email_builder, $invitation, $invoice->company); info("Firing email for invoice {$invoice->number}"); - }); if ($invoice->invitations->count() > 0) { event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars())); } - } else { - $invoice->next_send_date = null; $invoice->save(); - } }); } - - } diff --git a/app/Jobs/Util/SendFailedEmails.php b/app/Jobs/Util/SendFailedEmails.php index 3ba120495a52..e9975213e0ef 100644 --- a/app/Jobs/Util/SendFailedEmails.php +++ b/app/Jobs/Util/SendFailedEmails.php @@ -1,6 +1,6 @@ processEmails(); } else { //multiDB environment, need to foreach (MultiDB::$dbs as $db) { - MultiDB::setDB($db); $this->processEmails(); } } - } private function processEmails() { -\Log::error("processing emails"); + \Log::error('processing emails'); //info("process emails"); //@todo check that the quota is available for the job - + $email_jobs = SystemLog::where('event_id', SystemLog::EVENT_MAIL_RETRY_QUEUE)->get(); - $email_jobs->each(function($job){ - + $email_jobs->each(function ($job) { $job_meta_array = $job->log; $invitation = $job_meta_array['entity_name']::where('key', $job_meta_array['invitation_key'])->with('contact')->first(); - if($invitation->invoice){ + if ($invitation->invoice) { $email_builder = (new InvoiceEmail())->build($invitation, $job_meta_array['reminder_template']); if ($invitation->contact->send_email && $invitation->contact->email) { @@ -79,7 +75,5 @@ class SendFailedEmails implements ShouldQueue } } }); - } - } diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index 2373540e112c..67f2f348500c 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -1,6 +1,6 @@ filepath = $filepath; @@ -74,7 +72,6 @@ class StartMigration implements ShouldQueue */ public function handle() { - set_time_limit(0); MultiDB::setDb($this->company->db); @@ -91,7 +88,7 @@ class StartMigration implements ShouldQueue $filename = pathinfo($this->filepath, PATHINFO_FILENAME); try { - if (!$archive) { + if (! $archive) { throw new ProcessingMigrationArchiveFailed('Processing migration archive failed. Migration file is possibly corrupted.'); } @@ -106,7 +103,7 @@ class StartMigration implements ShouldQueue $file = storage_path("migrations/$filename/migration.json"); - if (!file_exists($file)) { + if (! file_exists($file)) { throw new NonExistingMigrationFile('Migration file does not exist, or it is corrupted.'); } @@ -115,7 +112,6 @@ class StartMigration implements ShouldQueue Import::dispatchNow($data, $this->company, $this->user); $this->company->setMigration(false); - } catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) { $this->company->setMigration(false); @@ -127,7 +123,6 @@ class StartMigration implements ShouldQueue } //always make sure we unset the migration as running - return true; } diff --git a/app/Jobs/Util/SystemLogger.php b/app/Jobs/Util/SystemLogger.php index d7036ddeec79..204affdcf398 100644 --- a/app/Jobs/Util/SystemLogger.php +++ b/app/Jobs/Util/SystemLogger.php @@ -1,6 +1,6 @@ updateCurrencies(); } - - - } - else + } else { $this->updateCurrencies(); - + } } private function updateCurrencies() { - info("updating currencies"); - - if(empty(config('ninja.currency_converter_api_key'))) + info('updating currencies'); + + if (empty(config('ninja.currency_converter_api_key'))) { return; + } $cc_endpoint = sprintf('https://openexchangerates.org/api/latest.json?app_id=%s', config('ninja.currency_converter_api_key')); @@ -66,11 +61,9 @@ class UpdateExchangeRates implements ShouldQueue $currency_api = json_decode($response->getBody()); /* Update all currencies */ - Currency::all()->each(function ($currency) use($currency_api){ - + Currency::all()->each(function ($currency) use ($currency_api) { $currency->exchange_rate = $currency_api->rates->{$currency->code}; $currency->save(); - }); /* Rebuild the cache */ diff --git a/app/Jobs/Util/UploadAvatar.php b/app/Jobs/Util/UploadAvatar.php index ff3d4bfc114a..a3b9a5b131c8 100644 --- a/app/Jobs/Util/UploadAvatar.php +++ b/app/Jobs/Util/UploadAvatar.php @@ -1,6 +1,6 @@ directory, 0775); + Storage::makeDirectory('public/'.$this->directory, 0775); - $tmp_file = sha1(time()).".png"; + $tmp_file = sha1(time()).'.png'; $file_png = imagepng(imagecreatefromstring(file_get_contents($this->file)), sys_get_temp_dir().'/'.$tmp_file); - - $path = Storage::putFile('public/' . $this->directory, new File(sys_get_temp_dir().'/'.$tmp_file)); -info($path); -info($tmp_file); + $path = Storage::putFile('public/'.$this->directory, new File(sys_get_temp_dir().'/'.$tmp_file)); + + info($path); + info($tmp_file); $url = Storage::url($path); - + //return file path if ($url) { return $url; diff --git a/app/Jobs/Util/UploadFile.php b/app/Jobs/Util/UploadFile.php index e451ac47d6f7..3744ba37cd65 100644 --- a/app/Jobs/Util/UploadFile.php +++ b/app/Jobs/Util/UploadFile.php @@ -1,6 +1,6 @@ [ 'path' => 'documents', - ] + ], ]; protected $file; diff --git a/app/Jobs/Util/VersionCheck.php b/app/Jobs/Util/VersionCheck.php index ad7017db016f..9662fa1b4136 100644 --- a/app/Jobs/Util/VersionCheck.php +++ b/app/Jobs/Util/VersionCheck.php @@ -1,6 +1,6 @@ update(['latest_version' => $version_file]); } diff --git a/app/Jobs/Util/WebhookHandler.php b/app/Jobs/Util/WebhookHandler.php index 6c6a4ca8c650..da51fef1b120 100644 --- a/app/Jobs/Util/WebhookHandler.php +++ b/app/Jobs/Util/WebhookHandler.php @@ -2,8 +2,8 @@ namespace App\Jobs\Util; -use GuzzleHttp\RequestOptions; use App\Transformers\ArraySerializer; +use GuzzleHttp\RequestOptions; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; @@ -25,7 +25,6 @@ class WebhookHandler implements ShouldQueue * * @return void */ - public function __construct($event_id, $entity) { $this->event_id = $event_id; @@ -39,24 +38,25 @@ class WebhookHandler implements ShouldQueue */ public function handle() :bool { - - if(!$this->entity->company || $this->entity->company->company_users->first()->is_migrating == true) + if (! $this->entity->company || $this->entity->company->company_users->first()->is_migrating == true) { return true; + } $subscriptions = \App\Models\Webhook::where('company_id', $this->entity->company_id) ->where('event_id', $this->event_id) ->get(); - if(!$subscriptions || $subscriptions->count() == 0) + if (! $subscriptions || $subscriptions->count() == 0) { return true; + } - $subscriptions->each(function($subscription) { + $subscriptions->each(function ($subscription) { $this->process($subscription); }); return true; - } + private function process($subscription) { // generate JSON data @@ -75,16 +75,15 @@ class WebhookHandler implements ShouldQueue private function postData($subscription, $data, $headers = []) { - $base_headers = [ 'Content-Length' => strlen(json_encode($data)), - 'Accept' => 'application/json' + 'Accept' => 'application/json', ]; $client = new \GuzzleHttp\Client(['headers' => array_merge($base_headers, $headers)]); $response = $client->post($subscription->target_url, [ - RequestOptions::JSON => $data // or 'json' => [...] + RequestOptions::JSON => $data, // or 'json' => [...] ]); if ($response->getStatusCode() == 410 || $response->getStatusCode() == 200) { @@ -94,9 +93,6 @@ class WebhookHandler implements ShouldQueue public function failed($exception) { - - info(print_r($exception->getMessage(),1)); - + info(print_r($exception->getMessage(), 1)); } } - \ No newline at end of file diff --git a/app/Libraries/Currency/Conversion/CurrencyApi.php b/app/Libraries/Currency/Conversion/CurrencyApi.php index 87c3504c3b6c..f834da493132 100644 --- a/app/Libraries/Currency/Conversion/CurrencyApi.php +++ b/app/Libraries/Currency/Conversion/CurrencyApi.php @@ -1,6 +1,6 @@ convertToUsd($amount, $from_currency); - $to_currency = Currency::find($to_currency_id); + return $this->convertFromUsdToCurrency($usd_amount, $to_currency); + } - $usd_amount = $this->convertToUsd($amount, $from_currency); + public function exchangeRate($from_currency_id, $to_currency_id, $date = null) + { + $from_currency = Currency::find($from_currency_id); - return $this->convertFromUsdToCurrency($usd_amount, $to_currency); - - } + $to_currency = Currency::find($to_currency_id); - public function exchangeRate($from_currency_id, $to_currency_id, $date = null) - { + $usd_amount = $this->convertToUsd(1, $from_currency); - $from_currency = Currency::find($from_currency_id); + return $this->convertFromUsdToCurrency($usd_amount, $to_currency); + } - $to_currency = Currency::find($to_currency_id); + /** + * Converts a currency amount to USD. + * + * @param float $amount amount + * @param object $currency currency object + * @return float USD Amount + */ + private function convertToUsd($amount, $currency) + { + return $amount / $currency->exchange_rate; + } - $usd_amount = $this->convertToUsd(1, $from_currency); - - return $this->convertFromUsdToCurrency($usd_amount, $to_currency); - - } - - /** - * Converts a currency amount to USD - * - * @param float $amount amount - * @param object $currency currency object - * @return float USD Amount - */ - private function convertToUsd($amount, $currency) - { - return $amount / $currency->exchange_rate; - } - - /** - * Converts USD to any other denomination - * - * @param float $amount amount - * @param object $currency destination currency - * @return float the converted amount - */ - private function convertFromUsdToCurrency($amount, $currency) - { - return $amount * $currency->exchange_rate; - } - -} \ No newline at end of file + /** + * Converts USD to any other denomination. + * + * @param float $amount amount + * @param object $currency destination currency + * @return float the converted amount + */ + private function convertFromUsdToCurrency($amount, $currency) + { + return $amount * $currency->exchange_rate; + } +} diff --git a/app/Libraries/Currency/Conversion/CurrencyConversionInterface.php b/app/Libraries/Currency/Conversion/CurrencyConversionInterface.php index 3e0d98b9201f..d03fcb9947e1 100644 --- a/app/Libraries/Currency/Conversion/CurrencyConversionInterface.php +++ b/app/Libraries/Currency/Conversion/CurrencyConversionInterface.php @@ -1,6 +1,6 @@ client->isAccessTokenExpired()) { - + if ($this->client->isAccessTokenExpired()) { $this->client->fetchAccessTokenWithRefreshToken($user->oauth_user_refresh_token); $access_token = $this->client->getAccessToken(); @@ -53,7 +50,6 @@ class Google $user->oauth_user_token = $access_token; $user->save(); - } return $this; diff --git a/app/Libraries/MultiDB.php b/app/Libraries/MultiDB.php index d15196a40bce..58be6049e7cb 100644 --- a/app/Libraries/MultiDB.php +++ b/app/Libraries/MultiDB.php @@ -1,6 +1,6 @@ whereSubdomain($subdomain)->get()->count() >=1) { + if (Company::on($db)->whereSubdomain($subdomain)->get()->count() >= 1) { return false; } } @@ -77,12 +74,13 @@ class MultiDB //multi-db active foreach (self::$dbs as $db) { - if (User::on($db)->where(['email' => $email])->get()->count() >=1) { // if user already exists, validation will fail + if (User::on($db)->where(['email' => $email])->get()->count() >= 1) { // if user already exists, validation will fail return true; } } self::setDefaultDatabase(); + return false; } @@ -102,17 +100,19 @@ class MultiDB public static function checkUserAndCompanyCoExist($email, $company_key) :bool { foreach (self::$dbs as $db) { - if (User::on($db)->where(['email' => $email])->get()->count() >=1) { // if user already exists, validation will fail - if (Company::on($db)->where(['company_key' => $company_key])->get()->count() >=1) { + if (User::on($db)->where(['email' => $email])->get()->count() >= 1) { // if user already exists, validation will fail + if (Company::on($db)->where(['company_key' => $company_key])->get()->count() >= 1) { return true; } else { self::setDefaultDatabase(); + return false; } } } self::setDefaultDatabase(); + return true; } @@ -137,31 +137,31 @@ class MultiDB } self::setDefaultDatabase(); - + return null; } public static function contactFindAndSetDb($token) :bool { foreach (self::$dbs as $db) { - if ($ct = ClientContact::on($db)->whereRaw("BINARY `token`= ?", [$token])->first()) { + if ($ct = ClientContact::on($db)->whereRaw('BINARY `token`= ?', [$token])->first()) { self::setDb($ct->company->db); - + return true; } } self::setDefaultDatabase(); + return false; } public static function userFindAndSetDb($email) : bool { - //multi-db active foreach (self::$dbs as $db) { - if (User::on($db)->where(['email' => $email])->get()->count() >=1) { // if user already exists, validation will fail + if (User::on($db)->where(['email' => $email])->get()->count() >= 1) { // if user already exists, validation will fail return true; } } @@ -172,11 +172,13 @@ class MultiDB public static function findAndSetDb($token) :bool { foreach (self::$dbs as $db) { - if ($ct = CompanyToken::on($db)->whereRaw("BINARY `token`= ?", [$token])->first()) { + if ($ct = CompanyToken::on($db)->whereRaw('BINARY `token`= ?', [$token])->first()) { self::setDb($ct->company->db); + return true; } } + return false; } @@ -185,9 +187,11 @@ class MultiDB foreach (self::$dbs as $db) { if ($company = Company::on($db)->where('company_key', $company_key)->first()) { self::setDb($company->db); + return true; } } + return false; } @@ -196,11 +200,13 @@ class MultiDB foreach (self::$dbs as $db) { if ($company = Company::on($db)->whereSubdomain($subdomain)->first()) { self::setDb($company->db); + return true; } } self::setDefaultDatabase(); + return false; } @@ -209,13 +215,15 @@ class MultiDB $class = 'App\Models\\'.ucfirst($entity).'Invitation'; foreach (self::$dbs as $db) { - if ($invite = $class::on($db)->whereRaw("BINARY `key`= ?", [$invitation_key])->first()) { + if ($invite = $class::on($db)->whereRaw('BINARY `key`= ?', [$invitation_key])->first()) { self::setDb($db); + return true; } } self::setDefaultDatabase(); + return false; } diff --git a/app/Libraries/OAuth/OAuth.php b/app/Libraries/OAuth/OAuth.php index 292938131076..42b034460913 100644 --- a/app/Libraries/OAuth/OAuth.php +++ b/app/Libraries/OAuth/OAuth.php @@ -1,6 +1,6 @@ $user->getId(), - 'oauth_provider_id'=>$provider + 'oauth_provider_id'=>$provider, ]; if ($user = MultiDB::hasUser($query)) { @@ -57,7 +53,7 @@ class OAuth { $name = trim($name); $last_name = (strpos($name, ' ') === false) ? '' : preg_replace('#.*\s([\w-]*)$#', '$1', $name); - $first_name = trim(preg_replace('#' . preg_quote($last_name, '/') . '#', '', $name)); + $first_name = trim(preg_replace('#'.preg_quote($last_name, '/').'#', '', $name)); return [$first_name, $last_name]; } @@ -104,6 +100,7 @@ class OAuth case 'google': $this->provider_instance = new Google(); $this->provider_id = self::SOCIAL_GOOGLE; + return $this; default: @@ -122,7 +119,7 @@ class OAuth $data = [ 'oauth_user_id' => $oauth_user_id, - 'oauth_provider_id' => $this->provider_id + 'oauth_provider_id' => $this->provider_id, ]; if ($this->provider_instance) { diff --git a/app/Libraries/OAuth/Providers/Google.php b/app/Libraries/OAuth/Providers/Google.php index 0449d16170f3..9f2b6bf9e202 100644 --- a/app/Libraries/OAuth/Providers/Google.php +++ b/app/Libraries/OAuth/Providers/Google.php @@ -7,6 +7,7 @@ class Google implements ProviderInterface public function getTokenResponse($token) { $client = new \Google_Client(); + return $client->verifyIdToken($token); } @@ -24,5 +25,4 @@ class Google implements ProviderInterface { return $payload['name']; } - } diff --git a/app/Libraries/OFX.php b/app/Libraries/OFX.php index 04c3662b21f3..64b88ebd72ea 100644 --- a/app/Libraries/OFX.php +++ b/app/Libraries/OFX.php @@ -1,6 +1,6 @@ ofxVersion . "\n". + 'VERSION:'.$this->ofxVersion."\n". "SECURITY:NONE\n". "ENCODING:USASCII\n". "CHARSET:1252\n". @@ -129,7 +129,7 @@ class Login ''.$this->bank->fid."\n". "\n". "QWIN\n". - "" . $this->appVersion . "\n". + ''.$this->appVersion."\n". "\n". "\n". "\n". @@ -178,7 +178,7 @@ class Account $ofxRequest = "OFXHEADER:100\n". "DATA:OFXSGML\n". - "VERSION:" . $this->login->ofxVersion . "\n". + 'VERSION:'.$this->login->ofxVersion."\n". "SECURITY:NONE\n". "ENCODING:USASCII\n". "CHARSET:1252\n". @@ -198,7 +198,7 @@ class Account ''.$this->login->bank->fid."\n". "\n". "QWIN\n". - "" . $this->login->appVersion . "\n". + ''.$this->login->appVersion."\n". "\n". "\n"; if ($this->type == 'BANK') { diff --git a/app/Listeners/Activity/ArchivedClientActivity.php b/app/Listeners/Activity/ArchivedClientActivity.php index e847b90d62a1..3f2a92cc7ef2 100644 --- a/app/Listeners/Activity/ArchivedClientActivity.php +++ b/app/Listeners/Activity/ArchivedClientActivity.php @@ -1,6 +1,6 @@ company->db); - + $fields = new \stdClass; $fields->payment_id = $event->credit->id; - $fields->client_id = $event->credit->client_id; - $fields->user_id = $event->credit->user_id; + $fields->client_id = $event->credit->client_id; + $fields->user_id = $event->credit->user_id; $fields->company_id = $event->credit->company_id; $fields->activity_type_id = Activity::ARCHIVE_CREDIT; $this->activity_repo->save($fields, $$event->credit, $event->event_vars); - } } diff --git a/app/Listeners/Activity/DeleteClientActivity.php b/app/Listeners/Activity/DeleteClientActivity.php index bc8bfd9ba3c5..8db7ae6e04b8 100644 --- a/app/Listeners/Activity/DeleteClientActivity.php +++ b/app/Listeners/Activity/DeleteClientActivity.php @@ -1,6 +1,6 @@ payment; $invoices = $payment->invoices; - + $fields = new \stdClass; $fields->payment_id = $payment->id; @@ -66,6 +66,5 @@ class PaymentArchivedActivity implements ShouldQueue // } $this->activity_repo->save($fields, $payment, $event->event_vars); - } } diff --git a/app/Listeners/Activity/PaymentCreatedActivity.php b/app/Listeners/Activity/PaymentCreatedActivity.php index 4641cddc6e31..9937bd8c479f 100644 --- a/app/Listeners/Activity/PaymentCreatedActivity.php +++ b/app/Listeners/Activity/PaymentCreatedActivity.php @@ -1,6 +1,6 @@ payment; $invoices = $payment->invoices; - + $fields = new \stdClass; $fields->payment_id = $payment->id; diff --git a/app/Listeners/Activity/PaymentDeletedActivity.php b/app/Listeners/Activity/PaymentDeletedActivity.php index 24754367d2f7..6152d4e4acf8 100644 --- a/app/Listeners/Activity/PaymentDeletedActivity.php +++ b/app/Listeners/Activity/PaymentDeletedActivity.php @@ -1,6 +1,6 @@ payment; $invoices = $payment->invoices; - + $fields = new \stdClass; $fields->payment_id = $payment->id; diff --git a/app/Listeners/Activity/PaymentRefundedActivity.php b/app/Listeners/Activity/PaymentRefundedActivity.php index 582fce25b0a5..eb53002673ff 100644 --- a/app/Listeners/Activity/PaymentRefundedActivity.php +++ b/app/Listeners/Activity/PaymentRefundedActivity.php @@ -1,6 +1,6 @@ client_id = $event->payment->id; - $fields->client_id = $event->payment->client_id; + $fields->client_id = $event->payment->client_id; $fields->user_id = $event->payment->user_id; $fields->company_id = $event->payment->company_id; $fields->activity_type_id = Activity::REFUNDED_PAYMENT; diff --git a/app/Listeners/Activity/PaymentUpdatedActivity.php b/app/Listeners/Activity/PaymentUpdatedActivity.php index b18e6ca12550..6ee2be927a37 100644 --- a/app/Listeners/Activity/PaymentUpdatedActivity.php +++ b/app/Listeners/Activity/PaymentUpdatedActivity.php @@ -1,6 +1,6 @@ payment; $invoices = $payment->invoices; - + $fields = new \stdClass; $fields->payment_id = $payment->id; - $fields->client_id = $payment->client_id; + $fields->client_id = $payment->client_id; $fields->user_id = $payment->user_id; $fields->company_id = $payment->company_id; $fields->activity_type_id = Activity::UPDATE_PAYMENT; $this->activity_repo->save($fields, $payment, $event->event_vars); - // foreach ($invoices as $invoice) { + // foreach ($invoices as $invoice) { // //todo we may need to add additional logic if in the future we apply payments to other entity Types, not just invoices // $fields->invoice_id = $invoice->id; diff --git a/app/Listeners/Activity/PaymentVoidedActivity.php b/app/Listeners/Activity/PaymentVoidedActivity.php index 9149675b9257..b3cf775b2698 100644 --- a/app/Listeners/Activity/PaymentVoidedActivity.php +++ b/app/Listeners/Activity/PaymentVoidedActivity.php @@ -1,6 +1,6 @@ company->db); $quote = $event->quote; - + $fields = new \stdClass; $fields->quote_id = $quote->id; @@ -54,7 +54,5 @@ class QuoteUpdatedActivity implements ShouldQueue $fields->activity_type_id = Activity::UPDATE_QUOTE; $this->activity_repo->save($fields, $quote, $event->event_vars); - - } } diff --git a/app/Listeners/Activity/RestoreClientActivity.php b/app/Listeners/Activity/RestoreClientActivity.php index 35e4cd4bc5f9..8e807a4510a2 100644 --- a/app/Listeners/Activity/RestoreClientActivity.php +++ b/app/Listeners/Activity/RestoreClientActivity.php @@ -1,6 +1,6 @@ credit_id = $event->credit->id; - $fields->client_id = $event->credit->client_id; + $fields->client_id = $event->credit->client_id; $fields->user_id = $event->credit->user_id; $fields->company_id = $event->credit->company_id; $fields->activity_type_id = Activity::UPDATE_CREDIT; diff --git a/app/Listeners/Contact/UpdateContactLastLogin.php b/app/Listeners/Contact/UpdateContactLastLogin.php index 16002cc6afc1..f8a002749b96 100644 --- a/app/Listeners/Contact/UpdateContactLastLogin.php +++ b/app/Listeners/Contact/UpdateContactLastLogin.php @@ -1,6 +1,6 @@ company->db); - + $client_contact = $event->client_contact; $client_contact->last_login = now(); $client_contact->client->last_login = now(); - + $client_contact->save(); } } diff --git a/app/Listeners/Credit/CreateCreditInvitation.php b/app/Listeners/Credit/CreateCreditInvitation.php index 8a3a0d5504d5..9b20ee0c7aec 100644 --- a/app/Listeners/Credit/CreateCreditInvitation.php +++ b/app/Listeners/Credit/CreateCreditInvitation.php @@ -1,6 +1,6 @@ whereCreditId($credit->id) ->first(); - if (!$invitation && $contact->send_credit) { + if (! $invitation && $contact->send_credit) { $ii = CreditInvitationFactory::create($credit->company_id, $credit->user_id); $ii->credit_id = $credit->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send_credit) { + } elseif ($invitation && ! $contact->send_credit) { $invitation->delete(); } }); diff --git a/app/Listeners/Credit/CreditRestoredActivity.php b/app/Listeners/Credit/CreditRestoredActivity.php index 3111df9dd6ce..d5983811678a 100644 --- a/app/Listeners/Credit/CreditRestoredActivity.php +++ b/app/Listeners/Credit/CreditRestoredActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->credit_id = $event->credit->id; - $fields->client_id = $event->credit->client_id; + $fields->client_id = $event->credit->client_id; $fields->user_id = $event->credit->user_id; $fields->company_id = $event->credit->company_id; $fields->activity_type_id = Activity::RESTORE_CREDIT; $this->activity_repo->save($fields, $event->credit, $event->event_vars); - } } diff --git a/app/Listeners/Credit/CreditViewedActivity.php b/app/Listeners/Credit/CreditViewedActivity.php index 19701155873a..6aae2267ee9e 100644 --- a/app/Listeners/Credit/CreditViewedActivity.php +++ b/app/Listeners/Credit/CreditViewedActivity.php @@ -1,6 +1,6 @@ company->db); $path = sprintf('%s/%s', storage_path('app/public'), $event->company->company_key); @@ -41,6 +40,5 @@ class DeleteCompanyDocuments Storage::deleteDirectory($event->company->company_key); Document::whereCompanyId($event->company->id)->delete(); - } } diff --git a/app/Listeners/Invoice/CreateInvoiceActivity.php b/app/Listeners/Invoice/CreateInvoiceActivity.php index 38f5a8dc888b..68fd1851d0c5 100644 --- a/app/Listeners/Invoice/CreateInvoiceActivity.php +++ b/app/Listeners/Invoice/CreateInvoiceActivity.php @@ -1,6 +1,6 @@ invoice_id = $event->invoice->id; - $fields->client_id = $event->invoice->client_id; - $fields->user_id = $event->invoice->user_id; + $fields->client_id = $event->invoice->client_id; + $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::CREATE_INVOICE; diff --git a/app/Listeners/Invoice/CreateInvoiceInvitation.php b/app/Listeners/Invoice/CreateInvoiceInvitation.php index 5fa64e389fa7..a22b7c9928df 100644 --- a/app/Listeners/Invoice/CreateInvoiceInvitation.php +++ b/app/Listeners/Invoice/CreateInvoiceInvitation.php @@ -1,6 +1,6 @@ whereInvoiceId($invoice->id) ->first(); - if (!$invitation && $contact->send) { + if (! $invitation && $contact->send) { $ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id); $ii->invoice_id = $invoice->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send) { + } elseif ($invitation && ! $contact->send) { $invitation->delete(); } }); diff --git a/app/Listeners/Invoice/CreateInvoicePdf.php b/app/Listeners/Invoice/CreateInvoicePdf.php index 3654f2e39ba6..824006fe6dc1 100644 --- a/app/Listeners/Invoice/CreateInvoicePdf.php +++ b/app/Listeners/Invoice/CreateInvoicePdf.php @@ -1,6 +1,6 @@ company->db); $event->invoice->invitations->each(function ($invitation) { - PdfCreator::dispatch($invitation); - }); } } diff --git a/app/Listeners/Invoice/InvoiceArchivedActivity.php b/app/Listeners/Invoice/InvoiceArchivedActivity.php index 895eb7d277f4..10b0ec0116d1 100644 --- a/app/Listeners/Invoice/InvoiceArchivedActivity.php +++ b/app/Listeners/Invoice/InvoiceArchivedActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->invoice_id = $event->invoice->id; - $fields->client_id = $event->invoice->client_id; + $fields->client_id = $event->invoice->client_id; $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::ARCHIVE_INVOICE; diff --git a/app/Listeners/Invoice/InvoiceCancelledActivity.php b/app/Listeners/Invoice/InvoiceCancelledActivity.php index 9a2e820b695d..76de03c61a2e 100644 --- a/app/Listeners/Invoice/InvoiceCancelledActivity.php +++ b/app/Listeners/Invoice/InvoiceCancelledActivity.php @@ -1,6 +1,6 @@ company->db); + MultiDB::setDb($event->company->db); - $fields = new \stdClass; + $fields = new \stdClass; $fields->invoice_id = $event->invoice->id; - $fields->client_id = $event->invoice->client_id; - $fields->user_id = $event->invoice->user_id; + $fields->client_id = $event->invoice->client_id; + $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::CANCELLED_INVOICE; diff --git a/app/Listeners/Invoice/InvoiceDeletedActivity.php b/app/Listeners/Invoice/InvoiceDeletedActivity.php index 0b4eee507b59..ba39008764bf 100644 --- a/app/Listeners/Invoice/InvoiceDeletedActivity.php +++ b/app/Listeners/Invoice/InvoiceDeletedActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->invoice_id = $event->invoice->id; - $fields->client_id = $event->invoice->client_id; - $fields->user_id = $event->invoice->user_id; + $fields->client_id = $event->invoice->client_id; + $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::DELETE_INVOICE; diff --git a/app/Listeners/Invoice/InvoiceEmailActivity.php b/app/Listeners/Invoice/InvoiceEmailActivity.php index e61144d093a7..1a164ecfa193 100644 --- a/app/Listeners/Invoice/InvoiceEmailActivity.php +++ b/app/Listeners/Invoice/InvoiceEmailActivity.php @@ -1,6 +1,6 @@ invitation->company->company_users as $company_user) { - $user = $company_user->user; $notification = new EntitySentNotification($event->invitation, 'invoice'); @@ -61,16 +60,13 @@ class InvoiceEmailedNotification implements ShouldQueue //This allows us better control of how we //handle the mailer - EntitySentMailer::dispatch($event->invitation, 'invoice', $user, $event->invitation->company); + EntitySentMailer::dispatch($event->invitation, 'invoice', $user, $event->invitation->company); $first_notification_sent = false; - } $notification->method = $methods; $user->notify($notification); } - - } } diff --git a/app/Listeners/Invoice/InvoicePaidActivity.php b/app/Listeners/Invoice/InvoicePaidActivity.php index 4cd38ec75c67..fd39151d86e7 100644 --- a/app/Listeners/Invoice/InvoicePaidActivity.php +++ b/app/Listeners/Invoice/InvoicePaidActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->invoice_id = $event->invoice->id; - $fields->client_id = $event->invoice->client_id; - $fields->user_id = $event->invoice->user_id; + $fields->client_id = $event->invoice->client_id; + $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::RESTORE_INVOICE; diff --git a/app/Listeners/Invoice/InvoiceReversedActivity.php b/app/Listeners/Invoice/InvoiceReversedActivity.php index 7f465627996e..8006ffc136ab 100644 --- a/app/Listeners/Invoice/InvoiceReversedActivity.php +++ b/app/Listeners/Invoice/InvoiceReversedActivity.php @@ -1,6 +1,6 @@ invoice_id = $event->invoice->id; - $fields->client_id = $event->invoice->client_id; - $fields->user_id = $event->invoice->user_id; + $fields->client_id = $event->invoice->client_id; + $fields->user_id = $event->invoice->user_id; $fields->company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::REVERSED_INVOICE; diff --git a/app/Listeners/Invoice/InvoiceViewedActivity.php b/app/Listeners/Invoice/InvoiceViewedActivity.php index 72239bf06faf..c83cd55892b1 100644 --- a/app/Listeners/Invoice/InvoiceViewedActivity.php +++ b/app/Listeners/Invoice/InvoiceViewedActivity.php @@ -1,6 +1,6 @@ company_id = $event->invoice->company_id; $fields->activity_type_id = Activity::UPDATE_INVOICE; $fields->invoice_id = $event->invoice->id; - + $this->activity_repo->save($fields, $event->invoice, $event->event_vars); } } diff --git a/app/Listeners/Invoice/UpdateInvoiceInvitations.php b/app/Listeners/Invoice/UpdateInvoiceInvitations.php index 52141fdd53a5..ceb9fad179ee 100644 --- a/app/Listeners/Invoice/UpdateInvoiceInvitations.php +++ b/app/Listeners/Invoice/UpdateInvoiceInvitations.php @@ -1,6 +1,6 @@ payment; $invoices = $payment->invoices; - - /** + /* * Move this into an event */ $invoices->each(function ($invoice) use ($payment) { diff --git a/app/Listeners/Misc/InvitationViewedListener.php b/app/Listeners/Misc/InvitationViewedListener.php index 1997c2baf4b5..00cba9098d43 100644 --- a/app/Listeners/Misc/InvitationViewedListener.php +++ b/app/Listeners/Misc/InvitationViewedListener.php @@ -1,6 +1,6 @@ company->company_users as $company_user) { - $entity_viewed = "{$entity_name}_viewed"; $methods = $this->findUserNotificationTypes($invitation, $company_user, $entity_name, ['all_notifications', $entity_viewed]); @@ -56,14 +55,12 @@ class InvitationViewedListener implements ShouldQueue if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); - EntityViewedMailer::dispatch($invitation, $entity_name, $company_user->user, $invitation->company); - + EntityViewedMailer::dispatch($invitation, $entity_name, $company_user->user, $invitation->company); } $notification->method = $methods; $company_user->user->notify($notification); - } if (isset($invitation->company->slack_webhook_url)) { @@ -72,9 +69,5 @@ class InvitationViewedListener implements ShouldQueue Notification::route('slack', $invitation->company->slack_webhook_url) ->notify($notification); } - } - - - } diff --git a/app/Listeners/Payment/PaymentNotification.php b/app/Listeners/Payment/PaymentNotification.php index 99f30b210050..780e535fc675 100644 --- a/app/Listeners/Payment/PaymentNotification.php +++ b/app/Listeners/Payment/PaymentNotification.php @@ -1,6 +1,6 @@ company->db); + MultiDB::setDb($event->company->db); - $payment = $event->payment; + $payment = $event->payment; /*User notifications*/ foreach ($payment->company->company_users as $company_user) { - - if($company_user->is_migrating) + if ($company_user->is_migrating) { return true; - + } + $user = $company_user->user; $methods = $this->findUserEntityNotificationType($payment, $company_user, ['all_notifications']); @@ -65,7 +66,7 @@ class PaymentNotification implements ShouldQueue //This allows us better control of how we //handle the mailer - EntityPaidMailer::dispatch($payment, $user, $payment->company); + EntityPaidMailer::dispatch($payment, $user, $payment->company); } $notification = new NewPaymentNotification($payment, $payment->company); @@ -99,7 +100,7 @@ class PaymentNotification implements ShouldQueue $client = $payment->client; $amount = $payment->amount; - + if ($invoice) { $items = $invoice->line_items; $item = end($items)->product_key; @@ -117,10 +118,10 @@ class PaymentNotification implements ShouldQueue $base = "v=1&tid={$analytics_id}&cid={$client->id}&cu={$currency_code}&ti={$entity_number}"; - $url = $base . "&t=transaction&ta=ninja&tr={$amount}"; + $url = $base."&t=transaction&ta=ninja&tr={$amount}"; $this->sendAnalytics($url); - $url = $base . "&t=item&in={$item}&ip={$amount}&iq=1"; + $url = $base."&t=item&in={$item}&ip={$amount}&iq=1"; $this->sendAnalytics($url); } diff --git a/app/Listeners/Payment/PaymentRestoredActivity.php b/app/Listeners/Payment/PaymentRestoredActivity.php index ec97e9a579b5..e08d4a29f25f 100644 --- a/app/Listeners/Payment/PaymentRestoredActivity.php +++ b/app/Listeners/Payment/PaymentRestoredActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->payment_id = $event->payment->id; - $fields->client_id = $event->payment->client_id; - $fields->user_id = $event->payment->user_id; + $fields->client_id = $event->payment->client_id; + $fields->user_id = $event->payment->user_id; $fields->company_id = $event->payment->company_id; $fields->activity_type_id = Activity::RESTORE_PAYMENT; diff --git a/app/Listeners/Quote/CreateQuoteInvitation.php b/app/Listeners/Quote/CreateQuoteInvitation.php index 7344fba339a9..1594a9adbe46 100644 --- a/app/Listeners/Quote/CreateQuoteInvitation.php +++ b/app/Listeners/Quote/CreateQuoteInvitation.php @@ -1,6 +1,6 @@ whereQuoteId($quote->id) ->first(); - if (!$invitation && $contact->send_credit) { + if (! $invitation && $contact->send_credit) { $ii = QuoteInvitationFactory::create($quote->company_id, $quote->user_id); $ii->quote_id = $quote->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send_credit) { + } elseif ($invitation && ! $contact->send_credit) { $invitation->delete(); } }); diff --git a/app/Listeners/Quote/QuoteApprovedActivity.php b/app/Listeners/Quote/QuoteApprovedActivity.php index 844593568bc9..d57fdeabdf99 100644 --- a/app/Listeners/Quote/QuoteApprovedActivity.php +++ b/app/Listeners/Quote/QuoteApprovedActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->quote_id = $event->quote->id; - $fields->client_id = $event->quote->client_id; - $fields->user_id = $event->quote->user_id; + $fields->client_id = $event->quote->client_id; + $fields->user_id = $event->quote->user_id; $fields->client_contact_id = $event->contact->id; $fields->company_id = $event->payment->company_id; $fields->activity_type_id = Activity::RESTORE_PAYMENT; diff --git a/app/Listeners/Quote/QuoteArchivedActivity.php b/app/Listeners/Quote/QuoteArchivedActivity.php index 56dc5e7704c8..6a3f05b4c852 100644 --- a/app/Listeners/Quote/QuoteArchivedActivity.php +++ b/app/Listeners/Quote/QuoteArchivedActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->quote_id = $event->quote->id; - $fields->client_id = $event->quote->client_id; - $fields->user_id = $event->quote->user_id; + $fields->client_id = $event->quote->client_id; + $fields->user_id = $event->quote->user_id; $fields->company_id = $event->quote->company_id; $fields->activity_type_id = Activity::ARCHIVE_QUOTE; diff --git a/app/Listeners/Quote/QuoteDeletedActivity.php b/app/Listeners/Quote/QuoteDeletedActivity.php index bea34f11264d..64354a0e1ecf 100644 --- a/app/Listeners/Quote/QuoteDeletedActivity.php +++ b/app/Listeners/Quote/QuoteDeletedActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->quote_id = $event->quote->id; - $fields->client_id = $event->quote->client_id; - $fields->user_id = $event->quote->user_id; + $fields->client_id = $event->quote->client_id; + $fields->user_id = $event->quote->user_id; $fields->company_id = $event->quote->company_id; $fields->activity_type_id = Activity::DELETE_QUOTE; diff --git a/app/Listeners/Quote/QuoteEmailActivity.php b/app/Listeners/Quote/QuoteEmailActivity.php index 13b4ecdf4434..f78c5211cece 100644 --- a/app/Listeners/Quote/QuoteEmailActivity.php +++ b/app/Listeners/Quote/QuoteEmailActivity.php @@ -1,6 +1,6 @@ quote_id = $event->invitation->quote->id; - $fields->client_id = $event->invitation->quote->client_id; - $fields->user_id = $event->invitation->quote->user_id; + $fields->client_id = $event->invitation->quote->client_id; + $fields->user_id = $event->invitation->quote->user_id; $fields->company_id = $event->invitation->quote->company_id; $fields->client_contact_id = $event->invitation->quote->client_contact_id; $fields->activity_type_id = Activity::EMAIL_QUOTE; diff --git a/app/Listeners/Quote/QuoteRestoredActivity.php b/app/Listeners/Quote/QuoteRestoredActivity.php index 2b480e5560e2..5ceebe6bfcd8 100644 --- a/app/Listeners/Quote/QuoteRestoredActivity.php +++ b/app/Listeners/Quote/QuoteRestoredActivity.php @@ -1,6 +1,6 @@ company->db); $fields = new \stdClass; $fields->quote_id = $event->quote->id; - $fields->client_id = $event->quote->client_id; - $fields->user_id = $event->quote->user_id; + $fields->client_id = $event->quote->client_id; + $fields->user_id = $event->quote->user_id; $fields->company_id = $event->quote->company_id; $fields->activity_type_id = Activity::RESTORE_QUOTE; diff --git a/app/Listeners/Quote/QuoteViewedActivity.php b/app/Listeners/Quote/QuoteViewedActivity.php index a10c8e78fd24..64bd80e73101 100644 --- a/app/Listeners/Quote/QuoteViewedActivity.php +++ b/app/Listeners/Quote/QuoteViewedActivity.php @@ -1,6 +1,6 @@ user_id = $event->user->id; } - + $fields->company_id = $event->user->company_id; $fields->activity_type_id = Activity::ARCHIVE_USER; diff --git a/app/Listeners/User/CreatedUserActivity.php b/app/Listeners/User/CreatedUserActivity.php index a37ee9c48f95..8a4508f610e0 100644 --- a/app/Listeners/User/CreatedUserActivity.php +++ b/app/Listeners/User/CreatedUserActivity.php @@ -1,6 +1,6 @@ user_id = $event->user->id; } - + $fields->company_id = $event->user->company_id; $fields->activity_type_id = Activity::CREATE_USER; diff --git a/app/Listeners/User/DeletedUserActivity.php b/app/Listeners/User/DeletedUserActivity.php index ffed3dc68d3a..25e567fe1754 100644 --- a/app/Listeners/User/DeletedUserActivity.php +++ b/app/Listeners/User/DeletedUserActivity.php @@ -1,6 +1,6 @@ company->db); + MultiDB::setDb($event->company->db); - $fields = new \stdClass; + $fields = new \stdClass; if (auth()->user()->id) { $fields->user_id = auth()->user()->id; } else { $fields->user_id = $event->user->id; } - + $fields->company_id = $event->company->id; $fields->activity_type_id = Activity::DELETE_USER; diff --git a/app/Listeners/User/RestoredUserActivity.php b/app/Listeners/User/RestoredUserActivity.php index 060ff4af9451..961961645a60 100644 --- a/app/Listeners/User/RestoredUserActivity.php +++ b/app/Listeners/User/RestoredUserActivity.php @@ -1,6 +1,6 @@ user_id = $event->user->id; } - + $fields->company_id = $event->user->company_id; $fields->activity_type_id = Activity::RESTORE_USER; diff --git a/app/Listeners/User/UpdateUserLastLogin.php b/app/Listeners/User/UpdateUserLastLogin.php index 79e91c665cdd..b012c53b5a5c 100644 --- a/app/Listeners/User/UpdateUserLastLogin.php +++ b/app/Listeners/User/UpdateUserLastLogin.php @@ -1,6 +1,6 @@ user_id = $event->user->id; } - + $fields->company_id = $event->user->company_id; $fields->activity_type_id = Activity::UPDATE_USER; diff --git a/app/Mail/Admin/EntityNotificationMailer.php b/app/Mail/Admin/EntityNotificationMailer.php index 6b077651518c..8e49a34d97aa 100644 --- a/app/Mail/Admin/EntityNotificationMailer.php +++ b/app/Mail/Admin/EntityNotificationMailer.php @@ -1,6 +1,6 @@ subject($this->mail_obj->subject) ->markdown($this->mail_obj->markdown, $this->mail_obj->data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->mail_obj->tag); - }); + $message->getHeaders()->addTextHeader('Tag', $this->mail_obj->tag); + }); } } diff --git a/app/Mail/Admin/EntityPaidObject.php b/app/Mail/Admin/EntityPaidObject.php index 237fbc36eeb8..b4a1c71262c6 100644 --- a/app/Mail/Admin/EntityPaidObject.php +++ b/app/Mail/Admin/EntityPaidObject.php @@ -1,6 +1,6 @@ amount = $this->getAmount(); - $mail_obj->subject = $this->getSubject(); - $mail_obj->data = $this->getData(); - $mail_obj->markdown = 'email.admin.generic'; - $mail_obj->tag = $this->company->company_key; - - return $mail_obj; + $mail_obj = new \stdClass; + $mail_obj->amount = $this->getAmount(); + $mail_obj->subject = $this->getSubject(); + $mail_obj->data = $this->getData(); + $mail_obj->markdown = 'email.admin.generic'; + $mail_obj->tag = $this->company->company_key; + + return $mail_obj; } private function getAmount() { - return Number::formatMoney($this->payment->amount, $this->payment->client); + return Number::formatMoney($this->payment->amount, $this->payment->client); } private function getSubject() @@ -60,20 +60,19 @@ class EntityPaidObject private function getData() { - $settings = $this->payment->client->getMergedSettings(); $amount = Number::formatMoney($this->payment->amount, $this->payment->client); - + $invoice_texts = ctrans('texts.invoice_number_short'); foreach ($this->payment->invoices as $invoice) { - $invoice_texts .= $invoice->number . ','; + $invoice_texts .= $invoice->number.','; } $invoice_texts = substr($invoice_texts, 0, -1); - $data = [ + $data = [ 'title' => ctrans( 'texts.notification_payment_paid_subject', ['client' => $this->payment->client->present()->name()] @@ -94,4 +93,4 @@ class EntityPaidObject return $data; } -} \ No newline at end of file +} diff --git a/app/Mail/Admin/EntitySentObject.php b/app/Mail/Admin/EntitySentObject.php index ef5506d175c1..5ebcf6a19c64 100644 --- a/app/Mail/Admin/EntitySentObject.php +++ b/app/Mail/Admin/EntitySentObject.php @@ -1,6 +1,6 @@ amount = $this->getAmount(); - $mail_obj->subject = $this->getSubject(); - $mail_obj->data = $this->getData(); - $mail_obj->markdown = 'email.admin.generic'; - $mail_obj->tag = $this->company->company_key; - - return $mail_obj; + $mail_obj = new \stdClass; + $mail_obj->amount = $this->getAmount(); + $mail_obj->subject = $this->getSubject(); + $mail_obj->data = $this->getData(); + $mail_obj->markdown = 'email.admin.generic'; + $mail_obj->tag = $this->company->company_key; + + return $mail_obj; } private function getAmount() { - return Number::formatMoney($this->entity->amount, $this->entity->client); + return Number::formatMoney($this->entity->amount, $this->entity->client); } private function getSubject() { - return - ctrans( - "texts.notification_{$this->entity_type}_sent_subject", - [ - 'client' => $this->contact->present()->name(), - 'invoice' => $this->entity->number, - ] - ); + return + ctrans( + "texts.notification_{$this->entity_type}_sent_subject", + [ + 'client' => $this->contact->present()->name(), + 'invoice' => $this->entity->number, + ] + ); } private function getData() { + $settings = $this->entity->client->getMergedSettings(); - $settings = $this->entity->client->getMergedSettings(); - - return [ + return [ 'title' => $this->getSubject(), 'message' => ctrans( "texts.notification_{$this->entity_type}_sent", @@ -86,6 +85,5 @@ class EntitySentObject 'signature' => $settings->email_signature, 'logo' => $this->company->present()->logo(), ]; - } -} \ No newline at end of file +} diff --git a/app/Mail/Admin/EntityViewedObject.php b/app/Mail/Admin/EntityViewedObject.php index ac0104cfafa1..e491e1566696 100644 --- a/app/Mail/Admin/EntityViewedObject.php +++ b/app/Mail/Admin/EntityViewedObject.php @@ -1,6 +1,6 @@ amount = $this->getAmount(); - $mail_obj->subject = $this->getSubject(); - $mail_obj->data = $this->getData(); - $mail_obj->markdown = 'email.admin.generic'; - $mail_obj->tag = $this->company->company_key; - - return $mail_obj; + $mail_obj = new \stdClass; + $mail_obj->amount = $this->getAmount(); + $mail_obj->subject = $this->getSubject(); + $mail_obj->data = $this->getData(); + $mail_obj->markdown = 'email.admin.generic'; + $mail_obj->tag = $this->company->company_key; + + return $mail_obj; } private function getAmount() { - return Number::formatMoney($this->entity->amount, $this->entity->client); + return Number::formatMoney($this->entity->amount, $this->entity->client); } private function getSubject() @@ -68,10 +68,9 @@ class EntityViewedObject private function getData() { + $settings = $this->entity->client->getMergedSettings(); - $settings = $this->entity->client->getMergedSettings(); - - $data = [ + $data = [ 'title' => $this->getSubject(), 'message' => ctrans( "texts.notification_{$this->entity_type}_viewed", @@ -89,4 +88,4 @@ class EntityViewedObject return $data; } -} \ No newline at end of file +} diff --git a/app/Mail/Admin/PaymentFailureObject.php b/app/Mail/Admin/PaymentFailureObject.php index 1da8a8fe5e25..08077206bfdd 100644 --- a/app/Mail/Admin/PaymentFailureObject.php +++ b/app/Mail/Admin/PaymentFailureObject.php @@ -1,6 +1,6 @@ amount = $this->getAmount(); - $mail_obj->subject = $this->getSubject(); - $mail_obj->data = $this->getData(); - $mail_obj->markdown = 'email.admin.generic'; - $mail_obj->tag = $this->company->company_key; - - return $mail_obj; + $mail_obj = new \stdClass; + $mail_obj->amount = $this->getAmount(); + $mail_obj->subject = $this->getSubject(); + $mail_obj->data = $this->getData(); + $mail_obj->markdown = 'email.admin.generic'; + $mail_obj->tag = $this->company->company_key; + + return $mail_obj; } private function getAmount() { - return Number::formatMoney($this->amount, $this->client); + return Number::formatMoney($this->amount, $this->client); } private function getSubject() @@ -62,7 +62,7 @@ class PaymentFailureObject { $signature = $this->client->getSetting('email_signature'); - $data = [ + $data = [ 'title' => ctrans( 'texts.payment_failed_subject', ['client' => $this->client->present()->name()] @@ -80,4 +80,4 @@ class PaymentFailureObject return $data; } -} \ No newline at end of file +} diff --git a/app/Mail/BouncedEmail.php b/app/Mail/BouncedEmail.php index 68876078cc99..8dacad29dd30 100644 --- a/app/Mail/BouncedEmail.php +++ b/app/Mail/BouncedEmail.php @@ -1,6 +1,6 @@ user()->account; @@ -64,7 +63,7 @@ class SupportMessageSent extends Mailable ->markdown('email.support.message', [ 'message' => $this->message, 'system_info' => $system_info, - 'laravel_log' => $log_lines + 'laravel_log' => $log_lines, ]); } } diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 173f1ac56cc2..2a4e42aabef3 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -1,6 +1,6 @@ build_email = $build_email; $this->user = $user; //this is inappropriate here, need to refactor 'user' in this context the 'user' could also be the 'system' - + $this->client = $client; } @@ -49,7 +49,7 @@ class TemplateEmail extends Mailable /*Alter Run Time Mailer configuration (driver etc etc) to regenerate the Mailer Singleton*/ //if using a system level template - $template_name = 'email.template.' . $this->build_email->getTemplate(); + $template_name = 'email.template.'.$this->build_email->getTemplate(); $settings = $this->client->getMergedSettings(); @@ -59,7 +59,7 @@ class TemplateEmail extends Mailable ->subject($this->build_email->getSubject()) ->text('email.template.plain', [ 'body' => $this->build_email->getBody(), - 'footer' => $this->build_email->getFooter() + 'footer' => $this->build_email->getFooter(), ]) ->view($template_name, [ 'body' => $this->build_email->getBody(), @@ -69,11 +69,11 @@ class TemplateEmail extends Mailable 'title' => $this->build_email->getSubject(), 'signature' => $settings->email_signature, 'settings' => $settings, - 'company' => $company + 'company' => $company, ]); //conditionally attach files - if ($settings->pdf_email_attachment !== false && !empty($this->build_email->getAttachments())) { + if ($settings->pdf_email_attachment !== false && ! empty($this->build_email->getAttachments())) { foreach ($this->build_email->getAttachments() as $file) { $message->attach($file); } diff --git a/app/Mail/TestMailServer.php b/app/Mail/TestMailServer.php index 86d0d6ccc161..6dc52b3f810b 100644 --- a/app/Mail/TestMailServer.php +++ b/app/Mail/TestMailServer.php @@ -1,6 +1,6 @@ markdown('email.support.message', [ 'message' => $this->message, 'system_info' => '', - 'laravel_log' => [] + 'laravel_log' => [], ]); } } diff --git a/app/Mail/User/UserNotificationMailer.php b/app/Mail/User/UserNotificationMailer.php index 755067bf84cd..dddafeb13c15 100644 --- a/app/Mail/User/UserNotificationMailer.php +++ b/app/Mail/User/UserNotificationMailer.php @@ -1,6 +1,6 @@ subject($this->mail_obj->subject) ->markdown($this->mail_obj->markdown, $this->mail_obj->data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->mail_obj->tag); - }); + $message->getHeaders()->addTextHeader('Tag', $this->mail_obj->tag); + }); } } diff --git a/app/Models/Account.php b/app/Models/Account.php index fc162dcb6a79..e681c7701d2a 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -1,6 +1,6 @@ hasOne(Company::class, 'id', 'default_company_id'); } + /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ @@ -123,14 +123,13 @@ class Account extends BaseModel return $this->plan ?: ''; } - public function hasFeature($feature) { $plan_details = $this->getPlanDetails(); $self_host = ! Ninja::isNinja(); switch ($feature) { - + case self::FEATURE_TASKS: case self::FEATURE_EXPENSES: case self::FEATURE_QUOTES: @@ -201,15 +200,16 @@ class Account extends BaseModel { if (! Ninja::isNinja()) { return false; - } + } return $this->plan == 'free'; } public function isEnterpriseClient() { - if(!Ninja::isNinja()) + if (! Ninja::isNinja()) { return false; + } return $this->plan == 'enterprise'; } diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 9969ac137fef..8ba4bf497480 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -1,6 +1,6 @@ 'boolean', @@ -88,10 +87,9 @@ class Activity extends StaticModel public function getEntityType() { - return Activity::class; + return self::class; } - public function backup() { return $this->hasOne(Backup::class); @@ -152,8 +150,7 @@ class Activity extends StaticModel return $this->belongsTo(Company::class); } - - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { if (is_numeric($value)) { throw new ModelNotFoundException("Record with value {$value} not found"); diff --git a/app/Models/Backup.php b/app/Models/Backup.php index ab066cfe8bed..79ed840742f4 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -1,6 +1,6 @@ hasMany('App\Models\BankSubaccount'); + return $this->hasMany(\App\Models\BankSubaccount::class); } public function getEntityType() { - return BankAccount::class; + return self::class; } - } diff --git a/app/Models/BankSubaccount.php b/app/Models/BankSubaccount.php index c2f2f84b6cbb..b975df1164d0 100644 --- a/app/Models/BankSubaccount.php +++ b/app/Models/BankSubaccount.php @@ -1,6 +1,6 @@ 'timestamp', 'deleted_at' => 'timestamp', ]; - + protected $dateFormat = 'Y-m-d H:i:s.u'; - + public function getHashedIdAttribute() { return $this->encodePrimaryKey($this->id); @@ -53,10 +53,10 @@ class BaseModel extends Model public function dateMutator($value) { - if (!empty($value)) { + if (! empty($value)) { return (new Carbon($value))->format('Y-m-d'); } - + return $value; } @@ -70,7 +70,7 @@ class BaseModel extends Model if (config()->has($configPath)) { $function = config()->get($configPath); - return call_user_func_array(array($this, $function[0]), $function[1]); + return call_user_func_array([$this, $function[0]], $function[1]); } } @@ -83,7 +83,7 @@ class BaseModel extends Model public function scopeCompany($query) { $query->where('company_id', auth()->user()->companyId()); - + return $query; } @@ -92,7 +92,7 @@ class BaseModel extends Model */ public function scopeScope($query) { - $query->where($this->getTable() .'.company_id', '=', auth()->user()->company()->id); + $query->where($this->getTable().'.company_id', '=', auth()->user()->company()->id); return $query; } @@ -123,7 +123,6 @@ class BaseModel extends Model } } - public function setSettingsByEntity($entity, $settings) { switch ($entity) { @@ -145,7 +144,7 @@ class BaseModel extends Model break; } } - + /** * Gets the settings. * @@ -164,7 +163,7 @@ class BaseModel extends Model * @param mixed $value * @return \Illuminate\Database\Eloquent\Model|null */ - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { if (is_numeric($value)) { throw new ModelNotFoundException("Record with value {$value} not found"); @@ -189,6 +188,6 @@ class BaseModel extends Model */ public function getFileName($extension = 'pdf') { - return $this->number . '.' . $extension; + return $this->number.'.'.$extension; } } diff --git a/app/Models/Client.php b/app/Models/Client.php index 829c97603325..fcf885357b5f 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -1,6 +1,6 @@ 'boolean', 'country_id' => 'string', @@ -120,7 +119,7 @@ class Client extends BaseModel implements HasLocalePreference public function getEntityType() { - return Client::class; + return self::class; } public function ledger() @@ -140,7 +139,7 @@ class Client extends BaseModel implements HasLocalePreference /** * Retrieves the specific payment token per - * gateway - per payment method + * gateway - per payment method. * * Allows the storage of multiple tokens * per client per gateway per payment_method @@ -206,7 +205,7 @@ class Client extends BaseModel implements HasLocalePreference { return $this->hasMany(SystemLog::class); } - + public function timezone() { return Timezone::find($this->getSetting('timezone_id')); @@ -217,7 +216,7 @@ class Client extends BaseModel implements HasLocalePreference //return Language::find($this->getSetting('language_id')); $languages = Cache::get('languages'); - + return $languages->filter(function ($item) { return $item->id == $this->getSetting('language_id'); })->first(); @@ -225,13 +224,13 @@ class Client extends BaseModel implements HasLocalePreference public function locale() { - return $this->language()->locale ?: 'en'; + return $this->language()->locale ?: 'en'; } public function date_format() { $date_formats = Cache::get('date_formats'); - + return $date_formats->filter(function ($item) { return $item->id == $this->getSetting('date_format_id'); })->first()->format; @@ -242,7 +241,7 @@ class Client extends BaseModel implements HasLocalePreference public function currency() { $currencies = Cache::get('currencies'); - + return $currencies->filter(function ($item) { return $item->id == $this->getSetting('currency_id'); })->first(); @@ -261,7 +260,7 @@ class Client extends BaseModel implements HasLocalePreference /** * Adjusts client "balances" when a client * makes a payment that goes on file, but does - * not effect the client.balance record + * not effect the client.balance record. * * @param float $amount Adjustment amount * @return Client @@ -274,10 +273,9 @@ class Client extends BaseModel implements HasLocalePreference // } /** - * * Returns the entire filtered set * of settings which have been merged from - * Client > Group > Company levels + * Client > Group > Company levels. * * @return object stdClass object of settings */ @@ -293,10 +291,9 @@ class Client extends BaseModel implements HasLocalePreference } /** - * * Returns a single setting * which cascades from - * Client > Group > Company + * Client > Group > Company. * * @param string $setting The Setting parameter * @return mixed The setting requested @@ -307,7 +304,7 @@ class Client extends BaseModel implements HasLocalePreference /*Client Settings*/ if ($this->settings && property_exists($this->settings, $setting) && isset($this->settings->{$setting})) { /*need to catch empty string here*/ - if (is_string($this->settings->{$setting}) && (iconv_strlen($this->settings->{$setting}) >=1)) { + if (is_string($this->settings->{$setting}) && (iconv_strlen($this->settings->{$setting}) >= 1)) { return $this->settings->{$setting}; } } @@ -332,7 +329,7 @@ class Client extends BaseModel implements HasLocalePreference /*Client Settings*/ if ($this->settings && (property_exists($this->settings, $setting) !== false) && (isset($this->settings->{$setting}) !== false)) { /*need to catch empty string here*/ - if (is_string($this->settings->{$setting}) && (iconv_strlen($this->settings->{$setting}) >=1)) { + if (is_string($this->settings->{$setting}) && (iconv_strlen($this->settings->{$setting}) >= 1)) { return $this; } } @@ -347,7 +344,7 @@ class Client extends BaseModel implements HasLocalePreference return $this->company; } - throw new \Exception("Could not find a settings object", 1); + throw new \Exception('Could not find a settings object', 1); } public function documents() @@ -361,25 +358,25 @@ class Client extends BaseModel implements HasLocalePreference } /** - * Returns the first Credit Card Gateway + * Returns the first Credit Card Gateway. * - * @return NULL|CompanyGateway The Priority Credit Card gateway + * @return null|CompanyGateway The Priority Credit Card gateway */ public function getCreditCardGateway() :?CompanyGateway { $company_gateways = $this->getSetting('company_gateway_ids'); /* It is very important to respect the order of the company_gateway_ids as they are ordered by priority*/ - if (strlen($company_gateways)>=1) { - $transformed_ids = $this->transformKeys(explode(",", $company_gateways)); + if (strlen($company_gateways) >= 1) { + $transformed_ids = $this->transformKeys(explode(',', $company_gateways)); $gateways = $this->company ->company_gateways ->whereIn('id', $transformed_ids) - ->sortby(function($model) use ($transformed_ids){ - return array_search($model->id, $transformed_ids); - }); + ->sortby(function ($model) use ($transformed_ids) { + return array_search($model->id, $transformed_ids); + }); } else { - $gateways = $this->company->company_gateways;//todo perhaps we can remove this or keep as a catch all. + $gateways = $this->company->company_gateways; //todo perhaps we can remove this or keep as a catch all. } foreach ($gateways as $gateway) { @@ -395,14 +392,14 @@ class Client extends BaseModel implements HasLocalePreference { $company_gateways = $this->getSetting('company_gateway_ids'); - if (strlen($company_gateways)>=1) { - $transformed_ids = $this->transformKeys(explode(",", $company_gateways)); + if (strlen($company_gateways) >= 1) { + $transformed_ids = $this->transformKeys(explode(',', $company_gateways)); $gateways = $this->company ->company_gateways ->whereIn('id', $transformed_ids) - ->sortby(function($model) use ($transformed_ids){ - return array_search($model->id, $transformed_ids); - }); + ->sortby(function ($model) use ($transformed_ids) { + return array_search($model->id, $transformed_ids); + }); } else { $gateways = $this->company->company_gateways; } @@ -465,39 +462,38 @@ class Client extends BaseModel implements HasLocalePreference $company_gateways = $this->getSetting('company_gateway_ids'); - if ($company_gateways || $company_gateways == "0") { //we need to check for "0" here as we disable a payment gateway for a client with the number "0" + if ($company_gateways || $company_gateways == '0') { //we need to check for "0" here as we disable a payment gateway for a client with the number "0" - $transformed_ids = $this->transformKeys(explode(",", $company_gateways)); + $transformed_ids = $this->transformKeys(explode(',', $company_gateways)); $gateways = $this->company ->company_gateways ->whereIn('id', $transformed_ids) - ->sortby(function($model) use ($transformed_ids){ - return array_search($model->id, $transformed_ids); - }); - + ->sortby(function ($model) use ($transformed_ids) { + return array_search($model->id, $transformed_ids); + }); } else { $gateways = $this->company->company_gateways->where('is_deleted', false); } $valid_gateways = $gateways->filter(function ($method) use ($amount) { - - if(isset($method->fees_and_limits)){ + if (isset($method->fees_and_limits)) { //sometimes the key value of the fees and limits object are not static, //we have to harvest the key value as follows $properties = array_keys(get_object_vars($method->fees_and_limits)); $fees_and_limits = $method->fees_and_limits->{$properties[0]}; - } - else + } else { return true; + } - if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $fees_and_limits->min_limit != -1 && $amount < $fees_and_limits->min_limit) - return false; - - if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $fees_and_limits->max_limit != -1 && $amount > $fees_and_limits->max_limit) + if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $fees_and_limits->min_limit != -1 && $amount < $fees_and_limits->min_limit) { return false; + } + + if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $fees_and_limits->max_limit != -1 && $amount > $fees_and_limits->max_limit) { + return false; + } return true; - })->all(); $payment_methods = []; @@ -507,7 +503,7 @@ class Client extends BaseModel implements HasLocalePreference $payment_methods[] = [$gateway->id => $type]; } } - + $payment_methods_collections = collect($payment_methods); //** Plucks the remaining keys into its own collection @@ -522,9 +518,9 @@ class Client extends BaseModel implements HasLocalePreference $fee_label = $gateway->calcGatewayFeeLabel($amount, $this); $payment_urls[] = [ - 'label' => ctrans('texts.' . $gateway->getTypeAlias($gateway_type_id)) . $fee_label, + 'label' => ctrans('texts.'.$gateway->getTypeAlias($gateway_type_id)).$fee_label, 'company_gateway_id' => $gateway_id, - 'gateway_type_id' => $gateway_type_id + 'gateway_type_id' => $gateway_type_id, ]; } } @@ -535,7 +531,7 @@ class Client extends BaseModel implements HasLocalePreference public function preferredLocale() { $languages = Cache::get('languages'); - + return $languages->filter(function ($item) { return $item->id == $this->getSetting('language_id'); })->first()->locale; @@ -543,46 +539,46 @@ class Client extends BaseModel implements HasLocalePreference public function invoice_filepath() { - return $this->company->company_key . '/' . $this->client_hash . '/invoices/'; + return $this->company->company_key.'/'.$this->client_hash.'/invoices/'; } public function quote_filepath() { - return $this->company->company_key . '/' . $this->client_hash . '/quotes/'; + return $this->company->company_key.'/'.$this->client_hash.'/quotes/'; } public function credit_filepath() { - return $this->company->company_key . '/' . $this->client_hash . '/credits/'; + return $this->company->company_key.'/'.$this->client_hash.'/credits/'; } public function company_filepath() { - return $this->company->company_key . '/'; + return $this->company->company_key.'/'; } public function document_filepath() { - return $this->company->company_key . '/documents/'; + return $this->company->company_key.'/documents/'; } public function setCompanyDefaults($data, $entity_name) :array { $defaults = []; - if (!(array_key_exists('terms', $data) && strlen($data['terms']) > 1)) { + if (! (array_key_exists('terms', $data) && strlen($data['terms']) > 1)) { $defaults['terms'] = $this->getSetting($entity_name.'_terms'); } elseif (array_key_exists('terms', $data)) { $defaults['terms'] = $data['terms']; } - if (!(array_key_exists('footer', $data) && strlen($data['footer']) > 1)) { + if (! (array_key_exists('footer', $data) && strlen($data['footer']) > 1)) { $defaults['footer'] = $this->getSetting($entity_name.'_footer'); } elseif (array_key_exists('footer', $data)) { $defaults['footer'] = $data['footer']; } - if (strlen($this->public_notes) >=1) { + if (strlen($this->public_notes) >= 1) { $defaults['public_notes'] = $this->public_notes; } diff --git a/app/Models/ClientContact.php b/app/Models/ClientContact.php index cc8804e08438..91cba76ac520 100644 --- a/app/Models/ClientContact.php +++ b/app/Models/ClientContact.php @@ -1,6 +1,6 @@ attributes['avatar'] = url('/') . $value; + if (! filter_var($value, FILTER_VALIDATE_URL) && $value) { + $this->attributes['avatar'] = url('/').$value; } else { $this->attributes['avatar'] = $value; } @@ -161,13 +161,11 @@ class ClientContact extends Authenticatable implements HasLocalePreference public function preferredLocale() { - $languages = Cache::get('languages'); return $languages->filter(function ($item) { return $item->id == $this->client->getSetting('language_id'); })->first()->locale; - } public function routeNotificationForMail($notification) @@ -181,7 +179,7 @@ class ClientContact extends Authenticatable implements HasLocalePreference * @param mixed $value * @return \Illuminate\Database\Eloquent\Model|null */ - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { return $this ->withTrashed() diff --git a/app/Models/ClientGatewayToken.php b/app/Models/ClientGatewayToken.php index ab65290ed5d3..4426b777f94b 100644 --- a/app/Models/ClientGatewayToken.php +++ b/app/Models/ClientGatewayToken.php @@ -1,6 +1,6 @@ where('id', $this->decodePrimaryKey($value))->firstOrFail(); diff --git a/app/Models/Company.php b/app/Models/Company.php index edb4d55a6544..8093ab24bd42 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -1,6 +1,6 @@ morphMany(Document::class, 'documentable'); } - + public function getEntityType() { - return Company::class; + return self::class; } public function ledger() @@ -249,7 +248,6 @@ class Company extends BaseModel return $this->hasMany(Quote::class)->withTrashed(); } - /** * @return \Illuminate\Database\Eloquent\Relations\HasMany */ @@ -296,9 +294,6 @@ class Company extends BaseModel return $this->hasMany(GroupSetting::class); } - /** - * - */ public function timezone() { return Timezone::find($this->settings->timezone_id); @@ -414,7 +409,7 @@ class Company extends BaseModel return User::find($c->user_id); } - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { return $this->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } @@ -422,7 +417,7 @@ class Company extends BaseModel public function domain() { if (Ninja::isNinja()) { - return $this->subdomain . config('ninja.app_domain'); + return $this->subdomain.config('ninja.app_domain'); } return config('ninja.app_url'); @@ -442,12 +437,9 @@ class Company extends BaseModel { $company_users = CompanyUser::where('company_id', $this->id)->get(); - foreach($company_users as $cu) - { - $cu->is_migrating=$status; + foreach ($company_users as $cu) { + $cu->is_migrating = $status; $cu->save(); } - } - } diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index 2f521501aedb..6ebf2371e213 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -1,6 +1,6 @@ 'object', 'updated_at' => 'timestamp', @@ -64,7 +64,7 @@ class CompanyGateway extends BaseModel public function getEntityType() { - return CompanyGateway::class; + return self::class; } public function company() @@ -82,7 +82,7 @@ class CompanyGateway extends BaseModel if ($gateway_type_id == 'token') { $gateway_type_id = 1; } - + return GatewayType::find($gateway_type_id)->alias; } @@ -96,14 +96,14 @@ class CompanyGateway extends BaseModel private function driver_class() { - $class = 'App\\PaymentDrivers\\' . $this->gateway->provider . 'PaymentDriver'; + $class = 'App\\PaymentDrivers\\'.$this->gateway->provider.'PaymentDriver'; //$class = str_replace('\\', '', $class); $class = str_replace('_', '', $class); if (class_exists($class)) { return $class; } else { - return 'App\\PaymentDrivers\\BasePaymentDriver'; + return \App\PaymentDrivers\BasePaymentDriver::class; } } @@ -139,7 +139,6 @@ class CompanyGateway extends BaseModel return object_get($this->getConfig(), $field, false); } - /** * @return bool */ @@ -202,25 +201,28 @@ class CompanyGateway extends BaseModel } /** - * Returns the current test mode of the gateway - * - * @return boolean whether the gateway is in testmode or not. + * Returns the current test mode of the gateway. + * + * @return bool whether the gateway is in testmode or not. */ public function isTestMode() :bool { $config = $this->getConfig(); - if($this->gateway->provider == 'Stripe' && strpos($config->publishableKey, 'test')) + if ($this->gateway->provider == 'Stripe' && strpos($config->publishableKey, 'test')) { return true; + } - if($config && property_exists($config, 'testMode') && $config->testMode) + if ($config && property_exists($config, 'testMode') && $config->testMode) { return true; + } return false; } + /** * Get Publishable Key - * Only works for STRIPE and PAYMILL + * Only works for STRIPE and PAYMILL. * @return string The Publishable key */ public function getPublishableKey() :string @@ -230,12 +232,13 @@ class CompanyGateway extends BaseModel public function getFeesAndLimits() { - if (is_null($this->fees_and_limits)) + if (is_null($this->fees_and_limits)) { return false; + } $fees_and_limits = new \stdClass; - foreach($this->fees_and_limits as $key => $value) { + foreach ($this->fees_and_limits as $key => $value) { $fees_and_limits = $this->fees_and_limits->{$key}; } @@ -243,7 +246,7 @@ class CompanyGateway extends BaseModel } /** - * Returns the formatted fee amount for the gateway + * Returns the formatted fee amount for the gateway. * * @param float $amount The payment amount * @param Client $client The client object @@ -253,7 +256,7 @@ class CompanyGateway extends BaseModel { $label = ''; - if (!$this->feesEnabled()) { + if (! $this->feesEnabled()) { return $label; } @@ -261,7 +264,7 @@ class CompanyGateway extends BaseModel if ($fee > 0) { $fee = Number::formatMoney(round($fee, 2), $client); - $label = ' - ' . $fee . ' ' . ctrans('texts.fee'); + $label = ' - '.$fee.' '.ctrans('texts.fee'); } return $label; @@ -269,11 +272,11 @@ class CompanyGateway extends BaseModel public function calcGatewayFee($amount, $include_taxes = false) { - $fees_and_limits = $this->getFeesAndLimits(); - if(!$fees_and_limits) + if (! $fees_and_limits) { return 0; + } $fee = 0; @@ -281,31 +284,31 @@ class CompanyGateway extends BaseModel $fee += $fees_and_limits->fee_amount; info("fee after adding fee amount = {$fee}"); } - + if ($fees_and_limits->fee_percent) { $fee += $amount * $fees_and_limits->fee_percent / 100; info("fee after adding fee percent = {$fee}"); } - /* Cap fee if we have to here. */ - if($fees_and_limits->fee_cap > 0 && ($fee > $fees_and_limits->fee_cap)) + /* Cap fee if we have to here. */ + if ($fees_and_limits->fee_cap > 0 && ($fee > $fees_and_limits->fee_cap)) { $fee = $fees_and_limits->fee_cap; + } $pre_tax_fee = $fee; /**/ - if($include_taxes) - { + if ($include_taxes) { if ($fees_and_limits->fee_tax_rate1) { $fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate1 / 100; info("fee after adding fee tax 1 = {$fee}"); } - + if ($fees_and_limits->fee_tax_rate2) { $fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate2 / 100; info("fee after adding fee tax 2 = {$fee}"); } - + if ($fees_and_limits->fee_tax_rate3) { $fee += $pre_tax_fee * $fees_and_limits->fee_tax_rate3 / 100; info("fee after adding fee tax 3 = {$fee}"); @@ -316,10 +319,10 @@ class CompanyGateway extends BaseModel } /** - * we need to average out the gateway fees across all the invoices - * so lets iterate. - * - * we MAY need to adjust the final fee to ensure our rounding makes sense! + * we need to average out the gateway fees across all the invoices + * so lets iterate. + * + * we MAY need to adjust the final fee to ensure our rounding makes sense! */ public function calcGatewayFeeObject($amount, $invoice_count) { @@ -329,10 +332,11 @@ class CompanyGateway extends BaseModel $fees_and_limits = $this->getFeesAndLimits(); - if(!$fees_and_limits) + if (! $fees_and_limits) { return $fee_object; + } - $fee_component_amount = $fees_and_limits->fee_amount ?: 0; + $fee_component_amount = $fees_and_limits->fee_amount ?: 0; $fee_component_percent = $fees_and_limits->fee_percent ? ($amount * $fees_and_limits->fee_percent / 100) : 0; $combined_fee_component = $fee_component_amount + $fee_component_percent; @@ -345,10 +349,9 @@ class CompanyGateway extends BaseModel $fee_component_tax_name3 = $fees_and_limits->fee_tax_name3 ?: ''; $fee_component_tax_rate3 = $fees_and_limits->fee_tax_rate3 ? ($combined_fee_component * $fees_and_limits->fee_tax_rate3 / 100) : 0; - } - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { return $this ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); diff --git a/app/Models/CompanyLedger.php b/app/Models/CompanyLedger.php index 94b349097a18..b92c9b53945d 100644 --- a/app/Models/CompanyLedger.php +++ b/app/Models/CompanyLedger.php @@ -1,6 +1,6 @@ 'timestamp', 'created_at' => 'timestamp', @@ -31,7 +31,7 @@ class CompanyLedger extends Model public function getEntityType() { - return CompanyLedger::class; + return self::class; } public function user() diff --git a/app/Models/CompanyToken.php b/app/Models/CompanyToken.php index 3ecc905573df..ed9cd2581c82 100644 --- a/app/Models/CompanyToken.php +++ b/app/Models/CompanyToken.php @@ -1,6 +1,6 @@ hasOne(CompanyUser::class,'user_id','user_id') + return $this->hasOne(CompanyUser::class, 'user_id', 'user_id') ->where('company_id', $this->company_id) ->where('user_id', $this->user_id); } - } diff --git a/app/Models/CompanyUser.php b/app/Models/CompanyUser.php index fa699b40e274..3d4b63780308 100644 --- a/app/Models/CompanyUser.php +++ b/app/Models/CompanyUser.php @@ -1,6 +1,6 @@ hasMany(CompanyToken::class, 'user_id', 'user_id'); } - public function scopeAuthCompany($query) { $query->where('company_id', auth()->user()->companyId()); - + return $query; } } diff --git a/app/Models/Country.php b/app/Models/Country.php index 46d8d751e9eb..0d5e81231358 100644 --- a/app/Models/Country.php +++ b/app/Models/Country.php @@ -1,6 +1,6 @@ 'timestamp', 'deleted_at' => 'timestamp', ]; - + /** * Localizes the country name for the clients language. * @@ -33,6 +33,6 @@ class Country extends StaticModel */ public function getName() :string { - return trans('texts.country_' . $this->name); + return trans('texts.country_'.$this->name); } } diff --git a/app/Models/Credit.php b/app/Models/Credit.php index 1a1a6c9ddf5d..9a222ad7938d 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -1,6 +1,6 @@ dateMutator($value); } - public function assigned_user() { return $this->belongsTo(User::class, 'assigned_user_id', 'id'); @@ -118,7 +117,7 @@ class Credit extends BaseModel { return $this->hasManyThrough(Backup::class, Activity::class); } - + public function company() { return $this->belongsTo(Company::class); @@ -145,7 +144,7 @@ class Credit extends BaseModel } /** - * The invoice which the credit has been created from + * The invoice which the credit has been created from. */ public function invoice() { @@ -156,11 +155,12 @@ class Credit extends BaseModel { return $this->morphMany(CompanyLedger::class, 'company_ledgerable'); } - + public function ledger() { return new LedgerService($this); } + /** * The invoice/s which the credit has * been applied to. @@ -180,9 +180,8 @@ class Credit extends BaseModel return $this->morphMany(Document::class, 'documentable'); } - /** - * Access the invoice calculator object + * Access the invoice calculator object. * * @return object The invoice calculator object getters */ @@ -199,7 +198,6 @@ class Credit extends BaseModel return $credit_calc->build(); } - public function service() { return new CreditService($this); @@ -237,18 +235,17 @@ class Credit extends BaseModel public function pdf_file_path($invitation = null) { + $storage_path = Storage::url($this->client->credit_filepath().$this->number.'.pdf'); - $storage_path = Storage::url($this->client->credit_filepath() . $this->number . '.pdf'); - - if (Storage::exists($this->client->credit_filepath() . $this->number . '.pdf')) { + if (Storage::exists($this->client->credit_filepath().$this->number.'.pdf')) { return $storage_path; } - if (!$invitation) { - event(new CreditWasUpdated($this, $this->company, Ninja::eventVars())); + if (! $invitation) { + event(new CreditWasUpdated($this, $this->company, Ninja::eventVars())); CreateCreditPdf::dispatchNow($this, $this->company, $this->client->primary_contact()->first()); } else { - event(new CreditWasUpdated($this, $this->company, Ninja::eventVars())); + event(new CreditWasUpdated($this, $this->company, Ninja::eventVars())); CreateCreditPdf::dispatchNow($invitation->credit, $invitation->company, $invitation->contact); } @@ -258,7 +255,7 @@ class Credit extends BaseModel public function markInvitationsSent() { $this->invitations->each(function ($invitation) { - if (!isset($invitation->sent_date)) { + if (! isset($invitation->sent_date)) { $invitation->sent_date = Carbon::now(); $invitation->save(); } diff --git a/app/Models/CreditInvitation.php b/app/Models/CreditInvitation.php index cc8ca06288ca..7cc5df13d891 100644 --- a/app/Models/CreditInvitation.php +++ b/app/Models/CreditInvitation.php @@ -1,6 +1,6 @@ credit->client->quote_filepath() . $this->credit->number . '.pdf'); + $storage_path = Storage::url($this->credit->client->quote_filepath().$this->credit->number.'.pdf'); - if (!Storage::exists($this->credit->client->credit_filepath() . $this->credit->number . '.pdf')) { + if (! Storage::exists($this->credit->client->credit_filepath().$this->credit->number.'.pdf')) { event(new CreditWasUpdated($this, $this->company, Ninja::eventVars())); CreateCreditPdf::dispatchNow($this); } diff --git a/app/Models/Currency.php b/app/Models/Currency.php index 0f5e931e56c3..6d5ed2ea4345 100644 --- a/app/Models/Currency.php +++ b/app/Models/Currency.php @@ -1,6 +1,6 @@ 'december', ]; - /** * @var bool */ diff --git a/app/Models/Design.php b/app/Models/Design.php index cc3524466f4d..c7ebbdaa6780 100644 --- a/app/Models/Design.php +++ b/app/Models/Design.php @@ -1,6 +1,6 @@ $this->hashed_id]) . '/download'; + return route('api.documents.show', ['document' => $this->hashed_id]).'/download'; } public function deleteFile() diff --git a/app/Models/Expense.php b/app/Models/Expense.php index a1633ce2d5a5..d9550a413293 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -1,6 +1,6 @@ 'boolean', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', ]; - + protected $touches = []; public function getEntityType() { - return Expense::class; + return self::class; } public function documents() diff --git a/app/Models/ExpenseCategory.php b/app/Models/ExpenseCategory.php index 6e923e25596c..edc826661ffb 100644 --- a/app/Models/ExpenseCategory.php +++ b/app/Models/ExpenseCategory.php @@ -1,6 +1,6 @@ belongsTo('App\Models\Expense'); + return $this->belongsTo(\App\Models\Expense::class); } } diff --git a/app/Models/Filterable.php b/app/Models/Filterable.php index bd0858d3f6d0..1f86c9459799 100644 --- a/app/Models/Filterable.php +++ b/app/Models/Filterable.php @@ -1,6 +1,6 @@ where('id', $this->decodePrimaryKey($value))->firstOrFail(); diff --git a/app/Models/Industry.php b/app/Models/Industry.php index 35dfbf8fca7e..4b02ee7707d7 100644 --- a/app/Models/Industry.php +++ b/app/Models/Industry.php @@ -1,6 +1,6 @@ dateMutator($value); } - public function company() { return $this->belongsTo(Company::class); @@ -214,6 +213,7 @@ class Invoice extends BaseModel { return $this->hasMany(Credit::class); } + // public function credits() // { // return $this->belongsToMany(Credit::class)->using(Paymentable::class)->withPivot( @@ -223,7 +223,7 @@ class Invoice extends BaseModel // } /** - * Service entry points + * Service entry points. */ public function service() :InvoiceService { @@ -241,14 +241,14 @@ class Invoice extends BaseModel public function getStatusAttribute() { - if ($this->status_id == Invoice::STATUS_SENT && $this->due_date > Carbon::now()) { - return Invoice::STATUS_UNPAID; - } elseif ($this->status_id == Invoice::STATUS_PARTIAL && $this->partial_due_date > Carbon::now()) { - return Invoice::STATUS_UNPAID; - } elseif ($this->status_id == Invoice::STATUS_SENT && $this->due_date < Carbon::now()) { - return Invoice::STATUS_OVERDUE; - } elseif ($this->status_id == Invoice::STATUS_PARTIAL && $this->partial_due_date < Carbon::now()) { - return Invoice::STATUS_OVERDUE; + if ($this->status_id == self::STATUS_SENT && $this->due_date > Carbon::now()) { + return self::STATUS_UNPAID; + } elseif ($this->status_id == self::STATUS_PARTIAL && $this->partial_due_date > Carbon::now()) { + return self::STATUS_UNPAID; + } elseif ($this->status_id == self::STATUS_SENT && $this->due_date < Carbon::now()) { + return self::STATUS_OVERDUE; + } elseif ($this->status_id == self::STATUS_PARTIAL && $this->partial_due_date < Carbon::now()) { + return self::STATUS_OVERDUE; } else { return $this->status_id; } @@ -256,15 +256,15 @@ class Invoice extends BaseModel public function isPayable(): bool { - if($this->status_id == Invoice::STATUS_DRAFT && $this->is_deleted == false){ + if ($this->status_id == self::STATUS_DRAFT && $this->is_deleted == false) { return true; - }else if ($this->status_id == Invoice::STATUS_SENT && $this->is_deleted == false) { + } elseif ($this->status_id == self::STATUS_SENT && $this->is_deleted == false) { return true; - } elseif ($this->status_id == Invoice::STATUS_PARTIAL && $this->is_deleted == false) { + } elseif ($this->status_id == self::STATUS_PARTIAL && $this->is_deleted == false) { return true; - } elseif ($this->status_id == Invoice::STATUS_SENT && $this->is_deleted == false) { + } elseif ($this->status_id == self::STATUS_SENT && $this->is_deleted == false) { return true; - } elseif ($this->status_id == Invoice::STATUS_DRAFT && $this->is_deleted == false) { + } elseif ($this->status_id == self::STATUS_DRAFT && $this->is_deleted == false) { return true; } else { return false; @@ -303,32 +303,32 @@ class Invoice extends BaseModel public static function badgeForStatus(int $status) { switch ($status) { - case Invoice::STATUS_DRAFT: - return '
' . ctrans('texts.draft') . '
'; + case self::STATUS_DRAFT: + return '
'.ctrans('texts.draft').'
'; break; - case Invoice::STATUS_SENT: - return '
' . ctrans('texts.sent') . '
'; + case self::STATUS_SENT: + return '
'.ctrans('texts.sent').'
'; break; - case Invoice::STATUS_PARTIAL: - return '
' . ctrans('texts.partial') . '
'; + case self::STATUS_PARTIAL: + return '
'.ctrans('texts.partial').'
'; break; - case Invoice::STATUS_PAID: - return '
' . ctrans('texts.paid') . '
'; + case self::STATUS_PAID: + return '
'.ctrans('texts.paid').'
'; break; - case Invoice::STATUS_CANCELLED: - return '
' . ctrans('texts.cancelled') . '
'; + case self::STATUS_CANCELLED: + return '
'.ctrans('texts.cancelled').'
'; break; - case Invoice::STATUS_OVERDUE: - return '
' . ctrans('texts.overdue') . '
'; + case self::STATUS_OVERDUE: + return '
'.ctrans('texts.overdue').'
'; break; - case Invoice::STATUS_UNPAID: - return '
' . ctrans('texts.unpaid') . '
'; + case self::STATUS_UNPAID: + return '
'.ctrans('texts.unpaid').'
'; break; - case Invoice::STATUS_REVERSED: - return '
' . ctrans('texts.reversed') . '
'; + case self::STATUS_REVERSED: + return '
'.ctrans('texts.reversed').'
'; break; default: - # code... + // code... break; } } @@ -336,38 +336,38 @@ class Invoice extends BaseModel public static function stringStatus(int $status) { switch ($status) { - case Invoice::STATUS_DRAFT: + case self::STATUS_DRAFT: return ctrans('texts.draft'); break; - case Invoice::STATUS_SENT: + case self::STATUS_SENT: return ctrans('texts.sent'); break; - case Invoice::STATUS_PARTIAL: + case self::STATUS_PARTIAL: return ctrans('texts.partial'); break; - case Invoice::STATUS_PAID: + case self::STATUS_PAID: return ctrans('texts.paid'); break; - case Invoice::STATUS_CANCELLED: + case self::STATUS_CANCELLED: return ctrans('texts.cancelled'); break; - case Invoice::STATUS_OVERDUE: + case self::STATUS_OVERDUE: return ctrans('texts.overdue'); break; - case Invoice::STATUS_UNPAID: + case self::STATUS_UNPAID: return ctrans('texts.unpaid'); break; - case Invoice::STATUS_REVERSED: + case self::STATUS_REVERSED: return ctrans('texts.reversed'); break; default: - # code... + // code... break; } } /** - * Access the invoice calculator object + * Access the invoice calculator object. * * @return object The invoice calculator object getters */ @@ -386,12 +386,13 @@ class Invoice extends BaseModel public function pdf_file_path($invitation = null) { - if(!$invitation) + if (! $invitation) { $invitation = $this->invitations->first(); + } - $storage_path = Storage::url($this->client->invoice_filepath() . $this->number . '.pdf'); + $storage_path = Storage::url($this->client->invoice_filepath().$this->number.'.pdf'); - if (!Storage::exists($this->client->invoice_filepath() . $this->number . '.pdf')) { + if (! Storage::exists($this->client->invoice_filepath().$this->number.'.pdf')) { event(new InvoiceWasUpdated($this, $this->company, Ninja::eventVars())); CreateInvoicePdf::dispatchNow($invitation); } @@ -399,15 +400,13 @@ class Invoice extends BaseModel return $storage_path; } - /** - * Updates Invites to SENT - * + * Updates Invites to SENT. */ public function markInvitationsSent() { $this->invitations->each(function ($invitation) { - if (!isset($invitation->sent_date)) { + if (! isset($invitation->sent_date)) { $invitation->sent_date = Carbon::now(); $invitation->save(); } @@ -416,9 +415,9 @@ class Invoice extends BaseModel /** * Filtering logic to determine - * whether an invoice is locked - * based on the current status of the invoice - * @return boolean [description] + * whether an invoice is locked + * based on the current status of the invoice. + * @return bool [description] */ public function isLocked() :bool { @@ -433,7 +432,7 @@ class Invoice extends BaseModel break; case 'when_paid': return $this->status_id == self::STATUS_PAID || $this->status_id == self::STATUS_PARTIAL; - break; + break; default: return false; break; @@ -460,7 +459,6 @@ class Invoice extends BaseModel // return strtotime($this->createClientDate(date(), $this->client->timezone()->name)) > (strtotime($due_date) + (60 * 60 * 24)); // } - /** * @param bool $save * diff --git a/app/Models/InvoiceInvitation.php b/app/Models/InvoiceInvitation.php index 86b1fe5c1ed1..60669e07483b 100644 --- a/app/Models/InvoiceInvitation.php +++ b/app/Models/InvoiceInvitation.php @@ -1,6 +1,6 @@ signature_base64) { + if (! $this->signature_base64) { return false; } @@ -142,14 +141,13 @@ class InvoiceInvitation extends BaseModel public function pdf_file_path() { - $storage_path = Storage::url($this->invoice->client->invoice_filepath() . $this->invoice->number . '.pdf'); + $storage_path = Storage::url($this->invoice->client->invoice_filepath().$this->invoice->number.'.pdf'); - if (!Storage::exists($this->invoice->client->invoice_filepath() . $this->invoice->number . '.pdf')) { + if (! Storage::exists($this->invoice->client->invoice_filepath().$this->invoice->number.'.pdf')) { event(new InvoiceWasUpdated($this->invoice, $this->company, Ninja::eventVars())); CreateInvoicePdf::dispatchNow($this); } return $storage_path; } - } diff --git a/app/Models/Language.php b/app/Models/Language.php index 77e411d019e2..0e8f2169b562 100644 --- a/app/Models/Language.php +++ b/app/Models/Language.php @@ -1,6 +1,6 @@ belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); } - + public function documents() { return $this->morphMany(Document::class, 'documentable'); @@ -157,7 +157,7 @@ class Payment extends BaseModel public function clientPaymentDate() { - if (!$this->date) { + if (! $this->date) { return ''; } @@ -188,7 +188,7 @@ class Payment extends BaseModel return '
'.ctrans('texts.payment_status_6').'
'; break; default: - # code... + // code... break; } } @@ -203,14 +203,14 @@ class Payment extends BaseModel return new PaymentService($this); } - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { return $this ->withTrashed() ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } - public function refund(array $data) :Payment + public function refund(array $data) :self { return $this->service()->refundPayment($data); diff --git a/app/Models/PaymentHash.php b/app/Models/PaymentHash.php index 2031b2f1aba7..6c23c88a239f 100644 --- a/app/Models/PaymentHash.php +++ b/app/Models/PaymentHash.php @@ -1,6 +1,6 @@ 'object' + 'data' => 'object', ]; public function invoices() { - return $this->data; + return $this->data; } } diff --git a/app/Models/PaymentLibrary.php b/app/Models/PaymentLibrary.php index 5175f6e9ec65..3dee9b6d9e41 100644 --- a/app/Models/PaymentLibrary.php +++ b/app/Models/PaymentLibrary.php @@ -1,6 +1,6 @@ num_days == -1 ? 0 : $this->num_days; @@ -51,7 +51,7 @@ class PaymentTerm extends BaseModel ->sort() ->values() ->all(); - + return $default_terms; } diff --git a/app/Models/PaymentType.php b/app/Models/PaymentType.php index dbe86dee86ea..3d9ed1f8f190 100644 --- a/app/Models/PaymentType.php +++ b/app/Models/PaymentType.php @@ -1,6 +1,6 @@ entity->first_name . ' ' . $this->entity->last_name; + return $this->entity->first_name.' '.$this->entity->last_name; } public function first_name() { - return $this->entity->first_name ?: ''; + return $this->entity->first_name ?: ''; } public function last_name() { - return $this->entity->last_name ?: ''; + return $this->entity->last_name ?: ''; } } diff --git a/app/Models/Presenters/ClientPresenter.php b/app/Models/Presenters/ClientPresenter.php index b13d007437f0..d22fd10f9563 100644 --- a/app/Models/Presenters/ClientPresenter.php +++ b/app/Models/Presenters/ClientPresenter.php @@ -1,6 +1,6 @@ entity->name) + if ($this->entity->name) { return $this->entity->name; + } $contact = $this->entity->primary_contact->first(); $contact_name = 'No Contact Set'; - if ($contact && (strlen($contact->first_name) >=1 || strlen($contact->last_name) >=1)) { - $contact_name = $contact->first_name. ' '. $contact->last_name; - } - elseif($contact && (strlen($contact->email))) + if ($contact && (strlen($contact->first_name) >= 1 || strlen($contact->last_name) >= 1)) { + $contact_name = $contact->first_name.' '.$contact->last_name; + } elseif ($contact && (strlen($contact->email))) { $contact_name = $contact->email; + } return $contact_name; } public function primary_contact_name() { - return $this->entity->primary_contact->first() !== null ? $this->entity->primary_contact->first()->first_name . ' '. $this->entity->primary_contact->first()->last_name : 'No primary contact set'; + return $this->entity->primary_contact->first() !== null ? $this->entity->primary_contact->first()->first_name.' '.$this->entity->primary_contact->first()->last_name : 'No primary contact set'; } public function email() @@ -57,16 +56,16 @@ class ClientPresenter extends EntityPresenter $client = $this->entity; if ($address1 = $client->address1) { - $str .= e($address1) . '
'; + $str .= e($address1).'
'; } if ($address2 = $client->address2) { - $str .= e($address2) . '
'; + $str .= e($address2).'
'; } if ($cityState = $this->getCityState()) { - $str .= e($cityState) . '
'; + $str .= e($cityState).'
'; } if ($country = $client->country) { - $str .= e($country->name) . '
'; + $str .= e($country->name).'
'; } return $str; @@ -78,16 +77,16 @@ class ClientPresenter extends EntityPresenter $client = $this->entity; if ($address1 = $client->shipping_address1) { - $str .= e($address1) . '
'; + $str .= e($address1).'
'; } if ($address2 = $client->shipping_address2) { - $str .= e($address2) . '
'; + $str .= e($address2).'
'; } if ($cityState = $this->getCityState()) { - $str .= e($cityState) . '
'; + $str .= e($cityState).'
'; } if ($country = $client->country) { - $str .= e($country->name) . '
'; + $str .= e($country->name).'
'; } return $str; @@ -105,7 +104,7 @@ class ClientPresenter extends EntityPresenter /** * Calculated company data fields - * using settings + * using settings. */ public function company_name() { @@ -119,18 +118,18 @@ class ClientPresenter extends EntityPresenter $settings = $this->entity->getMergedSettings(); $str = ''; - + if ($settings->address1) { - $str .= e($settings->address1) . '
'; + $str .= e($settings->address1).'
'; } if ($settings->address2) { - $str .= e($settings->address2) . '
'; + $str .= e($settings->address2).'
'; } if ($cityState = $this->getCityState()) { - $str .= e($cityState) . '
'; + $str .= e($cityState).'
'; } if ($country = Country::find($settings->country_id)) { - $str .= e($country->name) . '
'; + $str .= e($country->name).'
'; } return $str; diff --git a/app/Models/Presenters/CompanyPresenter.php b/app/Models/Presenters/CompanyPresenter.php index a4306c640b4f..aac2ff141ce7 100644 --- a/app/Models/Presenters/CompanyPresenter.php +++ b/app/Models/Presenters/CompanyPresenter.php @@ -1,6 +1,6 @@ entity->settings; } @@ -46,27 +44,27 @@ class CompanyPresenter extends EntityPresenter $str = ''; $company = $this->entity; - if (!$settings) { + if (! $settings) { $settings = $this->entity->settings; } if ($address1 = $settings->address1) { - $str .= e($address1) . '
'; + $str .= e($address1).'
'; } if ($address2 = $settings->address2) { - $str .= e($address2) . '
'; + $str .= e($address2).'
'; } if ($cityState = $this->getCompanyCityState($settings)) { - $str .= e($cityState) . '
'; + $str .= e($cityState).'
'; } if ($country = Country::find($settings->country_id)) { - $str .= e($country->name) . '
'; + $str .= e($country->name).'
'; } if ($settings->phone) { - $str .= ctrans('texts.work_phone') . ": ". e($settings->phone) .'
'; + $str .= ctrans('texts.work_phone').': '.e($settings->phone).'
'; } if ($settings->email) { - $str .= ctrans('texts.work_email') . ": ". e($settings->email) .'
'; + $str .= ctrans('texts.work_email').': '.e($settings->email).'
'; } return $str; @@ -74,7 +72,7 @@ class CompanyPresenter extends EntityPresenter public function getCompanyCityState($settings = null) { - if (!$settings) { + if (! $settings) { $settings = $this->entity->settings; } diff --git a/app/Models/Presenters/CreditPresenter.php b/app/Models/Presenters/CreditPresenter.php index b108831a7908..4dfde31e2ced 100644 --- a/app/Models/Presenters/CreditPresenter.php +++ b/app/Models/Presenters/CreditPresenter.php @@ -1,6 +1,6 @@ encodePrimaryKey($this->entity->id); } - /** - * - */ public function url() { } - /** - * - */ public function path() { } - /** - * - */ public function editUrl() { } @@ -62,23 +52,14 @@ class EntityPresenter extends Presenter { } - /** - * - */ public function statusColor() { } - /** - * - */ public function link() { } - /** - * - */ public function titledName() { } @@ -134,9 +115,9 @@ class EntityPresenter extends Presenter } if ($swap) { - return $postalCode . ' ' . $str; + return $postalCode.' '.$str; } else { - return $str . ' ' . $postalCode; + return $str.' '.$postalCode; } } diff --git a/app/Models/Presenters/InvoicePresenter.php b/app/Models/Presenters/InvoicePresenter.php index 567113b10962..ceee58492bc5 100644 --- a/app/Models/Presenters/InvoicePresenter.php +++ b/app/Models/Presenters/InvoicePresenter.php @@ -1,6 +1,6 @@ balance, $this->client); diff --git a/app/Models/Presenters/QuotePresenter.php b/app/Models/Presenters/QuotePresenter.php index 2e8f77c1af6e..484a55818704 100644 --- a/app/Models/Presenters/QuotePresenter.php +++ b/app/Models/Presenters/QuotePresenter.php @@ -1,6 +1,6 @@ balance, $this->client); diff --git a/app/Models/Presenters/UserPresenter.php b/app/Models/Presenters/UserPresenter.php index 83a640578ec8..6d52863e5f76 100644 --- a/app/Models/Presenters/UserPresenter.php +++ b/app/Models/Presenters/UserPresenter.php @@ -1,6 +1,6 @@ entity->first_name) ? $this->entity->first_name : ''; $last_name = isset($this->entity->last_name) ? $this->entity->last_name : ''; - - return $first_name . ' ' . $last_name; + + return $first_name.' '.$last_name; } } diff --git a/app/Models/Product.php b/app/Models/Product.php index 900068b3538a..b13f7e9e79d9 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -1,6 +1,6 @@ belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); } - + public function documents() { return $this->morphMany(Document::class, 'documentable'); diff --git a/app/Models/Project.php b/app/Models/Project.php index bf6c8874efb0..f3e0bf074489 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -31,7 +31,7 @@ class Project extends BaseModel 'custom_value1', 'custom_value2', ]; - + protected $casts = [ 'updated_at' => 'timestamp', 'created_at' => 'timestamp', @@ -39,7 +39,7 @@ class Project extends BaseModel public function getEntityType() { - return Project::class; + return self::class; } protected $touches = []; diff --git a/app/Models/Proposal.php b/app/Models/Proposal.php index 02a142fd9caa..ba396989b495 100644 --- a/app/Models/Proposal.php +++ b/app/Models/Proposal.php @@ -1,6 +1,6 @@ dateMutator($value); } - public function company() { return $this->belongsTo(Company::class); @@ -125,7 +124,7 @@ class Quote extends BaseModel { return $this->hasManyThrough(Backup::class, Activity::class); } - + public function user() { return $this->belongsTo(User::class)->withTrashed(); @@ -157,7 +156,7 @@ class Quote extends BaseModel } /** - * Access the quote calculator object + * Access the quote calculator object. * * @return object The quote calculator object getters */ @@ -175,13 +174,12 @@ class Quote extends BaseModel } /** - * Updates Invites to SENT - * + * Updates Invites to SENT. */ public function markInvitationsSent() { $this->invitations->each(function ($invitation) { - if (!isset($invitation->sent_date)) { + if (! isset($invitation->sent_date)) { $invitation->sent_date = Carbon::now(); $invitation->save(); } @@ -195,17 +193,18 @@ class Quote extends BaseModel public function pdf_file_path($invitation = null) { - if(!$invitation) + if (! $invitation) { $invitation = $this->invitations->where('client_contact_id', $this->client->primary_contact()->first()->id)->first(); + } - $storage_path = Storage::url($this->client->quote_filepath() . $this->number . '.pdf'); + $storage_path = Storage::url($this->client->quote_filepath().$this->number.'.pdf'); - if (Storage::exists($this->client->quote_filepath() . $this->number . '.pdf')) { + if (Storage::exists($this->client->quote_filepath().$this->number.'.pdf')) { return $storage_path; } - event(new QuoteWasUpdated($this, $this->company, Ninja::eventVars())); - + event(new QuoteWasUpdated($this, $this->company, Ninja::eventVars())); + CreateQuotePdf::dispatchNow($invitation); return $storage_path; @@ -218,20 +217,20 @@ class Quote extends BaseModel public static function badgeForStatus(int $status) { switch ($status) { - case Quote::STATUS_DRAFT: - return '
' . ctrans('texts.draft') . '
'; + case self::STATUS_DRAFT: + return '
'.ctrans('texts.draft').'
'; break; - case Quote::STATUS_SENT: - return '
' . ctrans('texts.pending') . '
'; + case self::STATUS_SENT: + return '
'.ctrans('texts.pending').'
'; break; - case Quote::STATUS_APPROVED: - return '
' . ctrans('texts.approved') . '
'; + case self::STATUS_APPROVED: + return '
'.ctrans('texts.approved').'
'; break; - case Quote::STATUS_EXPIRED: - return '
' . ctrans('texts.expired') . '
'; + case self::STATUS_EXPIRED: + return '
'.ctrans('texts.expired').'
'; break; default: - # code... + // code... break; } } diff --git a/app/Models/QuoteInvitation.php b/app/Models/QuoteInvitation.php index 361a11009075..78b1ae7e4cc4 100644 --- a/app/Models/QuoteInvitation.php +++ b/app/Models/QuoteInvitation.php @@ -1,6 +1,6 @@ quote->client->quote_filepath() . $this->quote->number . '.pdf'); + $storage_path = Storage::url($this->quote->client->quote_filepath().$this->quote->number.'.pdf'); - if (!Storage::exists($this->quote->client->quote_filepath() . $this->quote->number . '.pdf')) { + if (! Storage::exists($this->quote->client->quote_filepath().$this->quote->number.'.pdf')) { event(new QuoteWasUpdated($this->quote, $this->company, Ninja::eventVars())); CreateQuotePdf::dispatchNow($this); } diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 3415a2c857ad..88b6842ffa7d 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -1,6 +1,6 @@ format('Y-m-d'); } + return $value; } public function getDueDateAttribute($value) { - if (!empty($value)) { + if (! empty($value)) { return (new Carbon($value))->format('Y-m-d'); } + return $value; } public function getPartialDueDateAttribute($value) { - if (!empty($value)) { + if (! empty($value)) { return (new Carbon($value))->format('Y-m-d'); } + return $value; } - + public function company() { return $this->belongsTo(Company::class); @@ -162,10 +163,10 @@ class RecurringInvoice extends BaseModel { return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); } - + public function invoices() { - return $this->hasMany(Invoice::class, "id", "recurring_id")->withTrashed(); + return $this->hasMany(Invoice::class, 'id', 'recurring_id')->withTrashed(); } public function invitations() @@ -175,10 +176,10 @@ class RecurringInvoice extends BaseModel public function getStatusAttribute() { - if ($this->status_id == RecurringInvoice::STATUS_ACTIVE && $this->start_date > Carbon::now()) { //marked as active, but yet to fire first cycle - return RecurringInvoice::STATUS_PENDING; - } elseif ($this->status_id == RecurringInvoice::STATUS_ACTIVE && $this->next_send_date > Carbon::now()) { - return RecurringInvoice::STATUS_COMPLETED; + if ($this->status_id == self::STATUS_ACTIVE && $this->start_date > Carbon::now()) { //marked as active, but yet to fire first cycle + return self::STATUS_PENDING; + } elseif ($this->status_id == self::STATUS_ACTIVE && $this->next_send_date > Carbon::now()) { + return self::STATUS_COMPLETED; } else { return $this->status_id; } @@ -187,27 +188,27 @@ class RecurringInvoice extends BaseModel public function nextSendDate() :?Carbon { switch ($this->frequency_id) { - case RecurringInvoice::FREQUENCY_WEEKLY: + case self::FREQUENCY_WEEKLY: return Carbon::parse($this->next_send_date->addWeek()); - case RecurringInvoice::FREQUENCY_TWO_WEEKS: + case self::FREQUENCY_TWO_WEEKS: return Carbon::parse($this->next_send_date->addWeeks(2)); - case RecurringInvoice::FREQUENCY_FOUR_WEEKS: + case self::FREQUENCY_FOUR_WEEKS: return Carbon::parse($this->next_send_date->addWeeks(4)); - case RecurringInvoice::FREQUENCY_MONTHLY: + case self::FREQUENCY_MONTHLY: return Carbon::parse($this->next_send_date->addMonthNoOverflow()); - case RecurringInvoice::FREQUENCY_TWO_MONTHS: + case self::FREQUENCY_TWO_MONTHS: return Carbon::parse($this->next_send_date->addMonthsNoOverflow(2)); - case RecurringInvoice::FREQUENCY_THREE_MONTHS: + case self::FREQUENCY_THREE_MONTHS: return Carbon::parse($this->next_send_date->addMonthsNoOverflow(3)); - case RecurringInvoice::FREQUENCY_FOUR_MONTHS: + case self::FREQUENCY_FOUR_MONTHS: return Carbon::parse($this->next_send_date->addMonthsNoOverflow(4)); - case RecurringInvoice::FREQUENCY_SIX_MONTHS: + case self::FREQUENCY_SIX_MONTHS: return Carbon::parse($this->next_send_date->addMonthsNoOverflow(6)); - case RecurringInvoice::FREQUENCY_ANNUALLY: + case self::FREQUENCY_ANNUALLY: return Carbon::parse($this->next_send_date->addYear()); - case RecurringInvoice::FREQUENCY_TWO_YEARS: + case self::FREQUENCY_TWO_YEARS: return Carbon::parse($this->next_send_date->addYears(2)); - case RecurringInvoice::FREQUENCY_THREE_YEARS: + case self::FREQUENCY_THREE_YEARS: return Carbon::parse($this->next_send_date->addYears(3)); default: return null; @@ -234,23 +235,23 @@ class RecurringInvoice extends BaseModel public static function badgeForStatus(int $status) { switch ($status) { - case RecurringInvoice::STATUS_DRAFT: + case self::STATUS_DRAFT: return '

'.ctrans('texts.draft').'

'; break; - case RecurringInvoice::STATUS_PENDING: + case self::STATUS_PENDING: return '

'.ctrans('texts.sent').'

'; break; - case RecurringInvoice::STATUS_ACTIVE: + case self::STATUS_ACTIVE: return '

'.ctrans('texts.partial').'

'; break; - case RecurringInvoice::STATUS_COMPLETED: + case self::STATUS_COMPLETED: return '

'.ctrans('texts.status_completed').'

'; break; - case RecurringInvoice::STATUS_CANCELLED: + case self::STATUS_CANCELLED: return '

'.ctrans('texts.overdue').'

'; break; default: - # code... + // code... break; } } @@ -258,38 +259,38 @@ class RecurringInvoice extends BaseModel public static function frequencyForKey(int $frequency_id) :string { switch ($frequency_id) { - case RecurringInvoice::FREQUENCY_WEEKLY: + case self::FREQUENCY_WEEKLY: return ctrans('texts.freq_weekly'); break; - case RecurringInvoice::FREQUENCY_TWO_WEEKS: + case self::FREQUENCY_TWO_WEEKS: return ctrans('texts.freq_two_weeks'); break; - case RecurringInvoice::FREQUENCY_FOUR_WEEKS: + case self::FREQUENCY_FOUR_WEEKS: return ctrans('texts.freq_four_weeks'); break; - case RecurringInvoice::FREQUENCY_MONTHLY: + case self::FREQUENCY_MONTHLY: return ctrans('texts.freq_monthly'); break; - case RecurringInvoice::FREQUENCY_TWO_MONTHS: + case self::FREQUENCY_TWO_MONTHS: return ctrans('texts.freq_two_months'); break; - case RecurringInvoice::FREQUENCY_THREE_MONTHS: + case self::FREQUENCY_THREE_MONTHS: return ctrans('texts.freq_three_months'); break; - case RecurringInvoice::FREQUENCY_FOUR_MONTHS: + case self::FREQUENCY_FOUR_MONTHS: return ctrans('texts.freq_four_months'); break; - case RecurringInvoice::FREQUENCY_SIX_MONTHS: + case self::FREQUENCY_SIX_MONTHS: return ctrans('texts.freq_six_months'); break; - case RecurringInvoice::FREQUENCY_ANNUALLY: + case self::FREQUENCY_ANNUALLY: return ctrans('texts.freq_annually'); break; - case RecurringInvoice::FREQUENCY_TWO_YEARS: + case self::FREQUENCY_TWO_YEARS: return ctrans('texts.freq_two_years'); break; default: - # code... + // code... break; } } @@ -298,5 +299,4 @@ class RecurringInvoice extends BaseModel { //todo send back a list of the next send dates and due dates } - } diff --git a/app/Models/RecurringInvoiceInvitation.php b/app/Models/RecurringInvoiceInvitation.php index 055d289486d6..d5a66a8415c0 100644 --- a/app/Models/RecurringInvoiceInvitation.php +++ b/app/Models/RecurringInvoiceInvitation.php @@ -1,6 +1,6 @@ format('Y-m-d'); } + return $value; } public function getDueDateAttribute($value) { - if (!empty($value)) { + if (! empty($value)) { return (new Carbon($value))->format('Y-m-d'); } + return $value; } public function getPartialDueDateAttribute($value) { - if (!empty($value)) { + if (! empty($value)) { return (new Carbon($value))->format('Y-m-d'); } + return $value; } - + public function company() { return $this->belongsTo(Company::class); @@ -145,7 +147,7 @@ class RecurringQuote extends BaseModel { return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); } - + public function invitations() { $this->morphMany(RecurringQuoteInvitation::class); diff --git a/app/Models/Size.php b/app/Models/Size.php index e97d04ccde86..c0382eb8827a 100644 --- a/app/Models/Size.php +++ b/app/Models/Size.php @@ -1,6 +1,6 @@ 'timestamp', 'deleted_at' => 'timestamp', ]; - + protected $dateFormat = 'Y-m-d H:i:s.u'; public function getIdAttribute() { - return (string)$this->attributes['id']; + return (string) $this->attributes['id']; } /* @@ -34,7 +34,7 @@ class StaticModel extends Model public function scopeCompany($query) { $query->where('company_id', auth()->user()->companyId()); - + return $query; } } diff --git a/app/Models/SystemLog.php b/app/Models/SystemLog.php index 25d082952709..32cb0248aca0 100644 --- a/app/Models/SystemLog.php +++ b/app/Models/SystemLog.php @@ -1,6 +1,6 @@ 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', - 'log' => 'array' + 'log' => 'array', ]; protected $dateFormat = 'Y-m-d H:i:s.u'; @@ -38,7 +38,7 @@ class SystemLog extends Model /* Event IDs*/ const EVENT_PAYMENT_RECONCILIATION_FAILURE = 10; const EVENT_PAYMENT_RECONCILIATION_SUCCESS = 11; - + const EVENT_GATEWAY_SUCCESS = 21; const EVENT_GATEWAY_FAILURE = 22; const EVENT_GATEWAY_ERROR = 23; @@ -67,7 +67,7 @@ class SystemLog extends Model 'type_id', ]; - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { if (is_numeric($value)) { throw new ModelNotFoundException("Record with value {$value} not found"); @@ -77,13 +77,13 @@ class SystemLog extends Model ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } - /* + /* V2 type of scope */ public function scopeCompany($query) { $query->where('company_id', auth()->user()->companyId()); - + return $query; } } diff --git a/app/Models/Task.php b/app/Models/Task.php index 1b95095ed16d..f028773f8848 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -1,6 +1,6 @@ $company->id]); - + $this->company = $company; } /** - * Returns the currently set Company + * Returns the currently set Company. */ public function getCompany() { @@ -169,7 +167,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns the current company + * Returns the current company. * * @return Collection */ @@ -192,11 +190,11 @@ class User extends Authenticatable implements MustVerifyEmail public function company_user() { - if (!$this->id && auth()->user()) { + if (! $this->id && auth()->user()) { $this->id = auth()->user()->id; } - return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'company_id', 'id', 'company_id') + return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'company_id', 'id', 'company_id') ->where('company_user.user_id', $this->id) ->withTrashed(); @@ -214,7 +212,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns the currently set company id for the user + * Returns the currently set company id for the user. * * @return int */ @@ -229,7 +227,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns a comma separated list of user permissions + * Returns a comma separated list of user permissions. * * @return comma separated list */ @@ -239,7 +237,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns a object of User Settings + * Returns a object of User Settings. * * @return stdClass */ @@ -249,7 +247,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns a boolean of the administrator status of the user + * Returns a boolean of the administrator status of the user. * * @return bool */ @@ -264,7 +262,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns all user created contacts + * Returns all user created contacts. * * @return Collection */ @@ -274,7 +272,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns a boolean value if the user owns the current Entity + * Returns a boolean value if the user owns the current Entity. * * @param string Entity * @return bool @@ -285,7 +283,7 @@ class User extends Authenticatable implements MustVerifyEmail } /** - * Returns a boolean value if the user is assigned to the current Entity + * Returns a boolean value if the user is assigned to the current Entity. * * @param string Entity * @return bool @@ -295,20 +293,19 @@ class User extends Authenticatable implements MustVerifyEmail return ! empty($entity->assigned_user_id) && $entity->assigned_user_id == $this->id; } - /** - * Returns true if permissions exist in the map + * Returns true if permissions exist in the map. * * @param string permission - * @return boolean + * @return bool */ public function hasPermission($permission) : bool { - $parts = explode("_", $permission); + $parts = explode('_', $permission); $all_permission = ''; if (count($parts) > 1) { - $all_permission = $parts[0] . '_all'; + $all_permission = $parts[0].'_all'; } return $this->isOwner() || @@ -338,7 +335,6 @@ class User extends Authenticatable implements MustVerifyEmail } } - public function routeNotificationForMail($notification) { return $this->email; @@ -350,7 +346,7 @@ class User extends Authenticatable implements MustVerifyEmail * @param mixed $value * @return \Illuminate\Database\Eloquent\Model|null */ - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { return $this ->withTrashed() diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index f473cb290dc4..9aae462d21f0 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -1,6 +1,6 @@ 'string', 'currency_id' => 'string', @@ -61,7 +60,7 @@ class Vendor extends BaseModel public function getEntityType() { - return Vendor::class; + return self::class; } public function documents() diff --git a/app/Models/VendorContact.php b/app/Models/VendorContact.php index 09ff54825938..7240059df922 100644 --- a/app/Models/VendorContact.php +++ b/app/Models/VendorContact.php @@ -1,6 +1,6 @@ encodePrimaryKey($this->id); } - + public function getContactIdAttribute() { return $this->encodePrimaryKey($this->id); @@ -116,7 +116,7 @@ class VendorContact extends Authenticatable implements HasLocalePreference public function preferredLocale() { $languages = Cache::get('languages'); - + return $languages->filter(function ($item) { return $item->id == $this->client->getSetting('language_id'); })->first()->locale; @@ -126,14 +126,13 @@ class VendorContact extends Authenticatable implements HasLocalePreference //return $lang->locale; } - /** * Retrieve the model for a bound value. * * @param mixed $value * @return \Illuminate\Database\Eloquent\Model|null */ - public function resolveRouteBinding($value) + public function resolveRouteBinding($value, $field = NULL) { return $this ->withTrashed() diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index 0b4b3a1e39e2..c7124fb9c3c2 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -1,6 +1,6 @@ $this->company->present()->logo(), ]; - return (new MailMessage) ->subject($subject) ->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -131,7 +129,7 @@ class EntitySentNotification extends Notification implements ShouldQueue [ 'amount' => $amount, 'client' => $this->contact->present()->name(), - 'invoice' => $this->entity->number + 'invoice' => $this->entity->number, ] )) ->attachment(function ($attachment) use ($amount) { diff --git a/app/Notifications/Admin/EntityViewedNotification.php b/app/Notifications/Admin/EntityViewedNotification.php index 9dfe340727c8..e9b158922731 100644 --- a/app/Notifications/Admin/EntityViewedNotification.php +++ b/app/Notifications/Admin/EntityViewedNotification.php @@ -6,11 +6,11 @@ use App\Utils\Number; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Queue\SerializesModels; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\SerializesModels; class EntityViewedNotification extends Notification implements ShouldQueue { @@ -22,9 +22,8 @@ class EntityViewedNotification extends Notification implements ShouldQueue * @return void * @ */ - protected $invitation; - + protected $entity_name; protected $entity; @@ -68,7 +67,7 @@ class EntityViewedNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* + //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* $data = $this->buildDataArray(); $subject = $this->buildSubject(); @@ -77,8 +76,8 @@ class EntityViewedNotification extends Notification implements ShouldQueue ->subject($subject) ->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -108,7 +107,7 @@ class EntityViewedNotification extends Notification implements ShouldQueue [ 'amount' => $amount, 'client' => $this->contact->present()->name(), - $this->entity_name => $this->entity->number + $this->entity_name => $this->entity->number, ] )) ->attachment(function ($attachment) use ($amount) { @@ -120,7 +119,6 @@ class EntityViewedNotification extends Notification implements ShouldQueue }); } - private function buildDataArray() { $amount = Number::formatMoney($this->entity->amount, $this->entity->client); @@ -141,7 +139,6 @@ class EntityViewedNotification extends Notification implements ShouldQueue 'logo' => $this->company->present()->logo(), ]; - return $data; } diff --git a/app/Notifications/Admin/InvoiceSentNotification.php b/app/Notifications/Admin/InvoiceSentNotification.php index 100d6e0200fb..adfe6e955ff1 100644 --- a/app/Notifications/Admin/InvoiceSentNotification.php +++ b/app/Notifications/Admin/InvoiceSentNotification.php @@ -21,9 +21,8 @@ class InvoiceSentNotification extends Notification implements ShouldQueue * * @return void */ - protected $invitation; - + protected $invoice; protected $company; @@ -63,8 +62,7 @@ class InvoiceSentNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* - + //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* $amount = Number::formatMoney($this->invoice->amount, $this->invoice->client); $subject = ctrans( @@ -85,19 +83,18 @@ class InvoiceSentNotification extends Notification implements ShouldQueue 'invoice' => $this->invoice->number, ] ), - 'url' => config('ninja.app_url') . 'invoices/' . $this->invoice->hashed_id, + 'url' => config('ninja.app_url').'invoices/'.$this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), ]; - return (new MailMessage) ->subject($subject) - ->markdown('email.admin.generic', $data) + ->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -127,7 +124,7 @@ class InvoiceSentNotification extends Notification implements ShouldQueue [ 'amount' => $amount, 'client' => $this->contact->present()->name(), - 'invoice' => $this->invoice->number + 'invoice' => $this->invoice->number, ] )) ->attachment(function ($attachment) use ($amount) { diff --git a/app/Notifications/Admin/InvoiceViewedNotification.php b/app/Notifications/Admin/InvoiceViewedNotification.php index f1249299189b..f6da63ee1390 100644 --- a/app/Notifications/Admin/InvoiceViewedNotification.php +++ b/app/Notifications/Admin/InvoiceViewedNotification.php @@ -21,9 +21,8 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue * * @return void */ - protected $invitation; - + protected $invoice; protected $company; @@ -65,7 +64,6 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* - $amount = Number::formatMoney($this->invoice->amount, $this->invoice->client); $subject = ctrans( 'texts.notification_invoice_viewed_subject', @@ -85,7 +83,7 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue 'invoice' => $this->invoice->number, ] ), - 'url' => config('ninja.app_url') . 'invoices/' . $this->invoice->hashed_id, + 'url' => config('ninja.app_url').'invoices/'.$this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), @@ -95,8 +93,8 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue ->subject($subject) ->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -126,7 +124,7 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue [ 'amount' => $amount, 'client' => $this->contact->present()->name(), - 'invoice' => $this->invoice->number + 'invoice' => $this->invoice->number, ] )); } diff --git a/app/Notifications/Admin/NewPartialPaymentNotification.php b/app/Notifications/Admin/NewPartialPaymentNotification.php index 384857195af1..6c725570646a 100644 --- a/app/Notifications/Admin/NewPartialPaymentNotification.php +++ b/app/Notifications/Admin/NewPartialPaymentNotification.php @@ -22,7 +22,6 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue * * @return void */ - protected $payment; protected $company; @@ -58,17 +57,16 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* - + //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* $amount = Number::formatMoney($this->payment->amount, $this->payment->client); - + $invoice_texts = ctrans('texts.invoice_number_short'); foreach ($this->payment->invoices as $invoice) { - $invoice_texts .= $invoice->number . ','; + $invoice_texts .= $invoice->number.','; } - + $invoice_texts = substr($invoice_texts, 0, -1); $data = [ @@ -83,13 +81,12 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue 'invoice' => $invoice_texts, ] ), - 'url' => config('ninja.app_url') . 'payments/' . $this->payment->hashed_id, + 'url' => config('ninja.app_url').'payments/'.$this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), ]; - return (new MailMessage) ->subject( ctrans( @@ -98,8 +95,8 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue ) )->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -122,21 +119,21 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue $invoice_texts = ctrans('texts.invoice_number_short'); foreach ($this->payment->invoices as $invoice) { - $invoice_texts .= $invoice->number . ','; + $invoice_texts .= $invoice->number.','; } - + $invoice_texts = substr($invoice_texts, 0, -1); return (new SlackMessage) ->success() //->to("#devv2") - ->from("System") + ->from('System') ->image($logo) ->content(ctrans( 'texts.notification_payment_paid', ['amount' => $amount, 'client' => $this->payment->client->present()->name(), - 'invoice' => $invoice_texts] + 'invoice' => $invoice_texts, ] )); } } diff --git a/app/Notifications/Admin/NewPaymentNotification.php b/app/Notifications/Admin/NewPaymentNotification.php index f3e3ee30233a..90102046d053 100644 --- a/app/Notifications/Admin/NewPaymentNotification.php +++ b/app/Notifications/Admin/NewPaymentNotification.php @@ -22,7 +22,6 @@ class NewPaymentNotification extends Notification implements ShouldQueue * * @return void */ - protected $payment; protected $company; @@ -48,11 +47,11 @@ class NewPaymentNotification extends Notification implements ShouldQueue * @param mixed $notifiable * @return array */ - public function via($notifiable) { return $this->method ?: []; } + /** * Get the mail representation of the notification. * @@ -61,17 +60,16 @@ class NewPaymentNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* - + //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* $amount = Number::formatMoney($this->payment->amount, $this->payment->client); - + $invoice_texts = ctrans('texts.invoice_number_short'); foreach ($this->payment->invoices as $invoice) { - $invoice_texts .= $invoice->number . ','; + $invoice_texts .= $invoice->number.','; } - + $invoice_texts = substr($invoice_texts, 0, -1); $data = [ @@ -86,23 +84,22 @@ class NewPaymentNotification extends Notification implements ShouldQueue 'invoice' => $invoice_texts, ] ), - 'url' => config('ninja.app_url') . 'payments/' . $this->payment->hashed_id, + 'url' => config('ninja.app_url').'payments/'.$this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), ]; - return (new MailMessage) ->subject( ctrans( 'texts.notification_payment_paid_subject', - ['client' => $this->payment->client->present()->name(),] + ['client' => $this->payment->client->present()->name()] ) )->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -125,21 +122,21 @@ class NewPaymentNotification extends Notification implements ShouldQueue $invoice_texts = ctrans('texts.invoice_number_short'); foreach ($this->payment->invoices as $invoice) { - $invoice_texts .= $invoice->number . ','; + $invoice_texts .= $invoice->number.','; } - + $invoice_texts = substr($invoice_texts, 0, -1); return (new SlackMessage) ->success() //->to("#devv2") - ->from("System") + ->from('System') ->image($logo) ->content(ctrans( 'texts.notification_payment_paid', ['amount' => $amount, 'client' => $this->payment->client->present()->name(), - 'invoice' => $invoice_texts] + 'invoice' => $invoice_texts, ] )); } } diff --git a/app/Notifications/BaseNotification.php b/app/Notifications/BaseNotification.php index 2fb450ba2860..a965f4d89d0b 100644 --- a/app/Notifications/BaseNotification.php +++ b/app/Notifications/BaseNotification.php @@ -87,10 +87,9 @@ class BaseNotification extends Notification implements ShouldQueue $mail_message->attachData($ubl_string, $this->entity->getFileName('xml')); } - return $mail_message->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key); + }); } public function buildMailMessageData() :array @@ -103,7 +102,7 @@ class BaseNotification extends Notification implements ShouldQueue $email_style_custom = $this->settings->email_style_custom; $body = strtr($email_style_custom, "$body", $body); } - + $data = [ 'body' => $body, 'design' => $design_style, @@ -123,7 +122,6 @@ class BaseNotification extends Notification implements ShouldQueue public function getTemplateView() { - switch ($this->settings->email_style) { case 'plain': return 'email.template.plain'; @@ -141,7 +139,5 @@ class BaseNotification extends Notification implements ShouldQueue return 'email.admin.generic_email'; break; } - } - -} \ No newline at end of file +} diff --git a/app/Notifications/ClientContactRequestCancellation.php b/app/Notifications/ClientContactRequestCancellation.php index 50cb20fd6608..25c2fcce0ddc 100644 --- a/app/Notifications/ClientContactRequestCancellation.php +++ b/app/Notifications/ClientContactRequestCancellation.php @@ -22,7 +22,6 @@ class ClientContactRequestCancellation extends Notification implements ShouldQue * * @return void */ - protected $recurring_invoice; protected $client_contact; @@ -34,7 +33,6 @@ class ClientContactRequestCancellation extends Notification implements ShouldQue */ public static $toMailCallback; - public function __construct($recurring_invoice, $client_contact) { $this->recurring_invoice = $recurring_invoice; @@ -49,7 +47,7 @@ class ClientContactRequestCancellation extends Notification implements ShouldQue */ public function via($notifiable) { - return ['mail','slack']; + return ['mail', 'slack']; } /** @@ -63,13 +61,11 @@ class ClientContactRequestCancellation extends Notification implements ShouldQue if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable, $this->client_contact); } - $client_contact_name = $this->client_contact->present()->name(); $client_name = $this->client_contact->client->present()->name(); $recurring_invoice_number = $this->recurring_invoice->number; - return (new MailMessage) ->subject('Request for recurring invoice cancellation from '.$client_contact_name) ->markdown('email.support.cancellation', [ @@ -98,13 +94,12 @@ class ClientContactRequestCancellation extends Notification implements ShouldQue return (new SlackMessage) ->success() - ->to("#devv2") - ->from("System") + ->to('#devv2') + ->from('System') ->image('https://app.invoiceninja.com/favicon.png') ->content("Contact {$name} from client {$client_name} requested to cancel Recurring Invoice #{$recurring_invoice_number}"); } - /** * Set a callback that should be used when building the notification mail message. * diff --git a/app/Notifications/ClientContactResetPassword.php b/app/Notifications/ClientContactResetPassword.php index 65e8803f161c..ee901bf11af1 100644 --- a/app/Notifications/ClientContactResetPassword.php +++ b/app/Notifications/ClientContactResetPassword.php @@ -15,10 +15,10 @@ class ClientContactResetPassword extends Notification { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; /** - * The password reset token. - * - * @var string - */ + * The password reset token. + * + * @var string + */ public $token; /** diff --git a/app/Notifications/NewAccountCreated.php b/app/Notifications/NewAccountCreated.php index 72018c28889f..8052890c7fed 100644 --- a/app/Notifications/NewAccountCreated.php +++ b/app/Notifications/NewAccountCreated.php @@ -21,7 +21,6 @@ class NewAccountCreated extends Notification implements ShouldQueue * * @return void */ - protected $user; protected $company; @@ -43,7 +42,7 @@ class NewAccountCreated extends Notification implements ShouldQueue */ public function via($notifiable) { - return ['slack','mail']; + return ['slack', 'mail']; } /** @@ -54,7 +53,7 @@ class NewAccountCreated extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $user_name = $this->user->first_name . " " . $this->user->last_name; + $user_name = $this->user->first_name.' '.$this->user->last_name; $email = $this->user->email; $ip = $this->user->ip; @@ -67,12 +66,11 @@ class NewAccountCreated extends Notification implements ShouldQueue 'logo' => $this->company->present()->logo(), ]; - return (new MailMessage) ->subject(ctrans('texts.new_signup')) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }) + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }) ->markdown('email.admin.generic', $data); } @@ -93,7 +91,7 @@ class NewAccountCreated extends Notification implements ShouldQueue { $this->user->setCompany($this->company); - $user_name = $this->user->first_name . " " . $this->user->last_name; + $user_name = $this->user->first_name.' '.$this->user->last_name; $email = $this->user->email; $ip = $this->user->ip; diff --git a/app/Notifications/Ninja/NewAccountCreated.php b/app/Notifications/Ninja/NewAccountCreated.php index eeed78b237d1..99bc9e7e50b0 100644 --- a/app/Notifications/Ninja/NewAccountCreated.php +++ b/app/Notifications/Ninja/NewAccountCreated.php @@ -6,11 +6,11 @@ use App\Mail\Signup\NewSignup; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Queue\SerializesModels; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\SerializesModels; class NewAccountCreated extends Notification implements ShouldQueue { @@ -21,7 +21,6 @@ class NewAccountCreated extends Notification implements ShouldQueue * * @return void */ - protected $user; protected $company; @@ -43,7 +42,7 @@ class NewAccountCreated extends Notification implements ShouldQueue */ public function via($notifiable) { - return ['slack','mail']; + return ['slack', 'mail']; } /** @@ -54,7 +53,7 @@ class NewAccountCreated extends Notification implements ShouldQueue */ public function toMail($notifiable) { - $user_name = $this->user->first_name . " " . $this->user->last_name; + $user_name = $this->user->first_name.' '.$this->user->last_name; $email = $this->user->email; $ip = $this->user->ip; @@ -67,13 +66,12 @@ class NewAccountCreated extends Notification implements ShouldQueue 'logo' => $this->company->present()->logo(), ]; - return (new MailMessage) ->subject(ctrans('texts.new_signup')) ->markdown('email.admin.generic', $data) ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); + $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); + }); } /** @@ -93,7 +91,7 @@ class NewAccountCreated extends Notification implements ShouldQueue { $this->user->setCompany($this->company); - $user_name = $this->user->first_name . " " . $this->user->last_name; + $user_name = $this->user->first_name.' '.$this->user->last_name; $email = $this->user->email; $ip = $this->user->ip; diff --git a/app/Notifications/Ninja/VerifyUser.php b/app/Notifications/Ninja/VerifyUser.php index 9ba76c367f9d..163af70ecefa 100644 --- a/app/Notifications/Ninja/VerifyUser.php +++ b/app/Notifications/Ninja/VerifyUser.php @@ -6,11 +6,11 @@ use App\Mail\Signup\NewSignup; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; -use Illuminate\Queue\InteractsWithQueue; -use Illuminate\Queue\SerializesModels; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\SlackMessage; use Illuminate\Notifications\Notification; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Queue\SerializesModels; class VerifyUser extends Notification implements ShouldQueue { @@ -21,7 +21,6 @@ class VerifyUser extends Notification implements ShouldQueue * * @return void */ - protected $user; public function __construct($user) diff --git a/app/Notifications/SendGenericNotification.php b/app/Notifications/SendGenericNotification.php index d805c995a2ea..9d4a7afa8c16 100644 --- a/app/Notifications/SendGenericNotification.php +++ b/app/Notifications/SendGenericNotification.php @@ -26,9 +26,8 @@ class SendGenericNotification extends BaseNotification implements ShouldQueue * * @return void */ - protected $invitation; - + protected $entity; protected $contact; @@ -73,17 +72,15 @@ class SendGenericNotification extends BaseNotification implements ShouldQueue */ public function toMail($notifiable) { - $mail_message = (new MailMessage) ->withSwiftMessage(function ($message) { $message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key); })->markdown($this->getTemplateView(), $this->buildMailMessageData()); - //})->markdown('email.template.plain', $this->buildMailMessageData()); + //})->markdown('email.template.plain', $this->buildMailMessageData()); $mail_message = $this->buildMailMessageSettings($mail_message); return $mail_message; - } /** diff --git a/app/Observers/AccountObserver.php b/app/Observers/AccountObserver.php index 7c0215429ed6..086cd8596243 100644 --- a/app/Observers/AccountObserver.php +++ b/app/Observers/AccountObserver.php @@ -1,6 +1,6 @@ label){ + if (! $company_gateway->label) { $company_gateway->label = $company_gateway->gateway->name; $company_gateway->save(); } diff --git a/app/Observers/CompanyObserver.php b/app/Observers/CompanyObserver.php index ce47b7894ba1..2877fe8d1f9e 100644 --- a/app/Observers/CompanyObserver.php +++ b/app/Observers/CompanyObserver.php @@ -1,6 +1,6 @@ authorize = $authorize; - - $this->client = $client; + + $this->client = $client; } public function create($data = null) { - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $this->authorize->init(); // Create the Bill To info for new payment type - + $contact = $this->client->primary_contact()->first(); - $refId = 'ref' . time(); - + $refId = 'ref'.time(); + // Create a new CustomerProfileType and add the payment profile object $customerProfile = new CustomerProfileType(); $customerProfile->setDescription($this->client->present()->name()); - $customerProfile->setMerchantCustomerId("M_" . time()); + $customerProfile->setMerchantCustomerId('M_'.time()); $customerProfile->setEmail($this->client->present()->email()); // Assemble the complete transaction request @@ -66,24 +64,19 @@ class AuthorizeCreateCustomer // Create the controller and get the response $controller = new CreateCustomerProfileController($request); $response = $controller->executeWithApiResponse($this->authorize->mode()); - - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { - + + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { return $response->getCustomerProfileId(); - } else { + $errorMessages = $response->getMessages()->getMessage(); - $errorMessages = $response->getMessages()->getMessage(); + $message = 'Unable to add customer to Authorize.net gateway'; - $message = "Unable to add customer to Authorize.net gateway"; - - if(is_array($errorMessages)) - $message = $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText(); + if (is_array($errorMessages)) { + $message = $errorMessages[0]->getCode().' '.$errorMessages[0]->getText(); + } throw new GenericPaymentDriverFailure($message); } - } - - -} \ No newline at end of file +} diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index 36fcc60deed5..87fca0a08e7e 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -1,7 +1,7 @@ authorize->client->id) + ->where('company_gateway_id', $this->authorize->company_gateway->id) + ->where('gateway_type_id', GatewayType::CREDIT_CARD) + ->get(); - $tokens = ClientGatewayToken::where('client_id', $this->authorize->client->id) - ->where('company_gateway_id', $this->authorize->company_gateway->id) - ->where('gateway_type_id', GatewayType::CREDIT_CARD) - ->get(); - - $data['tokens'] = $tokens; - $data['gateway'] = $this->authorize->company_gateway; - $data['public_client_id'] = $this->authorize->init()->getPublicClientKey(); - $data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId'); - - return render('gateways.authorize.credit_card_payment', $data); + $data['tokens'] = $tokens; + $data['gateway'] = $this->authorize->company_gateway; + $data['public_client_id'] = $this->authorize->init()->getPublicClientKey(); + $data['api_login_id'] = $this->authorize->company_gateway->getConfigField('apiLoginId'); + return render('gateways.authorize.credit_card_payment', $data); } public function processPaymentResponse($request) { - - if($request->token) + if ($request->token) { return $this->processTokenPayment($request); + } $data = $request->all(); - + $authorise_create_customer = new AuthorizeCreateCustomer($this->authorize, $this->authorize->client); $gateway_customer_reference = $authorise_create_customer->create($data); - + $authorise_payment_method = new AuthorizePaymentMethod($this->authorize); $payment_profile = $authorise_payment_method->addPaymentMethodToClient($gateway_customer_reference, $data); $payment_profile_id = $payment_profile->getPaymentProfile()->getCustomerPaymentProfileId(); - - if($request->has('store_card') && $request->input('store_card') === 'true'){ + + if ($request->has('store_card') && $request->input('store_card') === 'true') { $authorise_payment_method->payment_method = GatewayType::CREDIT_CARD; $client_gateway_token = $authorise_payment_method->createClientGatewayToken($payment_profile, $gateway_customer_reference); } @@ -87,29 +83,24 @@ class AuthorizeCreditCard $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($gateway_customer_reference, $payment_profile_id, $data['amount_with_fee']); return $this->handleResponse($data, $request); - } private function processTokenPayment($request) { - $client_gateway_token = ClientGatewayToken::find($this->decodePrimaryKey($request->token)); $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($client_gateway_token->gateway_customer_reference, $client_gateway_token->token, $request->input('amount_with_fee')); return $this->handleResponse($data, $request); - } private function tokenBilling($cgt, $payment_hash) { - $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total; $data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($cgt->gateway_customer_reference, $cgt->token, $amount); - if($data['response'] != null && $data['response']->getMessages()->getResultCode() == "Ok") { - + if ($data['response'] != null && $data['response']->getMessages()->getResultCode() == 'Ok') { $payment = $this->createPaymentRecord($data, $amount); $payment->meta = $cgt->meta; $payment->save(); @@ -121,41 +112,35 @@ class AuthorizeCreditCard $vars = [ 'hashed_ids' => $invoice->hashed_id, - 'amount' => $amount + 'amount' => $amount, ]; $logger_message = [ 'server_response' => $response->getTransactionResponse()->getTransId(), - 'data' => $this->formatGatewayResponse($data, $vars) + 'data' => $this->formatGatewayResponse($data, $vars), ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); - return true; - } - else { - - + return true; + } else { return false; } - } - + private function handleResponse($data, $request) - { - + { $response = $data['response']; - if($response != null && $response->getMessages()->getResultCode() == "Ok") + if ($response != null && $response->getMessages()->getResultCode() == 'Ok') { return $this->processSuccessfulResponse($data, $request); + } return $this->processFailedResponse($data, $request); - } private function storePayment($payment_hash, $data) { - $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total; $payment = $this->createPaymentRecord($data, $amount); @@ -167,57 +152,51 @@ class AuthorizeCreditCard event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars())); return $payment; - } private function createPaymentRecord($data, $amount) :?Payment { - $response = $data['response']; - //create a payment record + //create a payment record $payment = $this->authorize->createPayment($data['response']); $payment->gateway_type_id = GatewayType::CREDIT_CARD; $payment->type_id = PaymentType::CREDIT_CARD_OTHER; $payment->transaction_reference = $response->getTransactionResponse()->getTransId(); - $payment->amount = $amount; + $payment->amount = $amount; $payment->save(); return $payment; - } private function processSuccessfulResponse($data, $request) { - - $payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$request->input('payment_hash')])->firstOrFail(); + $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->firstOrFail(); $payment = $this->storePayment($payment_hash, $data); $vars = [ 'invoices' => $payment_hash->invoices(), - 'amount' => array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total + 'amount' => array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total, ]; $logger_message = [ 'server_response' => $data['response']->getTransactionResponse()->getTransId(), - 'data' => $this->formatGatewayResponse($data, $vars) + 'data' => $this->formatGatewayResponse($data, $vars), ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]); - } private function processFailedResponse($data, $request) - { + { //dd($data); - info(print_r($data,1)); + info(print_r($data, 1)); } private function formatGatewayResponse($data, $vars) { - $response = $data['response']; return [ @@ -228,7 +207,5 @@ class AuthorizeCreditCard 'description' => $response->getTransactionResponse()->getMessages()[0]->getDescription(), 'invoices' => $vars['invoices'], ]; - } - -} \ No newline at end of file +} diff --git a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php index c6dc4ef9ca3c..91b690f58c23 100644 --- a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php +++ b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php @@ -1,7 +1,7 @@ authorize->findClientGatewayRecord()){ + if ($client_gateway_token = $this->authorize->findClientGatewayRecord()) { $payment_profile = $this->addPaymentMethodToClient($client_gateway_token->gateway_customer_reference, $data); - } - else{ + } else { $gateway_customer_reference = (new AuthorizeCreateCustomer($this->authorize, $this->authorize->client))->create($data); $payment_profile = $this->addPaymentMethodToClient($gateway_customer_reference, $data); } @@ -112,17 +106,15 @@ class AuthorizePaymentMethod $this->createClientGatewayToken($payment_profile, $gateway_customer_reference); return redirect()->route('client.payment_methods.index'); - } public function authorizeBankTransferResponse($data) { - } public function createClientGatewayToken($payment_profile, $gateway_customer_reference) { - // info(print_r($payment_profile,1)); + // info(print_r($payment_profile,1)); $client_gateway_token = new ClientGatewayToken(); $client_gateway_token->company_id = $this->authorize->client->company_id; @@ -142,7 +134,7 @@ class AuthorizePaymentMethod $payment_meta = new \stdClass; $payment_meta->exp_month = 'xx'; $payment_meta->exp_year = 'xx'; - $payment_meta->brand = $payment_profile->getPaymentProfile()->getPayment()->getCreditCard()->getCardType(); + $payment_meta->brand = $payment_profile->getPaymentProfile()->getPayment()->getCreditCard()->getCardType(); $payment_meta->last4 = $payment_profile->getPaymentProfile()->getPayment()->getCreditCard()->getCardNumber(); $payment_meta->type = $this->payment_method; @@ -151,13 +143,12 @@ class AuthorizePaymentMethod public function addPaymentMethodToClient($gateway_customer_reference, $data) { - - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $this->authorize->init(); - + // Set the transaction's refId - $refId = 'ref' . time(); + $refId = 'ref'.time(); // Set the payment data for the payment profile to a token obtained from Accept.js $op = new OpaqueDataType(); @@ -168,8 +159,8 @@ class AuthorizePaymentMethod $contact = $this->authorize->client->primary_contact()->first(); - if($contact){ - // Create the Bill To info for new payment type + if ($contact) { + // Create the Bill To info for new payment type $billto = new CustomerAddressType(); $billto->setFirstName($contact->present()->first_name()); $billto->setLastName($contact->present()->last_name()); @@ -179,9 +170,10 @@ class AuthorizePaymentMethod $billto->setState($this->authorize->client->state); $billto->setZip($this->authorize->client->postal_code); - if($this->authorize->client->country_id) + if ($this->authorize->client->country_id) { $billto->setCountry($this->authorize->client->country->name); - + } + $billto->setPhoneNumber($this->authorize->client->phone); } @@ -189,8 +181,9 @@ class AuthorizePaymentMethod $paymentprofile = new CustomerPaymentProfileType(); $paymentprofile->setCustomerType('individual'); - if($billto) + if ($billto) { $paymentprofile->setBillTo($billto); + } $paymentprofile->setPayment($paymentOne); $paymentprofile->setDefaultPaymentProfile(true); @@ -203,40 +196,37 @@ class AuthorizePaymentMethod // Add an existing profile id to the request $paymentprofilerequest->setCustomerProfileId($gateway_customer_reference); $paymentprofilerequest->setPaymentProfile($paymentprofile); - $paymentprofilerequest->setValidationMode("liveMode"); + $paymentprofilerequest->setValidationMode('liveMode'); // Create the controller and get the response $controller = new CreateCustomerPaymentProfileController($paymentprofilerequest); $response = $controller->executeWithApiResponse($this->authorize->mode()); - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) { + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { return $this->getPaymentProfile($gateway_customer_reference, $response->getCustomerPaymentProfileId()); } else { - $errorMessages = $response->getMessages()->getMessage(); - $message = "Unable to add customer to Authorize.net gateway"; + $message = 'Unable to add customer to Authorize.net gateway'; - if(is_array($errorMessages)) - $message = $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText(); + if (is_array($errorMessages)) { + $message = $errorMessages[0]->getCode().' '.$errorMessages[0]->getText(); + } throw new GenericPaymentDriverFailure($message); - } - } public function getPaymentProfile($gateway_customer_reference, $payment_profile_id) { - - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $this->authorize->init(); - - // Set the transaction's refId - $refId = 'ref' . time(); - //request requires customerProfileId and customerPaymentProfileId + // Set the transaction's refId + $refId = 'ref'.time(); + + //request requires customerProfileId and customerPaymentProfileId $request = new GetCustomerPaymentProfileRequest(); $request->setMerchantAuthentication($this->authorize->merchant_authentication); $request->setRefId($refId); @@ -246,22 +236,20 @@ class AuthorizePaymentMethod $controller = new GetCustomerPaymentProfileController($request); $response = $controller->executeWithApiResponse($this->authorize->mode()); - if(($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { return $response; - } - else if($response){ - + } elseif ($response) { $errorMessages = $response->getMessages()->getMessage(); - $message = "Unable to add payment method to Authorize.net gateway"; + $message = 'Unable to add payment method to Authorize.net gateway'; - if(is_array($errorMessages)) - $message = $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText(); + if (is_array($errorMessages)) { + $message = $errorMessages[0]->getCode().' '.$errorMessages[0]->getText(); + } throw new GenericPaymentDriverFailure($message); + } else { + throw new GenericPaymentDriverFailure('Error communicating with Authorize.net'); } - else - throw new GenericPaymentDriverFailure("Error communicating with Authorize.net"); } - } diff --git a/app/PaymentDrivers/Authorize/AuthorizeTransactions.php b/app/PaymentDrivers/Authorize/AuthorizeTransactions.php index fc18107e8583..20906860bde2 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeTransactions.php +++ b/app/PaymentDrivers/Authorize/AuthorizeTransactions.php @@ -1,7 +1,7 @@ authorize = $authorize; } - function getTransactionDetails($transactionId) - { - /* Create a merchantAuthenticationType object with authentication details - retrieved from the constants file */ - $this->authorize->init(); - - // Set the transaction's refId - $refId = 'ref' . time(); + public function getTransactionDetails($transactionId) + { + /* Create a merchantAuthenticationType object with authentication details + retrieved from the constants file */ + $this->authorize->init(); - $request = new GetTransactionDetailsRequest(); - $request->setMerchantAuthentication($this->authorize->merchant_authentication); - $request->setTransId($transactionId); + // Set the transaction's refId + $refId = 'ref'.time(); - $controller = new GetTransactionDetailsController($request); + $request = new GetTransactionDetailsRequest(); + $request->setMerchantAuthentication($this->authorize->merchant_authentication); + $request->setTransId($transactionId); - $response = $controller->executeWithApiResponse($this->authorize->mode()); + $controller = new GetTransactionDetailsController($request); - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) - { - info( "SUCCESS: Transaction Status:" . $response->getTransaction()->getTransactionStatus() ); - info( " Auth Amount:" . $response->getTransaction()->getAuthAmount() ); - info( " Trans ID:" . $response->getTransaction()->getTransId() ); - } - else - { - info( "ERROR : Invalid response\n"); - $errorMessages = $response->getMessages()->getMessage(); - info( "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() ); - } + $response = $controller->executeWithApiResponse($this->authorize->mode()); - return $response; - } -} \ No newline at end of file + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { + info('SUCCESS: Transaction Status:'.$response->getTransaction()->getTransactionStatus()); + info(' Auth Amount:'.$response->getTransaction()->getAuthAmount()); + info(' Trans ID:'.$response->getTransaction()->getTransId()); + } else { + info("ERROR : Invalid response\n"); + $errorMessages = $response->getMessages()->getMessage(); + info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()); + } + + return $response; + } +} diff --git a/app/PaymentDrivers/Authorize/ChargePaymentProfile.php b/app/PaymentDrivers/Authorize/ChargePaymentProfile.php index 9a3249c15ec5..4d7281609d57 100644 --- a/app/PaymentDrivers/Authorize/ChargePaymentProfile.php +++ b/app/PaymentDrivers/Authorize/ChargePaymentProfile.php @@ -1,7 +1,7 @@ authorize = $authorize; } + public function chargeCustomerProfile($profile_id, $payment_profile_id, $amount) + { + $this->authorize->init(); - function chargeCustomerProfile($profile_id, $payment_profile_id, $amount) - { + // Set the transaction's refId + $refId = 'ref'.time(); - $this->authorize->init(); - - // Set the transaction's refId - $refId = 'ref' . time(); + $profileToCharge = new CustomerProfilePaymentType(); + $profileToCharge->setCustomerProfileId($profile_id); + $paymentProfile = new PaymentProfileType(); + $paymentProfile->setPaymentProfileId($payment_profile_id); + $profileToCharge->setPaymentProfile($paymentProfile); - $profileToCharge = new CustomerProfilePaymentType(); - $profileToCharge->setCustomerProfileId($profile_id); - $paymentProfile = new PaymentProfileType(); - $paymentProfile->setPaymentProfileId($payment_profile_id); - $profileToCharge->setPaymentProfile($paymentProfile); + $transactionRequestType = new TransactionRequestType(); + $transactionRequestType->setTransactionType('authCaptureTransaction'); + $transactionRequestType->setAmount($amount); + $transactionRequestType->setProfile($profileToCharge); + $transactionRequestType->setCurrencyCode($this->authorize->client->currency()->code); - $transactionRequestType = new TransactionRequestType(); - $transactionRequestType->setTransactionType("authCaptureTransaction"); - $transactionRequestType->setAmount($amount); - $transactionRequestType->setProfile($profileToCharge); - $transactionRequestType->setCurrencyCode($this->authorize->client->currency()->code); + $request = new CreateTransactionRequest(); + $request->setMerchantAuthentication($this->authorize->merchant_authentication); + $request->setRefId($refId); + $request->setTransactionRequest($transactionRequestType); + $controller = new CreateTransactionController($request); + $response = $controller->executeWithApiResponse($this->authorize->mode()); - $request = new CreateTransactionRequest(); - $request->setMerchantAuthentication($this->authorize->merchant_authentication); - $request->setRefId( $refId); - $request->setTransactionRequest( $transactionRequestType); - $controller = new CreateTransactionController($request); - $response = $controller->executeWithApiResponse($this->authorize->mode()); + if ($response != null && $response->getMessages()->getResultCode() == 'Ok') { + $tresponse = $response->getTransactionResponse(); - if($response != null && $response->getMessages()->getResultCode() == "Ok") - { - $tresponse = $response->getTransactionResponse(); - - if ($tresponse != null && $tresponse->getMessages() != null) - { - info(" Transaction Response code : " . $tresponse->getResponseCode() ); - info( "Charge Customer Profile APPROVED :" ); - info(" Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() ); - info(" Charge Customer Profile TRANS ID : " . $tresponse->getTransId() ); - info(" Code : " . $tresponse->getMessages()[0]->getCode()); - info(" Description : " . $tresponse->getMessages()[0]->getDescription()); - //info(" Charge Customer Profile TRANS STATUS : " . $tresponse->getTransactionStatus() ); - //info(" Charge Customer Profile Amount : " . $tresponse->getAuthAmount()); + if ($tresponse != null && $tresponse->getMessages() != null) { + info(' Transaction Response code : '.$tresponse->getResponseCode()); + info('Charge Customer Profile APPROVED :'); + info(' Charge Customer Profile AUTH CODE : '.$tresponse->getAuthCode()); + info(' Charge Customer Profile TRANS ID : '.$tresponse->getTransId()); + info(' Code : '.$tresponse->getMessages()[0]->getCode()); + info(' Description : '.$tresponse->getMessages()[0]->getDescription()); + //info(" Charge Customer Profile TRANS STATUS : " . $tresponse->getTransactionStatus() ); + //info(" Charge Customer Profile Amount : " . $tresponse->getAuthAmount()); - info(" Code : " . $tresponse->getMessages()[0]->getCode() ); - info(" Description : " . $tresponse->getMessages()[0]->getDescription() ); - info(print_r($tresponse->getMessages()[0],1)); + info(' Code : '.$tresponse->getMessages()[0]->getCode()); + info(' Description : '.$tresponse->getMessages()[0]->getDescription()); + info(print_r($tresponse->getMessages()[0], 1)); + } else { + info('Transaction Failed '); + if ($tresponse->getErrors() != null) { + info(' Error code : '.$tresponse->getErrors()[0]->getErrorCode()); + info(' Error message : '.$tresponse->getErrors()[0]->getErrorText()); + info(print_r($tresponse->getErrors()[0], 1)); + } + } + } else { + info('Transaction Failed '); + $tresponse = $response->getTransactionResponse(); + if ($tresponse != null && $tresponse->getErrors() != null) { + info(' Error code : '.$tresponse->getErrors()[0]->getErrorCode()); + info(' Error message : '.$tresponse->getErrors()[0]->getErrorText()); + info(print_r($tresponse->getErrors()[0], 1)); + } else { + info(' Error code : '.$response->getMessages()->getMessage()[0]->getCode()); + info(' Error message : '.$response->getMessages()->getMessage()[0]->getText()); + } } - else - { - info("Transaction Failed "); - if($tresponse->getErrors() != null) - { - info(" Error code : " . $tresponse->getErrors()[0]->getErrorCode() ); - info(" Error message : " . $tresponse->getErrors()[0]->getErrorText() ); - info(print_r($tresponse->getErrors()[0],1)); - } - } - } - else - { - info("Transaction Failed "); - $tresponse = $response->getTransactionResponse(); - if($tresponse != null && $tresponse->getErrors() != null) - { - info(" Error code : " . $tresponse->getErrors()[0]->getErrorCode() ); - info(" Error message : " . $tresponse->getErrors()[0]->getErrorText() ); - info(print_r($tresponse->getErrors()[0],1)); - } - else - { - info(" Error code : " . $response->getMessages()->getMessage()[0]->getCode() ); - info(" Error message : " . $response->getMessages()->getMessage()[0]->getText() ); - } - } return [ 'response' => $response, 'amount' => $amount, 'profile_id' => $profile_id, - 'payment_profile_id' => $payment_profile_id + 'payment_profile_id' => $payment_profile_id, ]; - } - - } \ No newline at end of file +} diff --git a/app/PaymentDrivers/Authorize/RefundTransaction.php b/app/PaymentDrivers/Authorize/RefundTransaction.php index e7b7362c355a..8bedfcf40bfc 100644 --- a/app/PaymentDrivers/Authorize/RefundTransaction.php +++ b/app/PaymentDrivers/Authorize/RefundTransaction.php @@ -1,7 +1,7 @@ authorize_transaction = new AuthorizeTransactions($this->authorize); } - function refundTransaction(Payment $payment, $amount) - { - error_reporting (E_ALL & ~E_DEPRECATED); + public function refundTransaction(Payment $payment, $amount) + { + error_reporting(E_ALL & ~E_DEPRECATED); - $transaction_details = $this->authorize_transaction->getTransactionDetails($payment->transaction_reference); + $transaction_details = $this->authorize_transaction->getTransactionDetails($payment->transaction_reference); + $this->authorize->init(); - $this->authorize->init(); - - // Set the transaction's refId - $refId = 'ref' . time(); + // Set the transaction's refId + $refId = 'ref'.time(); - $paymentProfile = new PaymentProfileType(); - $paymentProfile->setPaymentProfileId( $transaction_details->getTransaction()->getProfile()->getCustomerPaymentProfileId() ); + $paymentProfile = new PaymentProfileType(); + $paymentProfile->setPaymentProfileId($transaction_details->getTransaction()->getProfile()->getCustomerPaymentProfileId()); - // set customer profile - $customerProfile = new CustomerProfilePaymentType(); - $customerProfile->setCustomerProfileId( $transaction_details->getTransaction()->getProfile()->getCustomerProfileId() ); - $customerProfile->setPaymentProfile( $paymentProfile ); + // set customer profile + $customerProfile = new CustomerProfilePaymentType(); + $customerProfile->setCustomerProfileId($transaction_details->getTransaction()->getProfile()->getCustomerProfileId()); + $customerProfile->setPaymentProfile($paymentProfile); - //create a transaction - $transactionRequest = new TransactionRequestType(); - $transactionRequest->setTransactionType("refundTransaction"); - $transactionRequest->setAmount($amount); - $transactionRequest->setProfile($customerProfile); - $transactionRequest->setRefTransId($payment->transaction_reference); + //create a transaction + $transactionRequest = new TransactionRequestType(); + $transactionRequest->setTransactionType('refundTransaction'); + $transactionRequest->setAmount($amount); + $transactionRequest->setProfile($customerProfile); + $transactionRequest->setRefTransId($payment->transaction_reference); - $request = new CreateTransactionRequest(); - $request->setMerchantAuthentication($this->authorize->merchant_authentication); - $request->setRefId($refId); - $request->setTransactionRequest($transactionRequest); - $controller = new CreateTransactionController($request); - $response = $controller->executeWithApiResponse($this->authorize->mode()); + $request = new CreateTransactionRequest(); + $request->setMerchantAuthentication($this->authorize->merchant_authentication); + $request->setRefId($refId); + $request->setTransactionRequest($transactionRequest); + $controller = new CreateTransactionController($request); + $response = $controller->executeWithApiResponse($this->authorize->mode()); - if ($response != null) - { - if($response->getMessages()->getResultCode() == "Ok") - { - $tresponse = $response->getTransactionResponse(); - - if ($tresponse != null && $tresponse->getMessages() != null) - { + if ($response != null) { + if ($response->getMessages()->getResultCode() == 'Ok') { + $tresponse = $response->getTransactionResponse(); - return [ - 'transaction_reference' => $tresponse->getTransId(), - 'success' => true, - 'description' => $tresponse->getMessages()[0]->getDescription(), - 'code' => $tresponse->getMessages()[0]->getCode(), - 'transaction_response' => $tresponse->getResponseCode() - ]; + if ($tresponse != null && $tresponse->getMessages() != null) { + return [ + 'transaction_reference' => $tresponse->getTransId(), + 'success' => true, + 'description' => $tresponse->getMessages()[0]->getDescription(), + 'code' => $tresponse->getMessages()[0]->getCode(), + 'transaction_response' => $tresponse->getResponseCode(), + ]; + } else { + if ($tresponse->getErrors() != null) { + return [ + 'transaction_reference' => '', + 'transaction_response' => '', + 'success' => false, + 'description' => $tresponse->getErrors()[0]->getErrorText(), + 'code' => $tresponse->getErrors()[0]->getErrorCode(), + ]; + } + } + } else { + echo "Transaction Failed \n"; + $tresponse = $response->getTransactionResponse(); + if ($tresponse != null && $tresponse->getErrors() != null) { + return [ + 'transaction_reference' => '', + 'transaction_response' => '', + 'success' => false, + 'description' => $tresponse->getErrors()[0]->getErrorText(), + 'code' => $tresponse->getErrors()[0]->getErrorCode(), + ]; + } else { + return [ + 'transaction_reference' => '', + 'transaction_response' => '', + 'success' => false, + 'description' => $response->getMessages()->getMessage()[0]->getText(), + 'code' => $response->getMessages()->getMessage()[0]->getCode(), + ]; + } + } + } else { + return [ + 'transaction_reference' => '', + 'transaction_response' => '', + 'success' => false, + 'description' => 'No response returned', + 'code' => 'No response returned', + ]; + } - } - else - { - - if($tresponse->getErrors() != null) - { - - return [ - 'transaction_reference' => '', - 'transaction_response' => '', - 'success' => false, - 'description' => $tresponse->getErrors()[0]->getErrorText(), - 'code' => $tresponse->getErrors()[0]->getErrorCode(), - ]; - - } - } - } - else - { - echo "Transaction Failed \n"; - $tresponse = $response->getTransactionResponse(); - if($tresponse != null && $tresponse->getErrors() != null) - { - - return [ - 'transaction_reference' => '', - 'transaction_response' => '', - 'success' => false, - 'description' => $tresponse->getErrors()[0]->getErrorText(), - 'code' => $tresponse->getErrors()[0]->getErrorCode(), - ]; - - } - else - { - - return [ - 'transaction_reference' => '', - 'transaction_response' => '', - 'success' => false, - 'description' => $response->getMessages()->getMessage()[0]->getText(), - 'code' => $response->getMessages()->getMessage()[0]->getCode(), - ]; - - } - } - } - else - { - - return [ - 'transaction_reference' => '', - 'transaction_response' => '', - 'success' => false, - 'description' => 'No response returned', - 'code' => 'No response returned', - ]; - - } - - return [ - 'transaction_reference' => '', - 'transaction_response' => '', - 'success' => false, - 'description' => 'No response returned', - 'code' => 'No response returned', - ]; - } - - -} \ No newline at end of file + return [ + 'transaction_reference' => '', + 'transaction_response' => '', + 'success' => false, + 'description' => 'No response returned', + 'code' => 'No response returned', + ]; + } +} diff --git a/app/PaymentDrivers/AuthorizePaymentDriver.php b/app/PaymentDrivers/AuthorizePaymentDriver.php index 17dabf1d3aaa..60f569dec2c0 100644 --- a/app/PaymentDrivers/AuthorizePaymentDriver.php +++ b/app/PaymentDrivers/AuthorizePaymentDriver.php @@ -1,7 +1,7 @@ AuthorizeCreditCard::class, ]; public function setPaymentMethod($payment_method_id) { - $class = self::$methods[$payment_method_id]; $this->payment_method = new $class($this); return $this; - } + /** - * Returns the gateway types + * Returns the gateway types. */ public function gatewayTypes() :array { @@ -70,7 +66,7 @@ class AuthorizePaymentDriver extends BaseDriver public function init() { - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $this->merchant_authentication = new MerchantAuthenticationType(); $this->merchant_authentication->setName($this->company_gateway->getConfigField('apiLoginId')); @@ -81,7 +77,6 @@ class AuthorizePaymentDriver extends BaseDriver public function getPublicClientKey() { - $request = new GetMerchantDetailsRequest(); $request->setMerchantAuthentication($this->merchant_authentication); @@ -89,17 +84,15 @@ class AuthorizePaymentDriver extends BaseDriver $response = $controller->executeWithApiResponse($this->mode()); return $response->getPublicClientKey(); - } public function mode() { - - if($this->company_gateway->getConfigField('testMode')) + if ($this->company_gateway->getConfigField('testMode')) { return ANetEnvironment::SANDBOX; - - return $env = ANetEnvironment::PRODUCTION; + } + return $env = ANetEnvironment::PRODUCTION; } public function authorizeView($payment_method) @@ -112,11 +105,11 @@ class AuthorizePaymentDriver extends BaseDriver return (new AuthorizePaymentMethod($this))->authorizeResponseView($data); } - public function authorize($payment_method) + public function authorize($payment_method) { return $this->authorizeView($payment_method); } - + public function processPaymentView($data) { return $this->payment_method->processPaymentView($data); @@ -127,12 +120,12 @@ class AuthorizePaymentDriver extends BaseDriver return $this->payment_method->processPaymentResponse($request); } - public function purchase($amount, $return_client_response = false) + public function purchase($amount, $return_client_response = false) { return false; } - public function refund(Payment $payment, $refund_amount, $return_client_response = false) + public function refund(Payment $payment, $refund_amount, $return_client_response = false) { return (new RefundTransaction($this))->refundTransaction($payment, $refund_amount); } @@ -144,11 +137,10 @@ class AuthorizePaymentDriver extends BaseDriver ->first(); } - public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) + public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) { $this->setPaymentMethod($cgt->gateway_type_id); return $this->payment_method->tokenBilling($cgt, $payment_hash); } - } diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 93f34e02328a..4de14177282a 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -1,7 +1,7 @@ invoices(); $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->get(); $payment->invoices()->sync($invoices); - $invoices->each(function ($invoice) use($payment){ + $invoices->each(function ($invoice) use ($payment) { event(new InvoiceWasPaid($invoice, $payment->company, Ninja::eventVars())); }); @@ -127,8 +131,8 @@ class BaseDriver extends AbstractPaymentDriver } /** - * Create a payment from an online payment - * + * Create a payment from an online payment. + * * @param array $data Payment data * @param int $status The payment status_id * @return Payment The payment object @@ -146,18 +150,20 @@ class BaseDriver extends AbstractPaymentDriver } /** - * Process an unattended payment - * + * Process an unattended payment. + * * @param ClientGatewayToken $cgt The client gateway token object * @param PaymentHash $payment_hash The Payment hash containing the payment meta data * @return Response The payment response */ - public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) {} + public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) + { + } /** * When a successful payment is made, we need to append the gateway fee - * to an invoice - * + * to an invoice. + * * @param PaymentResponseRequest $request The incoming payment request * @return void Success/Failure */ @@ -168,25 +174,22 @@ class BaseDriver extends AbstractPaymentDriver /*Payment invoices*/ $payment_invoices = $payment_hash->invoices(); - + // /*Fee charged at gateway*/ $fee_total = $payment_hash->fee_total; // Sum of invoice amounts // $invoice_totals = array_sum(array_column($payment_invoices,'amount')); - + /*Hydrate invoices*/ $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->get(); - $invoices->each(function($invoice) use($fee_total){ - - if(collect($invoice->line_items)->contains('type_id', '3')){ + $invoices->each(function ($invoice) use ($fee_total) { + if (collect($invoice->line_items)->contains('type_id', '3')) { $invoice->service()->toggleFeesPaid()->save(); $invoice->client->service()->updateBalance($fee_total)->save(); $invoice->ledger()->updateInvoiceBalance($fee_total, $notes = 'Gateway fee adjustment'); } - }); - } } diff --git a/app/PaymentDrivers/BasePaymentDriver.php b/app/PaymentDrivers/BasePaymentDriver.php index fb499b6b1659..b2b5acdfe3fa 100644 --- a/app/PaymentDrivers/BasePaymentDriver.php +++ b/app/PaymentDrivers/BasePaymentDriver.php @@ -1,7 +1,7 @@ $invoice->getRequestedAmount(), 'currency' => $invoice->getCurrencyCode(), 'returnUrl' => $completeUrl, @@ -42,7 +37,6 @@ use Omnipay\Omnipay; 'transactionType' => 'Purchase', 'clientIp' => Request::getClientIp(), ]; - */ class BasePaymentDriver { @@ -67,7 +61,6 @@ class BasePaymentDriver /* Authorise payment methods */ protected $can_authorise_credit_card = false; - public function __construct(CompanyGateway $company_gateway, Client $client, $invitation = false) { $this->company_gateway = $company_gateway; @@ -78,7 +71,7 @@ class BasePaymentDriver } /** - * Returns the Omnipay driver + * Returns the Omnipay driver. * @return object Omnipay initialized object */ protected function gateway() @@ -91,7 +84,7 @@ class BasePaymentDriver /** * Return the configuration fields for the - * Gatway + * Gatway. * @return array The configuration fields */ public function getFields() @@ -100,7 +93,7 @@ class BasePaymentDriver } /** - * Returns the default gateway type + * Returns the default gateway type. */ public function gatewayTypes() { @@ -113,9 +106,10 @@ class BasePaymentDriver { return $this->company_gateway->id; } + /** - * Returns whether refunds are possible with the gateway - * @return boolean TRUE|FALSE + * Returns whether refunds are possible with the gateway. + * @return bool TRUE|FALSE */ public function getRefundable(): bool { @@ -123,8 +117,8 @@ class BasePaymentDriver } /** - * Returns whether token billing is possible with the gateway - * @return boolean TRUE|FALSE + * Returns whether token billing is possible with the gateway. + * @return bool TRUE|FALSE */ public function getTokenBilling(): bool { @@ -142,7 +136,7 @@ class BasePaymentDriver } /** - * Refunds a given payment + * Refunds a given payment. * @return void */ public function refundPayment($payment, $amount = 0) @@ -153,7 +147,7 @@ class BasePaymentDriver $amount = $payment->getCompletedAmount(); } - if ($payment->is_deleted || !$amount) { + if ($payment->is_deleted || ! $amount) { return false; } @@ -200,7 +194,7 @@ class BasePaymentDriver } /** - * Return the contact if possible + * Return the contact if possible. * * @return ClientContact The ClientContact object */ @@ -234,7 +228,6 @@ class BasePaymentDriver 'clientIp' => request()->getClientIp(), ]; - return $data; } @@ -248,7 +241,6 @@ class BasePaymentDriver ->send(); return $response; - } public function completePurchase($data) @@ -272,10 +264,8 @@ class BasePaymentDriver return $payment->service()->applyNumber()->save(); } - public function attachInvoices(Payment $payment, PaymentHash $payment_hash): Payment { - $paid_invoices = $payment_hash->invoices(); $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->get(); $payment->invoices()->sync($invoices); @@ -286,8 +276,8 @@ class BasePaymentDriver /** * When a successful payment is made, we need to append the gateway fee - * to an invoice - * + * to an invoice. + * * @param PaymentResponseRequest $request The incoming payment request * @return void Success/Failure */ @@ -298,26 +288,22 @@ class BasePaymentDriver /*Payment invoices*/ $payment_invoices = $payment_hash->invoices(); - + // /*Fee charged at gateway*/ $fee_total = $payment_hash->fee_total; // Sum of invoice amounts // $invoice_totals = array_sum(array_column($payment_invoices,'amount')); - + /*Hydrate invoices*/ $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->get(); - $invoices->each(function($invoice) use($fee_total){ - - if(collect($invoice->line_items)->contains('type_id', '3')){ + $invoices->each(function ($invoice) use ($fee_total) { + if (collect($invoice->line_items)->contains('type_id', '3')) { $invoice->service()->toggleFeesPaid()->save(); $invoice->client->service()->updateBalance($fee_total)->save(); $invoice->ledger()->updateInvoiceBalance($fee_total, $notes = 'Gateway fee adjustment'); } - }); - } } - diff --git a/app/PaymentDrivers/CheckoutCom/Utilities.php b/app/PaymentDrivers/CheckoutCom/Utilities.php index 6c1f1b897d35..20804a258de0 100644 --- a/app/PaymentDrivers/CheckoutCom/Utilities.php +++ b/app/PaymentDrivers/CheckoutCom/Utilities.php @@ -1,7 +1,7 @@ all()); $state['store_card'] = boolval($state['store_card']); - if ($request->has('token') && !is_null($request->token)) { + if ($request->has('token') && ! is_null($request->token)) { $method = new IdSource($state['token']); $payment = new CheckoutPayment($method, $state['currency']); $payment->amount = $state['value']; @@ -126,7 +126,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver $payment->amount = $state['value']; if ($this->client->currency()->code === 'EUR') { - $payment->{"3ds"} = ['enabled' => true]; + $payment->{'3ds'} = ['enabled' => true]; } } @@ -165,7 +165,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver ]; $payment = $this->createPayment($data, Payment::STATUS_COMPLETED); - $payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$state['payment_hash']])->firstOrFail(); + $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$state['payment_hash']])->firstOrFail(); $this->attachInvoices($payment, $payment_hash); $payment->service()->updateInvoicePayment($payment_hash); @@ -173,7 +173,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver $logger_message = [ 'server_response' => $state['payment_response'], - 'data' => $data + 'data' => $data, ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_CHECKOUT, $this->client); @@ -205,7 +205,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver $logger_message = [ 'server_response' => $state['payment_response'], - 'data' => $data + 'data' => $data, ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_CHECKOUT, $this->client); @@ -233,7 +233,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver // throw new \Exception('Failed to process the payment: ' . $state['payment_response']->response_summary, 1); return render('gateways.unsuccessful', [ - 'code' => $state['payment_response']->response_code + 'code' => $state['payment_response']->response_code, ]); } @@ -318,6 +318,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver } } - public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) {} - + public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) + { + } } diff --git a/app/PaymentDrivers/CustomPaymentDriver.php b/app/PaymentDrivers/CustomPaymentDriver.php index dbdb2a428b17..00b823595cce 100644 --- a/app/PaymentDrivers/CustomPaymentDriver.php +++ b/app/PaymentDrivers/CustomPaymentDriver.php @@ -1,7 +1,7 @@ 'EC-50V302605X606694D', 'SUCCESSPAGEREDIRECTREQUESTED' => 'false', 'TIMESTAMP' => '2019-09-30T22:21:21Z', @@ -58,7 +58,6 @@ use Omnipay\Common\Item; 'PAYMENTINFO_0_ACK' => 'Success', ) */ - class PayPalExpressPaymentDriver extends BasePaymentDriver { use MakesHash; @@ -84,15 +83,15 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver } /** - * Processes the payment with this gateway + * Processes the payment with this gateway. * - * @var $data['invoices'] - * @var $data['amount'] - * @var $data['fee'] - * @var $data['amount_with_fee'] - * @var $data['token'] - * @var $data['payment_method_id'] - * @var $data['payment_hash'] + * @var['invoices'] + * @var['amount'] + * @var['fee'] + * @var['amount_with_fee'] + * @var['token'] + * @var['payment_method_id'] + * @var['payment_hash'] * * @param array $data variables required to build payment page * @return view Gateway and payment method specific view @@ -101,7 +100,6 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver { $response = $this->purchase($this->paymentDetails($data), $this->paymentItems($data)); - if ($response->isRedirect()) { // redirect to offsite payment gateway $response->redirect(); @@ -114,7 +112,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver SystemLogger::dispatch( [ 'server_response' => $response->getData(), - 'data' => $data + 'data' => $data, ], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, @@ -122,7 +120,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver $this->client ); - throw new \Exception("Error Processing Payment", 1); + throw new \Exception('Error Processing Payment', 1); } } @@ -138,21 +136,20 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver SystemLogger::dispatch( [ 'server_response' => $response->getData(), - 'data' => $request->all() + 'data' => $request->all(), ], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_PAYPAL, $this->client ); - } elseif (!$response->isSuccessful()) { - + } elseif (! $response->isSuccessful()) { PaymentFailureMailer::dispatch($this->client, $response->getMessage, $this->client->company, $response['PAYMENTINFO_0_AMT']); SystemLogger::dispatch( [ 'data' => $request->all(), - 'server_response' => $response->getData() + 'server_response' => $response->getData(), ], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, @@ -164,7 +161,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver } $payment = $this->createPayment($response->getData()); - $payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$request->input('payment_hash')])->firstOrFail(); + $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->firstOrFail(); $this->attachInvoices($payment, $payment_hash); $payment->service()->updateInvoicePayment($payment_hash); @@ -185,43 +182,43 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver $data['ButtonSource'] = 'InvoiceNinja_SP'; $data['solutionType'] = 'Sole'; // show 'Pay with credit card' option - $data['transactionId'] = $data['transactionId'] . '-' . time(); + $data['transactionId'] = $data['transactionId'].'-'.time(); return $data; } private function buildReturnUrl($input): string { - $url = $this->client->company->domain() . "/client/payments/process/response"; - $url .= "?company_gateway_id={$this->company_gateway->id}&gateway_type_id=" . GatewayType::PAYPAL; - $url .= "&payment_hash=" . $input['payment_hash']; - $url .= "&amount=" . $input['amount']; - $url .= "&fee=" . $input['fee']; + $url = $this->client->company->domain().'/client/payments/process/response'; + $url .= "?company_gateway_id={$this->company_gateway->id}&gateway_type_id=".GatewayType::PAYPAL; + $url .= '&payment_hash='.$input['payment_hash']; + $url .= '&amount='.$input['amount']; + $url .= '&fee='.$input['fee']; return $url; } private function buildCancelUrl($input): string { - $url = $this->client->company->domain() . '/client/invoices'; + $url = $this->client->company->domain().'/client/invoices'; return $url; } private function buildDescription($input): string { - $invoice_numbers = ""; + $invoice_numbers = ''; foreach ($input['invoices'] as $invoice) { - $invoice_numbers .= $invoice->number . " "; + $invoice_numbers .= $invoice->number.' '; } - return ctrans('texts.invoice_number') . ": {$invoice_numbers}"; + return ctrans('texts.invoice_number').": {$invoice_numbers}"; } private function buildTransactionId($input): string { - return implode(",", $input['hashed_ids']); + return implode(',', $input['hashed_ids']); } private function paymentItems($input): array diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index 8358b19cf681..07d36ed723ce 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -1,7 +1,7 @@ $this->stripe->company_gateway->id, 'gateway_type_id' => GatewayType::SOFORT, - 'hashed_ids' => implode(",", $data['hashed_ids']), + 'hashed_ids' => implode(',', $data['hashed_ids']), 'amount' => $data['amount'], 'fee' => $data['fee'], 'payment_method_id' => GatewayType::SOFORT, @@ -92,7 +92,7 @@ class Alipay $logger_message = [ 'server_response' => $state, - 'data' => $data + 'data' => $data, ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client); diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 7ac60d47124d..c92b475f9252 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -1,7 +1,7 @@ invoices(), 'amount')) + $payment_hash->fee_total; $invoice = sInvoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->first(); - if($invoice) + if ($invoice) { $description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}"; - else + } else { $description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}"; + } $this->stripe->init(); @@ -56,7 +56,6 @@ class Charge $response = null; try { - $response = $local_stripe->paymentIntents->create([ 'amount' => $this->stripe->convertToStripeAmount($amount, $this->stripe->client->currency()->precision), 'currency' => $this->stripe->client->getCurrencyCode(), @@ -67,89 +66,80 @@ class Charge ]); SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client); + } catch (\Stripe\Exception\CardException $e) { + // Since it's a decline, \Stripe\Exception\CardException will be caught - - } catch(\Stripe\Exception\CardException $e) { - // Since it's a decline, \Stripe\Exception\CardException will be caught - - $data = [ + $data = [ 'status' => $e->getHttpStatus(), 'error_type' => $e->getError()->type, 'error_code' => $e->getError()->code, 'param' => $e->getError()->param, - 'message' => $e->getError()->message + 'message' => $e->getError()->message, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); } catch (\Stripe\Exception\RateLimitException $e) { - // Too many requests made to the API too quickly - - $data = [ + // Too many requests made to the API too quickly + + $data = [ 'status' => '', 'error_type' => '', 'error_code' => '', 'param' => '', - 'message' => 'Too many requests made to the API too quickly' + 'message' => 'Too many requests made to the API too quickly', ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); } catch (\Stripe\Exception\InvalidRequestException $e) { - // Invalid parameters were supplied to Stripe's API - // - $data = [ + // Invalid parameters were supplied to Stripe's API + // + $data = [ 'status' => '', 'error_type' => '', 'error_code' => '', 'param' => '', - 'message' => 'Invalid parameters were supplied to Stripe\'s API' + 'message' => 'Invalid parameters were supplied to Stripe\'s API', ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); } catch (\Stripe\Exception\AuthenticationException $e) { - // Authentication with Stripe's API failed - - $data = [ + // Authentication with Stripe's API failed + + $data = [ 'status' => '', 'error_type' => '', 'error_code' => '', 'param' => '', - 'message' => 'Authentication with Stripe\'s API failed' + 'message' => 'Authentication with Stripe\'s API failed', ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); } catch (\Stripe\Exception\ApiConnectionException $e) { - // Network communication with Stripe failed - - $data = [ + // Network communication with Stripe failed + + $data = [ 'status' => '', 'error_type' => '', 'error_code' => '', 'param' => '', - 'message' => 'Network communication with Stripe failed' + 'message' => 'Network communication with Stripe failed', ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); } catch (\Stripe\Exception\ApiErrorException $e) { - - $data = [ + $data = [ 'status' => '', 'error_type' => '', 'error_code' => '', 'param' => '', - 'message' => 'API Error' + 'message' => 'API Error', ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); } catch (Exception $e) { - // Something else happened, completely unrelated to Stripe - // - $data = [ + // Something else happened, completely unrelated to Stripe + // + $data = [ 'status' => '', 'error_type' => '', 'error_code' => '', @@ -157,11 +147,12 @@ class Charge 'message' => $e->getMessage(), ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); - } + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); + } - if(!$response) + if (! $response) { return false; + } $payment_method_type = $response->charges->data[0]->payment_method_details->card->brand; //info($payment_method_type); @@ -185,7 +176,6 @@ class Charge return $payment; } - private function formatGatewayResponse($data, $vars) { $response = $data['response']; @@ -214,7 +204,6 @@ class Charge break; } } - } // const CREDIT = 1; @@ -323,8 +312,8 @@ class Charge // "transfer_group": null, // "source": "tok_visa" // } -// -// +// +// // [2020-07-14 23:06:47] local.INFO: Stripe\PaymentIntent Object // ( // [id] => pi_1H4xD0Kmol8YQE9DKhrvV6Nc @@ -337,10 +326,10 @@ class Charge // [amount] => 1000 // [amount_capturable] => 0 // [amount_received] => 1000 -// [application] => -// [application_fee_amount] => -// [canceled_at] => -// [cancellation_reason] => +// [application] => +// [application_fee_amount] => +// [canceled_at] => +// [cancellation_reason] => // [capture_method] => automatic // [charges] => Stripe\Collection Object // ( @@ -353,25 +342,25 @@ class Charge // [object] => charge // [amount] => 1000 // [amount_refunded] => 0 -// [application] => -// [application_fee] => -// [application_fee_amount] => +// [application] => +// [application_fee] => +// [application_fee_amount] => // [balance_transaction] => txn_1H4xD1Kmol8YQE9DE9qFoO0R // [billing_details] => Stripe\StripeObject Object // ( // [address] => Stripe\StripeObject Object // ( -// [city] => -// [country] => -// [line1] => -// [line2] => +// [city] => +// [country] => +// [line1] => +// [line2] => // [postal_code] => 42334 -// [state] => +// [state] => // ) -// [email] => +// [email] => // [name] => sds -// [phone] => +// [phone] => // ) // [calculated_statement_descriptor] => NODDY @@ -380,27 +369,27 @@ class Charge // [currency] => usd // [customer] => cus_He4VEiYldHJWqG // [description] => Invoice 0023 for 10 for client Corwin Group -// [destination] => -// [dispute] => -// [disputed] => -// [failure_code] => -// [failure_message] => +// [destination] => +// [dispute] => +// [disputed] => +// [failure_code] => +// [failure_message] => // [fraud_details] => Array // ( // ) -// [invoice] => -// [livemode] => +// [invoice] => +// [livemode] => // [metadata] => Stripe\StripeObject Object // ( // ) -// [on_behalf_of] => -// [order] => +// [on_behalf_of] => +// [order] => // [outcome] => Stripe\StripeObject Object // ( // [network_status] => approved_by_network -// [reason] => +// [reason] => // [risk_level] => normal // [risk_score] => 13 // [seller_message] => Payment complete. @@ -417,9 +406,9 @@ class Charge // [brand] => visa // [checks] => Stripe\StripeObject Object // ( -// [address_line1_check] => +// [address_line1_check] => // [address_postal_code_check] => pass -// [cvc_check] => +// [cvc_check] => // ) // [country] => US @@ -427,20 +416,20 @@ class Charge // [exp_year] => 2024 // [fingerprint] => oCjEXlb4syFKwgbJ // [funding] => credit -// [installments] => +// [installments] => // [last4] => 4242 // [network] => visa -// [three_d_secure] => -// [wallet] => +// [three_d_secure] => +// [wallet] => // ) // [type] => card // ) -// [receipt_email] => -// [receipt_number] => +// [receipt_email] => +// [receipt_number] => // [receipt_url] => https://pay.stripe.com/receipts/acct_19DXXPKmol8YQE9D/ch_1H4xD0Kmol8YQE9Ds9b1ZWjw/rcpt_HeFiiwzRZtnOpvHyohNN5JXtCYe8Rdc -// [refunded] => +// [refunded] => // [refunds] => Stripe\Collection Object // ( // [object] => list @@ -448,25 +437,25 @@ class Charge // ( // ) -// [has_more] => +// [has_more] => // [total_count] => 0 // [url] => /v1/charges/ch_1H4xD0Kmol8YQE9Ds9b1ZWjw/refunds // ) -// [review] => -// [shipping] => -// [source] => -// [source_transfer] => -// [statement_descriptor] => -// [statement_descriptor_suffix] => +// [review] => +// [shipping] => +// [source] => +// [source_transfer] => +// [statement_descriptor] => +// [statement_descriptor_suffix] => // [status] => succeeded -// [transfer_data] => -// [transfer_group] => +// [transfer_data] => +// [transfer_group] => // ) // ) -// [has_more] => +// [has_more] => // [total_count] => 1 // [url] => /v1/charges?payment_intent=pi_1H4xD0Kmol8YQE9DKhrvV6Nc // ) @@ -477,23 +466,23 @@ class Charge // [currency] => usd // [customer] => cus_He4VEiYldHJWqG // [description] => Invoice 0023 for 10 for client Corwin Group -// [invoice] => -// [last_payment_error] => -// [livemode] => +// [invoice] => +// [last_payment_error] => +// [livemode] => // [metadata] => Stripe\StripeObject Object // ( // ) -// [next_action] => -// [next_source_action] => -// [on_behalf_of] => +// [next_action] => +// [next_source_action] => +// [on_behalf_of] => // [payment_method] => pm_1H4mNAKmol8YQE9DUMRsuTXs // [payment_method_options] => Stripe\StripeObject Object // ( // [card] => Stripe\StripeObject Object // ( -// [installments] => -// [network] => +// [installments] => +// [network] => // [request_three_d_secure] => automatic // ) @@ -504,14 +493,14 @@ class Charge // [0] => card // ) -// [receipt_email] => -// [review] => -// [setup_future_usage] => -// [shipping] => -// [source] => -// [statement_descriptor] => -// [statement_descriptor_suffix] => +// [receipt_email] => +// [review] => +// [setup_future_usage] => +// [shipping] => +// [source] => +// [statement_descriptor] => +// [statement_descriptor_suffix] => // [status] => succeeded -// [transfer_data] => -// [transfer_group] => -// ) \ No newline at end of file +// [transfer_data] => +// [transfer_group] => +// ) diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php index d726dcf1b774..c52ca0b9e279 100644 --- a/app/PaymentDrivers/Stripe/CreditCard.php +++ b/app/PaymentDrivers/Stripe/CreditCard.php @@ -1,7 +1,7 @@ token; } else { - $payment_intent_data['setup_future_usage'] = 'off_session'; + $payment_intent_data['setup_future_usage'] = 'off_session'; // $payment_intent_data['save_payment_method'] = true; // $payment_intent_data['confirm'] = true; } @@ -114,7 +114,7 @@ class CreditCard { $server_response = json_decode($request->input('gateway_response')); - $payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$request->input('payment_hash')])->firstOrFail(); + $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->firstOrFail(); $state = [ 'payment_method' => $server_response->payment_method, @@ -173,7 +173,7 @@ class CreditCard $payment_meta = new \stdClass; $payment_meta->exp_month = $payment_method_object['card']['exp_month']; $payment_meta->exp_year = $payment_method_object['card']['exp_year']; - $payment_meta->brand = $payment_method_object['card']['brand']; + $payment_meta->brand = $payment_method_object['card']['brand']; $payment_meta->last4 = $payment_method_object['card']['last4']; $payment_meta->type = $payment_method_object['type']; @@ -184,7 +184,7 @@ class CreditCard } // Todo: Need to fix this to support payment types other than credit card.... sepa etc etc - if (!isset($state['payment_type'])) { + if (! isset($state['payment_type'])) { $state['payment_type'] = PaymentType::CREDIT_CARD_OTHER; } @@ -206,7 +206,7 @@ class CreditCard $logger_message = [ 'server_response' => $state['payment_intent'], - 'data' => $data + 'data' => $data, ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client); diff --git a/app/PaymentDrivers/Stripe/SOFORT.php b/app/PaymentDrivers/Stripe/SOFORT.php index 55ed95508e65..3d8c0999f939 100644 --- a/app/PaymentDrivers/Stripe/SOFORT.php +++ b/app/PaymentDrivers/Stripe/SOFORT.php @@ -1,7 +1,7 @@ $this->stripe->company_gateway->id, 'gateway_type_id' => GatewayType::SOFORT, - 'hashed_ids' => implode(",", $data['hashed_ids']), + 'hashed_ids' => implode(',', $data['hashed_ids']), 'amount' => $data['amount'], 'fee' => $data['fee'], ]); @@ -84,7 +84,7 @@ class SOFORT $payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING); - /** @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */ + /* @todo: https://github.com/invoiceninja/invoiceninja/pull/3789/files#r436175798 */ if (isset($state['hashed_ids'])) { $this->stripe->attachInvoices($payment, $state['hashed_ids']); } @@ -93,7 +93,7 @@ class SOFORT $logger_message = [ 'server_response' => $state, - 'data' => $data + 'data' => $data, ]; SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client); diff --git a/app/PaymentDrivers/Stripe/Utilities.php b/app/PaymentDrivers/Stripe/Utilities.php index 0f6671481eb5..1a581fbc5e43 100644 --- a/app/PaymentDrivers/Stripe/Utilities.php +++ b/app/PaymentDrivers/Stripe/Utilities.php @@ -1,7 +1,7 @@ init(); @@ -263,17 +262,16 @@ class StripePaymentDriver extends BasePaymentDriver * * @return \Stripe\SetupIntent */ - public function getSetupIntent(): \Stripe\SetupIntent + public function getSetupIntent(): SetupIntent { $this->init(); return SetupIntent::create(); } - /** - * Returns the Stripe publishable key - * @return NULL|string The stripe publishable key + * Returns the Stripe publishable key. + * @return null|string The stripe publishable key */ public function getPublishableKey(): ?string { @@ -281,9 +279,9 @@ class StripePaymentDriver extends BasePaymentDriver } /** - * Finds or creates a Stripe Customer object + * Finds or creates a Stripe Customer object. * - * @return NULL|\Stripe\Customer A Stripe customer object + * @return null|\Stripe\Customer A Stripe customer object */ public function findOrCreateCustomer(): ?\Stripe\Customer { @@ -306,7 +304,7 @@ class StripePaymentDriver extends BasePaymentDriver $customer = \Stripe\Customer::create($data); } - if (!$customer) { + if (! $customer) { throw new \Exception('Unable to create gateway customer'); } @@ -368,7 +366,7 @@ class StripePaymentDriver extends BasePaymentDriver return response([], 200); } - public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) + public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) { return (new Charge($this))->tokenBilling($cgt, $payment_hash); } @@ -376,14 +374,13 @@ class StripePaymentDriver extends BasePaymentDriver /** * Creates a payment record for the given * data array. - * + * * @param array $data An array of payment attributes * @param float $amount The amount of the payment * @return Payment The payment object */ public function createPaymentRecord($data, $amount) :?Payment { - $payment = PaymentFactory::create($this->client->company_id, $this->client->user_id); $payment->client_id = $this->client->id; $payment->company_gateway_id = $this->company_gateway->id; @@ -393,7 +390,7 @@ class StripePaymentDriver extends BasePaymentDriver $payment->currency_id = $this->client->getSetting('currency_id'); $payment->date = Carbon::now(); $payment->transaction_reference = $data['transaction_reference']; - $payment->amount = $amount; + $payment->amount = $amount; $payment->save(); return $payment->service()->applyNumber()->save(); diff --git a/app/Policies/ActivityPolicy.php b/app/Policies/ActivityPolicy.php index f8e1cc7c7f44..4964a99b2759 100644 --- a/app/Policies/ActivityPolicy.php +++ b/app/Policies/ActivityPolicy.php @@ -1,6 +1,6 @@ isAdmin() && $entity->id == $user->companyId()) - || ($user->hasPermission('view_' . strtolower(class_basename($entity))) && $entity->id == $user->companyId()) + || ($user->hasPermission('view_'.strtolower(class_basename($entity))) && $entity->id == $user->companyId()) || ($user->hasPermission('view_all') && $entity->id == $user->companyId()) || $user->owns($entity); } - /** - * Checks if the user has edit permissions + * Checks if the user has edit permissions. * * We MUST also check that the user can both edit a entity and also check the entity belongs to the users company!!!!!! * @@ -61,7 +59,7 @@ class CompanyPolicy extends EntityPolicy public function edit(User $user, $entity) : bool { return ($user->isAdmin() && $entity->id == $user->companyId()) - || ($user->hasPermission('edit_' . strtolower(class_basename($entity))) && $entity->id == $user->companyId()) + || ($user->hasPermission('edit_'.strtolower(class_basename($entity))) && $entity->id == $user->companyId()) || ($user->hasPermission('edit_all') && $entity->id == $user->companyId()) || $user->owns($entity); } diff --git a/app/Policies/CompanyTokenPolicy.php b/app/Policies/CompanyTokenPolicy.php index 13d4ff20109c..3ced3df77e2a 100644 --- a/app/Policies/CompanyTokenPolicy.php +++ b/app/Policies/CompanyTokenPolicy.php @@ -1,6 +1,6 @@ isAdmin() && $entity->company_id == $user->companyId()) - || ($user->hasPermission('edit_' . strtolower(class_basename($entity))) && $entity->company_id == $user->companyId()) + || ($user->hasPermission('edit_'.strtolower(class_basename($entity))) && $entity->company_id == $user->companyId()) || ($user->hasPermission('edit_all') && $entity->company_id == $user->companyId()) || $user->owns($entity) || $user->assigned($entity); } - /** - * Checks if the user has view permissions + * Checks if the user has view permissions. * * We MUST also check that the user can both view a entity and also check the entity belongs to the users company!!!!!! * @param User $user @@ -66,7 +64,7 @@ class EntityPolicy public function view(User $user, $entity) : bool { return ($user->isAdmin() && $entity->company_id == $user->companyId()) - || ($user->hasPermission('view_' . strtolower(class_basename($entity))) && $entity->company_id == $user->companyId()) + || ($user->hasPermission('view_'.strtolower(class_basename($entity))) && $entity->company_id == $user->companyId()) || ($user->hasPermission('view_all') && $entity->company_id == $user->companyId()) || $user->owns($entity) || $user->assigned($entity); diff --git a/app/Policies/ExpensePolicy.php b/app/Policies/ExpensePolicy.php index 1b2ac5daf988..98946b0186c5 100644 --- a/app/Policies/ExpensePolicy.php +++ b/app/Policies/ExpensePolicy.php @@ -1,6 +1,6 @@ isAdmin() || $user->hasPermission('create_user') || $user->hasPermission('create_all'); } - /* * * We need to override as User does not have the company_id property!!!!! @@ -43,6 +41,6 @@ class UserPolicy extends EntityPolicy { $company_user = CompanyUser::whereUserId($user->id)->AuthCompany()->first(); - return ($user->isAdmin() && $company_user); + return $user->isAdmin() && $company_user; } } diff --git a/app/Policies/VendorPolicy.php b/app/Policies/VendorPolicy.php index 61410870243f..59bf556f8af3 100644 --- a/app/Policies/VendorPolicy.php +++ b/app/Policies/VendorPolicy.php @@ -1,6 +1,6 @@ '\App\Models\Invoice', - 'proposals' => '\App\Models\Proposal', + 'invoices' => \App\Models\Invoice::class, + 'proposals' => \App\Models\Proposal::class, ]); Blade::if('env', function ($environment) { @@ -80,7 +80,6 @@ class AppServiceProvider extends ServiceProvider Quote::observe(QuoteObserver::class); Task::observe(TaskObserver::class); - // Queue::before(function (JobProcessing $event) { // // \Log::info('Event Job '.$event->connectionName); // \Log::error('Event Job '.$event->job->getJobId); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index fca6b60c28fa..45cf785d4664 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -1,6 +1,6 @@ registerPolicies(); Gate::define('view-list', function ($user, $entity) { $entity = strtolower(class_basename($entity)); - return $user->hasPermission('view_' . $entity) || $user->isAdmin(); + + return $user->hasPermission('view_'.$entity) || $user->isAdmin(); }); } - } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index ca7c30a04d04..88ce71d54d5d 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -1,6 +1,6 @@ composer('portal.*', 'App\Http\ViewComposers\PortalComposer'); + view()->composer('portal.*', \App\Http\ViewComposers\PortalComposer::class); } /** diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index a2892147e5e6..8215fb1dc87c 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -1,6 +1,6 @@ [ - CreditViewedActivity::class + CreditViewedActivity::class, ], //Designs DesignWasArchived::class => [ @@ -252,7 +252,7 @@ class EventServiceProvider extends ServiceProvider InvoiceCancelledActivity::class, ], InvitationWasViewed::class => [ - InvitationViewedListener::class + InvitationViewedListener::class, ], CompanyDocumentsDeleted::class => [ DeleteCompanyDocuments::class, @@ -297,7 +297,6 @@ class EventServiceProvider extends ServiceProvider * * @return void */ - public function boot() { parent::boot(); diff --git a/app/Providers/MultiDBProvider.php b/app/Providers/MultiDBProvider.php index 3cd7fc0d3792..77474135226b 100644 --- a/app/Providers/MultiDBProvider.php +++ b/app/Providers/MultiDBProvider.php @@ -1,6 +1,6 @@ app->runningInConsole()) { return; } diff --git a/app/Providers/MultiDatabaseUserProvider.php b/app/Providers/MultiDatabaseUserProvider.php index f03a6b9f7ae6..e248196442c2 100644 --- a/app/Providers/MultiDatabaseUserProvider.php +++ b/app/Providers/MultiDatabaseUserProvider.php @@ -1,6 +1,6 @@ setDB($database); - + /** Make sure we hook into the correct guard class */ $query = $this->conn->table((new $this->model)->getTable()); @@ -245,7 +245,7 @@ class MultiDatabaseUserProvider implements UserProvider $query = $this->conn->table('company_tokens'); if ($token) { - $query->whereRaw("BINARY `token`= ?", $token); + $query->whereRaw('BINARY `token`= ?', $token); $token = $query->get(); @@ -257,7 +257,7 @@ class MultiDatabaseUserProvider implements UserProvider } /** - * Sets the database at runtime + * Sets the database at runtime. */ private function setDB($database) { diff --git a/app/Providers/NinjaTranslationServiceProvider.php b/app/Providers/NinjaTranslationServiceProvider.php index df58fcabc6fd..471c946e7e50 100644 --- a/app/Providers/NinjaTranslationServiceProvider.php +++ b/app/Providers/NinjaTranslationServiceProvider.php @@ -1,6 +1,6 @@ app->singleton('translator', function($app) - { + + $this->app->singleton('translator', function ($app) { $loader = $app['translation.loader']; $locale = $app['config']['app.locale']; @@ -44,7 +43,5 @@ class NinjaTranslationServiceProvider extends TranslationServiceProvider return $trans; }); - } } - diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index feddf0b08bc2..88d47a61b3a0 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -1,6 +1,6 @@ namespace($this->namespace) ->group(base_path('routes/api.php')); } - + /** - * Define the "api" routes for the application. - * - * These routes are typically stateless. - * - * @return void - */ + * Define the "api" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ protected function mapContactApiRoutes() { Route::prefix('') @@ -122,9 +122,9 @@ class RouteServiceProvider extends ServiceProvider protected function mapShopApiRoutes() { - Route::prefix('') + Route::prefix('') ->middleware('shop') ->namespace($this->namespace) - ->group(base_path('routes/shop.php')); + ->group(base_path('routes/shop.php')); } } diff --git a/app/Repositories/AccountRepository.php b/app/Repositories/AccountRepository.php index d317b1c5f300..81cccae235b3 100644 --- a/app/Repositories/AccountRepository.php +++ b/app/Repositories/AccountRepository.php @@ -1,6 +1,6 @@ $value) { $activity->{$key} = $value; } - if($token_id = $this->getTokenId($event_vars)){ + if ($token_id = $this->getTokenId($event_vars)) { $fields->token_id = $token_id; } @@ -66,7 +66,7 @@ class ActivityRepository extends BaseRepository { $backup = new Backup(); - if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class){ + if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class) { $contact = $entity->client->primary_contact()->first(); $backup->html_backup = $this->generateEntityHtml($entity->getEntityDesigner(), $entity, $contact); $backup->amount = $entity->amount; @@ -80,18 +80,14 @@ class ActivityRepository extends BaseRepository public function getTokenId(array $event_vars) { + if ($event_vars['token']) { + $company_token = CompanyToken::whereRaw('BINARY `token`= ?', [$event_vars['token']])->first(); - if($event_vars['token']) - { - - $company_token = CompanyToken::whereRaw("BINARY `token`= ?", [$event_vars['token']])->first(); - - if($company_token) + if ($company_token) { return $company_token->id; - + } } return false; - } } diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 02cd86de56ef..18e3a00c1d40 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -1,6 +1,6 @@ trashed()) { return; } - + $entity->delete(); - + $className = $this->getEventClass($entity, 'Archived'); if (class_exists($className)) { @@ -126,7 +123,7 @@ class BaseRepository $className = $this->getEventClass($entity, 'Deleted'); - if (class_exists($className) && !($entity instanceOf Company)) { + if (class_exists($className) && ! ($entity instanceof Company)) { event(new $className($entity, $entity->company, Ninja::eventVars())); } } @@ -178,13 +175,13 @@ class BaseRepository public function getInvitation($invitation, $resource) { - if (is_array($invitation) && !array_key_exists('key', $invitation)) { + if (is_array($invitation) && ! array_key_exists('key', $invitation)) { return false; } - $invitation_class = sprintf("App\\Models\\%sInvitation", $resource); + $invitation_class = sprintf('App\\Models\\%sInvitation', $resource); - $invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation['key']])->first(); + $invitation = $invitation_class::whereRaw('BINARY `key`= ?', [$invitation['key']])->first(); return $invitation; } @@ -194,7 +191,6 @@ class BaseRepository */ protected function alternativeSave($data, $model) { - $class = new ReflectionClass($model); if (array_key_exists('client_id', $data)) { @@ -205,18 +201,18 @@ class BaseRepository $state = []; $resource = explode('\\', $class->name)[2]; /** This will extract 'Invoice' from App\Models\Invoice */ - $lcfirst_resource_id = lcfirst($resource) . '_id'; + $lcfirst_resource_id = lcfirst($resource).'_id'; if ($class->name == Invoice::class || $class->name == Quote::class) { $state['starting_amount'] = $model->amount; } - if (!$model->id) { + if (! $model->id) { $company_defaults = $client->setCompanyDefaults($data, lcfirst($resource)); $model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes'); $data = array_merge($company_defaults, $data); } - + $tmp_data = $data; /* We need to unset some variable as we sometimes unguard the model */ @@ -235,7 +231,7 @@ class BaseRepository $this->saveDocuments($data['documents'], $model); } - $invitation_factory_class = sprintf("App\\Factory\\%sInvitationFactory", $resource); + $invitation_factory_class = sprintf('App\\Factory\\%sInvitationFactory', $resource); if (isset($data['client_contacts'])) { foreach ($data['client_contacts'] as $contact) { @@ -251,14 +247,13 @@ class BaseRepository $invitations = collect($data['invitations']); /* Get array of Keys which have been removed from the invitations array and soft delete each invitation */ - $model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use($resource){ - - $invitation_class = sprintf("App\\Models\\%sInvitation", $resource); - $invitation = $invitation_class::whereRaw("BINARY `key`= ?", [$invitation])->first(); - - if($invitation) - $invitation->delete(); + $model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use ($resource) { + $invitation_class = sprintf('App\\Models\\%sInvitation', $resource); + $invitation = $invitation_class::whereRaw('BINARY `key`= ?', [$invitation])->first(); + if ($invitation) { + $invitation->delete(); + } }); foreach ($data['invitations'] as $invitation) { @@ -275,25 +270,20 @@ class BaseRepository if ($contact && $model->client_id == $contact->client_id); { - $invitation_class = sprintf("App\\Models\\%sInvitation", $resource); + $invitation_class = sprintf('App\\Models\\%sInvitation', $resource); $new_invitation = $invitation_class::withTrashed() ->where('client_contact_id', $contact->id) ->where($lcfirst_resource_id, $model->id) ->first(); - if($new_invitation && $new_invitation->trashed()){ - + if ($new_invitation && $new_invitation->trashed()) { $new_invitation->restore(); - - } - else { - + } else { $new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id); $new_invitation->{$lcfirst_resource_id} = $model->id; $new_invitation->client_contact_id = $contact->id; $new_invitation->save(); - } } @@ -309,48 +299,44 @@ class BaseRepository } $model = $model->calc()->getInvoice(); - + $state['finished_amount'] = $model->amount; $model = $model->service()->applyNumber()->save(); - + if ($model->company->update_products !== false) { UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company); } if ($class->name == Invoice::class) { - if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) { - $model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount'])); $model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save(); } - if(!$model->design_id) + if (! $model->design_id) { $model->design_id = $this->decodePrimaryKey($client->getSetting('invoice_design_id')); - + } } if ($class->name == Credit::class) { $model = $model->calc()->getCredit(); - if(!$model->design_id) + if (! $model->design_id) { $model->design_id = $this->decodePrimaryKey($client->getSetting('credit_design_id')); - + } } - + if ($class->name == Quote::class) { $model = $model->calc()->getQuote(); - if(!$model->design_id) + if (! $model->design_id) { $model->design_id = $this->decodePrimaryKey($client->getSetting('quote_design_id')); - + } } $model->save(); return $model->fresh(); - } - } diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index ac67a055e80c..3267bb20f84b 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -1,6 +1,6 @@ sortByDesc('is_primary')->map(function ($contact) { $contact['is_primary'] = $this->is_primary; $this->is_primary = false; + return $contact; }); @@ -51,7 +51,7 @@ class ClientContactRepository extends BaseRepository $update_contact = ClientContact::find($contact['id']); } - if (!$update_contact) { + if (! $update_contact) { $update_contact = ClientContactFactory::create($client->company_id, $client->user_id); $update_contact->client_id = $client->id; } @@ -67,7 +67,6 @@ class ClientContactRepository extends BaseRepository } $update_contact->save(); - }); //need to reload here to shake off stale contacts @@ -75,14 +74,11 @@ class ClientContactRepository extends BaseRepository //always made sure we have one blank contact to maintain state if ($client->contacts->count() == 0) { - $new_contact = ClientContactFactory::create($client->company_id, $client->user_id); $new_contact->client_id = $client->id; $new_contact->contact_key = Str::random(40); $new_contact->is_primary = true; $new_contact->save(); - } - } } diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php index 8b5582cb71fa..852daef6e6f8 100644 --- a/app/Repositories/ClientRepository.php +++ b/app/Repositories/ClientRepository.php @@ -1,6 +1,6 @@ save(); - if ($client->id_number == "" || !$client->id_number) { + if ($client->id_number == '' || ! $client->id_number) { $client->id_number = $this->getNextClientNumber($client); } diff --git a/app/Repositories/CompanyRepository.php b/app/Repositories/CompanyRepository.php index 375ea5b322b7..9480a82fa2ec 100644 --- a/app/Repositories/CompanyRepository.php +++ b/app/Repositories/CompanyRepository.php @@ -1,6 +1,6 @@ first(); + return CreditInvitation::whereRaw('BINARY `key`= ?', [$key])->first(); } } diff --git a/app/Repositories/DesignRepository.php b/app/Repositories/DesignRepository.php index 9e9070aa866f..353774e999d0 100644 --- a/app/Repositories/DesignRepository.php +++ b/app/Repositories/DesignRepository.php @@ -1,6 +1,6 @@ first(); + return InvoiceInvitation::whereRaw('BINARY `key`= ?', [$key])->first(); } /** @@ -85,7 +84,7 @@ class InvoiceRepository extends BaseRepository } $invoice->service()->handleCancellation()->save(); - + $invoice = parent::delete($invoice); return $invoice; diff --git a/app/Repositories/Migration/InvoiceMigrationRepository.php b/app/Repositories/Migration/InvoiceMigrationRepository.php index 70f2f11327a5..f6fca7eedc39 100644 --- a/app/Repositories/Migration/InvoiceMigrationRepository.php +++ b/app/Repositories/Migration/InvoiceMigrationRepository.php @@ -1,6 +1,6 @@ name)[2]; /** This will extract 'Invoice' from App\Models\Invoice */ - $lcfirst_resource_id = lcfirst($resource) . '_id'; + $lcfirst_resource_id = lcfirst($resource).'_id'; if ($class->name == Invoice::class || $class->name == Quote::class) { $state['starting_amount'] = $model->amount; } - if (!$model->id) { + if (! $model->id) { $company_defaults = $client->setCompanyDefaults($data, lcfirst($resource)); $model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes'); $data = array_merge($company_defaults, $data); } - + $tmp_data = $data; /* We need to unset some variable as we sometimes unguard the model */ @@ -84,7 +83,7 @@ class InvoiceMigrationRepository extends BaseRepository $this->saveDocuments($data['documents'], $model); } - $invitation_factory_class = sprintf("App\\Factory\\%sInvitationFactory", $resource); + $invitation_factory_class = sprintf('App\\Factory\\%sInvitationFactory', $resource); if (isset($data['client_contacts'])) { foreach ($data['client_contacts'] as $contact) { @@ -115,8 +114,7 @@ class InvoiceMigrationRepository extends BaseRepository //make sure we are creating an invite for a contact who belongs to the client only! $contact = ClientContact::find($invitation['client_contact_id']); - if ($contact && $model->client_id == $contact->client_id) - { + if ($contact && $model->client_id == $contact->client_id) { $new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id); $new_invitation->{$lcfirst_resource_id} = $model->id; $new_invitation->client_contact_id = $contact->id; @@ -134,50 +132,45 @@ class InvoiceMigrationRepository extends BaseRepository } $model = $model->calc()->getInvoice(); - + $state['finished_amount'] = $model->amount; - + $model = $model->service()->applyNumber()->save(); - + if ($model->company->update_products !== false) { UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company); } if ($class->name == Invoice::class) { - if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) { // $model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount'])); // $model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save(); } - if(!$model->design_id) + if (! $model->design_id) { $model->design_id = $this->decodePrimaryKey($client->getSetting('invoice_design_id')); - + } } if ($class->name == Credit::class) { $model = $model->calc()->getCredit(); - if(!$model->design_id) + if (! $model->design_id) { $model->design_id = $this->decodePrimaryKey($client->getSetting('credit_design_id')); - - + } } - + if ($class->name == Quote::class) { $model = $model->calc()->getQuote(); - if(!$model->design_id) + if (! $model->design_id) { $model->design_id = $this->decodePrimaryKey($client->getSetting('quote_design_id')); - - - + } } $model->save(); return $model->fresh(); } - } diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index ea9e9178a718..46b46ea114dd 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -1,6 +1,6 @@ id) { + if (! $payment->id) { $this->processExchangeRates($data, $payment); /*We only update the paid to date ONCE per payment*/ if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { - - if($data['amount'] == '') + if ($data['amount'] == '') { $data['amount'] = array_sum(array_column($data['invoices'], 'amount')); - + } } } @@ -96,7 +95,7 @@ class PaymentMigrationRepository extends BaseRepository $payment->save(); /*Ensure payment number generated*/ - if (!$payment->number || strlen($payment->number) == 0) { + if (! $payment->number || strlen($payment->number) == 0) { $payment->number = $payment->client->getNextPaymentNumber($payment->client); } @@ -105,19 +104,17 @@ class PaymentMigrationRepository extends BaseRepository /*Iterate through invoices and apply payments*/ if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { - $invoice_totals = array_sum(array_column($data['invoices'], 'amount')); - + $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get(); $payment->invoices()->saveMany($invoices); - - $payment->invoices->each(function ($inv) use($invoice_totals){ + + $payment->invoices->each(function ($inv) use ($invoice_totals) { $inv->pivot->amount = $invoice_totals; $inv->pivot->save(); }); - - } + } $fields = new \stdClass; @@ -126,7 +123,7 @@ class PaymentMigrationRepository extends BaseRepository $fields->company_id = $payment->company_id; $fields->activity_type_id = Activity::CREATE_PAYMENT; - foreach ($payment->invoices as $invoice) { + foreach ($payment->invoices as $invoice) { $fields->invoice_id = $invoice->id; $this->activity_repo->save($fields, $invoice, Ninja::eventVars()); @@ -136,7 +133,7 @@ class PaymentMigrationRepository extends BaseRepository $this->activity_repo->save($fields, $payment, Ninja::eventVars()); } - if ($invoice_totals == $payment->amount) { + if ($invoice_totals == $payment->amount) { $payment->applied += $payment->amount; } elseif ($invoice_totals < $payment->amount) { $payment->applied += $invoice_totals; @@ -147,14 +144,12 @@ class PaymentMigrationRepository extends BaseRepository return $payment->fresh(); } - /** * If the client is paying in a currency other than - * the company currency, we need to set a record + * the company currency, we need to set a record. */ private function processExchangeRates($data, $payment) { - $client = Client::find($data['client_id']); $client_currency = $client->getSetting('currency_id'); @@ -175,20 +170,21 @@ class PaymentMigrationRepository extends BaseRepository public function delete($payment) { //cannot double delete a payment - if($payment->is_deleted) + if ($payment->is_deleted) { return; + } $payment->service()->deletePayment(); return parent::delete($payment); - } public function restore($payment) { //we cannot restore a deleted payment. - if($payment->is_deleted) + if ($payment->is_deleted) { return; + } return parent::restore($payment); } diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 9e30c9f212f5..3888b845f9d5 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -1,6 +1,6 @@ id) { + if (! $payment->id) { $this->processExchangeRates($data, $payment); /*We only update the paid to date ONCE per payment*/ if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { - - if($data['amount'] == '') + if ($data['amount'] == '') { $data['amount'] = array_sum(array_column($data['invoices'], 'amount')); - + } + $client = Client::find($data['client_id']); $client->service()->updatePaidToDate($data['amount'])->save(); - } } @@ -99,7 +98,7 @@ class PaymentRepository extends BaseRepository } /*Ensure payment number generated*/ - if (!$payment->number || strlen($payment->number) == 0) { + if (! $payment->number || strlen($payment->number) == 0) { $payment->number = $payment->client->getNextPaymentNumber($payment->client); } @@ -112,24 +111,22 @@ class PaymentRepository extends BaseRepository $invoice_totals = array_sum(array_column($data['invoices'], 'amount')); $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get(); - + $payment->invoices()->saveMany($invoices); foreach ($data['invoices'] as $paid_invoice) { - $invoice = Invoice::whereId($paid_invoice['invoice_id'])->first(); - if ($invoice) + if ($invoice) { $invoice = $invoice->service()->markSent()->applyPayment($payment, $paid_invoice['amount'])->save(); - + } } } else { //payment is made, but not to any invoice, therefore we are applying the payment to the clients paid_to_date only //01-07-2020 i think we were duplicating the paid to date here. - //$payment->client->service()->updatePaidToDate($payment->amount)->save(); + //$payment->client->service()->updatePaidToDate($payment->amount)->save(); } - if (array_key_exists('credits', $data) && is_array($data['credits'])) { $credit_totals = array_sum(array_column($data['credits'], 'amount')); @@ -170,14 +167,12 @@ class PaymentRepository extends BaseRepository return $payment->fresh(); } - /** * If the client is paying in a currency other than - * the company currency, we need to set a record + * the company currency, we need to set a record. */ private function processExchangeRates($data, $payment) { - $client = Client::find($data['client_id']); $client_currency = $client->getSetting('currency_id'); @@ -198,20 +193,21 @@ class PaymentRepository extends BaseRepository public function delete($payment) { //cannot double delete a payment - if($payment->is_deleted) + if ($payment->is_deleted) { return; + } $payment->service()->deletePayment(); return parent::delete($payment); - } public function restore($payment) { //we cannot restore a deleted payment. - if($payment->is_deleted) + if ($payment->is_deleted) { return; + } return parent::restore($payment); } diff --git a/app/Repositories/PaymentTermRepository.php b/app/Repositories/PaymentTermRepository.php index e106b87d9392..aacdbaf16711 100644 --- a/app/Repositories/PaymentTermRepository.php +++ b/app/Repositories/PaymentTermRepository.php @@ -1,6 +1,6 @@ first(); + return QuoteInvitation::whereRaw('BINARY `key`= ?', [$key])->first(); } } diff --git a/app/Repositories/RecurringInvoiceRepository.php b/app/Repositories/RecurringInvoiceRepository.php index 7df37e577da3..736390139992 100644 --- a/app/Repositories/RecurringInvoiceRepository.php +++ b/app/Repositories/RecurringInvoiceRepository.php @@ -1,6 +1,6 @@ fill($data); - + $invoice->save(); $invoice_calc = new InvoiceSum($invoice, $invoice->settings); $invoice = $invoice_calc->build()->getInvoice(); - + return $invoice; } } diff --git a/app/Repositories/RecurringQuoteRepository.php b/app/Repositories/RecurringQuoteRepository.php index ade9b554fb29..65e218e28dbe 100644 --- a/app/Repositories/RecurringQuoteRepository.php +++ b/app/Repositories/RecurringQuoteRepository.php @@ -1,6 +1,6 @@ fill($request->input()); - - $quote->save(); + $quote->save(); $quote_calc = new InvoiceSum($quote, $quote->settings); @@ -38,7 +37,7 @@ class RecurringQuoteRepository extends BaseRepository //fire events here that cascading from the saving of an Quote //ie. client balance update... - + return $quote; } } diff --git a/app/Repositories/TokenRepository.php b/app/Repositories/TokenRepository.php index 18aca4b3b7ac..03a6b6628c73 100644 --- a/app/Repositories/TokenRepository.php +++ b/app/Repositories/TokenRepository.php @@ -1,6 +1,6 @@ fill($data); $company_token->is_system = false; - + $company_token->save(); return $company_token; diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index ff3cd9af71b4..16e9d34ddc70 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -1,6 +1,6 @@ user()->company(); - $account = $company->account;; + $account = $company->account; /* If hosted and Enterprise we need to increment the num_users field on the accounts table*/ - if(!$user->id && $account->isEnterpriseClient()){ + if (! $user->id && $account->isEnterpriseClient()) { $account->num_users++; $account->save(); } @@ -73,7 +73,7 @@ class UserRepository extends BaseRepository $cu = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->withTrashed()->first(); /*No company user exists - attach the user*/ - if (!$cu) { + if (! $cu) { $data['company_user']['account_id'] = $account->id; $data['company_user']['notifications'] = CompanySettings::notificationDefaults(); $data['company_user']['is_migrating'] = $is_migrating; @@ -112,7 +112,7 @@ class UserRepository extends BaseRepository } $user->delete(); - + event(new UserWasDeleted($user, $company, Ninja::eventVars())); return $user->fresh(); @@ -134,10 +134,10 @@ class UserRepository extends BaseRepository $cu->delete(); } - $user->is_deleted=true; + $user->is_deleted = true; $user->save(); $user->delete(); - + event(new UserWasDeleted($user, $company, Ninja::eventVars())); return $user->fresh(); diff --git a/app/Repositories/VendorContactRepository.php b/app/Repositories/VendorContactRepository.php index ff879576d560..ba831d338a50 100644 --- a/app/Repositories/VendorContactRepository.php +++ b/app/Repositories/VendorContactRepository.php @@ -1,6 +1,6 @@ sortByDesc('is_primary')->map(function ($contact) { $contact['is_primary'] = $this->is_primary; $this->is_primary = false; + return $contact; }); @@ -47,7 +48,7 @@ class VendorContactRepository extends BaseRepository $update_contact = VendorContact::find($this->decodePrimaryKey($contact['id'])); } - if (!$update_contact) { + if (! $update_contact) { $update_contact = new VendorContact; $update_contact->vendor_id = $vendor->id; $update_contact->company_id = $vendor->company_id; @@ -60,8 +61,6 @@ class VendorContactRepository extends BaseRepository $update_contact->save(); }); - - //always made sure we have one blank contact to maintain state if ($contacts->count() == 0) { $new_contact = new VendorContact; diff --git a/app/Repositories/VendorRepository.php b/app/Repositories/VendorRepository.php index 7b4a0def4ee1..2611e9bc0099 100644 --- a/app/Repositories/VendorRepository.php +++ b/app/Repositories/VendorRepository.php @@ -1,6 +1,6 @@ save(); - if ($vendor->id_number == "" || !$vendor->id_number) { + if ($vendor->id_number == '' || ! $vendor->id_number) { $vendor->id_number = $this->getNextVendorNumber($vendor); } //todo write tests for this and make sure that custom vendor numbers also works as expected from here @@ -75,7 +75,6 @@ class VendorRepository extends BaseRepository $data['name'] = $vendor->present()->name(); } - return $vendor; } diff --git a/app/Services/AbstractService.php b/app/Services/AbstractService.php index f52209521e83..edb1a7230354 100644 --- a/app/Services/AbstractService.php +++ b/app/Services/AbstractService.php @@ -1,6 +1,6 @@ client = $client; - + $this->credit = $credit; } @@ -48,7 +47,6 @@ class ApplyNumber extends AbstractService $this->credit->number = $this->getNextCreditNumber($this->client); - return $this->credit; } } diff --git a/app/Services/Credit/CreateInvitations.php b/app/Services/Credit/CreateInvitations.php index ae49f48367cd..4a742effd293 100644 --- a/app/Services/Credit/CreateInvitations.php +++ b/app/Services/Credit/CreateInvitations.php @@ -1,6 +1,6 @@ whereCreditId($this->credit->id) ->first(); - if (!$invitation) { + if (! $invitation) { $ii = CreditInvitationFactory::create($this->credit->company_id, $this->credit->user_id); $ii->credit_id = $this->credit->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send_email) { + } elseif ($invitation && ! $contact->send_email) { $invitation->delete(); } }); diff --git a/app/Services/Credit/CreditService.php b/app/Services/Credit/CreditService.php index 10fbcb2fc93f..e161ff6c2764 100644 --- a/app/Services/Credit/CreditService.php +++ b/app/Services/Credit/CreditService.php @@ -1,6 +1,6 @@ contact) { + if (! $this->contact) { $this->contact = $this->credit->client->primary_contact()->first(); } - $path = $this->credit->client->credit_filepath(); + $path = $this->credit->client->credit_filepath(); + + $file_path = $path.$this->credit->number.'.pdf'; - $file_path = $path . $this->credit->number . '.pdf'; - $disk = config('filesystems.default'); - + $file = Storage::disk($disk)->exists($file_path); - if (!$file) { + if (! $file) { $file_path = CreateCreditPdf::dispatchNow($this->credit, $this->credit->company, $this->contact); } diff --git a/app/Services/Credit/MarkSent.php b/app/Services/Credit/MarkSent.php index 9595ec6569db..2e86b79c8b33 100644 --- a/app/Services/Credit/MarkSent.php +++ b/app/Services/Credit/MarkSent.php @@ -1,6 +1,6 @@ company_gateway = $company_gateway; - + $this->invoice = $invoice; $this->amount = $amount; @@ -47,19 +46,18 @@ class AddGatewayFee extends AbstractService $this->cleanPendingGatewayFees(); - if($gateway_fee > 0) + if ($gateway_fee > 0) { return $this->processGatewayFee($gateway_fee); + } return $this->processGatewayDiscount($gateway_fee); - - } private function cleanPendingGatewayFees() { $invoice_items = $this->invoice->line_items; - $invoice_items = collect($invoice_items)->filter(function ($item){ + $invoice_items = collect($invoice_items)->filter(function ($item) { return $item->type_id != '3'; }); @@ -77,8 +75,7 @@ class AddGatewayFee extends AbstractService $invoice_item->quantity = 1; $invoice_item->cost = $gateway_fee; - if($fees_and_limits = $this->company_gateway->getFeesAndLimits()) - { + if ($fees_and_limits = $this->company_gateway->getFeesAndLimits()) { $invoice_item->tax_rate1 = $fees_and_limits->fee_tax_rate1; $invoice_item->tax_rate2 = $fees_and_limits->fee_tax_rate2; $invoice_item->tax_rate3 = $fees_and_limits->fee_tax_rate3; @@ -97,7 +94,6 @@ class AddGatewayFee extends AbstractService //$this->invoice->ledger()->updateInvoiceBalance($gateway_fee, $notes = 'Gateway fee adjustment'); return $this->invoice; - } private function processGatewayDiscount($gateway_fee) @@ -109,8 +105,7 @@ class AddGatewayFee extends AbstractService $invoice_item->quantity = 1; $invoice_item->cost = $gateway_fee; - if($fees_and_limits = $this->company_gateway->getFeesAndLimits()) - { + if ($fees_and_limits = $this->company_gateway->getFeesAndLimits()) { $invoice_item->tax_rate1 = $fees_and_limits->fee_tax_rate1; $invoice_item->tax_rate2 = $fees_and_limits->fee_tax_rate2; $invoice_item->tax_rate3 = $fees_and_limits->fee_tax_rate3; diff --git a/app/Services/Invoice/ApplyNumber.php b/app/Services/Invoice/ApplyNumber.php index d75986b38380..ccd30dbdce74 100644 --- a/app/Services/Invoice/ApplyNumber.php +++ b/app/Services/Invoice/ApplyNumber.php @@ -1,6 +1,6 @@ client = $client; - + $this->invoice = $invoice; } @@ -53,7 +53,7 @@ class ApplyNumber extends AbstractService break; default: - # code... + // code... break; } diff --git a/app/Services/Invoice/ApplyPayment.php b/app/Services/Invoice/ApplyPayment.php index 05a0d0ac99d2..431cb00c6418 100644 --- a/app/Services/Invoice/ApplyPayment.php +++ b/app/Services/Invoice/ApplyPayment.php @@ -1,6 +1,6 @@ payment ->ledger() - ->updatePaymentBalance($this->payment_amount*-1); + ->updatePaymentBalance($this->payment_amount * -1); info("apply payment method - current client balance = {$this->payment->client->balance}"); info("reducing client balance by payment amount {$this->payment_amount}"); - $this->invoice->client->service()->updateBalance($this->payment_amount*-1)->save(); + $this->invoice->client->service()->updateBalance($this->payment_amount * -1)->save(); // $this->invoice->client->service()->updateBalance($this->payment_amount*-1)->updatePaidToDate($this->payment_amount)->save(); info("post client balance = {$this->invoice->client->balance}"); @@ -61,22 +61,23 @@ class ApplyPayment extends AbstractService if ($this->invoice->hasPartial()) { //is partial and amount is exactly the partial amount if ($this->invoice->partial == $this->payment_amount) { - $this->invoice->service()->clearPartial()->setDueDate()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount*-1); + $this->invoice->service()->clearPartial()->setDueDate()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount * -1); } elseif ($this->invoice->partial > 0 && $this->invoice->partial > $this->payment_amount) { //partial amount exists, but the amount is less than the partial amount - $this->invoice->service()->updatePartial($this->payment_amount*-1)->updateBalance($this->payment_amount*-1); + $this->invoice->service()->updatePartial($this->payment_amount * -1)->updateBalance($this->payment_amount * -1); } elseif ($this->invoice->partial > 0 && $this->invoice->partial < $this->payment_amount) { //partial exists and the amount paid is GREATER than the partial amount - $this->invoice->service()->clearPartial()->setDueDate()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount*-1); + $this->invoice->service()->clearPartial()->setDueDate()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount * -1); } } elseif ($this->payment_amount == $this->invoice->balance) { //total invoice paid. - $this->invoice->service()->clearPartial()->setStatus(Invoice::STATUS_PAID)->updateBalance($this->payment_amount*-1); + $this->invoice->service()->clearPartial()->setStatus(Invoice::STATUS_PAID)->updateBalance($this->payment_amount * -1); } elseif ($this->payment_amount < $this->invoice->balance) { //partial invoice payment made - $this->invoice->service()->clearPartial()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount*-1); + $this->invoice->service()->clearPartial()->setStatus(Invoice::STATUS_PARTIAL)->updateBalance($this->payment_amount * -1); } info("2 end of apply payment method the client balnace = {$this->invoice->client->balance}"); $this->invoice->service()->applyNumber()->save(); info("3 end of apply payment method the client balnace = {$this->invoice->client->balance}"); + return $this->invoice; } } diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 068a2d323230..ee76aa4a1973 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -1,6 +1,6 @@ invoice = $invoice; - + $this->client = $invoice->client; } public function run() { - - if(!$this->invoice->isPayable()) + if (! $this->invoice->isPayable()) { return $this->invoice; + } $this->invoice = $this->invoice->service()->markSent()->save(); - if($this->invoice->balance > 0) - $gateway_token = $this->getGateway($this->invoice->balance); - else + if ($this->invoice->balance > 0) { + $gateway_token = $this->getGateway($this->invoice->balance); + } else { return $this->invoice->service()->markPaid()->save(); + } - if(!$gateway_token || !$gateway_token->gateway->driver($this->client)->token_billing){ + if (! $gateway_token || ! $gateway_token->gateway->driver($this->client)->token_billing) { return $this->invoice; } - if($this->invoice->partial > 0){ + if ($this->invoice->partial > 0) { $fee = $gateway_token->gateway->calcGatewayFee($this->invoice->partial); // $amount = $this->invoice->partial + $fee; $amount = $this->invoice->partial; - } - else{ + } else { $fee = $gateway_token->gateway->calcGatewayFee($this->invoice->balance); // $amount = $this->invoice->balance + $fee; $amount = $this->invoice->balance; @@ -96,28 +95,25 @@ class AutoBillInvoice extends AbstractService /** * Harvests a client gateway token which passes the - * necessary filters for an $amount - * + * necessary filters for an $amount. + * * @param float $amount The amount to charge * @return ClientGatewayToken The client gateway token */ private function getGateway($amount) { - $gateway_tokens = $this->client->gateway_tokens()->orderBy('is_default', 'DESC')->get(); - foreach($gateway_tokens as $gateway_token) - { - if($this->validGatewayLimits($gateway_token, $amount)){ + foreach ($gateway_tokens as $gateway_token) { + if ($this->validGatewayLimits($gateway_token, $amount)) { return $gateway_token; } } - } /** - * Adds a gateway fee to the invoice - * + * Adds a gateway fee to the invoice. + * * @param float $fee The fee amount. */ private function addFeeToInvoice(float $fee) @@ -132,7 +128,7 @@ class AutoBillInvoice extends AbstractService $item->notes = ctrans('texts.online_payment_surcharge'); $item->type_id = 3; - $items = (array)$this->invoice->line_items; + $items = (array) $this->invoice->line_items; $items[] = $item; $this->invoice->line_items = $items; @@ -140,7 +136,7 @@ class AutoBillInvoice extends AbstractService $this->invoice = $this->invoice->calc()->getInvoice()->save(); - if($starting_amount != $this->invoice->amount && $this->invoice->status_id != Invoice::STATUS_DRAFT){ + if ($starting_amount != $this->invoice->amount && $this->invoice->status_id != Invoice::STATUS_DRAFT) { $this->invoice->client->service()->updateBalance($this->invoice->amount - $starting_amount)->save(); $this->invoice->ledger()->updateInvoiceBalance($this->invoice->amount - $starting_amount, 'Invoice balance updated after stale gateway fee removed')->save(); } @@ -149,9 +145,9 @@ class AutoBillInvoice extends AbstractService } /** - * Removes any existing unpaid gateway fees + * Removes any existing unpaid gateway fees * due to previous payment failure. - * + * * @return $this */ // private function purgeStaleGatewayFees() @@ -167,7 +163,7 @@ class AutoBillInvoice extends AbstractService // if($item->type_id != 3) // $new_items[] = $item; - + // } // $this->invoice->line_items = $new_items; @@ -186,31 +182,30 @@ class AutoBillInvoice extends AbstractService /** * Checks whether a given gateway token is able * to process the payment after passing through the - * fees and limits check - * + * fees and limits check. + * * @param CompanyGateway $cg The CompanyGateway instance * @param float $amount The amount to be paid * @return bool */ public function validGatewayLimits($cg, $amount) : bool { - if(isset($cg->fees_and_limits)) - $fees_and_limits = $cg->fees_and_limits->{"1"}; - else + if (isset($cg->fees_and_limits)) { + $fees_and_limits = $cg->fees_and_limits->{'1'}; + } else { return true; + } - if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) { - info("amount {$amount} less than ". $fees_and_limits->min_limit); - $passes = false; - } - else if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit){ - info("amount {$amount} greater than ". $fees_and_limits->max_limit); + if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) { + info("amount {$amount} less than ".$fees_and_limits->min_limit); $passes = false; - } - else + } elseif ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit) { + info("amount {$amount} greater than ".$fees_and_limits->max_limit); + $passes = false; + } else { $passes = true; + } return $passes; } - } diff --git a/app/Services/Invoice/CreateInvitations.php b/app/Services/Invoice/CreateInvitations.php index f9b3f4a3a28e..8f64ff34e69c 100644 --- a/app/Services/Invoice/CreateInvitations.php +++ b/app/Services/Invoice/CreateInvitations.php @@ -1,6 +1,6 @@ withTrashed() ->first(); - if (!$invitation && $contact->send_email) { + if (! $invitation && $contact->send_email) { $ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id); $ii->invoice_id = $this->invoice->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send_email) { + } elseif ($invitation && ! $contact->send_email) { $invitation->delete(); } }); diff --git a/app/Services/Invoice/GetInvoicePdf.php b/app/Services/Invoice/GetInvoicePdf.php index c6c4354636aa..6dba525fb1f1 100644 --- a/app/Services/Invoice/GetInvoicePdf.php +++ b/app/Services/Invoice/GetInvoicePdf.php @@ -1,6 +1,6 @@ contact) { + if (! $this->contact) { $this->contact = $this->invoice->client->primary_contact()->first(); } $invitation = $this->invoice->invitations->where('client_contact_id', $this->contact->id)->first(); - $path = $this->invoice->client->invoice_filepath(); + $path = $this->invoice->client->invoice_filepath(); - $file_path = $path . $this->invoice->number . '.pdf'; + $file_path = $path.$this->invoice->number.'.pdf'; - $disk = config('filesystems.default'); + $disk = config('filesystems.default'); - $file = Storage::disk($disk)->exists($file_path); + $file = Storage::disk($disk)->exists($file_path); - if (!$file) { + if (! $file) { $file_path = CreateInvoicePdf::dispatchNow($invitation); } diff --git a/app/Services/Invoice/HandleCancellation.php b/app/Services/Invoice/HandleCancellation.php index 360e3d8b1eb6..11c0668c4ed9 100644 --- a/app/Services/Invoice/HandleCancellation.php +++ b/app/Services/Invoice/HandleCancellation.php @@ -1,6 +1,6 @@ invoice->invoiceCancellable($this->invoice)) { + if (! $this->invoice->invoiceCancellable($this->invoice)) { return $this->invoice; } - $adjustment = $this->invoice->balance*-1; + $adjustment = $this->invoice->balance * -1; $this->backupCancellation($adjustment); //set invoice balance to 0 - $this->invoice->ledger()->updateInvoiceBalance($adjustment, "Invoice cancellation"); + $this->invoice->ledger()->updateInvoiceBalance($adjustment, 'Invoice cancellation'); $this->invoice->balance = 0; $this->invoice = $this->invoice->service()->setStatus(Invoice::STATUS_CANCELLED)->save(); //adjust client balance $this->invoice->client->service()->updateBalance($adjustment)->save(); - + event(new InvoiceWasCancelled($this->invoice, $this->invoice->company, Ninja::eventVars())); - return $this->invoice; } public function reverse() { - $cancellation = $this->invoice->backup->cancellation; - $adjustment = $cancellation->adjustment*-1; + $adjustment = $cancellation->adjustment * -1; - $this->invoice->ledger()->updateInvoiceBalance($adjustment, "Invoice cancellation REVERSAL"); + $this->invoice->ledger()->updateInvoiceBalance($adjustment, 'Invoice cancellation REVERSAL'); - /* Reverse the invoice status and balance */ + /* Reverse the invoice status and balance */ $this->invoice->balance += $adjustment; $this->invoice->status_id = $cancellation->status_id; @@ -86,19 +84,17 @@ class HandleCancellation extends AbstractService $this->invoice->save(); return $this->invoice; - } /** * Backup the cancellation in case we ever need to reverse it. - * + * * @param float $adjustment The amount the balance has been reduced by to cancel the invoice - * @return void + * @return void */ private function backupCancellation($adjustment) { - - if(!is_object($this->invoice->backup)){ + if (! is_object($this->invoice->backup)) { $backup = new \stdClass; $this->invoice->backup = $backup; } @@ -112,6 +108,5 @@ class HandleCancellation extends AbstractService $this->invoice->backup = $invoice_backup; $this->invoice->save(); - } } diff --git a/app/Services/Invoice/HandleReversal.php b/app/Services/Invoice/HandleReversal.php index 5fd0a3f52c36..5ee609a06086 100644 --- a/app/Services/Invoice/HandleReversal.php +++ b/app/Services/Invoice/HandleReversal.php @@ -1,6 +1,6 @@ invoice->invoiceReversable($this->invoice)) { + if (! $this->invoice->invoiceReversable($this->invoice)) { return $this->invoice; } /* If the invoice has been cancelled - we need to unwind the cancellation before reversing*/ - if($this->invoice->status_id == Invoice::STATUS_CANCELLED) + if ($this->invoice->status_id == Invoice::STATUS_CANCELLED) { $this->invoice = $this->invoice->service()->reverseCancellation()->save(); + } $balance_remaining = $this->invoice->balance; @@ -68,16 +69,16 @@ class HandleReversal extends AbstractService }); /* Generate a credit for the $total_paid amount */ - $notes = "Credit for reversal of ".$this->invoice->number; + $notes = 'Credit for reversal of '.$this->invoice->number; if ($total_paid > 0) { $credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id); $credit->client_id = $this->invoice->client_id; $credit->invoice_id = $this->invoice->id; - + $item = InvoiceItemFactory::create(); $item->quantity = 1; - $item->cost = (float)$total_paid; + $item->cost = (float) $total_paid; $item->notes = $notes; $line_items[] = $item; @@ -95,10 +96,11 @@ class HandleReversal extends AbstractService } /* Set invoice balance to 0 */ - if($this->invoice->balance != 0) - $this->invoice->ledger()->updateInvoiceBalance($balance_remaining*-1, $notes)->save(); + if ($this->invoice->balance != 0) { + $this->invoice->ledger()->updateInvoiceBalance($balance_remaining * -1, $notes)->save(); + } - $this->invoice->balance=0; + $this->invoice->balance = 0; /* Set invoice status to reversed... somehow*/ $this->invoice->service()->setStatus(Invoice::STATUS_REVERSED)->save(); @@ -107,17 +109,16 @@ class HandleReversal extends AbstractService /* Reduce the client balance by $balance_remaining */ $this->invoice->client->service() - ->updateBalance($balance_remaining*-1) - ->updatePaidToDate($total_paid*-1) + ->updateBalance($balance_remaining * -1) + ->updatePaidToDate($total_paid * -1) ->save(); event(new InvoiceWasReversed($this->invoice, $this->invoice->company, Ninja::eventVars())); - + return $this->invoice; //create a ledger row for this with the resulting Credit ( also include an explanation in the notes section ) } - // public function run2() // { @@ -149,9 +150,6 @@ class HandleReversal extends AbstractService // }); // //Unwinding any payments made to this invoice - - + // } } - - \ No newline at end of file diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 40471e2e26d2..97f96efb55a4 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -1,6 +1,6 @@ invoice = (new AddGatewayFee($company_gateway, $this->invoice, $amount))->run(); return $this; } + /** - * Update an invoice balance - * + * Update an invoice balance. + * * @param float $balance_adjustment The amount to adjust the invoice by * a negative amount will REDUCE the invoice balance, a positive amount will INCREASE * the invoice balance - * + * * @return InvoiceService Parent class object */ public function updateBalance($balance_adjustment) @@ -171,11 +171,12 @@ class InvoiceService /* One liners */ public function setDueDate() { - if($this->invoice->due_date != '' || $this->invoice->client->getSetting('payment_terms') == '') + if ($this->invoice->due_date != '' || $this->invoice->client->getSetting('payment_terms') == '') { return $this; + } $this->invoice->due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); - + return $this; } @@ -188,29 +189,24 @@ class InvoiceService public function toggleFeesPaid() { - $this->invoice->line_items = collect($this->invoice->line_items) ->map(function ($item) { + if ($item->type_id == '3') { + $item->type_id = '4'; + } - if($item->type_id == '3') - $item->type_id = '4'; - - return $item; - - })->toArray(); + return $item; + })->toArray(); return $this; } public function removeUnpaidGatewayFees() { - $this->invoice->line_items = collect($this->invoice->line_items) ->reject(function ($item) { - - return $item->type_id == '3'; - - })->toArray(); + return $item->type_id == '3'; + })->toArray(); return $this; } @@ -250,17 +246,15 @@ class InvoiceService break; default: - # code... + // code... break; } - + return $this; } - - /** - * Saves the invoice + * Saves the invoice. * @return Invoice object */ public function save() :?Invoice diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index 65cdb607400a..0e6ea9a54a0a 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -1,6 +1,6 @@ invoice->statud_id == Invoice::STATUS_PAID) + if ($this->invoice->statud_id == Invoice::STATUS_PAID) { return $this->invoice; + } /* Create Payment */ $payment = PaymentFactory::create($this->invoice->company_id, $this->invoice->user_id); @@ -62,11 +63,11 @@ class MarkPaid extends AbstractService $payment->save(); $payment->invoices()->attach($this->invoice->id, [ - 'amount' => $payment->amount + 'amount' => $payment->amount, ]); $this->invoice->service() - ->updateBalance($payment->amount*-1) + ->updateBalance($payment->amount * -1) ->setStatus(Invoice::STATUS_PAID) ->applyNumber() ->save(); @@ -76,10 +77,10 @@ class MarkPaid extends AbstractService event(new InvoiceWasPaid($this->invoice, $payment->company, Ninja::eventVars())); $payment->ledger() - ->updatePaymentBalance($payment->amount*-1); + ->updatePaymentBalance($payment->amount * -1); $this->client_service - ->updateBalance($payment->amount*-1) + ->updateBalance($payment->amount * -1) ->updatePaidToDate($payment->amount) ->save(); diff --git a/app/Services/Invoice/MarkSent.php b/app/Services/Invoice/MarkSent.php index 6442213bcb64..c3bd7c903d4d 100644 --- a/app/Services/Invoice/MarkSent.php +++ b/app/Services/Invoice/MarkSent.php @@ -1,6 +1,6 @@ invoice->ledger()->updateInvoiceBalance($this->invoice->balance); event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars())); - + return $this->invoice->fresh(); } } diff --git a/app/Services/Invoice/SendEmail.php b/app/Services/Invoice/SendEmail.php index 58a9bb17ebc5..ca523cbb7d61 100644 --- a/app/Services/Invoice/SendEmail.php +++ b/app/Services/Invoice/SendEmail.php @@ -1,6 +1,6 @@ invoice = $invoice; @@ -35,15 +35,14 @@ class SendEmail extends AbstractService $this->contact = $contact; } - /** - * Builds the correct template to send + * Builds the correct template to send. * @param string $reminder_template The template name ie reminder1 * @return array */ public function run() { - if (!$this->reminder_template) { + if (! $this->reminder_template) { $this->reminder_template = $this->invoice->calculateTemplate(); } diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index 786c79c52342..cde6974e022c 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -1,6 +1,6 @@ request = $request; - + $this->invoice = $invoice; } public function run() { - - if($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') { + if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') { $this->invoice = $this->invoice->service()->autoBill()->save(); } - - if($this->request->has('paid') && $this->request->input('paid') == 'true') { + + if ($this->request->has('paid') && $this->request->input('paid') == 'true') { $this->invoice = $this->invoice->service()->markPaid()->save(); } - if($this->request->has('send_email') && $this->request->input('send_email') == 'true') { + if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') { $this->sendEmail(); } - if($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true'){ + if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true') { $this->invoice = $this->invoice->service()->markSent()->save(); } @@ -69,17 +68,14 @@ class TriggeredActions extends AbstractService //$reminder_template = $this->invoice->calculateTemplate(); $reminder_template = 'payment'; - $this->invoice->invitations->load('contact.client.country','invoice.client.country','invoice.company')->each(function ($invitation) use($reminder_template){ - + $this->invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($reminder_template) { $email_builder = (new InvoiceEmail())->build($invitation, $reminder_template); EmailInvoice::dispatch($email_builder, $invitation, $this->invoice->company); - }); if ($this->invoice->invitations->count() > 0) { event(new InvoiceWasEmailed($this->invoice->invitations->first(), $this->invoice->company, Ninja::eventVars())); } - } } diff --git a/app/Services/Invoice/UpdateBalance.php b/app/Services/Invoice/UpdateBalance.php index 6decec7a7f7e..618853b97f7f 100644 --- a/app/Services/Invoice/UpdateBalance.php +++ b/app/Services/Invoice/UpdateBalance.php @@ -1,6 +1,6 @@ balance_adjustment = $balance_adjustment; } - public function run() { if ($this->invoice->is_deleted) { diff --git a/app/Services/Ledger/LedgerService.php b/app/Services/Ledger/LedgerService.php index be81a8854173..4f34a6ba77c1 100644 --- a/app/Services/Ledger/LedgerService.php +++ b/app/Services/Ledger/LedgerService.php @@ -1,6 +1,6 @@ balance; } - + $company_ledger = CompanyLedgerFactory::create($this->entity->company_id, $this->entity->user_id); $company_ledger->client_id = $this->entity->client_id; $company_ledger->adjustment = $adjustment; @@ -50,7 +50,7 @@ class LedgerService public function updatePaymentBalance($adjustment) { $balance = 0; - + /* Get the last record for the client and set the current balance*/ $company_ledger = $this->ledger(); diff --git a/app/Services/Notification/NotificationService.php b/app/Services/Notification/NotificationService.php index 89ec35d7af8c..42f4614f3b33 100644 --- a/app/Services/Notification/NotificationService.php +++ b/app/Services/Notification/NotificationService.php @@ -1,6 +1,6 @@ company->owner()->notify($this->notification); - + if ($is_system) { $this->notification->is_system = true; @@ -64,7 +64,7 @@ class NotificationService extends AbstractService } /** - * Hosted notifications + * Hosted notifications. * @return void */ public function ninja() diff --git a/app/Services/Payment/ApplyNumber.php b/app/Services/Payment/ApplyNumber.php index ac33ef3d455d..a1c5adad6692 100644 --- a/app/Services/Payment/ApplyNumber.php +++ b/app/Services/Payment/ApplyNumber.php @@ -1,6 +1,6 @@ client = $payment->client; - + $this->payment = $payment; } diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index 548237a90980..d9d145fb5d0d 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -1,6 +1,6 @@ setStatus(Payment::STATUS_CANCELLED) //sets status of payment ->updateCreditables() //return the credits first ->adjustInvoices() @@ -45,63 +43,52 @@ class DeletePayment ->save(); } - - //reverse paymentables->invoices - + //reverse paymentables->credits - - //set refunded to amount + + //set refunded to amount //set applied amount to 0 private function updateClient() { - $this->payment->client->service()->updatePaidToDate(-1*$this->payment->amount)->save(); + $this->payment->client->service()->updatePaidToDate(-1 * $this->payment->amount)->save(); return $this; } private function adjustInvoices() { - if ($this->payment->invoices()->exists()) - { - - $this->payment->invoices()->each(function ($paymentable_invoice){ - + if ($this->payment->invoices()->exists()) { + $this->payment->invoices()->each(function ($paymentable_invoice) { $paymentable_invoice->service()->updateBalance($paymentable_invoice->pivot->amount)->save(); $paymentable_invoice->ledger()->updateInvoiceBalance($paymentable_invoice->pivot->amount)->save(); $paymentable_invoice->client->service()->updateBalance($paymentable_invoice->pivot->amount)->save(); - - if(floatval($paymentable_invoice->balance) == 0) + + if (floatval($paymentable_invoice->balance) == 0) { $paymentable_invoice->service()->setStatus(Invoice::STATUS_SENT)->save(); - else + } else { $paymentable_invoice->service()->setStatus(Invoice::STATUS_PARTIAL)->save(); + } //fire event for this credit // }); - } - return $this; } private function updateCreditables() { - if ($this->payment->credits()->exists()) - { - - $this->payment->credits()->each(function ($paymentable_credit){ - + if ($this->payment->credits()->exists()) { + $this->payment->credits()->each(function ($paymentable_credit) { $paymentable_credit->balance += $paymentable_credit->pivot->amount; $paymentable_credit->setStatus(Credit::STATUS_SENT); //fire event for this credit // }); - - } return $this; @@ -113,9 +100,10 @@ class DeletePayment return $this; } + /** - * Saves the payment - * + * Saves the payment. + * * @return Payment $payment */ private function save() @@ -124,6 +112,4 @@ class DeletePayment return $this->payment; } - - } diff --git a/app/Services/Payment/PaymentService.php b/app/Services/Payment/PaymentService.php index 3ac7de0e4e37..94e06316fb8e 100644 --- a/app/Services/Payment/PaymentService.php +++ b/app/Services/Payment/PaymentService.php @@ -1,6 +1,6 @@ save(); $payment->invoices()->attach($invoice->id, [ - 'amount' => $payment->amount + 'amount' => $payment->amount, ]); return $payment; } - + public function sendEmail($contact = null) { return (new SendEmail($this->payment, $contact))->run(); @@ -70,7 +70,7 @@ class PaymentService $client->service() ->updateBalance($this->payment->amount) - ->updatePaidToDate($this->payment->amount*-1) + ->updatePaidToDate($this->payment->amount * -1) ->save(); } @@ -102,5 +102,4 @@ class PaymentService return $this->payment->fresh(); } - } diff --git a/app/Services/Payment/RefundPayment.php b/app/Services/Payment/RefundPayment.php index bb020019bd18..ac4e31a4c6d3 100644 --- a/app/Services/Payment/RefundPayment.php +++ b/app/Services/Payment/RefundPayment.php @@ -1,6 +1,6 @@ calculateTotalRefund() //sets amount for the refund (needed if we are refunding multiple invoices in one payment) ->setStatus() //sets status of payment //->reversePayment() @@ -66,14 +64,13 @@ class RefundPayment } /** - * Process the refund through the gateway - * - * @return $this + * Process the refund through the gateway. + * + * @return $this */ private function processGatewayRefund() { if ($this->refund_data['gateway_refund'] !== false && $this->total_refund > 0) { - if ($this->payment->company_gateway) { $response = $gateway->driver($this->payment->client)->refund($this->payment, $this->total_refund); @@ -95,10 +92,10 @@ class RefundPayment } /** - * Create the payment activity - * + * Create the payment activity. + * * @param json $notes gateway_transaction - * @return $this + * @return $this */ private function createActivity($notes) { @@ -125,49 +122,45 @@ class RefundPayment } /** - * Determine the amount of refund - * + * Determine the amount of refund. + * * @return $this */ private function calculateTotalRefund() { - - if (array_key_exists('invoices', $this->refund_data) && count($this->refund_data['invoices']) > 0) + if (array_key_exists('invoices', $this->refund_data) && count($this->refund_data['invoices']) > 0) { $this->total_refund = collect($this->refund_data['invoices'])->sum('amount'); - else + } else { $this->total_refund = $this->refund_data['amount']; + } return $this; - } /** - * Set the payment status + * Set the payment status. */ private function setStatus() { - - if ($this->refund_data['amount'] == $this->payment->amount) + if ($this->refund_data['amount'] == $this->payment->amount) { $this->payment->status_id = Payment::STATUS_REFUNDED; - else + } else { $this->payment->status_id = Payment::STATUS_PARTIALLY_REFUNDED; + } return $this; - } /** - * Update the paymentable records - * + * Update the paymentable records. + * * @return $this */ private function updatePaymentables() { if (isset($this->refund_data['invoices']) && count($this->refund_data['invoices']) > 0) { $this->payment->invoices->each(function ($paymentable_invoice) { - collect($this->refund_data['invoices'])->each(function ($refunded_invoice) use ($paymentable_invoice) { - if ($refunded_invoice['invoice_id'] == $paymentable_invoice->id) { $paymentable_invoice->pivot->refunded += $refunded_invoice['amount']; $paymentable_invoice->pivot->save(); @@ -180,14 +173,13 @@ class RefundPayment } /** - * If credits have been bundled in this payment, we - * need to reverse these - * - * @return $this + * If credits have been bundled in this payment, we + * need to reverse these. + * + * @return $this */ private function updateCreditables() { - if ($this->payment->credits()->exists()) { //Adjust credits first!!! foreach ($this->payment->credits as $paymentable_credit) { @@ -222,29 +214,27 @@ class RefundPayment } /** - * Reverse the payments made on invoices - * - * @return $this + * Reverse the payments made on invoices. + * + * @return $this */ private function adjustInvoices() { $adjustment_amount = 0; if (isset($this->refund_data['invoices']) && count($this->refund_data['invoices']) > 0) { - - foreach ($this->refund_data['invoices'] as $refunded_invoice) - { - + foreach ($this->refund_data['invoices'] as $refunded_invoice) { $invoice = Invoice::find($refunded_invoice['invoice_id']); $invoice->service()->updateBalance($refunded_invoice['amount'])->save(); $invoice->ledger()->updateInvoiceBalance($refunded_invoice['amount'], "Refund of payment # {$this->payment->number}")->save(); - if ($invoice->amount == $invoice->balance) + if ($invoice->amount == $invoice->balance) { $invoice->service()->setStatus(Invoice::STATUS_SENT); - else + } else { $invoice->service()->setStatus(Invoice::STATUS_PARTIAL); - + } + $invoice->save(); $client = $invoice->client; @@ -259,18 +249,17 @@ class RefundPayment // $ledger_string = "Refund for Invoice {$invoice->number} for amount " . $refunded_invoice['amount']; //todo // $this->credit_note->ledger()->updateCreditBalance($adjustment_amount, $ledger_string); - - $client = $this->payment->client->fresh(); - $client->service()->updatePaidToDate(-1*$this->total_refund)->save(); + $client = $this->payment->client->fresh(); + $client->service()->updatePaidToDate(-1 * $this->total_refund)->save(); } return $this; } /** - * Saves the payment - * + * Saves the payment. + * * @return Payment $payment */ private function save() @@ -351,5 +340,4 @@ class RefundPayment // return $this; // } - } diff --git a/app/Services/Payment/SendEmail.php b/app/Services/Payment/SendEmail.php index bbdeffcf43b8..0f923828ba2e 100644 --- a/app/Services/Payment/SendEmail.php +++ b/app/Services/Payment/SendEmail.php @@ -1,6 +1,6 @@ payment_hash->invoices(); - + $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->get(); - collect($paid_invoices)->each(function ($paid_invoice) use($invoices) { - - $invoice = $invoices->first(function ($inv) use($paid_invoice) { + collect($paid_invoices)->each(function ($paid_invoice) use ($invoices) { + $invoice = $invoices->first(function ($inv) use ($paid_invoice) { return $paid_invoice->invoice_id == $inv->hashed_id; }); - if($invoice->id == $this->payment_hash->fee_invoice_id) + if ($invoice->id == $this->payment_hash->fee_invoice_id) { $paid_amount = $paid_invoice->amount + $this->payment_hash->fee_total; - else + } else { $paid_amount = $paid_invoice->amount; + } $this->payment ->ledger() - ->updatePaymentBalance($paid_amount*-1); + ->updatePaymentBalance($paid_amount * -1); $this->payment ->client ->service() - ->updateBalance($paid_amount*-1) + ->updateBalance($paid_amount * -1) ->updatePaidToDate($paid_amount) ->save(); - $pivot_invoice = $this->payment->invoices->first(function ($inv) use($paid_invoice){ - return $inv->hashed_id == $paid_invoice->invoice_id; + $pivot_invoice = $this->payment->invoices->first(function ($inv) use ($paid_invoice) { + return $inv->hashed_id == $paid_invoice->invoice_id; }); /*update paymentable record*/ $pivot_invoice->pivot->amount = $paid_amount; $pivot_invoice->save(); - $invoice->service() //caution what if we amount paid was less than partial - we wipe it! + $invoice->service() //caution what if we amount paid was less than partial - we wipe it! ->clearPartial() - ->updateBalance($paid_amount*-1) + ->updateBalance($paid_amount * -1) ->save(); event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); - }); return $this->payment; diff --git a/app/Services/PdfMaker/Design.php b/app/Services/PdfMaker/Design.php index f97c85ed0cbe..aa20b4c36133 100644 --- a/app/Services/PdfMaker/Design.php +++ b/app/Services/PdfMaker/Design.php @@ -1,7 +1,7 @@ design + $path.$this->design ); } @@ -153,7 +153,7 @@ class Design extends BaseDesign foreach ($variables as $variable) { $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'elements' => [ - ['element' => 'th', 'content' => $variable . '_label'], + ['element' => 'th', 'content' => $variable.'_label'], ['element' => 'th', 'content' => $variable], ]]; } @@ -177,7 +177,7 @@ class Design extends BaseDesign $elements = []; foreach ($this->context['pdf_variables']["{$this->type}_columns"] as $column) { - $elements[] = ['element' => 'th', 'content' => $column . '_label']; + $elements[] = ['element' => 'th', 'content' => $column.'_label']; } return $elements; @@ -223,7 +223,7 @@ class Design extends BaseDesign $elements[] = ['element' => 'tr', 'elements' => [ ['element' => 'td', 'properties' => ['colspan' => $this->calculateColspan(2)]], - ['element' => 'td', 'content' => $variable . '_label'], + ['element' => 'td', 'content' => $variable.'_label'], ['element' => 'td', 'content' => $variable], ]]; } diff --git a/app/Services/PdfMaker/Designs/Utilities/BaseDesign.php b/app/Services/PdfMaker/Designs/Utilities/BaseDesign.php index c567f20f235c..f445dc9b96a1 100644 --- a/app/Services/PdfMaker/Designs/Utilities/BaseDesign.php +++ b/app/Services/PdfMaker/Designs/Utilities/BaseDesign.php @@ -1,7 +1,7 @@ context['pdf_variables']['product_columns'])) { + if (in_array('$product.tax', (array) $this->context['pdf_variables']['product_columns'])) { $line_items = collect($this->entity->line_items); $tax1 = $line_items->where('tax_name1', '<>', '')->where('type_id', 1)->count(); @@ -126,23 +126,23 @@ trait DesignHelpers /** * Calculates the remaining colspans. - * - * @param int $taken - * @return int + * + * @param int $taken + * @return int */ public function calculateColspan(int $taken): int { $total = (int) count($this->context['pdf_variables']['product_columns']); - return (int)$total - $taken; + return (int) $total - $taken; } /** * Return "true" or "false" based on null or empty check. * We need to return false as string because of HTML parsing. - * - * @param mixed $property - * @return string + * + * @param mixed $property + * @return string */ public function toggleHiddenProperty($property): string { diff --git a/app/Services/PdfMaker/PdfMaker.php b/app/Services/PdfMaker/PdfMaker.php index e399f8b2892a..3958e1d7a323 100644 --- a/app/Services/PdfMaker/PdfMaker.php +++ b/app/Services/PdfMaker/PdfMaker.php @@ -1,7 +1,7 @@ document->getElementsByTagName($element['tag'])->item(0); - } elseif(!is_null($this->document->getElementById($element['id']))) { + } elseif (! is_null($this->document->getElementById($element['id']))) { $node = $this->document->getElementById($element['id']); } else { continue; @@ -80,7 +80,7 @@ trait PdfMakerUtilities $processed = []; foreach ($children as $child) { - if (!isset($child['order'])) { + if (! isset($child['order'])) { $child['order'] = 0; } @@ -97,10 +97,10 @@ trait PdfMakerUtilities public function updateElementProperty($element, string $attribute, string $value) { // We have exception for "hidden" property. - // hidden="true" or hidden="false" will both hide the element, + // hidden="true" or hidden="false" will both hide the element, // that's why we have to create an exception here for this rule. - if ($attribute == 'hidden' && ($value == false || $value == "false")) { + if ($attribute == 'hidden' && ($value == false || $value == 'false')) { return $element; } @@ -163,7 +163,7 @@ trait PdfMakerUtilities public function processOptions() { - if (!isset($this->options['all_pages_header']) && !isset($this->options['all_pages_footer'])) { + if (! isset($this->options['all_pages_header']) && ! isset($this->options['all_pages_footer'])) { return; } @@ -173,7 +173,7 @@ trait PdfMakerUtilities public function insertPrintCSS() { - $css = << @@ -270,7 +270,6 @@ trait PdfMakerUtilities isset($this->data['options']['all_pages_header']) && $this->data['options']['all_pages_header'] ) { - $header = $this->document->getElementById('header'); $clone = $header->cloneNode(true); diff --git a/app/Services/Quote/ApplyNumber.php b/app/Services/Quote/ApplyNumber.php index d81162809e5e..15cdff844f33 100644 --- a/app/Services/Quote/ApplyNumber.php +++ b/app/Services/Quote/ApplyNumber.php @@ -1,6 +1,6 @@ fresh(); - $invoice->service() + $invoice->service() ->markSent() ->createInvitations() ->save(); @@ -46,7 +46,7 @@ class ConvertQuote $quote->invoice_id = $invoice->id; $quote->status_id = Quote::STATUS_CONVERTED; $quote->save(); - + // maybe should return invoice here return $invoice; } diff --git a/app/Services/Quote/CreateInvitations.php b/app/Services/Quote/CreateInvitations.php index 28ec4b74a4cb..926ece634d70 100644 --- a/app/Services/Quote/CreateInvitations.php +++ b/app/Services/Quote/CreateInvitations.php @@ -1,6 +1,6 @@ whereQuoteId($quote->id) ->first(); - if (!$invitation && $contact->send_email) { + if (! $invitation && $contact->send_email) { $ii = QuoteInvitationFactory::create($quote->company_id, $quote->user_id); $ii->quote_id = $quote->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send_email) { + } elseif ($invitation && ! $contact->send_email) { $invitation->delete(); } }); diff --git a/app/Services/Quote/GetQuotePdf.php b/app/Services/Quote/GetQuotePdf.php index 92a46ef59983..2625679c5b38 100644 --- a/app/Services/Quote/GetQuotePdf.php +++ b/app/Services/Quote/GetQuotePdf.php @@ -1,6 +1,6 @@ contact) { + if (! $this->contact) { $this->contact = $this->quote->client->primary_contact()->first(); } $invitation = $this->quote->invitations->where('client_contact_id', $this->contact->id)->first(); - $path = $this->quote->client->invoice_filepath(); + $path = $this->quote->client->invoice_filepath(); - $file_path = $path . $this->quote->number . '.pdf'; + $file_path = $path.$this->quote->number.'.pdf'; - $disk = config('filesystems.default'); + $disk = config('filesystems.default'); - $file = Storage::disk($disk)->exists($file_path); + $file = Storage::disk($disk)->exists($file_path); - if (!$file) { + if (! $file) { $file_path = CreateQuotePdf::dispatchNow($invitation); } diff --git a/app/Services/Quote/MarkApproved.php b/app/Services/Quote/MarkApproved.php index 265cd13c0d79..3d04a623cfd9 100644 --- a/app/Services/Quote/MarkApproved.php +++ b/app/Services/Quote/MarkApproved.php @@ -1,6 +1,6 @@ quote->invoice_id) + if ($this->quote->invoice_id) { return $this; + } $convert_quote = new ConvertQuote($this->quote->client); @@ -69,7 +70,7 @@ class QuoteService return (new GetQuotePdf($this->quote, $contact))->run(); } - public function sendEmail($contact = null) :QuoteService + public function sendEmail($contact = null) :self { $send_email = new SendEmail($this->quote, null, $contact); @@ -79,10 +80,10 @@ class QuoteService } /** - * Applies the invoice number + * Applies the invoice number. * @return $this InvoiceService object */ - public function applyNumber() :QuoteService + public function applyNumber() :self { $apply_number = new ApplyNumber($this->quote->client); @@ -91,7 +92,7 @@ class QuoteService return $this; } - public function markSent() :QuoteService + public function markSent() :self { $mark_sent = new MarkSent($this->quote->client, $this->quote); @@ -100,14 +101,14 @@ class QuoteService return $this; } - public function setStatus($status) :QuoteService + public function setStatus($status) :self { $this->quote->status_id = $status; return $this; } - public function approve() :QuoteService + public function approve() :self { $this->setStatus(Quote::STATUS_APPROVED)->save(); @@ -139,17 +140,19 @@ class QuoteService public function isConvertable() :bool { - if($this->quote->invoice_id) + if ($this->quote->invoice_id) { return false; + } - if($this->quote->status_id == Quote::STATUS_EXPIRED) + if ($this->quote->status_id == Quote::STATUS_EXPIRED) { return false; + } return true; } /** - * Saves the quote + * Saves the quote. * @return Quote|null */ public function save() : ?Quote diff --git a/app/Services/Quote/SendEmail.php b/app/Services/Quote/SendEmail.php index 75203fb6bbef..e030cec6da9e 100644 --- a/app/Services/Quote/SendEmail.php +++ b/app/Services/Quote/SendEmail.php @@ -1,6 +1,6 @@ reminder_template The template name ie reminder1 * @return array */ public function run() { - if (!$this->reminder_template) { + if (! $this->reminder_template) { $this->reminder_template = $this->quote->calculateTemplate(); } diff --git a/app/Services/Recurring/RecurringService.php b/app/Services/Recurring/RecurringService.php index 353a37ac3b7f..0dd6efdc4ca4 100644 --- a/app/Services/Recurring/RecurringService.php +++ b/app/Services/Recurring/RecurringService.php @@ -1,6 +1,6 @@ (string)$this->encodePrimaryKey($account->id), + 'id' => (string) $this->encodePrimaryKey($account->id), 'default_url' => config('ninja.app_url'), 'plan' => $account->getPlan(), 'plan_term' => (string) $account->plan_terms, @@ -75,11 +74,11 @@ class AccountTransformer extends EntityTransformer 'utm_content' => (string) $account->utm_content, 'utm_term' => (string) $account->utm_term, 'referral_code' => (string) $account->referral_code, - 'latest_version' => (string)$account->latest_version, - 'current_version' => (string)config('ninja.app_version'), - 'updated_at' => (int)$account->updated_at, - 'archived_at' => (int)$account->deleted_at, - 'report_errors' => (bool)$account->report_errors, + 'latest_version' => (string) $account->latest_version, + 'current_version' => (string) config('ninja.app_version'), + 'updated_at' => (int) $account->updated_at, + 'archived_at' => (int) $account->deleted_at, + 'report_errors' => (bool) $account->report_errors, ]; } @@ -100,6 +99,7 @@ class AccountTransformer extends EntityTransformer public function includeUser(Account $account) { $transformer = new UserTransformer($this->serializer); + return $this->includeItem(auth()->user(), $transformer, User::class); // return $this->includeItem($account->default_company->owner(), $transformer, User::class); diff --git a/app/Transformers/ActivityTransformer.php b/app/Transformers/ActivityTransformer.php index e07161f0e9fc..887f0b776c34 100644 --- a/app/Transformers/ActivityTransformer.php +++ b/app/Transformers/ActivityTransformer.php @@ -1,6 +1,6 @@ $activity->invoice_id ? (string) $this->encodePrimaryKey($activity->invoice_id) : '', 'payment_id' => $activity->payment_id ? (string) $this->encodePrimaryKey($activity->payment_id) : '', 'credit_id' => $activity->credit_id ? (string) $this->encodePrimaryKey($activity->credit_id) : '', - 'updated_at' => (int)$activity->updated_at, - 'created_at' => (int)$activity->created_at, + 'updated_at' => (int) $activity->updated_at, + 'created_at' => (int) $activity->created_at, 'expense_id' => $activity->expense_id ? (string) $this->encodePrimaryKey($activity->expense_id) : '', 'is_system' => (bool) $activity->is_system, 'contact_id' => $activity->contact_id ? (string) $this->encodePrimaryKey($activity->contact_id) : '', diff --git a/app/Transformers/ArraySerializer.php b/app/Transformers/ArraySerializer.php index 2cff0872c35c..67e91550dede 100644 --- a/app/Transformers/ArraySerializer.php +++ b/app/Transformers/ArraySerializer.php @@ -1,6 +1,6 @@ $contact->first_name ?: '', 'last_name' => $contact->last_name ?: '', 'email' => $contact->email ?: '', - 'created_at' => (int)$contact->created_at, - 'updated_at' => (int)$contact->updated_at, - 'archived_at' => (int)$contact->deleted_at, + 'created_at' => (int) $contact->created_at, + 'updated_at' => (int) $contact->updated_at, + 'archived_at' => (int) $contact->deleted_at, 'is_primary' => (bool) $contact->is_primary, 'is_locked' => (bool) $contact->is_locked, 'phone' => $contact->phone ?: '', diff --git a/app/Transformers/ClientContactTransformer.php b/app/Transformers/ClientContactTransformer.php index e6dcb0812c15..6161c383f4e0 100644 --- a/app/Transformers/ClientContactTransformer.php +++ b/app/Transformers/ClientContactTransformer.php @@ -1,6 +1,6 @@ $contact->first_name ?: '', 'last_name' => $contact->last_name ?: '', 'email' => $contact->email ?: '', - 'created_at' => (int)$contact->created_at, - 'updated_at' => (int)$contact->updated_at, - 'archived_at' => (int)$contact->deleted_at, + 'created_at' => (int) $contact->created_at, + 'updated_at' => (int) $contact->updated_at, + 'archived_at' => (int) $contact->deleted_at, 'is_primary' => (bool) $contact->is_primary, 'is_locked' => (bool) $contact->is_locked, 'phone' => $contact->phone ?: '', @@ -46,7 +45,7 @@ class ClientContactTransformer extends EntityTransformer 'custom_value4' => $contact->custom_value4 ?: '', 'contact_key' => $contact->contact_key ?: '', 'send_email' => (bool) $contact->send_email, - 'last_login' => (int)$contact->last_login, + 'last_login' => (int) $contact->last_login, 'password' => empty($contact->password) ? '' : '**********', ]; } diff --git a/app/Transformers/ClientGatewayTokenTransformer.php b/app/Transformers/ClientGatewayTokenTransformer.php index 69a22bd69220..f084768bc2bc 100644 --- a/app/Transformers/ClientGatewayTokenTransformer.php +++ b/app/Transformers/ClientGatewayTokenTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($cgt->id), - 'token' => (string)$cgt->token ?: '', + 'token' => (string) $cgt->token ?: '', 'gateway_customer_reference' => $cgt->gateway_customer_reference ?: '', - 'gateway_type_id' => (string)$cgt->gateway_type_id ?: '', - 'company_gateway_id' => (string)$this->encodePrimaryKey($cgt->company_gateway_id) ?: '', + 'gateway_type_id' => (string) $cgt->gateway_type_id ?: '', + 'company_gateway_id' => (string) $this->encodePrimaryKey($cgt->company_gateway_id) ?: '', 'is_default' => (bool) $cgt->is_default, 'meta' => $cgt->meta, - 'created_at' => (int)$cgt->created_at, - 'updated_at' => (int)$cgt->updated_at, - 'archived_at' => (int)$cgt->deleted_at, + 'created_at' => (int) $cgt->created_at, + 'updated_at' => (int) $cgt->updated_at, + 'archived_at' => (int) $cgt->deleted_at, 'is_deleted' => (bool) $cgt->is_deleted, ]; } diff --git a/app/Transformers/ClientTransformer.php b/app/Transformers/ClientTransformer.php index cc533fc253c3..8e331ddbc089 100644 --- a/app/Transformers/ClientTransformer.php +++ b/app/Transformers/ClientTransformer.php @@ -1,6 +1,6 @@ includeCollection($client->documents, $transformer, Document::class); } - + /** * @param Client $client * @@ -117,11 +116,11 @@ class ClientTransformer extends EntityTransformer 'website' => $client->website ?: '', 'private_notes' => $client->private_notes ?: '', 'balance' => (float) $client->balance, - 'group_settings_id' => isset($client->group_settings_id) ? (string)$this->encodePrimaryKey($client->group_settings_id) : '', + 'group_settings_id' => isset($client->group_settings_id) ? (string) $this->encodePrimaryKey($client->group_settings_id) : '', 'paid_to_date' => (float) $client->paid_to_date, 'credit_balance' => (float) $client->credit_balance, - 'last_login' => (int)$client->last_login, - 'size_id' => (string)$client->size_id, + 'last_login' => (int) $client->last_login, + 'size_id' => (string) $client->size_id, 'public_notes' => $client->public_notes ?: '', // 'currency_id' => (string)$client->currency_id, 'address1' => $client->address1 ?: '', @@ -130,8 +129,8 @@ class ClientTransformer extends EntityTransformer 'city' => $client->city ?: '', 'state' => $client->state ?: '', 'postal_code' => $client->postal_code ?: '', - 'country_id' => (string)$client->country_id ?: '', - 'industry_id' => (string)$client->industry_id ?: '', + 'country_id' => (string) $client->country_id ?: '', + 'industry_id' => (string) $client->industry_id ?: '', 'custom_value1' => $client->custom_value1 ?: '', 'custom_value2' => $client->custom_value2 ?: '', 'custom_value3' => $client->custom_value3 ?: '', @@ -141,15 +140,15 @@ class ClientTransformer extends EntityTransformer 'shipping_city' => $client->shipping_city ?: '', 'shipping_state' => $client->shipping_state ?: '', 'shipping_postal_code' => $client->shipping_postal_code ?: '', - 'shipping_country_id' => (string)$client->shipping_country_id ?: '', + 'shipping_country_id' => (string) $client->shipping_country_id ?: '', 'settings' => $client->settings ?: new \stdClass, 'is_deleted' => (bool) $client->is_deleted, 'vat_number' => $client->vat_number ?: '', 'id_number' => $client->id_number ?: '', - 'updated_at' => (int)$client->updated_at, - 'archived_at' => (int)$client->deleted_at, - 'created_at' => (int)$client->created_at, - 'display_name' => $client->present()->name() + 'updated_at' => (int) $client->updated_at, + 'archived_at' => (int) $client->deleted_at, + 'created_at' => (int) $client->created_at, + 'display_name' => $client->present()->name(), ]; } } diff --git a/app/Transformers/CompanyGatewayTransformer.php b/app/Transformers/CompanyGatewayTransformer.php index 234190f74966..64e87a1ed9e4 100644 --- a/app/Transformers/CompanyGatewayTransformer.php +++ b/app/Transformers/CompanyGatewayTransformer.php @@ -1,6 +1,6 @@ (string)$this->encodePrimaryKey($company_gateway->id), - 'gateway_key' => (string)$company_gateway->gateway_key ?: '', - 'accepted_credit_cards' => (int)$company_gateway->accepted_credit_cards, - 'require_cvv' => (bool)$company_gateway->require_cvv, - 'show_billing_address' => (bool)$company_gateway->show_billing_address, - 'show_shipping_address' => (bool)$company_gateway->show_shipping_address, - 'update_details' => (bool)$company_gateway->update_details, + 'id' => (string) $this->encodePrimaryKey($company_gateway->id), + 'gateway_key' => (string) $company_gateway->gateway_key ?: '', + 'accepted_credit_cards' => (int) $company_gateway->accepted_credit_cards, + 'require_cvv' => (bool) $company_gateway->require_cvv, + 'show_billing_address' => (bool) $company_gateway->show_billing_address, + 'show_shipping_address' => (bool) $company_gateway->show_shipping_address, + 'update_details' => (bool) $company_gateway->update_details, 'config' => (string) $company_gateway->getConfigTransformed(), 'fees_and_limits' => $company_gateway->fees_and_limits ?: new \stdClass, - 'updated_at' => (int)$company_gateway->updated_at, - 'archived_at' => (int)$company_gateway->deleted_at, - 'created_at' => (int)$company_gateway->created_at, - 'is_deleted' => (bool)$company_gateway->is_deleted, + 'updated_at' => (int) $company_gateway->updated_at, + 'archived_at' => (int) $company_gateway->deleted_at, + 'created_at' => (int) $company_gateway->created_at, + 'is_deleted' => (bool) $company_gateway->is_deleted, 'custom_value1' => $company_gateway->custom_value1 ?: '', 'custom_value2' => $company_gateway->custom_value2 ?: '', 'custom_value3' => $company_gateway->custom_value3 ?: '', 'custom_value4' => $company_gateway->custom_value4 ?: '', - 'label' => (string)$company_gateway->label ?: '', - 'token_billing' => (string)$company_gateway->token_billing, - 'test_mode' => (bool)$company_gateway->isTestMode(), + 'label' => (string) $company_gateway->label ?: '', + 'token_billing' => (string) $company_gateway->token_billing, + 'test_mode' => (bool) $company_gateway->isTestMode(), ]; } diff --git a/app/Transformers/CompanyLedgerTransformer.php b/app/Transformers/CompanyLedgerTransformer.php index a9137e170679..d5214b7fca35 100644 --- a/app/Transformers/CompanyLedgerTransformer.php +++ b/app/Transformers/CompanyLedgerTransformer.php @@ -1,6 +1,6 @@ company_ledgerable_type)) . '_id'; + $entity_name = lcfirst(class_basename($company_ledger->company_ledgerable_type)).'_id'; + return [ - $entity_name => (string)$this->encodePrimaryKey($company_ledger->company_ledgerable_id), - 'notes' => (string)$company_ledger->notes ?: '', + $entity_name => (string) $this->encodePrimaryKey($company_ledger->company_ledgerable_id), + 'notes' => (string) $company_ledger->notes ?: '', 'balance' => (float) $company_ledger->balance, 'adjustment' => (float) $company_ledger->adjustment, - 'activity_id' => (int)$company_ledger->activity_id, - 'created_at' => (int)$company_ledger->created_at, - 'updated_at' => (int)$company_ledger->updated_at, - 'archived_at' => (int)$company_ledger->deleted_at, + 'activity_id' => (int) $company_ledger->activity_id, + 'created_at' => (int) $company_ledger->created_at, + 'updated_at' => (int) $company_ledger->updated_at, + 'archived_at' => (int) $company_ledger->deleted_at, ]; } } diff --git a/app/Transformers/CompanyTokenHashedTransformer.php b/app/Transformers/CompanyTokenHashedTransformer.php index 46b755c08d4c..69b16e40e8d8 100644 --- a/app/Transformers/CompanyTokenHashedTransformer.php +++ b/app/Transformers/CompanyTokenHashedTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($company_token->id), 'user_id' => $this->encodePrimaryKey($company_token->user_id), - 'token' => substr($company_token->token, 0 ,10)."xxxxxxxxxxx", + 'token' => substr($company_token->token, 0, 10).'xxxxxxxxxxx', 'name' => $company_token->name ?: '', - 'is_system' =>(bool)$company_token->is_system, - 'updated_at' => (int)$company_token->updated_at, - 'archived_at' => (int)$company_token->deleted_at, - 'created_at' => (int)$company_token->created_at, - 'is_deleted' => (bool)$company_token->is_deleted, + 'is_system' =>(bool) $company_token->is_system, + 'updated_at' => (int) $company_token->updated_at, + 'archived_at' => (int) $company_token->deleted_at, + 'created_at' => (int) $company_token->created_at, + 'is_deleted' => (bool) $company_token->is_deleted, ]; } } diff --git a/app/Transformers/CompanyTokenTransformer.php b/app/Transformers/CompanyTokenTransformer.php index cd41378703bc..daeb986042fe 100644 --- a/app/Transformers/CompanyTokenTransformer.php +++ b/app/Transformers/CompanyTokenTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($company_token->user_id), 'token' => $company_token->token, 'name' => $company_token->name ?: '', - 'is_system' =>(bool)$company_token->is_system, - 'updated_at' => (int)$company_token->updated_at, - 'archived_at' => (int)$company_token->deleted_at, - 'created_at' => (int)$company_token->created_at, - 'is_deleted' => (bool)$company_token->is_deleted, + 'is_system' =>(bool) $company_token->is_system, + 'updated_at' => (int) $company_token->updated_at, + 'archived_at' => (int) $company_token->deleted_at, + 'created_at' => (int) $company_token->created_at, + 'is_deleted' => (bool) $company_token->is_deleted, ]; } } diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index 1863a6a780b8..bd1de6b65de0 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -1,6 +1,6 @@ (string)$this->encodePrimaryKey($company->id), - 'company_key' => (string)$company->company_key ?: '', - 'update_products' => (bool)$company->update_products, - 'fill_products' => (bool)$company->fill_products, - 'convert_products' => (bool)$company->convert_products, - 'custom_surcharge_taxes1' => (bool)$company->custom_surcharge_taxes1, - 'custom_surcharge_taxes2' => (bool)$company->custom_surcharge_taxes2, - 'custom_surcharge_taxes3' => (bool)$company->custom_surcharge_taxes3, - 'custom_surcharge_taxes4' => (bool)$company->custom_surcharge_taxes4, - 'show_product_cost' => (bool)$company->show_product_cost, - 'enable_product_cost' => (bool)$company->enable_product_cost, - 'show_product_details' => (bool)$company->show_product_details, - 'enable_product_quantity' => (bool)$company->enable_product_quantity, - 'default_quantity' => (bool)$company->default_quantity, + 'id' => (string) $this->encodePrimaryKey($company->id), + 'company_key' => (string) $company->company_key ?: '', + 'update_products' => (bool) $company->update_products, + 'fill_products' => (bool) $company->fill_products, + 'convert_products' => (bool) $company->convert_products, + 'custom_surcharge_taxes1' => (bool) $company->custom_surcharge_taxes1, + 'custom_surcharge_taxes2' => (bool) $company->custom_surcharge_taxes2, + 'custom_surcharge_taxes3' => (bool) $company->custom_surcharge_taxes3, + 'custom_surcharge_taxes4' => (bool) $company->custom_surcharge_taxes4, + 'show_product_cost' => (bool) $company->show_product_cost, + 'enable_product_cost' => (bool) $company->enable_product_cost, + 'show_product_details' => (bool) $company->show_product_details, + 'enable_product_quantity' => (bool) $company->enable_product_quantity, + 'default_quantity' => (bool) $company->default_quantity, 'custom_fields' => $company->custom_fields ?: $std, 'size_id' => (string) $company->size_id ?: '', 'industry_id' => (string) $company->industry_id ?: '', @@ -128,14 +127,14 @@ class CompanyTransformer extends EntityTransformer 'portal_mode' => (string) $company->portal_mode ?: '', 'portal_domain' => (string) $company->portal_domain ?: '', 'settings' => $company->settings ?: '', - 'enabled_tax_rates' => (int)$company->enabled_tax_rates, - 'enabled_modules' => (int)$company->enabled_modules, - 'updated_at' => (int)$company->updated_at, - 'archived_at' => (int)$company->deleted_at, - 'created_at' =>(int)$company->created_at, - 'slack_webhook_url' => (string)$company->slack_webhook_url, - 'google_analytics_url' => (string)$company->google_analytics_key, //@deprecate - 'google_analytics_key' => (string)$company->google_analytics_key, + 'enabled_tax_rates' => (int) $company->enabled_tax_rates, + 'enabled_modules' => (int) $company->enabled_modules, + 'updated_at' => (int) $company->updated_at, + 'archived_at' => (int) $company->deleted_at, + 'created_at' =>(int) $company->created_at, + 'slack_webhook_url' => (string) $company->slack_webhook_url, + 'google_analytics_url' => (string) $company->google_analytics_key, //@deprecate + 'google_analytics_key' => (string) $company->google_analytics_key, 'enabled_item_tax_rates' => (int) $company->enabled_item_tax_rates, 'client_can_register' => (bool) $company->client_can_register, 'is_large' => (bool) $company->is_large, @@ -308,7 +307,7 @@ class CompanyTransformer extends EntityTransformer { $transformer = new PaymentTermTransformer($this->serializer); - return $this->includeCollection($company->payment_terms()->get(), $transformer, PaymentTerm::class); + return $this->includeCollection($company->payment_terms()->get(), $transformer, PaymentTerm::class); } public function includeSystemLogs(Company $company) diff --git a/app/Transformers/CompanyUserTransformer.php b/app/Transformers/CompanyUserTransformer.php index ea1e71e6456f..7e0afe76b65c 100644 --- a/app/Transformers/CompanyUserTransformer.php +++ b/app/Transformers/CompanyUserTransformer.php @@ -1,6 +1,6 @@ $company_user->permissions ?: '', - 'notifications' => (object)$company_user->notifications, - 'settings' => (object)$company_user->settings, + 'notifications' => (object) $company_user->notifications, + 'settings' => (object) $company_user->settings, 'is_owner' => (bool) $company_user->is_owner, 'is_admin' => (bool) $company_user->is_admin, 'is_locked' => (bool) $company_user->is_locked, - 'updated_at' => (int)$company_user->updated_at, - 'archived_at' => (int)$company_user->deleted_at, - 'created_at' => (int)$company_user->created_at, - + 'updated_at' => (int) $company_user->updated_at, + 'archived_at' => (int) $company_user->deleted_at, + 'created_at' => (int) $company_user->created_at, + ]; } diff --git a/app/Transformers/Contact/InvoiceTransformer.php b/app/Transformers/Contact/InvoiceTransformer.php index ac85577236fa..d471e2a93e07 100644 --- a/app/Transformers/Contact/InvoiceTransformer.php +++ b/app/Transformers/Contact/InvoiceTransformer.php @@ -1,6 +1,6 @@ (bool) $invoice->has_expenses, 'custom_text_value1' => $invoice->custom_text_value1 ?: '', 'custom_text_value2' => $invoice->custom_text_value2 ?: '', - 'line_items' => $invoice->line_items + 'line_items' => $invoice->line_items, ]; } } diff --git a/app/Transformers/CreditInvitationTransformer.php b/app/Transformers/CreditInvitationTransformer.php index c096c6e0d4c2..15b0ddad4d67 100644 --- a/app/Transformers/CreditInvitationTransformer.php +++ b/app/Transformers/CreditInvitationTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($invitation->id), 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), 'key' => $invitation->key, - 'link' => $invitation->getLink() ?:'', - 'sent_date' => $invitation->sent_date ?:'', - 'viewed_date' => $invitation->viewed_date ?:'', - 'opened_date' => $invitation->opened_date ?:'', + 'link' => $invitation->getLink() ?: '', + 'sent_date' => $invitation->sent_date ?: '', + 'viewed_date' => $invitation->viewed_date ?: '', + 'opened_date' => $invitation->opened_date ?: '', 'updated_at' => (int) $invitation->updated_at, 'archived_at' => (int) $invitation->deleted_at, 'created_at' => (int) $invitation->created_at, diff --git a/app/Transformers/CreditTransformer.php b/app/Transformers/CreditTransformer.php index b0bc6f720e58..94ac1f8f7d60 100644 --- a/app/Transformers/CreditTransformer.php +++ b/app/Transformers/CreditTransformer.php @@ -1,6 +1,6 @@ includeCollection($credit->invitations, $transformer, CreditInvitation::class); } + /* public function includePayments(quote $credit) { @@ -74,6 +75,7 @@ class CreditTransformer extends EntityTransformer public function includeDocuments(Credit $credit) { $transformer = new DocumentTransformer($this->serializer); + return $this->includeCollection($credit->documents, $transformer, Document::class); } @@ -89,9 +91,9 @@ class CreditTransformer extends EntityTransformer 'vendor_id' => (string) $this->encodePrimaryKey($credit->vendor_id), 'status_id' => (string) ($credit->status_id ?: 1), 'design_id' => (string) $this->encodePrimaryKey($credit->design_id), - 'created_at' => (int)$credit->created_at, - 'updated_at' => (int)$credit->updated_at, - 'archived_at' => (int)$credit->deleted_at, + 'created_at' => (int) $credit->created_at, + 'updated_at' => (int) $credit->updated_at, + 'archived_at' => (int) $credit->deleted_at, 'is_deleted' => (bool) $credit->is_deleted, 'number' => $credit->number ?: '', 'discount' => (float) $credit->discount, @@ -125,17 +127,17 @@ class CreditTransformer extends EntityTransformer 'custom_value4' => (string) $credit->custom_value4 ?: '', 'has_tasks' => (bool) $credit->has_tasks, 'has_expenses' => (bool) $credit->has_expenses, - 'custom_surcharge1' => (float)$credit->custom_surcharge1, - 'custom_surcharge2' => (float)$credit->custom_surcharge2, - 'custom_surcharge3' => (float)$credit->custom_surcharge3, - 'custom_surcharge4' => (float)$credit->custom_surcharge4, + 'custom_surcharge1' => (float) $credit->custom_surcharge1, + 'custom_surcharge2' => (float) $credit->custom_surcharge2, + 'custom_surcharge3' => (float) $credit->custom_surcharge3, + 'custom_surcharge4' => (float) $credit->custom_surcharge4, 'custom_surcharge_tax1' => (bool) $credit->custom_surcharge_tax1, 'custom_surcharge_tax2' => (bool) $credit->custom_surcharge_tax2, 'custom_surcharge_tax3' => (bool) $credit->custom_surcharge_tax3, 'custom_surcharge_tax4' => (bool) $credit->custom_surcharge_tax4, - 'line_items' => $credit->line_items ?: (array)[], + 'line_items' => $credit->line_items ?: (array) [], 'entity_type' => 'credit', - 'exchange_rate' => (float)$credit->exchange_rate, + 'exchange_rate' => (float) $credit->exchange_rate, ]; } } diff --git a/app/Transformers/DesignTransformer.php b/app/Transformers/DesignTransformer.php index 9ae55ce8ecce..a29b692b20e9 100644 --- a/app/Transformers/DesignTransformer.php +++ b/app/Transformers/DesignTransformer.php @@ -1,6 +1,6 @@ (string)$this->encodePrimaryKey($design->id), - 'name' => (string)$design->name, - 'is_custom' => (bool)$design->is_custom, - 'is_active' => (bool)$design->is_active, + 'id' => (string) $this->encodePrimaryKey($design->id), + 'name' => (string) $design->name, + 'is_custom' => (bool) $design->is_custom, + 'is_active' => (bool) $design->is_active, 'design' => $design->design, - 'updated_at' => (int)$design->updated_at, - 'archived_at' => (int)$design->deleted_at, - 'created_at' => (int)$design->created_at, - 'is_deleted' => (bool)$design->is_deleted, + 'updated_at' => (int) $design->updated_at, + 'archived_at' => (int) $design->deleted_at, + 'created_at' => (int) $design->created_at, + 'is_deleted' => (bool) $design->is_deleted, ]; } } diff --git a/app/Transformers/DocumentTransformer.php b/app/Transformers/DocumentTransformer.php index c614885424b6..a2ead7d56ce3 100644 --- a/app/Transformers/DocumentTransformer.php +++ b/app/Transformers/DocumentTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($expense->vendor_id), 'invoice_id' => $this->encodePrimaryKey($expense->invoice_id), 'client_id' => $this->encodePrimaryKey($expense->client_id), - 'bank_id' => (string)$expense->bank_id ?: '', - 'invoice_currency_id' => (string)$expense->invoice_currency_id ?: '', - 'expense_currency_id' => (string)$expense->expense_currency_id ?: '', - 'invoice_category_id' => (string)$expense->invoice_category_id ?: '', - 'payment_type_id' => (string)$expense->payment_type_id ?: '', - 'recurring_expense_id' => (string)$expense->recurring_expense_id ?: '', + 'bank_id' => (string) $expense->bank_id ?: '', + 'invoice_currency_id' => (string) $expense->invoice_currency_id ?: '', + 'expense_currency_id' => (string) $expense->expense_currency_id ?: '', + 'invoice_category_id' => (string) $expense->invoice_category_id ?: '', + 'payment_type_id' => (string) $expense->payment_type_id ?: '', + 'recurring_expense_id' => (string) $expense->recurring_expense_id ?: '', 'is_deleted' => (bool) $expense->is_deleted, 'should_be_invoiced' => (bool) $expense->should_be_invoiced, 'invoice_documents' => (bool) $expense->invoice_documents, - 'amount' => (float)$expense->amount ?: 0, - 'foreign_amount' => (float)$expense->foreign_amount ?: 0, - 'exchange_rate' => (float)$expense->exchange_rate ?: 0, + 'amount' => (float) $expense->amount ?: 0, + 'foreign_amount' => (float) $expense->foreign_amount ?: 0, + 'exchange_rate' => (float) $expense->exchange_rate ?: 0, 'tax_name1' => $expense->tax_name1 ? $expense->tax_name1 : '', 'tax_rate1' => (float) $expense->tax_rate1, 'tax_name2' => $expense->tax_name2 ? $expense->tax_name2 : '', @@ -74,9 +74,9 @@ class ExpenseTransformer extends EntityTransformer 'custom_value2' => $expense->custom_value2 ?: '', 'custom_value3' => $expense->custom_value3 ?: '', 'custom_value4' => $expense->custom_value4 ?: '', - 'updated_at' => (int)$expense->updated_at, - 'archived_at' => (int)$expense->deleted_at, - 'created_at' => (int)$expense->created_at, + 'updated_at' => (int) $expense->updated_at, + 'archived_at' => (int) $expense->deleted_at, + 'created_at' => (int) $expense->created_at, ]; } } diff --git a/app/Transformers/GatewayTransformer.php b/app/Transformers/GatewayTransformer.php index c9b48576785e..821a75e002f0 100644 --- a/app/Transformers/GatewayTransformer.php +++ b/app/Transformers/GatewayTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($gateway->id), - 'name' => (string)$gateway->name ?: '', - 'key' => (string)$gateway->key ?: '', - 'provider' => (string)$gateway->provider ?: '', - 'visible' => (bool)$gateway->visible, - 'sort_order' => (int)$gateway->sort_order, - 'default_gateway_type_id' => (string)$gateway->default_gateway_type_id, - 'site_url' => (string)$gateway->site_url ?: '', - 'is_offsite' => (bool)$gateway->is_offsite, - 'is_secure' => (bool)$gateway->is_secure, - 'fields' => (string)$gateway->fields ?: '', - 'updated_at' => (int)$gateway->updated_at, - 'created_at' => (int)$gateway->created_at, + 'name' => (string) $gateway->name ?: '', + 'key' => (string) $gateway->key ?: '', + 'provider' => (string) $gateway->provider ?: '', + 'visible' => (bool) $gateway->visible, + 'sort_order' => (int) $gateway->sort_order, + 'default_gateway_type_id' => (string) $gateway->default_gateway_type_id, + 'site_url' => (string) $gateway->site_url ?: '', + 'is_offsite' => (bool) $gateway->is_offsite, + 'is_secure' => (bool) $gateway->is_secure, + 'fields' => (string) $gateway->fields ?: '', + 'updated_at' => (int) $gateway->updated_at, + 'created_at' => (int) $gateway->created_at, ]; } } diff --git a/app/Transformers/GroupSettingTransformer.php b/app/Transformers/GroupSettingTransformer.php index ef9bc61b105b..6a3aa8e349f7 100644 --- a/app/Transformers/GroupSettingTransformer.php +++ b/app/Transformers/GroupSettingTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($group_setting->id), - 'name' => (string)$group_setting->name ?: '', + 'name' => (string) $group_setting->name ?: '', 'settings' => $group_setting->settings ?: new \stdClass, - 'created_at' => (int)$group_setting->created_at, - 'updated_at' => (int)$group_setting->updated_at, - 'archived_at' => (int)$group_setting->deleted_at, + 'created_at' => (int) $group_setting->created_at, + 'updated_at' => (int) $group_setting->updated_at, + 'archived_at' => (int) $group_setting->deleted_at, 'is_deleted' => (bool) $group_setting->is_deleted, ]; } diff --git a/app/Transformers/InvoiceHistoryTransformer.php b/app/Transformers/InvoiceHistoryTransformer.php index 44d2d3574d91..90b61bbb54bd 100644 --- a/app/Transformers/InvoiceHistoryTransformer.php +++ b/app/Transformers/InvoiceHistoryTransformer.php @@ -1,6 +1,6 @@ (string) $backup->json_backup ?: '', 'html_backup' => (string) $backup->html_backup ?: '', 'amount' => (float) $backup->amount, - 'created_at' => (int)$backup->created_at, - 'updated_at' => (int)$backup->updated_at, + 'created_at' => (int) $backup->created_at, + 'updated_at' => (int) $backup->updated_at, ]; } diff --git a/app/Transformers/InvoiceInvitationTransformer.php b/app/Transformers/InvoiceInvitationTransformer.php index 0693751141f1..8ffa7379c040 100644 --- a/app/Transformers/InvoiceInvitationTransformer.php +++ b/app/Transformers/InvoiceInvitationTransformer.php @@ -1,6 +1,6 @@ $this->encodePrimaryKey($invitation->id), 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), 'key' => $invitation->key, - 'link' => $invitation->getLink()?:'', - 'sent_date' => $invitation->sent_date?:'', - 'viewed_date' => $invitation->viewed_date?:'', - 'opened_date' => $invitation->opened_date?:'', + 'link' => $invitation->getLink() ?: '', + 'sent_date' => $invitation->sent_date ?: '', + 'viewed_date' => $invitation->viewed_date ?: '', + 'opened_date' => $invitation->opened_date ?: '', 'updated_at' => (int) $invitation->updated_at, 'archived_at' => (int) $invitation->deleted_at, 'created_at' => (int) $invitation->created_at, diff --git a/app/Transformers/InvoiceTransformer.php b/app/Transformers/InvoiceTransformer.php index c6737e568e6f..27c531ec61ad 100644 --- a/app/Transformers/InvoiceTransformer.php +++ b/app/Transformers/InvoiceTransformer.php @@ -1,6 +1,6 @@ includeCollection($invoice->history, $transformer, Backup::class); } - + public function includeClient(Invoice $invoice) { $transformer = new ClientTransformer($this->serializer); return $this->includeItem($invoice->client, $transformer, Client::class); } - + /* public function includePayments(Invoice $invoice) { @@ -82,7 +82,7 @@ class InvoiceTransformer extends EntityTransformer return $this->includeCollection($invoice->documents, $transformer, Document::class); } - + public function transform(Invoice $invoice) { return [ @@ -95,9 +95,9 @@ class InvoiceTransformer extends EntityTransformer 'vendor_id' => (string) $this->encodePrimaryKey($invoice->vendor_id), 'status_id' => (string) ($invoice->status_id ?: 1), 'design_id' => (string) $this->encodePrimaryKey($invoice->design_id), - 'created_at' => (int)$invoice->created_at, - 'updated_at' => (int)$invoice->updated_at, - 'archived_at' => (int)$invoice->deleted_at, + 'created_at' => (int) $invoice->created_at, + 'updated_at' => (int) $invoice->updated_at, + 'archived_at' => (int) $invoice->deleted_at, 'is_deleted' => (bool) $invoice->is_deleted, 'number' => $invoice->number ?: '', 'discount' => (float) $invoice->discount, @@ -131,16 +131,16 @@ class InvoiceTransformer extends EntityTransformer 'custom_value4' => (string) $invoice->custom_value4 ?: '', 'has_tasks' => (bool) $invoice->has_tasks, 'has_expenses' => (bool) $invoice->has_expenses, - 'custom_surcharge1' => (float)$invoice->custom_surcharge1, - 'custom_surcharge2' => (float)$invoice->custom_surcharge2, - 'custom_surcharge3' => (float)$invoice->custom_surcharge3, - 'custom_surcharge4' => (float)$invoice->custom_surcharge4, - 'exchange_rate' => (float)$invoice->exchange_rate, + 'custom_surcharge1' => (float) $invoice->custom_surcharge1, + 'custom_surcharge2' => (float) $invoice->custom_surcharge2, + 'custom_surcharge3' => (float) $invoice->custom_surcharge3, + 'custom_surcharge4' => (float) $invoice->custom_surcharge4, + 'exchange_rate' => (float) $invoice->exchange_rate, 'custom_surcharge_tax1' => (bool) $invoice->custom_surcharge_tax1, 'custom_surcharge_tax2' => (bool) $invoice->custom_surcharge_tax2, 'custom_surcharge_tax3' => (bool) $invoice->custom_surcharge_tax3, 'custom_surcharge_tax4' => (bool) $invoice->custom_surcharge_tax4, - 'line_items' => $invoice->line_items ?: (array)[], + 'line_items' => $invoice->line_items ?: (array) [], 'entity_type' => 'invoice', ]; } diff --git a/app/Transformers/PaymentTermTransformer.php b/app/Transformers/PaymentTermTransformer.php index 42fde5301bd3..8ecdbf3b18fe 100644 --- a/app/Transformers/PaymentTermTransformer.php +++ b/app/Transformers/PaymentTermTransformer.php @@ -1,6 +1,6 @@ (string) $this->encodePrimaryKey($payment_term->id), 'num_days' => (int) $payment_term->num_days, - 'name' => (string) ctrans('texts.payment_terms_net') . ' ' . $payment_term->getNumDays(), + 'name' => (string) ctrans('texts.payment_terms_net').' '.$payment_term->getNumDays(), 'is_deleted' => (bool) $payment_term->is_deleted, 'created_at' => (int) $payment_term->created_at, 'updated_at' => (int) $payment_term->updated_at, 'archived_at' => (int) $payment_term->deleted_at, ]; } - } diff --git a/app/Transformers/PaymentTransformer.php b/app/Transformers/PaymentTransformer.php index a7bbfad1d14b..f6e0bf6d4de6 100644 --- a/app/Transformers/PaymentTransformer.php +++ b/app/Transformers/PaymentTransformer.php @@ -1,6 +1,6 @@ serializer); + return $this->includeCollection($payment->documents, $transformer, Document::class); } @@ -83,9 +84,9 @@ class PaymentTransformer extends EntityTransformer 'transaction_reference' => $payment->transaction_reference ?: '', 'date' => $payment->date ?: '', 'is_manual' => (bool) $payment->is_manual, - 'created_at' => (int)$payment->created_at, - 'updated_at' => (int)$payment->updated_at, - 'archived_at' => (int)$payment->deleted_at, + 'created_at' => (int) $payment->created_at, + 'updated_at' => (int) $payment->updated_at, + 'archived_at' => (int) $payment->deleted_at, 'is_deleted' => (bool) $payment->is_deleted, 'type_id' => (string) $payment->type_id ?: '', 'invitation_id' => (string) $payment->invitation_id ?: '', diff --git a/app/Transformers/PaymentableTransformer.php b/app/Transformers/PaymentableTransformer.php index 8e3e17b7274f..f171e4b330bd 100644 --- a/app/Transformers/PaymentableTransformer.php +++ b/app/Transformers/PaymentableTransformer.php @@ -1,6 +1,6 @@ paymentable_type == Credit::class) { $entity_key = 'credit_id'; } - + return [ 'id' => $this->encodePrimaryKey($paymentable->id), $entity_key => $this->encodePrimaryKey($paymentable->paymentable_id), - 'amount' => (float)$paymentable->amount, - 'refunded' => (float)$paymentable->refunded, + 'amount' => (float) $paymentable->amount, + 'refunded' => (float) $paymentable->refunded, 'created_at' => (int) $paymentable->created_at, 'updated_at' => (int) $paymentable->updated_at, ]; diff --git a/app/Transformers/ProductTransformer.php b/app/Transformers/ProductTransformer.php index 211176e1c0d2..1b9a592f09f4 100644 --- a/app/Transformers/ProductTransformer.php +++ b/app/Transformers/ProductTransformer.php @@ -1,6 +1,6 @@ serializer); + return $this->includeCollection($product->documents, $transformer, Document::class); } @@ -83,9 +83,9 @@ class ProductTransformer extends EntityTransformer 'tax_rate2' => (float) $product->tax_rate2 ?: 0, 'tax_name3' => $product->tax_name3 ?: '', 'tax_rate3' => (float) $product->tax_rate3 ?: 0, - 'created_at' => (int)$product->created_at, - 'updated_at' => (int)$product->updated_at, - 'archived_at' => (int)$product->deleted_at, + 'created_at' => (int) $product->created_at, + 'updated_at' => (int) $product->updated_at, + 'archived_at' => (int) $product->deleted_at, 'custom_value1' => $product->custom_value1 ?: '', 'custom_value2' => $product->custom_value2 ?: '', 'custom_value3' => $product->custom_value3 ?: '', diff --git a/app/Transformers/ProjectTransformer.php b/app/Transformers/ProjectTransformer.php index 08f6d36cec43..aebd974094b6 100644 --- a/app/Transformers/ProjectTransformer.php +++ b/app/Transformers/ProjectTransformer.php @@ -1,6 +1,6 @@ (string) $this->encodePrimaryKey($project->id), 'name' => $project->name ?: '', 'client_id' => (string) $this->encodePrimaryKey($project->client_id), - 'created_at' => (int)$project->created_at, - 'updated_at' => (int)$project->updated_at, - 'archived_at' => (int)$project->deleted_at, + 'created_at' => (int) $project->created_at, + 'updated_at' => (int) $project->updated_at, + 'archived_at' => (int) $project->deleted_at, 'is_deleted' => (bool) $project->is_deleted, 'task_rate' => (float) $project->task_rate, 'due_date' => $project->due_date ?: '', diff --git a/app/Transformers/QuoteInvitationTransformer.php b/app/Transformers/QuoteInvitationTransformer.php index fe9e4cd8d2e4..ede951508579 100644 --- a/app/Transformers/QuoteInvitationTransformer.php +++ b/app/Transformers/QuoteInvitationTransformer.php @@ -1,6 +1,6 @@ includeCollection($quote->history, $transformer, Backup::class); } - + public function includeInvitations(Quote $quote) { $transformer = new QuoteInvitationTransformer($this->serializer); return $this->includeCollection($quote->invitations, $transformer, QuoteInvitation::class); } + /* public function includePayments(quote $quote) { @@ -76,9 +77,10 @@ class QuoteTransformer extends EntityTransformer public function includeDocuments(Quote $quote) { $transformer = new DocumentTransformer($this->serializer); + return $this->includeCollection($quote->documents, $transformer, Document::class); } - + public function transform(Quote $quote) { return [ @@ -88,12 +90,12 @@ class QuoteTransformer extends EntityTransformer 'amount' => (float) $quote->amount, 'balance' => (float) $quote->balance, 'client_id' => (string) $this->encodePrimaryKey($quote->client_id), - 'status_id' => (string)$quote->status_id, + 'status_id' => (string) $quote->status_id, 'design_id' => (string) $this->encodePrimaryKey($quote->design_id), - 'invoice_id' => (string)$this->encodePrimaryKey($quote->invoice_id), - 'updated_at' => (int)$quote->updated_at, - 'archived_at' => (int)$quote->deleted_at, - 'created_at' => (int)$quote->created_at, + 'invoice_id' => (string) $this->encodePrimaryKey($quote->invoice_id), + 'updated_at' => (int) $quote->updated_at, + 'archived_at' => (int) $quote->deleted_at, + 'created_at' => (int) $quote->created_at, 'number' => $quote->number ?: '', 'discount' => (float) $quote->discount, 'po_number' => $quote->po_number ?: '', @@ -127,14 +129,14 @@ class QuoteTransformer extends EntityTransformer 'custom_value4' => (string) $quote->custom_value4 ?: '', 'has_tasks' => (bool) $quote->has_tasks, 'has_expenses' => (bool) $quote->has_expenses, - 'custom_surcharge1' => (float)$quote->custom_surcharge1, - 'custom_surcharge2' => (float)$quote->custom_surcharge2, - 'custom_surcharge3' => (float)$quote->custom_surcharge3, - 'custom_surcharge4' => (float)$quote->custom_surcharge4, + 'custom_surcharge1' => (float) $quote->custom_surcharge1, + 'custom_surcharge2' => (float) $quote->custom_surcharge2, + 'custom_surcharge3' => (float) $quote->custom_surcharge3, + 'custom_surcharge4' => (float) $quote->custom_surcharge4, 'custom_surcharge_taxes' => (bool) $quote->custom_surcharge_taxes, - 'line_items' => $quote->line_items ?: (array)[], + 'line_items' => $quote->line_items ?: (array) [], 'entity_type' => 'quote', - 'exchange_rate' => (float)$quote->exchange_rate, + 'exchange_rate' => (float) $quote->exchange_rate, ]; } } diff --git a/app/Transformers/RecurringInvoiceTransformer.php b/app/Transformers/RecurringInvoiceTransformer.php index 41968c932383..a3151b437036 100644 --- a/app/Transformers/RecurringInvoiceTransformer.php +++ b/app/Transformers/RecurringInvoiceTransformer.php @@ -1,6 +1,6 @@ (float) $invoice->balance ?: '', 'client_id' => (string) $invoice->client_id, 'status_id' => (string) ($invoice->status_id ?: 1), - 'created_at' => (int)$invoice->created_at, - 'updated_at' => (int)$invoice->updated_at, - 'archived_at' => (int)$invoice->deleted_at, + 'created_at' => (int) $invoice->created_at, + 'updated_at' => (int) $invoice->updated_at, + 'archived_at' => (int) $invoice->deleted_at, 'discount' => (float) $invoice->discount ?: '', 'po_number' => $invoice->po_number ?: '', 'date' => $invoice->date ?: '', diff --git a/app/Transformers/RecurringQuoteTransformer.php b/app/Transformers/RecurringQuoteTransformer.php index bf4aaca7c3c1..65fc7d3ef61d 100644 --- a/app/Transformers/RecurringQuoteTransformer.php +++ b/app/Transformers/RecurringQuoteTransformer.php @@ -1,6 +1,6 @@ (float) $quote->balance ?: '', 'client_id' => (string) $quote->client_id, 'status_id' => (string) ($quote->status_id ?: 1), - 'created_at' => (int)$quote->created_at, - 'updated_at' => (int)$quote->updated_at, - 'archived_at' => (int)$quote->deleted_at, + 'created_at' => (int) $quote->created_at, + 'updated_at' => (int) $quote->updated_at, + 'archived_at' => (int) $quote->deleted_at, 'discount' => (float) $quote->discount ?: '', 'po_number' => $quote->po_number ?: '', 'quote_date' => $quote->quote_date ?: '', diff --git a/app/Transformers/Shop/CompanyShopProfileTransformer.php b/app/Transformers/Shop/CompanyShopProfileTransformer.php index 45d2a2a3ad7d..429a16b644c2 100644 --- a/app/Transformers/Shop/CompanyShopProfileTransformer.php +++ b/app/Transformers/Shop/CompanyShopProfileTransformer.php @@ -1,6 +1,6 @@ (string)$company->company_key ?: '', + 'company_key' => (string) $company->company_key ?: '', 'settings' => $this->trimCompany($company), ]; } @@ -103,8 +102,9 @@ class CompanyShopProfileTransformer extends EntityTransformer $new_settings = new \stdClass; - foreach($trimmed_company_settings as $key => $value) + foreach ($trimmed_company_settings as $key => $value) { $new_settings->{$key} = $value; + } return $new_settings; } diff --git a/app/Transformers/SystemLogTransformer.php b/app/Transformers/SystemLogTransformer.php index 3850a36d7ac6..965bf69112cc 100644 --- a/app/Transformers/SystemLogTransformer.php +++ b/app/Transformers/SystemLogTransformer.php @@ -32,8 +32,8 @@ class SystemLogTransformer extends EntityTransformer 'category_id' => (int) $system_log->category_id, 'type_id' => (int) $system_log->type_id, 'log' => json_encode($system_log->log), - 'updated_at' => (int)$system_log->updated_at, - 'created_at' => (int)$system_log->created_at, + 'updated_at' => (int) $system_log->updated_at, + 'created_at' => (int) $system_log->created_at, ]; } } diff --git a/app/Transformers/TaskTransformer.php b/app/Transformers/TaskTransformer.php index 426705d78e0a..b3d875349752 100644 --- a/app/Transformers/TaskTransformer.php +++ b/app/Transformers/TaskTransformer.php @@ -1,6 +1,6 @@ (string) $this->encodePrimaryKey($task->id), 'description' => $task->description ?: '', 'duration' => 0, - 'created_at' => (int)$task->created_at, - 'updated_at' => (int)$task->updated_at, - 'archived_at' => (int)$task->deleted_at, + 'created_at' => (int) $task->created_at, + 'updated_at' => (int) $task->updated_at, + 'archived_at' => (int) $task->deleted_at, 'invoice_id' => $this->encodePrimaryKey($task->invoice_id), 'client_id' => $this->encodePrimaryKey($task->client_id), 'project_id' => $this->encodePrimaryKey($task->project_id), diff --git a/app/Transformers/TaxRateTransformer.php b/app/Transformers/TaxRateTransformer.php index 771a0ede28c5..d42bee94674a 100644 --- a/app/Transformers/TaxRateTransformer.php +++ b/app/Transformers/TaxRateTransformer.php @@ -19,9 +19,9 @@ class TaxRateTransformer extends EntityTransformer 'name' => (string) $tax_rate->name, 'rate' => (float) $tax_rate->rate, 'is_deleted' => (bool) $tax_rate->is_deleted, - 'updated_at' => (int)$tax_rate->updated_at, - 'archived_at' => (int)$tax_rate->deleted_at, - 'created_at' => (int)$tax_rate->created_at, + 'updated_at' => (int) $tax_rate->updated_at, + 'archived_at' => (int) $tax_rate->deleted_at, + 'created_at' => (int) $tax_rate->created_at, ]; } } diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index 2d5aba5e4d3f..886840a35eb4 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -1,6 +1,6 @@ $user->last_name ?: '', 'email' => $user->email ?: '', 'last_login' => Carbon::parse($user->last_login)->timestamp, - 'created_at' => (int)$user->created_at, - 'updated_at' => (int)$user->updated_at, - 'archived_at' => (int)$user->deleted_at, - 'created_at' => (int)$user->created_at, - 'is_deleted' => (bool)$user->is_deleted, + 'created_at' => (int) $user->created_at, + 'updated_at' => (int) $user->updated_at, + 'archived_at' => (int) $user->deleted_at, + 'created_at' => (int) $user->created_at, + 'is_deleted' => (bool) $user->is_deleted, 'phone' => $user->phone ?: '', 'email_verified_at' => $user->getEmailVerifiedAt(), 'signature' => $user->signature ?: '', @@ -64,7 +63,7 @@ class UserTransformer extends EntityTransformer 'custom_value2' => $user->custom_value2 ?: '', 'custom_value3' => $user->custom_value3 ?: '', 'custom_value4' => $user->custom_value4 ?: '', - 'oauth_provider_id' => (string)$user->oauth_provider_id, + 'oauth_provider_id' => (string) $user->oauth_provider_id, ]; } diff --git a/app/Transformers/VendorContactTransformer.php b/app/Transformers/VendorContactTransformer.php index 5eea2b85a013..fb3382c212dc 100644 --- a/app/Transformers/VendorContactTransformer.php +++ b/app/Transformers/VendorContactTransformer.php @@ -1,6 +1,6 @@ $vendor->first_name ?: '', 'last_name' => $vendor->last_name ?: '', 'email' => $vendor->email ?: '', - 'created_at' => (int)$vendor->created_at, - 'updated_at' => (int)$vendor->updated_at, - 'archived_at' => (int)$vendor->deleted_at, + 'created_at' => (int) $vendor->created_at, + 'updated_at' => (int) $vendor->updated_at, + 'archived_at' => (int) $vendor->deleted_at, 'is_primary' => (bool) $vendor->is_primary, 'phone' => $vendor->phone ?: '', 'custom_value1' => $vendor->custom_value1 ?: '', diff --git a/app/Transformers/VendorTransformer.php b/app/Transformers/VendorTransformer.php index 623f994422af..a5eb2a03aa3a 100644 --- a/app/Transformers/VendorTransformer.php +++ b/app/Transformers/VendorTransformer.php @@ -1,6 +1,6 @@ $vendor->name ?: '', 'website' => $vendor->website ?: '', 'private_notes' => $vendor->private_notes ?: '', - 'last_login' => (int)$vendor->last_login, + 'last_login' => (int) $vendor->last_login, 'address1' => $vendor->address1 ?: '', 'address2' => $vendor->address2 ?: '', 'phone' => $vendor->phone ?: '', 'city' => $vendor->city ?: '', 'state' => $vendor->state ?: '', 'postal_code' => $vendor->postal_code ?: '', - 'country_id' => (string)$vendor->country_id ?: '', + 'country_id' => (string) $vendor->country_id ?: '', 'custom_value1' => $vendor->custom_value1 ?: '', 'custom_value2' => $vendor->custom_value2 ?: '', 'custom_value3' => $vendor->custom_value3 ?: '', @@ -92,9 +91,9 @@ class VendorTransformer extends EntityTransformer 'is_deleted' => (bool) $vendor->is_deleted, 'vat_number' => $vendor->vat_number ?: '', 'id_number' => $vendor->id_number ?: '', - 'updated_at' => (int)$vendor->updated_at, - 'archived_at' => (int)$vendor->deleted_at, - 'created_at' => (int)$vendor->created_at, + 'updated_at' => (int) $vendor->updated_at, + 'archived_at' => (int) $vendor->deleted_at, + 'created_at' => (int) $vendor->created_at, ]; } } diff --git a/app/Transformers/WebhookTransformer.php b/app/Transformers/WebhookTransformer.php index 4ffff6398bd0..a5557daae0ad 100644 --- a/app/Transformers/WebhookTransformer.php +++ b/app/Transformers/WebhookTransformer.php @@ -27,10 +27,10 @@ class WebhookTransformer extends EntityTransformer 'id' => (string) $this->encodePrimaryKey($webhook->id), 'company_id' => (string) $this->encodePrimaryKey($webhook->company_id), 'user_id' => (string) $this->encodePrimaryKey($webhook->user_id), - 'archived_at' => (int)$webhook->deleted_at, - 'updated_at' => (int)$webhook->updated_at, - 'created_at' => (int)$webhook->created_at, - 'is_deleted' => (bool)$webhook->is_deleted, + 'archived_at' => (int) $webhook->deleted_at, + 'updated_at' => (int) $webhook->updated_at, + 'created_at' => (int) $webhook->created_at, + 'is_deleted' => (bool) $webhook->is_deleted, 'target_url' => $webhook->target_url ? (string) $webhook->target_url : '', 'event_id' => (string) $webhook->event_id, 'format' => (string) $webhook->format, diff --git a/app/Utils/CurlUtils.php b/app/Utils/CurlUtils.php index 750d6e8a9bd6..94b2f3330e0c 100644 --- a/app/Utils/CurlUtils.php +++ b/app/Utils/CurlUtils.php @@ -1,6 +1,6 @@ designer = $designer; @@ -59,11 +58,11 @@ class HtmlEngine } public function build() :string - { + { App::setLocale($this->client->preferredLocale()); $values_and_labels = $this->generateLabelsAndValues(); - + $this->designer->build(); $data = []; @@ -75,130 +74,125 @@ class HtmlEngine $data['footer'] = $this->designer->getFooter(); $html = view('pdf.stub', $data)->render(); - - $html = $this->parseLabelsAndValues($values_and_labels['labels'], $values_and_labels['values'], $html); - - return $html; + $html = $this->parseLabelsAndValues($values_and_labels['labels'], $values_and_labels['values'], $html); + + return $html; } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - public function buildEntityDataArray() :array { - if (!$this->client->currency()) { + if (! $this->client->currency()) { throw new \Exception(debug_backtrace()[1]['function'], 1); exit; } $data = []; - $data['$global-margin'] = ['value' => 'm-8', 'label' => '']; - $data['$global-padding'] = ['value' => 'p-8', 'label' => '']; - $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; - $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; - $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; - $data['$total_tax_labels'] = ['value' => $this->totalTaxLabels(), 'label' => ctrans('texts.taxes')]; - $data['$total_tax_values'] = ['value' => $this->totalTaxValues(), 'label' => ctrans('texts.taxes')]; - $data['$line_tax_labels'] = ['value' => $this->lineTaxLabels(), 'label' => ctrans('texts.taxes')]; - $data['$line_tax_values'] = ['value' => $this->lineTaxValues(), 'label' => ctrans('texts.taxes')]; - $data['$date'] = ['value' => $this->entity->date ?: ' ', 'label' => ctrans('texts.date')]; + $data['$global-margin'] = ['value' => 'm-8', 'label' => '']; + $data['$global-padding'] = ['value' => 'p-8', 'label' => '']; + $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; + $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; + $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; + $data['$total_tax_labels'] = ['value' => $this->totalTaxLabels(), 'label' => ctrans('texts.taxes')]; + $data['$total_tax_values'] = ['value' => $this->totalTaxValues(), 'label' => ctrans('texts.taxes')]; + $data['$line_tax_labels'] = ['value' => $this->lineTaxLabels(), 'label' => ctrans('texts.taxes')]; + $data['$line_tax_values'] = ['value' => $this->lineTaxValues(), 'label' => ctrans('texts.taxes')]; + $data['$date'] = ['value' => $this->entity->date ?: ' ', 'label' => ctrans('texts.date')]; //$data['$invoice_date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.invoice_date')]; - $data['$invoice.date'] = &$data['$date']; - $data['$due_date'] = ['value' => $this->entity->due_date ?: ' ', 'label' => ctrans('texts.' . $this->entity_string . '_due_date')]; - $data['$invoice.due_date'] = &$data['$due_date']; - $data['$invoice.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; - $data['$invoice.po_number'] = ['value' => $this->entity->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; - $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; - $data['$invoice.line_taxes'] = &$data['$line_taxes']; - $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; - $data['$invoice.total_taxes'] = &$data['$total_taxes']; + $data['$invoice.date'] = &$data['$date']; + $data['$due_date'] = ['value' => $this->entity->due_date ?: ' ', 'label' => ctrans('texts.'.$this->entity_string.'_due_date')]; + $data['$invoice.due_date'] = &$data['$due_date']; + $data['$invoice.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; + $data['$invoice.po_number'] = ['value' => $this->entity->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; + $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; + $data['$invoice.line_taxes'] = &$data['$line_taxes']; + $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; + $data['$invoice.total_taxes'] = &$data['$total_taxes']; if ($this->entity_string == 'invoice') { - $data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')]; - $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; - $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''. ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; + $data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')]; + $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; + $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''.ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; // $data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')]; - - } + } if ($this->entity_string == 'quote') { - $data['$entity'] = ['value' => '', 'label' => ctrans('texts.quote')]; - $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')]; - $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''. ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; + $data['$entity'] = ['value' => '', 'label' => ctrans('texts.quote')]; + $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')]; + $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''.ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; // $data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_quote')]; - } + } if ($this->entity_string == 'credit') { - $data['$entity'] = ['value' => '', 'label' => ctrans('texts.credit')]; - $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')]; - $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''. ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; + $data['$entity'] = ['value' => '', 'label' => ctrans('texts.credit')]; + $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')]; + $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''.ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; // $data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_credit')]; - } + } - $data['$entity_number'] = &$data['$number']; + $data['$entity_number'] = &$data['$number']; //$data['$paid_to_date'] = ; - $data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; - $data['$discount'] = &$data['$invoice.discount']; - $data['$subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')]; - $data['$invoice.subtotal'] = &$data['$subtotal']; - $data['$balance_due'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')]; - $data['$quote.balance_due'] = &$data['$balance_due']; - $data['$invoice.balance_due'] = &$data['$balance_due']; - $data['$balance_due'] = &$data['$balance_due']; - $data['$outstanding'] = &$data['$balance_due']; - $data['$partial_due'] = ['value' => Number::formatMoney($this->entity->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; - $data['$total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')]; - $data['$amount'] = &$data['$total']; - $data['$quote.total'] = &$data['$total']; - $data['$invoice.total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')]; - $data['$invoice.amount'] = &$data['$total']; - $data['$quote.amount'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; - $data['$credit.total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')]; - $data['$credit.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')]; - $data['$credit.amount'] = &$data['$credit.total']; - $data['$credit.po_number'] = &$data['$invoice.po_number']; - $data['$credit.date'] = ['value' => $this->entity->date, 'label' => ctrans('texts.credit_date')]; - $data['$balance'] = ['value' => Number::formatMoney($this->entity_calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')]; - $data['$credit.balance'] = &$data['$balance']; + $data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; + $data['$discount'] = &$data['$invoice.discount']; + $data['$subtotal'] = ['value' => Number::formatMoney($this->entity_calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')]; + $data['$invoice.subtotal'] = &$data['$subtotal']; + $data['$balance_due'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')]; + $data['$quote.balance_due'] = &$data['$balance_due']; + $data['$invoice.balance_due'] = &$data['$balance_due']; + $data['$balance_due'] = &$data['$balance_due']; + $data['$outstanding'] = &$data['$balance_due']; + $data['$partial_due'] = ['value' => Number::formatMoney($this->entity->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; + $data['$total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')]; + $data['$amount'] = &$data['$total']; + $data['$quote.total'] = &$data['$total']; + $data['$invoice.total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')]; + $data['$invoice.amount'] = &$data['$total']; + $data['$quote.amount'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; + $data['$credit.total'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')]; + $data['$credit.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')]; + $data['$credit.amount'] = &$data['$credit.total']; + $data['$credit.po_number'] = &$data['$invoice.po_number']; + $data['$credit.date'] = ['value' => $this->entity->date, 'label' => ctrans('texts.credit_date')]; + $data['$balance'] = ['value' => Number::formatMoney($this->entity_calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')]; + $data['$credit.balance'] = &$data['$balance']; - $data['$invoice.balance'] = &$data['$balance']; - $data['$taxes'] = ['value' => Number::formatMoney($this->entity_calc->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')]; - $data['$invoice.taxes'] = &$data['$taxes']; - - $data['$invoice.custom1'] = ['value' => $this->entity->custom_value1 ?: ' ', 'label' => $this->makeCustomField('invoice1')]; - $data['$invoice.custom2'] = ['value' => $this->entity->custom_value2 ?: ' ', 'label' => $this->makeCustomField('invoice2')]; - $data['$invoice.custom3'] = ['value' => $this->entity->custom_value3 ?: ' ', 'label' => $this->makeCustomField('invoice3')]; - $data['$invoice.custom4'] = ['value' => $this->entity->custom_value4 ?: ' ', 'label' => $this->makeCustomField('invoice4')]; - $data['$invoice.public_notes'] = ['value' => $this->entity->public_notes ?: ' ', 'label' => ctrans('texts.public_notes')]; - $data['$entity.public_notes'] = &$data['$invoice.public_notes']; + $data['$invoice.balance'] = &$data['$balance']; + $data['$taxes'] = ['value' => Number::formatMoney($this->entity_calc->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')]; + $data['$invoice.taxes'] = &$data['$taxes']; - $data['$entity_issued_to'] = ['value' => '', 'label' => ctrans("texts.{$this->entity_string}_issued_to")]; - $data['$your_entity'] = ['value' => '', 'label' => ctrans("texts.your_{$this->entity_string}")]; + $data['$invoice.custom1'] = ['value' => $this->entity->custom_value1 ?: ' ', 'label' => $this->makeCustomField('invoice1')]; + $data['$invoice.custom2'] = ['value' => $this->entity->custom_value2 ?: ' ', 'label' => $this->makeCustomField('invoice2')]; + $data['$invoice.custom3'] = ['value' => $this->entity->custom_value3 ?: ' ', 'label' => $this->makeCustomField('invoice3')]; + $data['$invoice.custom4'] = ['value' => $this->entity->custom_value4 ?: ' ', 'label' => $this->makeCustomField('invoice4')]; + $data['$invoice.public_notes'] = ['value' => $this->entity->public_notes ?: ' ', 'label' => ctrans('texts.public_notes')]; + $data['$entity.public_notes'] = &$data['$invoice.public_notes']; - $data['$quote.date'] = ['value' => $this->entity->date ?: ' ', 'label' => ctrans('texts.quote_date')]; - $data['$quote.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')]; - $data['$quote.po_number'] = &$data['$invoice.po_number']; - $data['$quote.quote_number'] = &$data['$quote.number']; - $data['$quote_no'] = &$data['$quote.number']; - $data['$quote.quote_no'] = &$data['$quote.number']; - $data['$quote.valid_until'] = ['value' => $this->entity->due_date, 'label' => ctrans('texts.valid_until')]; - $data['$credit_amount'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')]; - $data['$credit_balance'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')]; - ; - $data['$credit_number'] = &$data['$number']; - $data['$credit_no'] = &$data['$number']; - $data['$credit.credit_no'] = &$data['$number']; + $data['$entity_issued_to'] = ['value' => '', 'label' => ctrans("texts.{$this->entity_string}_issued_to")]; + $data['$your_entity'] = ['value' => '', 'label' => ctrans("texts.your_{$this->entity_string}")]; + + $data['$quote.date'] = ['value' => $this->entity->date ?: ' ', 'label' => ctrans('texts.quote_date')]; + $data['$quote.number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')]; + $data['$quote.po_number'] = &$data['$invoice.po_number']; + $data['$quote.quote_number'] = &$data['$quote.number']; + $data['$quote_no'] = &$data['$quote.number']; + $data['$quote.quote_no'] = &$data['$quote.number']; + $data['$quote.valid_until'] = ['value' => $this->entity->due_date, 'label' => ctrans('texts.valid_until')]; + $data['$credit_amount'] = ['value' => Number::formatMoney($this->entity_calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')]; + $data['$credit_balance'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')]; + + $data['$credit_number'] = &$data['$number']; + $data['$credit_no'] = &$data['$number']; + $data['$credit.credit_no'] = &$data['$number']; // $data['$invoice_issued_to'] = ; // $data['$quote_issued_to'] = ; @@ -209,107 +203,106 @@ class HtmlEngine // $data['$invoice_to'] = ; // $data['$quote_to'] = ; // $data['$details'] = ; - $data['$invoice_no'] = &$data['$number']; - $data['$invoice.invoice_no'] = &$data['$number']; - $data['$client1'] = ['value' => $this->client->custom_value1 ?: ' ', 'label' => $this->makeCustomField('client1')]; - $data['$client2'] = ['value' => $this->client->custom_value2 ?: ' ', 'label' => $this->makeCustomField('client2')]; - $data['$client3'] = ['value' => $this->client->custom_value3 ?: ' ', 'label' => $this->makeCustomField('client3')]; - $data['$client4'] = ['value' => $this->client->custom_value4 ?: ' ', 'label' => $this->makeCustomField('client4')]; - $data['$address1'] = ['value' => $this->client->address1 ?: ' ', 'label' => ctrans('texts.address1')]; - $data['$address2'] = ['value' => $this->client->address2 ?: ' ', 'label' => ctrans('texts.address2')]; - $data['$id_number'] = ['value' => $this->client->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; - $data['$vat_number'] = ['value' => $this->client->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; - $data['$website'] = ['value' => $this->client->present()->website() ?: ' ', 'label' => ctrans('texts.website')]; - $data['$phone'] = ['value' => $this->client->present()->phone() ?: ' ', 'label' => ctrans('texts.phone')]; - $data['$country'] = ['value' => isset($this->client->country->name) ? $this->client->country->name : 'No Country Set', 'label' => ctrans('texts.country')]; - $data['$email'] = ['value' => isset($this->contact) ? $this->contact->email : 'no contact email on record', 'label' => ctrans('texts.email')]; - $data['$client_name'] = ['value' => $this->entity->present()->clientName() ?: ' ', 'label' => ctrans('texts.client_name')]; - $data['$client.name'] = &$data['$client_name']; - $data['$client.address1'] = &$data['$address1']; - $data['$client.address2'] = &$data['$address2']; - $data['$client_address'] = ['value' => $this->entity->present()->address() ?: ' ', 'label' => ctrans('texts.address')]; - $data['$client.address'] = &$data['$client_address']; - $data['$client.id_number'] = &$data['$id_number']; - $data['$client.vat_number'] = &$data['$vat_number']; - $data['$client.website'] = &$data['$website']; - $data['$client.phone'] = &$data['$phone']; - $data['$city_state_postal'] = ['value' => $this->entity->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; - $data['$client.city_state_postal'] = &$data['$city_state_postal']; - $data['$postal_city_state'] = ['value' => $this->entity->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; - $data['$client.postal_city_state'] = &$data['$postal_city_state']; - $data['$client.country'] = &$data['$country']; - $data['$client.email'] = &$data['$email']; + $data['$invoice_no'] = &$data['$number']; + $data['$invoice.invoice_no'] = &$data['$number']; + $data['$client1'] = ['value' => $this->client->custom_value1 ?: ' ', 'label' => $this->makeCustomField('client1')]; + $data['$client2'] = ['value' => $this->client->custom_value2 ?: ' ', 'label' => $this->makeCustomField('client2')]; + $data['$client3'] = ['value' => $this->client->custom_value3 ?: ' ', 'label' => $this->makeCustomField('client3')]; + $data['$client4'] = ['value' => $this->client->custom_value4 ?: ' ', 'label' => $this->makeCustomField('client4')]; + $data['$address1'] = ['value' => $this->client->address1 ?: ' ', 'label' => ctrans('texts.address1')]; + $data['$address2'] = ['value' => $this->client->address2 ?: ' ', 'label' => ctrans('texts.address2')]; + $data['$id_number'] = ['value' => $this->client->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; + $data['$vat_number'] = ['value' => $this->client->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; + $data['$website'] = ['value' => $this->client->present()->website() ?: ' ', 'label' => ctrans('texts.website')]; + $data['$phone'] = ['value' => $this->client->present()->phone() ?: ' ', 'label' => ctrans('texts.phone')]; + $data['$country'] = ['value' => isset($this->client->country->name) ? $this->client->country->name : 'No Country Set', 'label' => ctrans('texts.country')]; + $data['$email'] = ['value' => isset($this->contact) ? $this->contact->email : 'no contact email on record', 'label' => ctrans('texts.email')]; + $data['$client_name'] = ['value' => $this->entity->present()->clientName() ?: ' ', 'label' => ctrans('texts.client_name')]; + $data['$client.name'] = &$data['$client_name']; + $data['$client.address1'] = &$data['$address1']; + $data['$client.address2'] = &$data['$address2']; + $data['$client_address'] = ['value' => $this->entity->present()->address() ?: ' ', 'label' => ctrans('texts.address')]; + $data['$client.address'] = &$data['$client_address']; + $data['$client.id_number'] = &$data['$id_number']; + $data['$client.vat_number'] = &$data['$vat_number']; + $data['$client.website'] = &$data['$website']; + $data['$client.phone'] = &$data['$phone']; + $data['$city_state_postal'] = ['value' => $this->entity->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; + $data['$client.city_state_postal'] = &$data['$city_state_postal']; + $data['$postal_city_state'] = ['value' => $this->entity->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; + $data['$client.postal_city_state'] = &$data['$postal_city_state']; + $data['$client.country'] = &$data['$country']; + $data['$client.email'] = &$data['$email']; + $data['$contact.full_name'] = ['value' => $this->contact->present()->name(), 'label' => ctrans('texts.name')]; + $data['$contact.email'] = ['value' => $this->contact->email, 'label' => ctrans('texts.email')]; + $data['$contact.phone'] = ['value' => $this->contact->phone, 'label' => ctrans('texts.phone')]; - $data['$contact.full_name'] = ['value' => $this->contact->present()->name(), 'label' => ctrans('texts.name')]; - $data['$contact.email'] = ['value' => $this->contact->email, 'label' => ctrans('texts.email')]; - $data['$contact.phone'] = ['value' => $this->contact->phone, 'label' => ctrans('texts.phone')]; - - $data['$contact.name'] = ['value' => isset($this->contact) ? $this->contact->present()->name() : 'no contact name on record', 'label' => ctrans('texts.contact_name')]; - $data['$contact.first_name'] = ['value' => isset($contact) ? $contact->first_name : '', 'label' => ctrans('texts.first_name')]; - $data['$contact.last_name'] = ['value' => isset($contact) ? $contact->last_name : '', 'label' => ctrans('texts.last_name')]; - $data['$contact.custom1'] = ['value' => isset($this->contact) ? $this->contact->custom_value1 : ' ', 'label' => $this->makeCustomField('contact1')]; - $data['$contact.custom2'] = ['value' => isset($this->contact) ? $this->contact->custom_value2 : ' ', 'label' => $this->makeCustomField('contact1')]; - $data['$contact.custom3'] = ['value' => isset($this->contact) ? $this->contact->custom_value3 : ' ', 'label' => $this->makeCustomField('contact1')]; - $data['$contact.custom4'] = ['value' => isset($this->contact) ? $this->contact->custom_value4 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.name'] = ['value' => isset($this->contact) ? $this->contact->present()->name() : 'no contact name on record', 'label' => ctrans('texts.contact_name')]; + $data['$contact.first_name'] = ['value' => isset($contact) ? $contact->first_name : '', 'label' => ctrans('texts.first_name')]; + $data['$contact.last_name'] = ['value' => isset($contact) ? $contact->last_name : '', 'label' => ctrans('texts.last_name')]; + $data['$contact.custom1'] = ['value' => isset($this->contact) ? $this->contact->custom_value1 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.custom2'] = ['value' => isset($this->contact) ? $this->contact->custom_value2 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.custom3'] = ['value' => isset($this->contact) ? $this->contact->custom_value3 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.custom4'] = ['value' => isset($this->contact) ? $this->contact->custom_value4 : ' ', 'label' => $this->makeCustomField('contact1')]; $data['$company.city_state_postal'] = ['value' => $this->company->present()->cityStateZip($this->settings->city, $this->settings->state, $this->settings->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; $data['$company.postal_city_state'] = ['value' => $this->company->present()->cityStateZip($this->settings->city, $this->settings->state, $this->settings->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; - $data['$company.name'] = ['value' => $this->company->present()->name() ?: ' ', 'label' => ctrans('texts.company_name')]; - $data['$company.address1'] = ['value' => $this->settings->address1 ?: ' ', 'label' => ctrans('texts.address1')]; - $data['$company.address2'] = ['value' => $this->settings->address2 ?: ' ', 'label' => ctrans('texts.address2')]; - $data['$company.city'] = ['value' => $this->settings->city ?: ' ', 'label' => ctrans('texts.city')]; - $data['$company.state'] = ['value' => $this->settings->state ?: ' ', 'label' => ctrans('texts.state')]; - $data['$company.postal_code'] = ['value' => $this->settings->postal_code ?: ' ', 'label' => ctrans('texts.postal_code')]; - $data['$company.country'] = ['value' => $this->getCountryName(), 'label' => ctrans('texts.country')]; - $data['$company.phone'] = ['value' => $this->settings->phone ?: ' ', 'label' => ctrans('texts.phone')]; - $data['$company.email'] = ['value' => $this->settings->email ?: ' ', 'label' => ctrans('texts.email')]; - $data['$company.vat_number'] = ['value' => $this->settings->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; - $data['$company.id_number'] = ['value' => $this->settings->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; - $data['$company.website'] = ['value' => $this->settings->website ?: ' ', 'label' => ctrans('texts.website')]; - $data['$company.address'] = ['value' => $this->company->present()->address($this->settings) ?: ' ', 'label' => ctrans('texts.address')]; - + $data['$company.name'] = ['value' => $this->company->present()->name() ?: ' ', 'label' => ctrans('texts.company_name')]; + $data['$company.address1'] = ['value' => $this->settings->address1 ?: ' ', 'label' => ctrans('texts.address1')]; + $data['$company.address2'] = ['value' => $this->settings->address2 ?: ' ', 'label' => ctrans('texts.address2')]; + $data['$company.city'] = ['value' => $this->settings->city ?: ' ', 'label' => ctrans('texts.city')]; + $data['$company.state'] = ['value' => $this->settings->state ?: ' ', 'label' => ctrans('texts.state')]; + $data['$company.postal_code'] = ['value' => $this->settings->postal_code ?: ' ', 'label' => ctrans('texts.postal_code')]; + $data['$company.country'] = ['value' => $this->getCountryName(), 'label' => ctrans('texts.country')]; + $data['$company.phone'] = ['value' => $this->settings->phone ?: ' ', 'label' => ctrans('texts.phone')]; + $data['$company.email'] = ['value' => $this->settings->email ?: ' ', 'label' => ctrans('texts.email')]; + $data['$company.vat_number'] = ['value' => $this->settings->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; + $data['$company.id_number'] = ['value' => $this->settings->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; + $data['$company.website'] = ['value' => $this->settings->website ?: ' ', 'label' => ctrans('texts.website')]; + $data['$company.address'] = ['value' => $this->company->present()->address($this->settings) ?: ' ', 'label' => ctrans('texts.address')]; + $logo = $this->company->present()->logo($this->settings); - $data['$company.logo'] = ['value' => $logo ?: ' ', 'label' => ctrans('texts.logo')]; - $data['$company_logo'] = &$data['$company.logo']; - $data['$company1'] = ['value' => $this->settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')]; - $data['$company2'] = ['value' => $this->settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')]; - $data['$company3'] = ['value' => $this->settings->custom_value3 ?: ' ', 'label' => $this->makeCustomField('company3')]; - $data['$company4'] = ['value' => $this->settings->custom_value4 ?: ' ', 'label' => $this->makeCustomField('company4')]; + $data['$company.logo'] = ['value' => $logo ?: ' ', 'label' => ctrans('texts.logo')]; + $data['$company_logo'] = &$data['$company.logo']; + $data['$company1'] = ['value' => $this->settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')]; + $data['$company2'] = ['value' => $this->settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')]; + $data['$company3'] = ['value' => $this->settings->custom_value3 ?: ' ', 'label' => $this->makeCustomField('company3')]; + $data['$company4'] = ['value' => $this->settings->custom_value4 ?: ' ', 'label' => $this->makeCustomField('company4')]; - $data['$product.date'] = ['value' => '', 'label' => ctrans('texts.date')]; - $data['$product.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; - $data['$product.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; - $data['$product.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; - $data['$product.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; - $data['$product.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; - $data['$product.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; + $data['$product.date'] = ['value' => '', 'label' => ctrans('texts.date')]; + $data['$product.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; + $data['$product.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; + $data['$product.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; + $data['$product.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; + $data['$product.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; + $data['$product.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; - $data['$task.date'] = ['value' => '', 'label' => ctrans('texts.date')]; - $data['$task.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; - $data['$task.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; - $data['$task.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; - $data['$task.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; - $data['$task.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; - $data['$task.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; - $data['$contact.signature'] = ['value' => $this->invitation->signature_base64, 'label' => ctrans('texts.signature')]; + $data['$task.date'] = ['value' => '', 'label' => ctrans('texts.date')]; + $data['$task.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; + $data['$task.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; + $data['$task.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; + $data['$task.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; + $data['$task.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; + $data['$task.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; + $data['$contact.signature'] = ['value' => $this->invitation->signature_base64, 'label' => ctrans('texts.signature')]; - $data['$thanks'] = ['value' => '', 'label' => ctrans('texts.thanks')]; - $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; - $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; + $data['$thanks'] = ['value' => '', 'label' => ctrans('texts.thanks')]; + $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; + $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; - $data['_rate1'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['_rate2'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['_rate3'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['_rate1'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['_rate2'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['_rate3'] = ['value' => '', 'label' => ctrans('texts.tax')]; // $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')]; // $data['custom_label2'] = ['value' => '', 'label' => ctrans('texts.')]; @@ -355,12 +348,12 @@ class HtmlEngine return $data; } - public function generateLabelsAndValues() + public function generateLabelsAndValues() { $data = []; $values = $this->buildEntityDataArray(); - + foreach ($values as $key => $value) { $data['values'][$key] = $value['value']; $data['labels'][$key.'_label'] = $value['label']; @@ -368,18 +361,17 @@ class HtmlEngine return $data; } - private function totalTaxLabels() :string { $data = ''; - if (!$this->entity_calc->getTotalTaxMap()) { + if (! $this->entity_calc->getTotalTaxMap()) { return $data; } foreach ($this->entity_calc->getTotalTaxMap() as $tax) { - $data .= ''. $tax['name'] .''; + $data .= ''.$tax['name'].''; } return $data; @@ -389,12 +381,12 @@ class HtmlEngine { $data = ''; - if (!$this->entity_calc->getTotalTaxMap()) { + if (! $this->entity_calc->getTotalTaxMap()) { return $data; } foreach ($this->entity_calc->getTotalTaxMap() as $tax) { - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } return $data; @@ -403,13 +395,13 @@ class HtmlEngine private function lineTaxLabels() :string { $tax_map = $this->entity_calc->getTaxMap(); - + $data = ''; foreach ($tax_map as $tax) { - $data .= ''. $tax['name'] .''; + $data .= ''.$tax['name'].''; } - + return $data; } @@ -417,17 +409,18 @@ class HtmlEngine { $country = Country::find($this->settings->country_id)->first(); - if($country) + if ($country) { return $country->name; - + } return ' '; } + /** * Due to the way we are compiling the blade template we * have no ability to iterate, so in the case * of line taxes where there are multiple rows, - * we use this function to format a section of rows + * we use this function to format a section of rows. * * @return string a collection of rows with line item * aggregate data @@ -435,13 +428,13 @@ class HtmlEngine private function makeLineTaxes() :string { $tax_map = $this->entity_calc->getTaxMap(); - + $data = ''; foreach ($tax_map as $tax) { $data .= ''; - $data .= ''. $tax['name'] .''; - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.$tax['name'].''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } return $data; @@ -450,13 +443,13 @@ class HtmlEngine private function lineTaxValues() :string { $tax_map = $this->entity_calc->getTaxMap(); - + $data = ''; foreach ($tax_map as $tax) { - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } - + return $data; } @@ -466,7 +459,7 @@ class HtmlEngine if ($custom_fields && property_exists($custom_fields, $field)) { $custom_field = $custom_fields->{$field}; - $custom_field_parts = explode("|", $custom_field); + $custom_field_parts = explode('|', $custom_field); return $custom_field_parts[0]; } @@ -478,15 +471,15 @@ class HtmlEngine { $data = ''; - if (!$this->entity_calc->getTotalTaxMap()) { + if (! $this->entity_calc->getTotalTaxMap()) { return $data; } foreach ($this->entity_calc->getTotalTaxMap() as $tax) { $data .= ''; $data .= ''; - $data .= ''. $tax['name'] .''; - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.$tax['name'].''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } return $data; @@ -494,10 +487,9 @@ class HtmlEngine private function parseLabelsAndValues($labels, $values, $section) :string { - $section = strtr($section, $labels); - return strtr($section, $values); + return strtr($section, $values); } /* @@ -511,12 +503,11 @@ class HtmlEngine /** * Builds CSS to assist with the generation - * of Repeating headers and footers on the PDF + * of Repeating headers and footers on the PDF. * @return string The css string */ private function generateCustomCSS() :string { - $header_and_footer = ' .header, .header-space { height: 160px; @@ -583,9 +574,9 @@ class HtmlEngine if ($this->settings->all_pages_header && $this->settings->all_pages_footer) { $css .= $header_and_footer; - } elseif ($this->settings->all_pages_header && !$this->settings->all_pages_footer) { + } elseif ($this->settings->all_pages_header && ! $this->settings->all_pages_footer) { $css .= $header; - } elseif (!$this->settings->all_pages_header && $this->settings->all_pages_footer) { + } elseif (! $this->settings->all_pages_header && $this->settings->all_pages_footer) { $css .= $footer; } @@ -601,12 +592,11 @@ class HtmlEngine html { '; - $css .= 'font-size:' . $this->settings->font_size . 'px;'; + $css .= 'font-size:'.$this->settings->font_size.'px;'; // $css .= 'font-size:14px;'; $css .= '}'; return $css; } - -} \ No newline at end of file +} diff --git a/app/Utils/Ninja.php b/app/Utils/Ninja.php index dba0f3cdb9c5..5d4dc56f9b0a 100644 --- a/app/Utils/Ninja.php +++ b/app/Utils/Ninja.php @@ -1,6 +1,6 @@ version; - - $info = "App Version: v" . config('ninja.app_version') . "\\n" . - "White Label: " . "\\n" . // TODO: Implement white label with hasFeature. - "Server OS: " . php_uname('s') . ' ' . php_uname('r') . "\\n" . - "PHP Version: " . phpversion() . "\\n" . - "MySQL Version: " . $mysql_version; + $mysql_version = DB::select(DB::raw('select version() as version'))[0]->version; + + $info = 'App Version: v'.config('ninja.app_version').'\\n'. + 'White Label: '.'\\n'. // TODO: Implement white label with hasFeature. + 'Server OS: '.php_uname('s').' '.php_uname('r').'\\n'. + 'PHP Version: '.phpversion().'\\n'. + 'MySQL Version: '.$mysql_version; return $info; } @@ -60,7 +60,7 @@ class Ninja if (self::isNinjaDev()) { return true; } - + $data = [ 'license' => config('ninja.license'), ]; @@ -91,7 +91,7 @@ class Ninja return false; } - $url = config('ninja.license_url') . '/signup/register'; + $url = config('ninja.license_url').'/signup/register'; $data = ''; $fields = [ 'first_name' => urlencode($user->first_name), diff --git a/app/Utils/Number.php b/app/Utils/Number.php index 858af3f8ed3d..977b83b0fb20 100644 --- a/app/Utils/Number.php +++ b/app/Utils/Number.php @@ -1,6 +1,6 @@ country->thousand_separator)) { $thousand = $client->country->thousand_separator; } - + if (isset($client->country->decimal_separator)) { $decimal = $client->country->decimal_separator; } @@ -107,11 +107,11 @@ class Number $value = number_format($value, $precision, $decimal, $thousand); $symbol = $currency->symbol; - + if ($client->getSetting('show_currency_code') === true) { return "{$value} {$code}"; } elseif ($swapSymbol) { - return "{$value} " . trim($symbol); + return "{$value} ".trim($symbol); } elseif ($client->getSetting('show_currency_code') === false) { return "{$symbol}{$value}"; } else { diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index 5371ee23b4a7..366e4c066afb 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -1,6 +1,6 @@ {$entity}; + if ($invitation instanceof InvoiceInvitation) { + $entity = 'invoice'; + } elseif ($invitation instanceof CreditInvitation) { + $entity = 'credit'; + } elseif ($invitation instanceof QuoteInvitation) { + $entity = 'quote'; + } - if($entity == 'invoice') - $path = $entity_obj->client->invoice_filepath(); + $entity_obj = $invitation->{$entity}; - if($entity == 'quote') - $path = $entity_obj->client->quote_filepath(); + if ($entity == 'invoice') { + $path = $entity_obj->client->invoice_filepath(); + } - if($entity == 'credit') - $path = $entity_obj->client->credit_filepath(); + if ($entity == 'quote') { + $path = $entity_obj->client->quote_filepath(); + } - $file_path = $path . $entity_obj->number . '.pdf'; + if ($entity == 'credit') { + $path = $entity_obj->client->credit_filepath(); + } - $url = config('ninja.app_url') . 'phantom/' . $entity . '/' . $invitation->key . '?phantomjs_secret='. config('ninja.phantomjs_secret'); + $file_path = $path.$entity_obj->number.'.pdf'; - $key = config('ninja.phantomjs_key'); - $secret = config('ninja.phantomjs_key'); + $url = config('ninja.app_url').'phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret'); - $phantom_url = "https://phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$url}%22,renderType:%22pdf%22%7D"; + $key = config('ninja.phantomjs_key'); + $secret = config('ninja.phantomjs_key'); + + $phantom_url = "https://phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$url}%22,renderType:%22pdf%22%7D"; $pdf = \App\Utils\CurlUtils::get($phantom_url); Storage::makeDirectory($path, 0775); @@ -68,16 +72,15 @@ class Phantom $instance = Storage::disk(config('filesystems.default'))->put($file_path, $pdf); return $file_path; + } - } - - public function displayInvitation(string $entity, string $invitation_key) - { + public function displayInvitation(string $entity, string $invitation_key) + { $key = $entity.'_id'; $invitation_instance = 'App\Models\\'.ucfirst($entity).'Invitation'; - $invitation = $invitation_instance::whereRaw("BINARY `key`= ?", [$invitation_key])->first(); + $invitation = $invitation_instance::whereRaw('BINARY `key`= ?', [$invitation_key])->first(); $entity_obj = $invitation->{$entity}; @@ -85,15 +88,14 @@ class Phantom App::setLocale($invitation->contact->preferredLocale()); - $design_id = $entity_obj->design_id ? $entity_obj->design_id : $this->decodePrimaryKey($entity_obj->client->getSetting($entity . '_design_id')); + $design_id = $entity_obj->design_id ? $entity_obj->design_id : $this->decodePrimaryKey($entity_obj->client->getSetting($entity.'_design_id')); $design = Design::find($design_id); - + $designer = new Designer($entity_obj, $design, $entity_obj->client->getSetting('pdf_variables'), $entity); $data['html'] = (new HtmlEngine($designer, $invitation, $entity))->build(); return view('pdf.html', $data); - } - + } } diff --git a/app/Utils/Statics.php b/app/Utils/Statics.php index 8ee45134413c..9f78e42a16be 100644 --- a/app/Utils/Statics.php +++ b/app/Utils/Statics.php @@ -1,6 +1,6 @@ 'j. M. Y g:i a', 'format_moment' => 'DD. MMM. YYYY h:mm:ss a', 'format_dart' => 'd. MMM. yyyy h:mm a'], ['format' => 'j. F Y g:i a', 'format_moment' => 'DD. MMMM YYYY h:mm:ss a', 'format_dart' => 'd. MMMM yyyy h:mm a'], ]; - /** - * Company statics - * @param string|boolean $locale The user locale + * Company statics. + * @param string|bool $locale The user locale * @return array Array of statics */ public static function company($locale = false) :array @@ -101,7 +100,7 @@ class Statics })->values(); $data['currencies'] = Cache::get('currencies')->each(function ($currency) { - $currency->name = ctrans('texts.currency_' . Str::slug($currency->name, '_')); + $currency->name = ctrans('texts.currency_'.Str::slug($currency->name, '_')); })->sortBy(function ($currency) { return $currency->name; })->values(); diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index d5b560f6cf8b..eb1d830d2981 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -33,7 +33,7 @@ class SystemHealth 'openssl', 'mbstring', 'xml', - 'bcmath' + 'bcmath', ]; private static $php_version = 7.3; @@ -55,8 +55,8 @@ class SystemHealth $system_health = false; } - if(!self::simpleDbCheck() && $check_database) { - info("db fails"); + if (! self::simpleDbCheck() && $check_database) { + info('db fails'); $system_health = false; } @@ -64,7 +64,7 @@ class SystemHealth 'system_health' => $system_health, 'extensions' => self::extensions(), 'php_version' => [ - 'minimum_php_version' => (string)self::$php_version, + 'minimum_php_version' => (string) self::$php_version, 'current_php_version' => phpversion(), 'is_okay' => version_compare(phpversion(), self::$php_version, '>='), ], @@ -82,14 +82,11 @@ class SystemHealth exec('node -v', $foo, $exitCode); if ($exitCode === 0) { - return empty($foo[0]) ? 'Found node, but no version information' : $foo[0]; + return empty($foo[0]) ? 'Found node, but no version information' : $foo[0]; } - } catch (\Exception $e) { - return false; } - } public static function checkNpm() @@ -98,13 +95,11 @@ class SystemHealth exec('npm -v', $foo, $exitCode); if ($exitCode === 0) { - return empty($foo[0]) ? 'Found npm, but no version information' : $foo[0]; - } - - }catch (\Exception $e) { + return empty($foo[0]) ? 'Found npm, but no version information' : $foo[0]; + } + } catch (\Exception $e) { return false; } - } private static function simpleDbCheck() :bool @@ -114,8 +109,7 @@ class SystemHealth try { $pdo = DB::connection()->getPdo(); $result = true; - } - catch (\Exception $e) { + } catch (\Exception $e) { $result = false; } diff --git a/app/Utils/TempFile.php b/app/Utils/TempFile.php index 8c58b4152b07..50f5da847297 100644 --- a/app/Utils/TempFile.php +++ b/app/Utils/TempFile.php @@ -1,6 +1,6 @@ entity) > 1 && strlen($this->entity_id) >1) { + if (strlen($this->entity) > 1 && strlen($this->entity_id) > 1) { $class = 'App\Models\\'.ucfirst($this->entity); $this->entity_obj = $class::whereId($this->decodePrimaryKey($this->entity_id))->company()->first(); } @@ -88,7 +88,7 @@ class TemplateEngine private function setTemplates() { if (strlen($this->subject) == 0 && strlen($this->template) > 1) { - $subject_template = str_replace("template", "subject", $this->template); + $subject_template = str_replace('template', 'subject', $this->template); $this->subject = EmailTemplateDefaults::getDefaultTemplate($subject_template, $this->settings_entity->locale()); } @@ -126,12 +126,10 @@ class TemplateEngine ]); $this->body = $converter->convertToHtml($this->body); - } private function entityValues($contact) { - $data = $this->entity_obj->buildLabelsAndValues($contact); $this->body = strtr($this->body, $data['labels']); @@ -139,7 +137,7 @@ class TemplateEngine $this->subject = strtr($this->subject, $data['labels']); $this->subject = strtr($this->subject, $data['values']); - + $converter = new CommonMarkConverter([ 'allow_unsafe_links' => false, ]); @@ -169,7 +167,7 @@ class TemplateEngine } else { $wrapper = view($this->getTemplatePath($email_style), $data)->render(); $injection = ''; - $wrapper = str_replace('',$injection ,$wrapper); + $wrapper = str_replace('', $injection, $wrapper); } $data = [ diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index 870a91d5df32..358e4bc645f8 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -1,6 +1,6 @@ casts); foreach ($invoice_item as $key => $value) { - if (!array_key_exists($key, $item) || !isset($item[$key])) { + if (! array_key_exists($key, $item) || ! isset($item[$key])) { $item[$key] = $value; $item[$key] = BaseSettings::castAttribute(InvoiceItem::$casts[$key], $value); } } - if (array_key_exists("id", $item)) { + if (array_key_exists('id', $item)) { unset($item['id']); } - return $item; } } diff --git a/app/Utils/Traits/ClientGroupSettingsSaver.php b/app/Utils/Traits/ClientGroupSettingsSaver.php index 63c3be725367..97d5f67738da 100644 --- a/app/Utils/Traits/ClientGroupSettingsSaver.php +++ b/app/Utils/Traits/ClientGroupSettingsSaver.php @@ -1,6 +1,6 @@ $value) { - if (!isset($settings->{$key}) || empty($settings->{$key}) || (!is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { + if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { unset($settings->{$key}); } } - $settings = $this->checkSettingType($settings); //iterate through set properties with new values; @@ -83,24 +79,24 @@ trait ClientGroupSettingsSaver */ public function validateSettings($settings) { - $settings = (object)$settings; + $settings = (object) $settings; $casts = CompanySettings::$casts; ksort($casts); foreach ($settings as $key => $value) { - if (!isset($settings->{$key}) || empty($settings->{$key}) || (!is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { + if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { unset($settings->{$key}); } } foreach ($casts as $key => $value) { if (in_array($key, CompanySettings::$string_casts)) { - $value = "string"; + $value = 'string'; - if (!property_exists($settings, $key)) { + if (! property_exists($settings, $key)) { continue; - } elseif (!$this->checkAttribute($value, $settings->{$key})) { + } elseif (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } @@ -108,11 +104,11 @@ trait ClientGroupSettingsSaver } /*Separate loop if it is a _id field which is an integer cast as a string*/ elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { - $value = "integer"; - - if (!property_exists($settings, $key)) { + $value = 'integer'; + + if (! property_exists($settings, $key)) { continue; - } elseif (!$this->checkAttribute($value, $settings->{$key})) { + } elseif (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } @@ -120,13 +116,12 @@ trait ClientGroupSettingsSaver } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { + if (! property_exists($settings, $key) || is_null($settings->{$key}) || ! isset($settings->{$key}) || $settings->{$key} == '') { continue; } - /*Catch all filter */ - if (!$this->checkAttribute($value, $settings->{$key})) { + if (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } } @@ -147,16 +142,16 @@ trait ClientGroupSettingsSaver */ private function checkSettingType($settings) : \stdClass { - $settings = (object)$settings; + $settings = (object) $settings; $casts = CompanySettings::$casts; - + foreach ($casts as $key => $value) { /*Separate loop if it is a _id field which is an integer cast as a string*/ if (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { - $value = "integer"; - - if (!property_exists($settings, $key)) { + $value = 'integer'; + + if (! property_exists($settings, $key)) { continue; } elseif ($this->checkAttribute($value, $settings->{$key})) { if (substr($key, -3) == '_id') { @@ -172,7 +167,7 @@ trait ClientGroupSettingsSaver } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { + if (! property_exists($settings, $key) || is_null($settings->{$key}) || ! isset($settings->{$key}) || $settings->{$key} == '') { continue; } @@ -187,9 +182,9 @@ trait ClientGroupSettingsSaver unset($settings->{$key}); } } + return $settings; } - /** * Type checks a object property. @@ -218,7 +213,8 @@ trait ClientGroupSettingsSaver return is_array($value); case 'json': json_decode($string); - return (json_last_error() == JSON_ERROR_NONE); + + return json_last_error() == JSON_ERROR_NONE; default: return false; } diff --git a/app/Utils/Traits/CompanyGatewayFeesAndLimitsSaver.php b/app/Utils/Traits/CompanyGatewayFeesAndLimitsSaver.php index b5802eebe75c..989812584993 100644 --- a/app/Utils/Traits/CompanyGatewayFeesAndLimitsSaver.php +++ b/app/Utils/Traits/CompanyGatewayFeesAndLimitsSaver.php @@ -1,6 +1,6 @@ $value) { - /* Handles unset settings or blank strings */ - if (!property_exists($fee_and_limit, $key) || is_null($fee_and_limit->{$key}) || !isset($fee_and_limit->{$key}) || $fee_and_limit->{$key} == '') { + if (! property_exists($fee_and_limit, $key) || is_null($fee_and_limit->{$key}) || ! isset($fee_and_limit->{$key}) || $fee_and_limit->{$key} == '') { continue; } - + /*Catch all filter */ - if (!$this->checkAttribute($value, $fee_and_limit->{$key})) { + if (! $this->checkAttribute($value, $fee_and_limit->{$key})) { return [$key, $value]; } } @@ -74,7 +72,8 @@ trait CompanyGatewayFeesAndLimitsSaver return is_array($value); case 'json': json_decode($string); - return (json_last_error() == JSON_ERROR_NONE); + + return json_last_error() == JSON_ERROR_NONE; default: return false; } @@ -97,22 +96,21 @@ trait CompanyGatewayFeesAndLimitsSaver // return $new_arr; // } - // + // public function cleanFeesAndLimits($fees_and_limits) { $new_arr = []; foreach ($fees_and_limits as $key => $value) { - $fal = new FeesAndLimits; + $fal = new FeesAndLimits; // $fal->{$key} = $value; foreach ($value as $k => $v) { - $fal->{$k} = $v; $fal->{$k} = BaseSettings::castAttribute(FeesAndLimits::$casts[$k], $v); } - $new_arr[$key] = (array)$fal; + $new_arr[$key] = (array) $fal; } return $new_arr; diff --git a/app/Utils/Traits/CompanySettingsSaver.php b/app/Utils/Traits/CompanySettingsSaver.php index f975f4a7b589..a8b173bb0aa3 100644 --- a/app/Utils/Traits/CompanySettingsSaver.php +++ b/app/Utils/Traits/CompanySettingsSaver.php @@ -1,6 +1,6 @@ $value) { - + foreach ($settings as $key => $value) { if (is_null($settings->{$key})) { $company_settings->{$key} = ''; } else { - $company_settings->{$key} = $value; + $company_settings->{$key} = $value; } } @@ -78,19 +74,19 @@ trait CompanySettingsSaver */ public function validateSettings($settings) { - $settings = (object)$settings; + $settings = (object) $settings; $casts = CompanySettings::$casts; - + ksort($casts); foreach ($casts as $key => $value) { if (in_array($key, CompanySettings::$string_casts)) { - $value = "string"; + $value = 'string'; - if (!property_exists($settings, $key)) { + if (! property_exists($settings, $key)) { continue; - } elseif (!$this->checkAttribute($value, $settings->{$key})) { + } elseif (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } @@ -98,11 +94,11 @@ trait CompanySettingsSaver } /*Separate loop if it is a _id field which is an integer cast as a string*/ elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { - $value = "integer"; - - if (!property_exists($settings, $key)) { + $value = 'integer'; + + if (! property_exists($settings, $key)) { continue; - } elseif (!$this->checkAttribute($value, $settings->{$key})) { + } elseif (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } @@ -112,12 +108,12 @@ trait CompanySettingsSaver } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { + if (! property_exists($settings, $key) || is_null($settings->{$key}) || ! isset($settings->{$key}) || $settings->{$key} == '') { continue; } /*Catch all filter */ - if (!$this->checkAttribute($value, $settings->{$key})) { + if (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } } @@ -138,15 +134,15 @@ trait CompanySettingsSaver */ private function checkSettingType($settings) : \stdClass { - $settings = (object)$settings; + $settings = (object) $settings; $casts = CompanySettings::$casts; - + foreach ($casts as $key => $value) { if (in_array($key, CompanySettings::$string_casts)) { - $value = "string"; - - if (!property_exists($settings, $key)) { + $value = 'string'; + + if (! property_exists($settings, $key)) { continue; } elseif ($this->checkAttribute($value, $settings->{$key})) { if (substr($key, -3) == '_id') { @@ -162,9 +158,9 @@ trait CompanySettingsSaver } /*Separate loop if it is a _id field which is an integer cast as a string*/ if (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { - $value = "integer"; - - if (!property_exists($settings, $key)) { + $value = 'integer'; + + if (! property_exists($settings, $key)) { continue; } elseif ($this->checkAttribute($value, $settings->{$key})) { if (substr($key, -3) == '_id') { @@ -182,10 +178,9 @@ trait CompanySettingsSaver } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { + if (! property_exists($settings, $key) || is_null($settings->{$key}) || ! isset($settings->{$key}) || $settings->{$key} == '') { continue; } - /*Catch all filter */ if ($this->checkAttribute($value, $settings->{$key})) { @@ -229,7 +224,8 @@ trait CompanySettingsSaver return is_array($value); case 'json': json_decode($string); - return (json_last_error() == JSON_ERROR_NONE); + + return json_last_error() == JSON_ERROR_NONE; default: return false; } @@ -237,8 +233,9 @@ trait CompanySettingsSaver private function getAccountFromEntity($entity) { - if($entity instanceof Company) + if ($entity instanceof Company) { return $entity->account; + } return $entity->company->account; } diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index 82ad02f5f18c..3fd4467f7e73 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -1,6 +1,6 @@ getSetting('invoice_number_pattern'); $padding = $client->getSetting('counter_padding'); - + $invoice_number = $this->checkEntityNumber(Invoice::class, $client, $counter, $padding, $pattern); $this->incrementCounter($counter_entity, 'invoice_number_counter'); - return $invoice_number; } - /** * Gets the next credit number. * @@ -138,7 +135,7 @@ trait GeneratesCounter //Return a valid counter $pattern = $client->getSetting('quote_number_pattern'); $padding = $client->getSetting('counter_padding'); - + $quote_number = $this->checkEntityNumber(Quote::class, $client, $counter, $padding, $pattern); $this->incrementCounter($counter_entity, $used_counter); @@ -182,7 +179,7 @@ trait GeneratesCounter } /** - * Payment Number Generator + * Payment Number Generator. * @return string The payment number */ public function getNextPaymentNumber(Client $client) :string @@ -216,7 +213,7 @@ trait GeneratesCounter $this->incrementCounter($client->company, 'payment_number_counter'); } - return (string)$payment_number; + return (string) $payment_number; } /** @@ -241,13 +238,12 @@ trait GeneratesCounter return $client_number; } - /** * Determines if it has shared counter. * * @param \App\Models\Client $client The client * - * @return boolean True if has shared counter, False otherwise. + * @return bool True if has shared counter, False otherwise. */ public function hasSharedCounter(Client $client) : bool { @@ -255,11 +251,11 @@ trait GeneratesCounter } /** - * Checks that the number has not already been used + * Checks that the number has not already been used. * * @param Collection $entity The entity ie App\Models\Client, Invoice, Quote etc - * @param integer $counter The counter - * @param integer $padding The padding + * @param int $counter The counter + * @param int $padding The padding * * @return string The padded and prefixed invoice number */ @@ -271,7 +267,7 @@ trait GeneratesCounter $number = $this->padCounter($counter, $padding); $number = $this->applyNumberPattern($client, $number, $pattern); - + if ($class == Invoice::class || $class == RecurringInvoice::class) { $check = $class::whereCompanyId($client->company_id)->whereNumber($number)->withTrashed()->first(); } elseif ($class == Client::class) { @@ -287,29 +283,27 @@ trait GeneratesCounter $counter++; } while ($check); - return $number; } - /** - * Saves counters at both the company and client level + * Saves counters at both the company and client level. * * @param \App\Models\Client $client The client - * @param \App\Models\Client|integer|string $counter_name The counter name + * @param \App\Models\Client|int|string $counter_name The counter name */ private function incrementCounter($entity, string $counter_name) :void { $settings = $entity->settings; - - if ($counter_name == 'invoice_number_counter' && !property_exists($entity->settings, 'invoice_number_counter')) { + + if ($counter_name == 'invoice_number_counter' && ! property_exists($entity->settings, 'invoice_number_counter')) { $settings->invoice_number_counter = 0; } $settings->{$counter_name} = $settings->{$counter_name} + 1; - + $entity->settings = $settings; - + $entity->save(); } @@ -319,11 +313,11 @@ trait GeneratesCounter return $counter; } - return $prefix . $counter; + return $prefix.$counter; } /** - * Pads a number with leading 000000's + * Pads a number with leading 000000's. * * @param int $counter The counter * @param int $padding The padding @@ -335,10 +329,9 @@ trait GeneratesCounter return str_pad($counter, $padding, '0', STR_PAD_LEFT); } - /** * If we are using counter reset, - * check if we need to reset here + * check if we need to reset here. * * @param Client $client client entity * @return void @@ -396,9 +389,8 @@ trait GeneratesCounter $client->company->save(); } - /** - * { function_description } + * { function_description }. * * @param \App\Models\Client $client The client * @param string $counter The counter @@ -408,7 +400,7 @@ trait GeneratesCounter */ private function applyNumberPattern(Client $client, string $counter, $pattern) :string { - if (!$pattern) { + if (! $pattern) { return $counter; } @@ -455,7 +447,7 @@ trait GeneratesCounter $search[] = '{$id_number}'; $replace[] = $client->id_number; - + return str_replace($search, $replace, $pattern); } } diff --git a/app/Utils/Traits/Inviteable.php b/app/Utils/Traits/Inviteable.php index 42811e385485..0b7012738ac5 100644 --- a/app/Utils/Traits/Inviteable.php +++ b/app/Utils/Traits/Inviteable.php @@ -1,6 +1,6 @@ company->portal_mode) { case 'subdomain': - return $domain .'client/'. $entity_type .'/'. $this->key; + return $domain.'client/'.$entity_type.'/'.$this->key; break; case 'iframe': - return $domain .'client/'. $entity_type .'/'. $this->key; + return $domain.'client/'.$entity_type.'/'.$this->key; //return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key; break; case 'domain': - return $domain .'client/'. $entity_type .'/'. $this->key; + return $domain.'client/'.$entity_type.'/'.$this->key; break; } @@ -70,6 +66,6 @@ trait Inviteable public function getAdminLink() :string { - return $this->getLink(). '?silent=true'; + return $this->getLink().'?silent=true'; } } diff --git a/app/Utils/Traits/Invoice/ActionsInvoice.php b/app/Utils/Traits/Invoice/ActionsInvoice.php index fb523b8227c1..1cd930f1fdae 100644 --- a/app/Utils/Traits/Invoice/ActionsInvoice.php +++ b/app/Utils/Traits/Invoice/ActionsInvoice.php @@ -1,6 +1,6 @@ status_id <= Invoice::STATUS_SENT && - $invoice->is_deleted == false && - $invoice->deleted_at == null && + if ($invoice->status_id <= Invoice::STATUS_SENT && + $invoice->is_deleted == false && + $invoice->deleted_at == null && $invoice->balance == 0) { return true; } @@ -29,9 +29,9 @@ trait ActionsInvoice public function invoiceCancellable($invoice) :bool { - if (($invoice->status_id == Invoice::STATUS_SENT || - $invoice->status_id == Invoice::STATUS_PARTIAL) && - $invoice->is_deleted == false && + if (($invoice->status_id == Invoice::STATUS_SENT || + $invoice->status_id == Invoice::STATUS_PARTIAL) && + $invoice->is_deleted == false && $invoice->deleted_at == null) { return true; } @@ -41,11 +41,11 @@ trait ActionsInvoice public function invoiceReversable($invoice) :bool { - if (($invoice->status_id == Invoice::STATUS_SENT || - $invoice->status_id == Invoice::STATUS_PARTIAL || - $invoice->status_id == Invoice::STATUS_CANCELLED || - $invoice->status_id == Invoice::STATUS_PAID) && - $invoice->is_deleted == false && + if (($invoice->status_id == Invoice::STATUS_SENT || + $invoice->status_id == Invoice::STATUS_PARTIAL || + $invoice->status_id == Invoice::STATUS_CANCELLED || + $invoice->status_id == Invoice::STATUS_PAID) && + $invoice->is_deleted == false && $invoice->deleted_at == null) { return true; } diff --git a/app/Utils/Traits/InvoiceEmailBuilder.php b/app/Utils/Traits/InvoiceEmailBuilder.php index 09906146998d..147409b418b5 100644 --- a/app/Utils/Traits/InvoiceEmailBuilder.php +++ b/app/Utils/Traits/InvoiceEmailBuilder.php @@ -1,6 +1,6 @@ client; - if (!$reminder_template) { + if (! $reminder_template) { $reminder_template = $this->calculateTemplate(); } @@ -52,20 +50,19 @@ trait InvoiceEmailBuilder /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { - $body_template = trans('texts.invoice_message', ['amount'=>$this->present()->amount(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $body_template = trans('texts.invoice_message', ['amount'=>$this->present()->amount(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } $subject_template = $client->getSetting('email_subject_'.$reminder_template); if (iconv_strlen($subject_template) == 0) { if ($reminder_template == 'invoice') { - $subject_template = trans('texts.invoice_subject', ['number'=>$this->present()->invoice_number(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $subject_template = trans('texts.invoice_subject', ['number'=>$this->present()->invoice_number(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } else { - $subject_template = trans('texts.reminder_subject', ['number'=>$this->present()->invoice_number(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $subject_template = trans('texts.reminder_subject', ['number'=>$this->present()->invoice_number(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } } - $data['body'] = $this->parseTemplate($body_template, true, $contact); $data['subject'] = $this->parseTemplate($subject_template, false, $contact); diff --git a/app/Utils/Traits/MakesDates.php b/app/Utils/Traits/MakesDates.php index d3d5bec09002..e18659b095a9 100644 --- a/app/Utils/Traits/MakesDates.php +++ b/app/Utils/Traits/MakesDates.php @@ -1,6 +1,6 @@ convertToDateObject($utc_date); } - + return $utc_date->setTimezone(new \DateTimeZone($timezone)); } /** - * Converts from client timezone to UTC + * Converts from client timezone to UTC. * @param datetime object $utc_date * @param string $timezone ie Australia/Sydney * @return Carbon Carbon object @@ -52,17 +50,17 @@ trait MakesDates } /** - * Formats a date + * Formats a date. * @param Carbon/String $date Carbon object or date string * @param string $format The date display format * @return string The formatted date */ public function formatDate($date, string $format) :string { - if (!$date || strlen($date) < 1) { + if (! $date || strlen($date) < 1) { return ''; } - + if (is_string($date)) { $date = $this->convertToDateObject($date); } @@ -70,9 +68,8 @@ trait MakesDates return $date->format($format); } - /** - * Formats a date + * Formats a date. * @param Carbon/String $date Carbon object or date string * @param string $format The date display format * @return string The formatted date diff --git a/app/Utils/Traits/MakesHash.php b/app/Utils/Traits/MakesHash.php index 9b2318b25cf9..b957494ea7d9 100644 --- a/app/Utils/Traits/MakesHash.php +++ b/app/Utils/Traits/MakesHash.php @@ -1,6 +1,6 @@ getDbCode($db) . '-' . \Illuminate\Support\Str::random(config('ninja.key_length')); + return $this->getDbCode($db).'-'.\Illuminate\Support\Str::random(config('ninja.key_length')); } /** @@ -49,7 +48,7 @@ trait MakesHash { $hashids = new Hashids(config('ninja.hash_salt'), 10); - return $hashids->encode(str_replace(MultiDB::DB_PREFIX, "", $db)); + return $hashids->encode(str_replace(MultiDB::DB_PREFIX, '', $db)); } public function encodePrimaryKey($value) : string @@ -64,12 +63,12 @@ trait MakesHash try { $hashids = new Hashids(config('ninja.hash_salt'), 10); - $decoded_array = $hashids->decode($value); + $decoded_array = $hashids->decode($value); - if (!is_array($decoded_array)) { - throw new ModelNotFoundException("Resource not found", 1); + if (! is_array($decoded_array)) { + throw new ModelNotFoundException('Resource not found', 1); } - + return $decoded_array[0]; } catch (\Exception $e) { return response()->json(['error'=>'Invalid primary key'], 400); diff --git a/app/Utils/Traits/MakesHeaderData.php b/app/Utils/Traits/MakesHeaderData.php index 667eee3b01e8..2a0e0a88b7a1 100644 --- a/app/Utils/Traits/MakesHeaderData.php +++ b/app/Utils/Traits/MakesHeaderData.php @@ -1,6 +1,6 @@ load('client'); - + $client = $entity->client; App::setLocale($client->preferredLocale()); $values_and_labels = $entity->buildLabelsAndValues($contact); - + $designer->build(); $data = []; @@ -56,16 +54,16 @@ trait MakesInvoiceHtml $data['footer'] = $designer->getFooter(); $html = view('pdf.stub', $data)->render(); - + $html = $this->parseLabelsAndValues($values_and_labels['labels'], $values_and_labels['values'], $html); - + return $html; } public function generateEmailEntityHtml($entity, $content, $contact = null) :string { $entity->load('client'); - + $client = $entity->client; App::setLocale($client->preferredLocale()); @@ -77,20 +75,18 @@ trait MakesInvoiceHtml private function parseLabelsAndValues($labels, $values, $section) :string { - $section = strtr($section, $labels); $section = strtr($section, $values); - + return $section; } /** - * Parses the blade file string and processes the template variables + * Parses the blade file string and processes the template variables. * * @param string $string The Blade file string * @param array $data The array of template variables * @return string The return HTML string - * */ public function renderView($string, $data = []) :string { @@ -103,7 +99,7 @@ trait MakesInvoiceHtml extract($data, EXTR_SKIP); try { - eval('?' . '>' . $php); + eval('?'.'>'.$php); } catch (\Exception $e) { while (ob_get_level() > $obLevel) { ob_end_clean(); @@ -126,11 +122,11 @@ trait MakesInvoiceHtml */ public function getTemplate(string $template = 'plain') { - return File::get(resource_path('views/email/template/' . $template . '.blade.php')); + return File::get(resource_path('views/email/template/'.$template.'.blade.php')); } public function getTemplatePath(string $template = 'plain') { - return 'email.template.' . $template; + return 'email.template.'.$template; } } diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index b5e926a367cb..0cba97f7d120 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -1,6 +1,6 @@ {$field}; - $custom_field_parts = explode("|", $custom_field); + $custom_field_parts = explode('|', $custom_field); return $custom_field_parts[0]; } @@ -89,7 +87,7 @@ trait MakesInvoiceValues if ($custom_fields && property_exists($custom_fields, $field)) { $custom_field = $custom_fields->{$field}; - $custom_field_parts = explode("|", $custom_field); + $custom_field_parts = explode('|', $custom_field); return $custom_field_parts[1]; } @@ -99,7 +97,7 @@ trait MakesInvoiceValues /** * This method produces the key /value pairs for - * custom fields + * custom fields. * * We need to explode the field name and search for the | * we split on the pipe, the first value is the field name @@ -119,7 +117,7 @@ trait MakesInvoiceValues $value = ctrans('texts.'.$value); } - if (!$value) { + if (! $value) { $value = ''; } @@ -141,7 +139,7 @@ trait MakesInvoiceValues /** * Transforms all placeholders - * to invoice values + * to invoice values. * * @return array returns an array * of keyed labels (appended with _label) @@ -159,12 +157,12 @@ trait MakesInvoiceValues return $data; } - public function buildLabelsAndValues($contact) + public function buildLabelsAndValues($contact) { $data = []; $values = $this->makeLabelsAndValues($contact); - + foreach ($values as $key => $value) { $data['values'][$key] = $value['value']; $data['labels'][$key.'_label'] = $value['label']; @@ -175,14 +173,14 @@ trait MakesInvoiceValues private function makeLabelsAndValues($contact = null) :array { - if (!$this->client->currency() || !$this->client) { + if (! $this->client->currency() || ! $this->client) { throw new \Exception(debug_backtrace()[1]['function'], 1); exit; } - + $settings = $this->client->getMergedSettings(); - if (!$contact) { + if (! $contact) { $contact = $this->client->primary_contact()->first(); } @@ -190,106 +188,106 @@ trait MakesInvoiceValues $invitation = $this->invitations->where('client_contact_id', $contact->id)->first(); $data = []; - $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; - $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; - $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; - $data['$total_tax_labels'] = ['value' => $this->totalTaxLabels(), 'label' => ctrans('texts.taxes')]; - $data['$total_tax_values'] = ['value' => $this->totalTaxValues(), 'label' => ctrans('texts.taxes')]; - $data['$line_tax_labels'] = ['value' => $this->lineTaxLabels(), 'label' => ctrans('texts.taxes')]; - $data['$line_tax_values'] = ['value' => $this->lineTaxValues(), 'label' => ctrans('texts.taxes')]; - $data['$date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.date')]; + $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => '']; + $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; + $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; + $data['$total_tax_labels'] = ['value' => $this->totalTaxLabels(), 'label' => ctrans('texts.taxes')]; + $data['$total_tax_values'] = ['value' => $this->totalTaxValues(), 'label' => ctrans('texts.taxes')]; + $data['$line_tax_labels'] = ['value' => $this->lineTaxLabels(), 'label' => ctrans('texts.taxes')]; + $data['$line_tax_values'] = ['value' => $this->lineTaxValues(), 'label' => ctrans('texts.taxes')]; + $data['$date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.date')]; //$data['$invoice_date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.invoice_date')]; - $data['$invoice.date'] = &$data['$date']; - $data['$invoice.due_date'] = ['value' => $this->due_date ?: ' ', 'label' => ctrans('texts.due_date')]; - $data['$due_date'] = &$data['$invoice.due_date']; - $data['$invoice.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; - $data['$invoice.po_number'] = ['value' => $this->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; - $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; - $data['$invoice.line_taxes'] = &$data['$line_taxes']; - $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; - $data['$invoice.total_taxes'] = &$data['$total_taxes']; + $data['$invoice.date'] = &$data['$date']; + $data['$invoice.due_date'] = ['value' => $this->due_date ?: ' ', 'label' => ctrans('texts.due_date')]; + $data['$due_date'] = &$data['$invoice.due_date']; + $data['$invoice.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; + $data['$invoice.po_number'] = ['value' => $this->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; + $data['$line_taxes'] = ['value' => $this->makeLineTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; + $data['$invoice.line_taxes'] = &$data['$line_taxes']; + $data['$total_taxes'] = ['value' => $this->makeTotalTaxes() ?: ' ', 'label' => ctrans('texts.taxes')]; + $data['$invoice.total_taxes'] = &$data['$total_taxes']; if ($this instanceof Invoice) { - $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; - $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; - $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''. ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; + $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; + $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; + $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''.ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; // $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_invoice')]; } if ($this instanceof Quote) { - $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.quote')]; - $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; - $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''. ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; + $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.quote')]; + $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; + $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''.ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; // $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_quote')]; - } + } if ($this instanceof Credit) { - $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')]; - $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; - $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''. ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; + $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')]; + $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; + $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''.ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; // $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_credit')]; } - $data['$entity_number'] = &$data['$number']; + $data['$entity_number'] = &$data['$number']; //$data['$paid_to_date'] = ; - $data['$invoice.discount'] = ['value' => Number::formatMoney($calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; - $data['$discount'] = &$data['$invoice.discount']; - $data['$subtotal'] = ['value' => Number::formatMoney($calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')]; - $data['$invoice.subtotal'] = &$data['$subtotal']; - $data['$invoice.balance_due'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')]; - $data['$quote.balance_due'] = &$data['$invoice.balance_due']; - $data['$balance_due'] = &$data['$invoice.balance_due']; - $data['$invoice.partial_due'] = ['value' => Number::formatMoney($this->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; - $data['$total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')]; - $data['$amount'] = &$data['$total']; - $data['$quote.total'] = &$data['$total']; - $data['$invoice.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')]; - $data['$invoice.amount'] = &$data['$total']; - $data['$quote.amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; - $data['$credit.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')]; - $data['$credit.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; - $data['$credit.amount'] = &$data['$credit.total']; - $data['$credit.po_number'] = &$data['$invoice.po_number']; - $data['$credit.date'] = ['value' => $this->date, 'label' => ctrans('texts.credit_date')]; - $data['$balance'] = ['value' => Number::formatMoney($calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')]; - $data['$credit.balance'] = &$data['$balance']; + $data['$invoice.discount'] = ['value' => Number::formatMoney($calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')]; + $data['$discount'] = &$data['$invoice.discount']; + $data['$subtotal'] = ['value' => Number::formatMoney($calc->getSubTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.subtotal')]; + $data['$invoice.subtotal'] = &$data['$subtotal']; + $data['$invoice.balance_due'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.balance_due')]; + $data['$quote.balance_due'] = &$data['$invoice.balance_due']; + $data['$balance_due'] = &$data['$invoice.balance_due']; + $data['$invoice.partial_due'] = ['value' => Number::formatMoney($this->partial, $this->client) ?: ' ', 'label' => ctrans('texts.partial_due')]; + $data['$total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.total')]; + $data['$amount'] = &$data['$total']; + $data['$quote.total'] = &$data['$total']; + $data['$invoice.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.invoice_total')]; + $data['$invoice.amount'] = &$data['$total']; + $data['$quote.amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.quote_total')]; + $data['$credit.total'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_total')]; + $data['$credit.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; + $data['$credit.amount'] = &$data['$credit.total']; + $data['$credit.po_number'] = &$data['$invoice.po_number']; + $data['$credit.date'] = ['value' => $this->date, 'label' => ctrans('texts.credit_date')]; + $data['$balance'] = ['value' => Number::formatMoney($calc->getBalance(), $this->client) ?: ' ', 'label' => ctrans('texts.balance')]; + $data['$credit.balance'] = &$data['$balance']; + + $data['$invoice.balance'] = &$data['$balance']; + $data['$taxes'] = ['value' => Number::formatMoney($calc->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')]; + $data['$invoice.taxes'] = &$data['$taxes']; + + $data['$invoice.custom1'] = ['value' => $this->custom_value1 ?: ' ', 'label' => $this->makeCustomField('invoice1')]; + $data['$invoice.custom2'] = ['value' => $this->custom_value2 ?: ' ', 'label' => $this->makeCustomField('invoice2')]; + $data['$invoice.custom3'] = ['value' => $this->custom_value3 ?: ' ', 'label' => $this->makeCustomField('invoice3')]; + $data['$invoice.custom4'] = ['value' => $this->custom_value4 ?: ' ', 'label' => $this->makeCustomField('invoice4')]; + $data['$invoice.public_notes'] = ['value' => $this->public_notes ?: ' ', 'label' => ctrans('texts.public_notes')]; + $data['$entity.public_notes'] = &$data['$invoice.public_notes']; - $data['$invoice.balance'] = &$data['$balance']; - $data['$taxes'] = ['value' => Number::formatMoney($calc->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')]; - $data['$invoice.taxes'] = &$data['$taxes']; - - $data['$invoice.custom1'] = ['value' => $this->custom_value1 ?: ' ', 'label' => $this->makeCustomField('invoice1')]; - $data['$invoice.custom2'] = ['value' => $this->custom_value2 ?: ' ', 'label' => $this->makeCustomField('invoice2')]; - $data['$invoice.custom3'] = ['value' => $this->custom_value3 ?: ' ', 'label' => $this->makeCustomField('invoice3')]; - $data['$invoice.custom4'] = ['value' => $this->custom_value4 ?: ' ', 'label' => $this->makeCustomField('invoice4')]; - $data['$invoice.public_notes'] = ['value' => $this->public_notes ?: ' ', 'label' => ctrans('texts.public_notes')]; - $data['$entity.public_notes'] = &$data['$invoice.public_notes']; - // $data['$your_invoice'] = ; // $data['$quote'] = ; // $data['$your_quote'] = ; // - $data['$quote.date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.quote_date')]; - $data['$quote.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; - $data['$quote.po_number'] = &$data['$invoice.po_number']; - $data['$quote.quote_number'] = &$data['$quote.number']; - $data['$quote_no'] = &$data['$quote.number']; - $data['$quote.quote_no'] = &$data['$quote.number']; - $data['$quote.valid_until'] = ['value' => $this->due_date, 'label' => ctrans('texts.valid_until')]; - $data['$credit_amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')]; - $data['$credit_balance'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')]; - ; - $data['$credit_number'] = &$data['$number']; - $data['$credit_no'] = &$data['$number']; - $data['$credit.credit_no'] = &$data['$number']; + $data['$quote.date'] = ['value' => $this->date ?: ' ', 'label' => ctrans('texts.quote_date')]; + $data['$quote.number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; + $data['$quote.po_number'] = &$data['$invoice.po_number']; + $data['$quote.quote_number'] = &$data['$quote.number']; + $data['$quote_no'] = &$data['$quote.number']; + $data['$quote.quote_no'] = &$data['$quote.number']; + $data['$quote.valid_until'] = ['value' => $this->due_date, 'label' => ctrans('texts.valid_until')]; + $data['$credit_amount'] = ['value' => Number::formatMoney($calc->getTotal(), $this->client) ?: ' ', 'label' => ctrans('texts.credit_amount')]; + $data['$credit_balance'] = ['value' => Number::formatMoney($this->balance, $this->client) ?: ' ', 'label' => ctrans('texts.credit_balance')]; + + $data['$credit_number'] = &$data['$number']; + $data['$credit_no'] = &$data['$number']; + $data['$credit.credit_no'] = &$data['$number']; // $data['$invoice_issued_to'] = ; // $data['$quote_issued_to'] = ; @@ -300,98 +298,97 @@ trait MakesInvoiceValues // $data['$invoice_to'] = ; // $data['$quote_to'] = ; // $data['$details'] = ; - $data['$invoice_no'] = &$data['$number']; - $data['$invoice.invoice_no'] = &$data['$number']; - $data['$client1'] = ['value' => $this->client->custom_value1 ?: ' ', 'label' => $this->makeCustomField('client1')]; - $data['$client2'] = ['value' => $this->client->custom_value2 ?: ' ', 'label' => $this->makeCustomField('client2')]; - $data['$client3'] = ['value' => $this->client->custom_value3 ?: ' ', 'label' => $this->makeCustomField('client3')]; - $data['$client4'] = ['value' => $this->client->custom_value4 ?: ' ', 'label' => $this->makeCustomField('client4')]; - $data['$address1'] = ['value' => $this->client->address1 ?: ' ', 'label' => ctrans('texts.address1')]; - $data['$address2'] = ['value' => $this->client->address2 ?: ' ', 'label' => ctrans('texts.address2')]; - $data['$id_number'] = ['value' => $this->client->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; - $data['$vat_number'] = ['value' => $this->client->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; - $data['$website'] = ['value' => $this->client->present()->website() ?: ' ', 'label' => ctrans('texts.website')]; - $data['$phone'] = ['value' => $this->client->present()->phone() ?: ' ', 'label' => ctrans('texts.phone')]; - $data['$country'] = ['value' => isset($this->client->country->name) ? $this->client->country->name : 'No Country Set', 'label' => ctrans('texts.country')]; - $data['$email'] = ['value' => isset($contact) ? $contact->email : 'no contact email on record', 'label' => ctrans('texts.email')]; - $data['$client_name'] = ['value' => $this->present()->clientName() ?: ' ', 'label' => ctrans('texts.client_name')]; - $data['$client.name'] = &$data['$client_name']; - $data['$client.address1'] = &$data['$address1']; - $data['$client.address2'] = &$data['$address2']; - $data['$client_address'] = ['value' => $this->present()->address() ?: ' ', 'label' => ctrans('texts.address')]; - $data['$client.address'] = &$data['$client_address']; - $data['$client.id_number'] = &$data['$id_number']; - $data['$client.vat_number'] = &$data['$vat_number']; - $data['$client.website'] = &$data['$website']; - $data['$client.phone'] = &$data['$phone']; - $data['$city_state_postal'] = ['value' => $this->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; - $data['$client.city_state_postal'] = &$data['$city_state_postal']; - $data['$postal_city_state'] = ['value' => $this->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; - $data['$client.postal_city_state'] = &$data['$postal_city_state']; - $data['$client.country'] = &$data['$country']; - $data['$client.email'] = &$data['$email']; + $data['$invoice_no'] = &$data['$number']; + $data['$invoice.invoice_no'] = &$data['$number']; + $data['$client1'] = ['value' => $this->client->custom_value1 ?: ' ', 'label' => $this->makeCustomField('client1')]; + $data['$client2'] = ['value' => $this->client->custom_value2 ?: ' ', 'label' => $this->makeCustomField('client2')]; + $data['$client3'] = ['value' => $this->client->custom_value3 ?: ' ', 'label' => $this->makeCustomField('client3')]; + $data['$client4'] = ['value' => $this->client->custom_value4 ?: ' ', 'label' => $this->makeCustomField('client4')]; + $data['$address1'] = ['value' => $this->client->address1 ?: ' ', 'label' => ctrans('texts.address1')]; + $data['$address2'] = ['value' => $this->client->address2 ?: ' ', 'label' => ctrans('texts.address2')]; + $data['$id_number'] = ['value' => $this->client->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; + $data['$vat_number'] = ['value' => $this->client->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; + $data['$website'] = ['value' => $this->client->present()->website() ?: ' ', 'label' => ctrans('texts.website')]; + $data['$phone'] = ['value' => $this->client->present()->phone() ?: ' ', 'label' => ctrans('texts.phone')]; + $data['$country'] = ['value' => isset($this->client->country->name) ? $this->client->country->name : 'No Country Set', 'label' => ctrans('texts.country')]; + $data['$email'] = ['value' => isset($contact) ? $contact->email : 'no contact email on record', 'label' => ctrans('texts.email')]; + $data['$client_name'] = ['value' => $this->present()->clientName() ?: ' ', 'label' => ctrans('texts.client_name')]; + $data['$client.name'] = &$data['$client_name']; + $data['$client.address1'] = &$data['$address1']; + $data['$client.address2'] = &$data['$address2']; + $data['$client_address'] = ['value' => $this->present()->address() ?: ' ', 'label' => ctrans('texts.address')]; + $data['$client.address'] = &$data['$client_address']; + $data['$client.id_number'] = &$data['$id_number']; + $data['$client.vat_number'] = &$data['$vat_number']; + $data['$client.website'] = &$data['$website']; + $data['$client.phone'] = &$data['$phone']; + $data['$city_state_postal'] = ['value' => $this->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; + $data['$client.city_state_postal'] = &$data['$city_state_postal']; + $data['$postal_city_state'] = ['value' => $this->present()->cityStateZip($this->client->city, $this->client->state, $this->client->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; + $data['$client.postal_city_state'] = &$data['$postal_city_state']; + $data['$client.country'] = &$data['$country']; + $data['$client.email'] = &$data['$email']; + $data['$contact.full_name'] = ['value' => $contact->present()->name(), 'label' => ctrans('texts.name')]; + $data['$contact.email'] = ['value' => $contact->email, 'label' => ctrans('texts.email')]; + $data['$contact.phone'] = ['value' => $contact->phone, 'label' => ctrans('texts.phone')]; - $data['$contact.full_name'] = ['value' => $contact->present()->name(), 'label' => ctrans('texts.name')]; - $data['$contact.email'] = ['value' => $contact->email, 'label' => ctrans('texts.email')]; - $data['$contact.phone'] = ['value' => $contact->phone, 'label' => ctrans('texts.phone')]; - - $data['$contact.name'] = ['value' => isset($contact) ? $contact->present()->name() : 'no contact name on record', 'label' => ctrans('texts.contact_name')]; - $data['$contact.first_name'] = ['value' => isset($contact) ? $contact->first_name : '', 'label' => ctrans('texts.first_name')]; - $data['$contact.last_name'] = ['value' => isset($contact) ? $contact->last_name : '', 'label' => ctrans('texts.last_name')]; - $data['$contact.custom1'] = ['value' => isset($contact) ? $contact->custom_value1 : ' ', 'label' => $this->makeCustomField('contact1')]; - $data['$contact.custom2'] = ['value' => isset($contact) ? $contact->custom_value2 : ' ', 'label' => $this->makeCustomField('contact1')]; - $data['$contact.custom3'] = ['value' => isset($contact) ? $contact->custom_value3 : ' ', 'label' => $this->makeCustomField('contact1')]; - $data['$contact.custom4'] = ['value' => isset($contact) ? $contact->custom_value4 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.name'] = ['value' => isset($contact) ? $contact->present()->name() : 'no contact name on record', 'label' => ctrans('texts.contact_name')]; + $data['$contact.first_name'] = ['value' => isset($contact) ? $contact->first_name : '', 'label' => ctrans('texts.first_name')]; + $data['$contact.last_name'] = ['value' => isset($contact) ? $contact->last_name : '', 'label' => ctrans('texts.last_name')]; + $data['$contact.custom1'] = ['value' => isset($contact) ? $contact->custom_value1 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.custom2'] = ['value' => isset($contact) ? $contact->custom_value2 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.custom3'] = ['value' => isset($contact) ? $contact->custom_value3 : ' ', 'label' => $this->makeCustomField('contact1')]; + $data['$contact.custom4'] = ['value' => isset($contact) ? $contact->custom_value4 : ' ', 'label' => $this->makeCustomField('contact1')]; $data['$company.city_state_postal'] = ['value' => $this->company->present()->cityStateZip($settings->city, $settings->state, $settings->postal_code, false) ?: ' ', 'label' => ctrans('texts.city_state_postal')]; $data['$company.postal_city_state'] = ['value' => $this->company->present()->cityStateZip($settings->city, $settings->state, $settings->postal_code, true) ?: ' ', 'label' => ctrans('texts.postal_city_state')]; - $data['$company.name'] = ['value' => $this->company->present()->name() ?: ' ', 'label' => ctrans('texts.company_name')]; - $data['$company.address1'] = ['value' => $settings->address1 ?: ' ', 'label' => ctrans('texts.address1')]; - $data['$company.address2'] = ['value' => $settings->address2 ?: ' ', 'label' => ctrans('texts.address2')]; - $data['$company.city'] = ['value' => $settings->city ?: ' ', 'label' => ctrans('texts.city')]; - $data['$company.state'] = ['value' => $settings->state ?: ' ', 'label' => ctrans('texts.state')]; - $data['$company.postal_code'] = ['value' => $settings->postal_code ?: ' ', 'label' => ctrans('texts.postal_code')]; - $data['$company.country'] = ['value' => Country::find($settings->country_id)->first()->name ?: ' ', 'label' => ctrans('texts.country')]; - $data['$company.phone'] = ['value' => $settings->phone ?: ' ', 'label' => ctrans('texts.phone')]; - $data['$company.email'] = ['value' => $settings->email ?: ' ', 'label' => ctrans('texts.email')]; - $data['$company.vat_number'] = ['value' => $settings->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; - $data['$company.id_number'] = ['value' => $settings->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; - $data['$company.website'] = ['value' => $settings->website ?: ' ', 'label' => ctrans('texts.website')]; - $data['$company.address'] = ['value' => $this->company->present()->address($settings) ?: ' ', 'label' => ctrans('texts.address')]; - + $data['$company.name'] = ['value' => $this->company->present()->name() ?: ' ', 'label' => ctrans('texts.company_name')]; + $data['$company.address1'] = ['value' => $settings->address1 ?: ' ', 'label' => ctrans('texts.address1')]; + $data['$company.address2'] = ['value' => $settings->address2 ?: ' ', 'label' => ctrans('texts.address2')]; + $data['$company.city'] = ['value' => $settings->city ?: ' ', 'label' => ctrans('texts.city')]; + $data['$company.state'] = ['value' => $settings->state ?: ' ', 'label' => ctrans('texts.state')]; + $data['$company.postal_code'] = ['value' => $settings->postal_code ?: ' ', 'label' => ctrans('texts.postal_code')]; + $data['$company.country'] = ['value' => Country::find($settings->country_id)->first()->name ?: ' ', 'label' => ctrans('texts.country')]; + $data['$company.phone'] = ['value' => $settings->phone ?: ' ', 'label' => ctrans('texts.phone')]; + $data['$company.email'] = ['value' => $settings->email ?: ' ', 'label' => ctrans('texts.email')]; + $data['$company.vat_number'] = ['value' => $settings->vat_number ?: ' ', 'label' => ctrans('texts.vat_number')]; + $data['$company.id_number'] = ['value' => $settings->id_number ?: ' ', 'label' => ctrans('texts.id_number')]; + $data['$company.website'] = ['value' => $settings->website ?: ' ', 'label' => ctrans('texts.website')]; + $data['$company.address'] = ['value' => $this->company->present()->address($settings) ?: ' ', 'label' => ctrans('texts.address')]; + $logo = $this->company->present()->logo($settings); - $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; - $data['$company_logo'] = &$data['$company.logo']; - $data['$company1'] = ['value' => $settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')]; - $data['$company2'] = ['value' => $settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')]; - $data['$company3'] = ['value' => $settings->custom_value3 ?: ' ', 'label' => $this->makeCustomField('company3')]; - $data['$company4'] = ['value' => $settings->custom_value4 ?: ' ', 'label' => $this->makeCustomField('company4')]; + $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; + $data['$company_logo'] = &$data['$company.logo']; + $data['$company1'] = ['value' => $settings->custom_value1 ?: ' ', 'label' => $this->makeCustomField('company1')]; + $data['$company2'] = ['value' => $settings->custom_value2 ?: ' ', 'label' => $this->makeCustomField('company2')]; + $data['$company3'] = ['value' => $settings->custom_value3 ?: ' ', 'label' => $this->makeCustomField('company3')]; + $data['$company4'] = ['value' => $settings->custom_value4 ?: ' ', 'label' => $this->makeCustomField('company4')]; - $data['$product.date'] = ['value' => '', 'label' => ctrans('texts.date')]; - $data['$product.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; - $data['$product.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; - $data['$product.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; - $data['$product.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; - $data['$product.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; - $data['$product.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; + $data['$product.date'] = ['value' => '', 'label' => ctrans('texts.date')]; + $data['$product.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; + $data['$product.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; + $data['$product.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; + $data['$product.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; + $data['$product.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; + $data['$product.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; - $data['$task.date'] = ['value' => '', 'label' => ctrans('texts.date')]; - $data['$task.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; - $data['$task.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; - $data['$task.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; - $data['$task.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; - $data['$task.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; - $data['$task.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; - $data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; + $data['$task.date'] = ['value' => '', 'label' => ctrans('texts.date')]; + $data['$task.discount'] = ['value' => '', 'label' => ctrans('texts.discount')]; + $data['$task.product_key'] = ['value' => '', 'label' => ctrans('texts.product_key')]; + $data['$task.notes'] = ['value' => '', 'label' => ctrans('texts.notes')]; + $data['$task.cost'] = ['value' => '', 'label' => ctrans('texts.cost')]; + $data['$task.quantity'] = ['value' => '', 'label' => ctrans('texts.quantity')]; + $data['$task.tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name1'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')]; //$data['$contact.signature'] // $data['custom_label1'] = ['value' => '', 'label' => ctrans('texts.')]; @@ -439,7 +436,7 @@ trait MakesInvoiceValues } /** - * V2 of building a table header for PDFs + * V2 of building a table header for PDFs. * @param array $columns The array (or string of column headers) * @return string injectable HTML string */ @@ -450,18 +447,18 @@ trait MakesInvoiceValues $table_header = ''; foreach ($columns as $key => $column) { - $table_header .= '' . $column . '_label'; + $table_header .= ''.$column.'_label'; } - + $table_header .= ''; - $table_header = strtr($table_header, $data);// str_replace(array_keys($data), array_values($data), $table_header); + $table_header = strtr($table_header, $data); // str_replace(array_keys($data), array_values($data), $table_header); return $table_header; } /** - * V2 of building a table body for PDFs + * V2 of building a table body for PDFs. * @param array $columns The array (or string of column headers) * @return string injectable HTML string */ @@ -490,9 +487,9 @@ trait MakesInvoiceValues $table_row = ''; foreach ($default_columns as $key => $column) { - $table_row .= '' . $column . ''; + $table_row .= ''.$column.''; } - + $table_row .= ''; foreach ($items as $key => $item) { @@ -509,7 +506,7 @@ trait MakesInvoiceValues } /** - * Transform the column headers into translated header values + * Transform the column headers into translated header values. * * @param array $columns The column header values * @return array The new column header variables @@ -527,20 +524,19 @@ trait MakesInvoiceValues [ 'tax_name1', 'tax_name2', - 'tax_name3' + 'tax_name3', ], [ 'tax', 'tax', - 'tax' + 'tax', ], $columns ); } /** - * - * Transform the column headers into invoice variables + * Transform the column headers into invoice variables. * * @param array $columns The column header values * @return array The invoice variables @@ -558,7 +554,7 @@ trait MakesInvoiceValues 'custom_invoice_label4', 'tax_name1', 'tax_name2', - 'tax_name3' + 'tax_name3', ], [ 'custom_invoice_value1', @@ -567,22 +563,22 @@ trait MakesInvoiceValues 'custom_invoice_value4', 'tax_rate1', 'tax_rate2', - 'tax_rate3' + 'tax_rate3', ], $columns ); } /** - * Formats the line items for display + * Formats the line items for display. * @param array $items The array of invoice items * @return array The formatted array of invoice items */ public function transformLineItems($items, $table_type = '$product') :array { $data = []; - - if (!is_array($items)) { + + if (! is_array($items)) { $data; } @@ -610,24 +606,24 @@ trait MakesInvoiceValues if ($item->is_amount_discount) { $data[$key][$table_type.'.discount'] = Number::formatMoney($item->discount, $this->client); } else { - $data[$key][$table_type.'.discount'] = $item->discount . '%'; + $data[$key][$table_type.'.discount'] = $item->discount.'%'; } } else { $data[$key][$table_type.'.discount'] = ''; } if (isset($item->tax_rate1) && $item->tax_rate1 > 0) { - $data[$key][$table_type.'.tax_rate1'] = round($item->tax_rate1, 2) . "%"; + $data[$key][$table_type.'.tax_rate1'] = round($item->tax_rate1, 2).'%'; $data[$key][$table_type.'.tax1'] = &$data[$key][$table_type.'.tax_rate1']; } - + if (isset($item->tax_rate2) && $item->tax_rate2 > 0) { - $data[$key][$table_type.'.tax_rate2'] = round($item->tax_rate2, 2) . "%"; + $data[$key][$table_type.'.tax_rate2'] = round($item->tax_rate2, 2).'%'; $data[$key][$table_type.'.tax2'] = &$data[$key][$table_type.'.tax_rate2']; } if (isset($item->tax_rate3) && $item->tax_rate3 > 0) { - $data[$key][$table_type.'.tax_rate3'] = round($item->tax_rate3, 2) . "%"; + $data[$key][$table_type.'.tax_rate3'] = round($item->tax_rate3, 2).'%'; $data[$key][$table_type.'.tax3'] = &$data[$key][$table_type.'.tax_rate3']; } @@ -635,7 +631,7 @@ trait MakesInvoiceValues $data[$key][$table_type.'.tax_rate1'] = ''; $data[$key][$table_type.'.tax1'] = &$data[$key][$table_type.'.tax_rate1']; } - + if (isset($item->tax_rate2) && $item->tax_rate2 == 0) { $data[$key][$table_type.'.tax_rate2'] = ''; $data[$key][$table_type.'.tax2'] = &$data[$key][$table_type.'.tax_rate2']; @@ -646,7 +642,6 @@ trait MakesInvoiceValues $data[$key][$table_type.'.tax3'] = &$data[$key][$table_type.'.tax_rate3']; } } - return $data; } @@ -655,7 +650,7 @@ trait MakesInvoiceValues * Due to the way we are compiling the blade template we * have no ability to iterate, so in the case * of line taxes where there are multiple rows, - * we use this function to format a section of rows + * we use this function to format a section of rows. * * @return string a collection of rows with line item * aggregate data @@ -663,13 +658,13 @@ trait MakesInvoiceValues private function makeLineTaxes() :string { $tax_map = $this->calc()->getTaxMap(); - + $data = ''; foreach ($tax_map as $tax) { $data .= ''; - $data .= ''. $tax['name'] .''; - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.$tax['name'].''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } return $data; @@ -679,19 +674,18 @@ trait MakesInvoiceValues * @return string a collectino of with * itemised total tax data */ - private function makeTotalTaxes() :string { $data = ''; - if (!$this->calc()->getTotalTaxMap()) { + if (! $this->calc()->getTotalTaxMap()) { return $data; } foreach ($this->calc()->getTotalTaxMap() as $tax) { $data .= ''; - $data .= ''. $tax['name'] .''; - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.$tax['name'].''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } return $data; @@ -701,12 +695,12 @@ trait MakesInvoiceValues { $data = ''; - if (!$this->calc()->getTotalTaxMap()) { + if (! $this->calc()->getTotalTaxMap()) { return $data; } foreach ($this->calc()->getTotalTaxMap() as $tax) { - $data .= ''. $tax['name'] .''; + $data .= ''.$tax['name'].''; } return $data; @@ -716,12 +710,12 @@ trait MakesInvoiceValues { $data = ''; - if (!$this->calc()->getTotalTaxMap()) { + if (! $this->calc()->getTotalTaxMap()) { return $data; } foreach ($this->calc()->getTotalTaxMap() as $tax) { - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } return $data; @@ -730,26 +724,26 @@ trait MakesInvoiceValues private function lineTaxLabels() :string { $tax_map = $this->calc()->getTaxMap(); - + $data = ''; foreach ($tax_map as $tax) { - $data .= ''. $tax['name'] .''; + $data .= ''.$tax['name'].''; } - + return $data; } private function lineTaxValues() :string { $tax_map = $this->calc()->getTaxMap(); - + $data = ''; foreach ($tax_map as $tax) { - $data .= ''. Number::formatMoney($tax['total'], $this->client) .''; + $data .= ''.Number::formatMoney($tax['total'], $this->client).''; } - + return $data; } @@ -764,7 +758,7 @@ trait MakesInvoiceValues /** * Builds CSS to assist with the generation - * of Repeating headers and footers on the PDF + * of Repeating headers and footers on the PDF. * @return string The css string */ public function generateCustomCSS() :string @@ -837,9 +831,9 @@ trait MakesInvoiceValues if ($settings->all_pages_header && $settings->all_pages_footer) { $css .= $header_and_footer; - } elseif ($settings->all_pages_header && !$settings->all_pages_footer) { + } elseif ($settings->all_pages_header && ! $settings->all_pages_footer) { $css .= $header; - } elseif (!$settings->all_pages_header && $settings->all_pages_footer) { + } elseif (! $settings->all_pages_header && $settings->all_pages_footer) { $css .= $footer; } @@ -855,7 +849,7 @@ trait MakesInvoiceValues html { '; - $css .= 'font-size:' . $settings->font_size . 'px;'; + $css .= 'font-size:'.$settings->font_size.'px;'; // $css .= 'font-size:14px;'; $css .= '}'; diff --git a/app/Utils/Traits/MakesMenu.php b/app/Utils/Traits/MakesMenu.php index 5a2bb831f297..7e58701a8862 100644 --- a/app/Utils/Traits/MakesMenu.php +++ b/app/Utils/Traits/MakesMenu.php @@ -1,6 +1,6 @@ client->getMergedSettings(); } - if (!$this->isPayable()) { + if (! $this->isPayable()) { $this->next_send_date = null; $this->save(); + return; //exit early } @@ -37,7 +38,7 @@ trait MakesReminders $settings->num_days_reminder1 > 0) { $reminder_date = Carbon::parse($this->date)->addDays($settings->num_days_reminder1); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -51,7 +52,7 @@ trait MakesReminders $settings->num_days_reminder1 > 0) { $reminder_date = Carbon::parse($this->due_date)->subDays($settings->num_days_reminder1); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -60,13 +61,12 @@ trait MakesReminders } } - if ($settings->enable_reminder1 !== false && $settings->schedule_reminder1 == 'after_due_date' && $settings->num_days_reminder1 > 0) { $reminder_date = Carbon::parse($this->due_date)->addDays($settings->num_days_reminder1); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -80,7 +80,7 @@ trait MakesReminders $settings->num_days_reminder2 > 0) { $reminder_date = Carbon::parse($this->date)->addDays($settings->num_days_reminder2); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -94,7 +94,7 @@ trait MakesReminders $settings->num_days_reminder2 > 0) { $reminder_date = Carbon::parse($this->due_date)->subDays($settings->num_days_reminder2); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -103,13 +103,12 @@ trait MakesReminders } } - if ($settings->enable_reminder2 !== false && $settings->schedule_reminder2 == 'after_due_date' && $settings->num_days_reminder2 > 0) { $reminder_date = Carbon::parse($this->due_date)->addDays($settings->num_days_reminder2); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -123,7 +122,7 @@ trait MakesReminders $settings->num_days_reminder3 > 0) { $reminder_date = Carbon::parse($this->date)->addDays($settings->num_days_reminder3); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -137,7 +136,7 @@ trait MakesReminders $settings->num_days_reminder3 > 0) { $reminder_date = Carbon::parse($this->due_date)->subDays($settings->num_days_reminder3); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } @@ -146,13 +145,12 @@ trait MakesReminders } } - if ($settings->enable_reminder3 !== false && $settings->schedule_reminder3 == 'after_due_date' && $settings->num_days_reminder3 > 0) { $reminder_date = Carbon::parse($this->due_date)->addDays($settings->num_days_reminder3); - if (!$nsd) { + if (! $nsd) { $nsd = $reminder_date->format('Y-m-d'); } diff --git a/app/Utils/Traits/MakesTemplateData.php b/app/Utils/Traits/MakesTemplateData.php index 53082c6cff96..ffab5e775bc7 100644 --- a/app/Utils/Traits/MakesTemplateData.php +++ b/app/Utils/Traits/MakesTemplateData.php @@ -1,6 +1,6 @@ '', 'label' => ctrans('texts.tax')]; - $data['$app_url'] = ['value' => 'https://example.com', 'label' => '']; - $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; - $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; - $data['$total_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; - $data['$total_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; - $data['$line_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; - $data['$line_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; - $data['$date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.date')]; - $data['$invoice_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.invoice_date')]; - $data['$invoice.date'] = &$data['$date']; - $data['$due_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.due_date')]; - $data['$invoice.due_date'] = &$data['$due_date']; - $data['$invoice.number'] = ['value' => '#INV-20293', 'label' => ctrans('texts.invoice_number')]; + + $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; + $data['$app_url'] = ['value' => 'https://example.com', 'label' => '']; + $data['$from'] = ['value' => '', 'label' => ctrans('texts.from')]; + $data['$to'] = ['value' => '', 'label' => ctrans('texts.to')]; + $data['$total_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; + $data['$total_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; + $data['$line_tax_labels'] = ['value' => 'VAT', 'label' => ctrans('texts.taxes')]; + $data['$line_tax_values'] = ['value' => '17.5%', 'label' => ctrans('texts.taxes')]; + $data['$date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.date')]; + $data['$invoice_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.invoice_date')]; + $data['$invoice.date'] = &$data['$date']; + $data['$due_date'] = ['value' => '2010-02-02', 'label' => ctrans('texts.due_date')]; + $data['$invoice.due_date'] = &$data['$due_date']; + $data['$invoice.number'] = ['value' => '#INV-20293', 'label' => ctrans('texts.invoice_number')]; $data['$invoice.invoice_number'] = &$data['$invoice.number']; - $data['$invoice_number'] = &$data['$invoice.number']; - $data['$po_number'] = ['value' => '#PO-12322', 'label' => ctrans('texts.po_number')]; - $data['$invoice.po_number'] = &$data['$po_number']; - $data['$line_taxes'] = &$data['$line_tax_labels']; - $data['$invoice.line_taxes'] = &$data['$line_tax_labels']; - $data['$total_taxes'] = &$data['$line_tax_labels']; - $data['$invoice.total_taxes'] = &$data['$total_taxes']; - $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; - $data['$number'] = ['value' => '#ENT-292', 'label' => ctrans('texts.invoice_number')]; - $data['$entity.terms'] = ['value' => 'The terms and conditions are listed below and are non negotiable', 'label' => ctrans('texts.invoice_terms')]; - $data['$terms'] = &$data['$entity.terms']; - $data['$entity_number'] = &$data['$number']; - $data['$discount'] = ['value' => '$10.00', 'label' => ctrans('texts.discount')]; - $data['$invoice.discount'] = &$data['$discount']; - $data['$subtotal'] = ['value' => '$20.00', 'label' => ctrans('texts.subtotal')]; - $data['$invoice.subtotal'] = &$data['$subtotal']; - $data['$balance_due'] = ['value' => '$5.00', 'label' => ctrans('texts.balance_due')]; - $data['$invoice.balance_due'] = &$data['$balance_due']; - $data['$partial_due'] = ['value' => '$5.00', 'label' => ctrans('texts.partial_due')]; - $data['$invoice.partial_due'] = &$data['$partial_due']; - $data['$total'] = ['value' => '$100.00', 'label' => ctrans('texts.total')]; - $data['$invoice.total'] = ['value' => '$100.00', 'label' => ctrans('texts.invoice_total')]; - $data['$amount'] = &$data['$total']; - $data['$invoice_total'] = &$data['$total']; - $data['$invoice.amount'] = &$data['$total']; - $data['$quote_total'] = ['value' => '$100.00', 'label' => ctrans('texts.quote_total')]; - $data['$quote.amount'] = &$data['$quote_total']; - $data['$credit_total'] = ['value' => '$100.00', 'label' => ctrans('texts.credit_total')]; - $data['$credit.amount'] = &$data['$credit_total']; - $data['$balance'] = ['value' => '$100.00', 'label' => ctrans('texts.balance')]; - $data['$invoice.balance'] = &$data['$balance']; - $data['$taxes'] = ['value' => '$10.00', 'label' => ctrans('texts.taxes')]; - $data['$invoice.taxes'] = &$data['$taxes']; - $data['$invoice1'] = ['value' => '10', 'label' => 'invoice1']; - $data['$invoice2'] = ['value' => '10', 'label' => 'invoice2']; - $data['$invoice3'] = ['value' => '10', 'label' => 'invoice3']; - $data['$invoice4'] = ['value' => '10', 'label' => 'invoice4']; - $data['$invoice.public_notes'] = ['value' => '10', 'label' => ctrans('texts.public_notes')]; - $data['$entity.public_notes'] = &$data['$invoice.public_notes']; - $data['$quote_date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.quote_date')]; - $data['$quote_number'] = ['value' => '#QUOTE-19338', 'label' => ctrans('texts.quote_number')]; - $data['$quote.quote_number'] = &$data['$quote_number']; - $data['$quote_no'] = &$data['$quote_number']; - $data['$quote.quote_no'] = &$data['$quote_number']; - $data['$valid_until'] = ['value' => '2010-02-03', 'label' => ctrans('texts.valid_until')]; - $data['$quote_total'] = ['value' => '$20.00', 'label' => ctrans('texts.quote_total')]; - $data['$credit_amount'] = ['value' => '$15.00', 'label' => ctrans('texts.credit_amount')]; - $data['$credit_balance'] = ['value' => '$12.00', 'label' => ctrans('texts.credit_balance')]; - ; - $data['$credit_number'] = &$data['$number']; - $data['$credit_no'] = &$data['$number']; - $data['$credit.credit_no'] = &$data['$number']; - $data['$invoice_no'] = &$data['$number']; - $data['$invoice.invoice_no'] = &$data['$number']; - $data['$client1'] = ['value' => 'Client Custom Values', 'label' => 'client 1']; - $data['$client2'] = ['value' => 'Client Custom Values', 'label' => 'client 2']; - $data['$client3'] = ['value' => 'Client Custom Values', 'label' => 'client 3']; - $data['$client4'] = ['value' => 'Client Custom Values', 'label' => 'client 4']; - $data['$address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; - $data['$address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; - $data['$id_number'] = ['value' => 'ID Number', 'label' => ctrans('texts.id_number')]; - $data['$vat_number'] = ['value' => '555-434-324', 'label' => ctrans('texts.vat_number')]; - $data['$website'] = ['value' => 'https://www.invoiceninja.com', 'label' => ctrans('texts.website')]; - $data['$phone'] = ['value' => '555-12321', 'label' => ctrans('texts.phone')]; - $data['$country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; - $data['$email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; - $data['$client_name'] = ['value' => 'Joe Denkins', 'label' => ctrans('texts.client_name')]; - $data['$client.name'] = &$data['$client_name']; - $data['$client.address1'] = &$data['$address1']; - $data['$client.address2'] = &$data['$address2']; - $data['$client_address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; - $data['$client.address'] = &$data['$client_address']; - $data['$client.id_number'] = &$data['$id_number']; - $data['$client.vat_number'] = &$data['$vat_number']; - $data['$client.website'] = &$data['$website']; - $data['$client.phone'] = &$data['$phone']; - $data['$city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; - $data['$client.city_state_postal'] = &$data['$city_state_postal']; - $data['$postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; - $data['$client.postal_city_state'] = &$data['$postal_city_state']; - $data['$client.country'] = &$data['$country']; - $data['$client.email'] = &$data['$email']; - $data['$contact_name'] = ['value' => 'Jimmy Nadel', 'label' => ctrans('texts.contact_name')]; - $data['$contact.name'] = &$data['$contact_name']; - $data['$contact1'] = ['value' => 'Custom Contact Values', 'label' => 'contact 1']; - $data['$contact2'] = ['value' => 'Custom Contact Values', 'label' => 'contact 2']; - $data['$contact3'] = ['value' => 'Custom Contact Values', 'label' => 'contact 3']; - $data['$contact4'] = ['value' => 'Custom Contact Values', 'label' => 'contact 4']; + $data['$invoice_number'] = &$data['$invoice.number']; + $data['$po_number'] = ['value' => '#PO-12322', 'label' => ctrans('texts.po_number')]; + $data['$invoice.po_number'] = &$data['$po_number']; + $data['$line_taxes'] = &$data['$line_tax_labels']; + $data['$invoice.line_taxes'] = &$data['$line_tax_labels']; + $data['$total_taxes'] = &$data['$line_tax_labels']; + $data['$invoice.total_taxes'] = &$data['$total_taxes']; + $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.invoice')]; + $data['$number'] = ['value' => '#ENT-292', 'label' => ctrans('texts.invoice_number')]; + $data['$entity.terms'] = ['value' => 'The terms and conditions are listed below and are non negotiable', 'label' => ctrans('texts.invoice_terms')]; + $data['$terms'] = &$data['$entity.terms']; + $data['$entity_number'] = &$data['$number']; + $data['$discount'] = ['value' => '$10.00', 'label' => ctrans('texts.discount')]; + $data['$invoice.discount'] = &$data['$discount']; + $data['$subtotal'] = ['value' => '$20.00', 'label' => ctrans('texts.subtotal')]; + $data['$invoice.subtotal'] = &$data['$subtotal']; + $data['$balance_due'] = ['value' => '$5.00', 'label' => ctrans('texts.balance_due')]; + $data['$invoice.balance_due'] = &$data['$balance_due']; + $data['$partial_due'] = ['value' => '$5.00', 'label' => ctrans('texts.partial_due')]; + $data['$invoice.partial_due'] = &$data['$partial_due']; + $data['$total'] = ['value' => '$100.00', 'label' => ctrans('texts.total')]; + $data['$invoice.total'] = ['value' => '$100.00', 'label' => ctrans('texts.invoice_total')]; + $data['$amount'] = &$data['$total']; + $data['$invoice_total'] = &$data['$total']; + $data['$invoice.amount'] = &$data['$total']; + $data['$quote_total'] = ['value' => '$100.00', 'label' => ctrans('texts.quote_total')]; + $data['$quote.amount'] = &$data['$quote_total']; + $data['$credit_total'] = ['value' => '$100.00', 'label' => ctrans('texts.credit_total')]; + $data['$credit.amount'] = &$data['$credit_total']; + $data['$balance'] = ['value' => '$100.00', 'label' => ctrans('texts.balance')]; + $data['$invoice.balance'] = &$data['$balance']; + $data['$taxes'] = ['value' => '$10.00', 'label' => ctrans('texts.taxes')]; + $data['$invoice.taxes'] = &$data['$taxes']; + $data['$invoice1'] = ['value' => '10', 'label' => 'invoice1']; + $data['$invoice2'] = ['value' => '10', 'label' => 'invoice2']; + $data['$invoice3'] = ['value' => '10', 'label' => 'invoice3']; + $data['$invoice4'] = ['value' => '10', 'label' => 'invoice4']; + $data['$invoice.public_notes'] = ['value' => '10', 'label' => ctrans('texts.public_notes')]; + $data['$entity.public_notes'] = &$data['$invoice.public_notes']; + $data['$quote_date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.quote_date')]; + $data['$quote_number'] = ['value' => '#QUOTE-19338', 'label' => ctrans('texts.quote_number')]; + $data['$quote.quote_number'] = &$data['$quote_number']; + $data['$quote_no'] = &$data['$quote_number']; + $data['$quote.quote_no'] = &$data['$quote_number']; + $data['$valid_until'] = ['value' => '2010-02-03', 'label' => ctrans('texts.valid_until')]; + $data['$quote_total'] = ['value' => '$20.00', 'label' => ctrans('texts.quote_total')]; + $data['$credit_amount'] = ['value' => '$15.00', 'label' => ctrans('texts.credit_amount')]; + $data['$credit_balance'] = ['value' => '$12.00', 'label' => ctrans('texts.credit_balance')]; + + $data['$credit_number'] = &$data['$number']; + $data['$credit_no'] = &$data['$number']; + $data['$credit.credit_no'] = &$data['$number']; + $data['$invoice_no'] = &$data['$number']; + $data['$invoice.invoice_no'] = &$data['$number']; + $data['$client1'] = ['value' => 'Client Custom Values', 'label' => 'client 1']; + $data['$client2'] = ['value' => 'Client Custom Values', 'label' => 'client 2']; + $data['$client3'] = ['value' => 'Client Custom Values', 'label' => 'client 3']; + $data['$client4'] = ['value' => 'Client Custom Values', 'label' => 'client 4']; + $data['$address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; + $data['$address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; + $data['$id_number'] = ['value' => 'ID Number', 'label' => ctrans('texts.id_number')]; + $data['$vat_number'] = ['value' => '555-434-324', 'label' => ctrans('texts.vat_number')]; + $data['$website'] = ['value' => 'https://www.invoiceninja.com', 'label' => ctrans('texts.website')]; + $data['$phone'] = ['value' => '555-12321', 'label' => ctrans('texts.phone')]; + $data['$country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; + $data['$email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; + $data['$client_name'] = ['value' => 'Joe Denkins', 'label' => ctrans('texts.client_name')]; + $data['$client.name'] = &$data['$client_name']; + $data['$client.address1'] = &$data['$address1']; + $data['$client.address2'] = &$data['$address2']; + $data['$client_address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; + $data['$client.address'] = &$data['$client_address']; + $data['$client.id_number'] = &$data['$id_number']; + $data['$client.vat_number'] = &$data['$vat_number']; + $data['$client.website'] = &$data['$website']; + $data['$client.phone'] = &$data['$phone']; + $data['$city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; + $data['$client.city_state_postal'] = &$data['$city_state_postal']; + $data['$postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; + $data['$client.postal_city_state'] = &$data['$postal_city_state']; + $data['$client.country'] = &$data['$country']; + $data['$client.email'] = &$data['$email']; + $data['$contact_name'] = ['value' => 'Jimmy Nadel', 'label' => ctrans('texts.contact_name')]; + $data['$contact.name'] = &$data['$contact_name']; + $data['$contact1'] = ['value' => 'Custom Contact Values', 'label' => 'contact 1']; + $data['$contact2'] = ['value' => 'Custom Contact Values', 'label' => 'contact 2']; + $data['$contact3'] = ['value' => 'Custom Contact Values', 'label' => 'contact 3']; + $data['$contact4'] = ['value' => 'Custom Contact Values', 'label' => 'contact 4']; $data['$company.city_state_postal'] = ['value' => 'Los Angeles, CA, 90210', 'label' => ctrans('texts.city_state_postal')]; $data['$company.postal_city_state'] = ['value' => '90210, Los Angeles, CA', 'label' => ctrans('texts.postal_city_state')]; - $data['$company.name'] = ['value' => 'ACME co', 'label' => ctrans('texts.company_name')]; - $data['$company.company_name'] = &$data['$company.name']; - $data['$company.address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; - $data['$company.address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; - $data['$company.city'] = ['value' => 'Los Angeles', 'label' => ctrans('texts.city')]; - $data['$company.state'] = ['value' => 'CA', 'label' => ctrans('texts.state')]; - $data['$company.postal_code'] = ['value' => '90210', 'label' => ctrans('texts.postal_code')]; - $data['$company.country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; - $data['$company.phone'] = ['value' => '555-3432', 'label' => ctrans('texts.phone')]; - $data['$company.email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; - $data['$company.vat_number'] = ['value' => 'VAT-3344-223', 'label' => ctrans('texts.vat_number')]; - $data['$company.id_number'] = ['value' => 'ID-NO-#434', 'label' => ctrans('texts.id_number')]; - $data['$company.website'] = ['value' => 'https://invoiceninja.com', 'label' => ctrans('texts.website')]; - $data['$company.address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; - $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; - $data['$company_logo'] = &$data['$company.logo']; - $data['$company1'] = ['value' => 'Company Custom Value 1', 'label' => 'company label1']; - $data['$company2'] = ['value' => 'Company Custom Value 2', 'label' => 'company label2']; - $data['$company3'] = ['value' => 'Company Custom Value 3', 'label' => 'company label3']; - $data['$company4'] = ['value' => 'Company Custom Value 4', 'label' => 'company label4']; - $data['$product.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; - $data['$product.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; - $data['$product.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; - $data['$product.notes'] = ['value' => 'Product Stuff', 'label' => ctrans('texts.notes')]; - $data['$product.cost'] = ['value' => '$10.00', 'label' => ctrans('texts.cost')]; - $data['$product.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; - $data['$product.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; - $data['$product.tax_name3'] = ['value' => 'Sales TAX', 'label' => ctrans('texts.tax')]; - $data['$product.line_total'] = ['value' => '$20.00', 'label' => ctrans('texts.line_total')]; - $data['$task.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; - $data['$task.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; - $data['$task.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; - $data['$task.notes'] = ['value' => 'Note for Tasks', 'label' => ctrans('texts.notes')]; - $data['$task.cost'] = ['value' => '$100.00', 'label' => ctrans('texts.cost')]; - $data['$task.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; - $data['$task.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; - $data['$task.tax_name3'] = ['value' => 'CA Sales Tax', 'label' => ctrans('texts.tax')]; - $data['$task.line_total'] = ['value' => '$100.00', 'label' => ctrans('texts.line_total')]; + $data['$company.name'] = ['value' => 'ACME co', 'label' => ctrans('texts.company_name')]; + $data['$company.company_name'] = &$data['$company.name']; + $data['$company.address1'] = ['value' => '5 Jimbuckeroo Way', 'label' => ctrans('texts.address1')]; + $data['$company.address2'] = ['value' => 'Kalamazoo', 'label' => ctrans('texts.address2')]; + $data['$company.city'] = ['value' => 'Los Angeles', 'label' => ctrans('texts.city')]; + $data['$company.state'] = ['value' => 'CA', 'label' => ctrans('texts.state')]; + $data['$company.postal_code'] = ['value' => '90210', 'label' => ctrans('texts.postal_code')]; + $data['$company.country'] = ['value' => 'USA', 'label' => ctrans('texts.country')]; + $data['$company.phone'] = ['value' => '555-3432', 'label' => ctrans('texts.phone')]; + $data['$company.email'] = ['value' => 'user@example.com', 'label' => ctrans('texts.email')]; + $data['$company.vat_number'] = ['value' => 'VAT-3344-223', 'label' => ctrans('texts.vat_number')]; + $data['$company.id_number'] = ['value' => 'ID-NO-#434', 'label' => ctrans('texts.id_number')]; + $data['$company.website'] = ['value' => 'https://invoiceninja.com', 'label' => ctrans('texts.website')]; + $data['$company.address'] = ['value' => '5 Kalamazoo Way\n Jimbuckeroo\n USA 90210', 'label' => ctrans('texts.address')]; + $data['$company.logo'] = ['value' => "logo" ?: ' ', 'label' => ctrans('texts.logo')]; + $data['$company_logo'] = &$data['$company.logo']; + $data['$company1'] = ['value' => 'Company Custom Value 1', 'label' => 'company label1']; + $data['$company2'] = ['value' => 'Company Custom Value 2', 'label' => 'company label2']; + $data['$company3'] = ['value' => 'Company Custom Value 3', 'label' => 'company label3']; + $data['$company4'] = ['value' => 'Company Custom Value 4', 'label' => 'company label4']; + $data['$product.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; + $data['$product.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; + $data['$product.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; + $data['$product.notes'] = ['value' => 'Product Stuff', 'label' => ctrans('texts.notes')]; + $data['$product.cost'] = ['value' => '$10.00', 'label' => ctrans('texts.cost')]; + $data['$product.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; + $data['$product.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; + $data['$product.tax_name3'] = ['value' => 'Sales TAX', 'label' => ctrans('texts.tax')]; + $data['$product.line_total'] = ['value' => '$20.00', 'label' => ctrans('texts.line_total')]; + $data['$task.date'] = ['value' => '2010-02-03', 'label' => ctrans('texts.date')]; + $data['$task.discount'] = ['value' => '5%', 'label' => ctrans('texts.discount')]; + $data['$task.product_key'] = ['value' => 'key', 'label' => ctrans('texts.product_key')]; + $data['$task.notes'] = ['value' => 'Note for Tasks', 'label' => ctrans('texts.notes')]; + $data['$task.cost'] = ['value' => '$100.00', 'label' => ctrans('texts.cost')]; + $data['$task.quantity'] = ['value' => '1', 'label' => ctrans('texts.quantity')]; + $data['$task.tax_name1'] = ['value' => 'GST', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name2'] = ['value' => 'VAT', 'label' => ctrans('texts.tax')]; + $data['$task.tax_name3'] = ['value' => 'CA Sales Tax', 'label' => ctrans('texts.tax')]; + $data['$task.line_total'] = ['value' => '$100.00', 'label' => ctrans('texts.line_total')]; //$data['$paid_to_date'] = ; // $data['$your_invoice'] = ; diff --git a/app/Utils/Traits/Notifications/UserNotifies.php b/app/Utils/Traits/Notifications/UserNotifies.php index b6ae4092a5fc..38382a03f07b 100644 --- a/app/Utils/Traits/Notifications/UserNotifies.php +++ b/app/Utils/Traits/Notifications/UserNotifies.php @@ -1,6 +1,6 @@ notifications; if ($invitation->{$entity_name}->user_id == $company_user->_user_id || $invitation->{$entity_name}->assigned_user_id == $company_user->user_id) { - array_push($required_permissions, "all_user_notifications"); + array_push($required_permissions, 'all_user_notifications'); } - if (count(array_intersect($required_permissions, $notifications->email)) >=1 || count(array_intersect($required_permissions, "all_user_notifications")) >=1 || count(array_intersect($required_permissions, "all_notifications")) >=1) { + if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect($required_permissions, 'all_user_notifications')) >= 1 || count(array_intersect($required_permissions, 'all_notifications')) >= 1) { array_push($notifiable_methods, 'mail'); } @@ -40,7 +39,6 @@ trait UserNotifies return $notifiable_methods; } - public function findUserEntityNotificationType($entity, $company_user, $required_permissions) :array { if ($this->migrationRunning($company_user)) { @@ -50,14 +48,15 @@ trait UserNotifies $notifiable_methods = []; $notifications = $company_user->notifications; - if(!$notifications) + if (! $notifications) { return []; - - if ($entity->user_id == $company_user->_user_id || $entity->assigned_user_id == $company_user->user_id) { - array_push($required_permissions, "all_user_notifications"); } - if (count(array_intersect($required_permissions, $notifications->email)) >=1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >=1 || count(array_intersect($required_permissions, ['all_notifications'])) >=1) { + if ($entity->user_id == $company_user->_user_id || $entity->assigned_user_id == $company_user->user_id) { + array_push($required_permissions, 'all_user_notifications'); + } + + if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >= 1 || count(array_intersect($required_permissions, ['all_notifications'])) >= 1) { array_push($notifiable_methods, 'mail'); } @@ -73,12 +72,11 @@ trait UserNotifies $notifiable_methods = []; $notifications = $company_user->notifications; - if (count(array_intersect($required_permissions, $notifications->email)) >=1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >=1 || count(array_intersect($required_permissions, ['all_notifications'])) >=1) { + if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >= 1 || count(array_intersect($required_permissions, ['all_notifications'])) >= 1) { array_push($notifiable_methods, 'mail'); } return $notifiable_methods; - } private function migrationRunning($company_user) diff --git a/app/Utils/Traits/NumberFormatter.php b/app/Utils/Traits/NumberFormatter.php index b500a28e2c47..f594b42dec80 100644 --- a/app/Utils/Traits/NumberFormatter.php +++ b/app/Utils/Traits/NumberFormatter.php @@ -1,6 +1,6 @@ parseFloat($value), $precision, '.', ''); } - /** - * Parse a float value that may be delimited with either a comma or decimal point + * Parse a float value that may be delimited with either a comma or decimal point. * * @param string $value The value * diff --git a/app/Utils/Traits/Payment/Refundable.php b/app/Utils/Traits/Payment/Refundable.php index c31f83ea7f3d..61456209f112 100644 --- a/app/Utils/Traits/Payment/Refundable.php +++ b/app/Utils/Traits/Payment/Refundable.php @@ -1,6 +1,6 @@ save(); $credit_note->number = $this->client->getNextCreditNumber($this->client); $credit_note->save(); - + $this->createActivity($data, $credit_note->id); //determine if we need to refund via gateway @@ -80,7 +79,6 @@ trait Refundable return $this->fresh(); } - private function refundPaymentWithInvoices($data) { $total_refund = 0; @@ -116,7 +114,7 @@ trait Refundable $credit_line_item->line_total = $invoice['amount']; $credit_line_item->date = $data['date']; - $ledger_string .= $credit_line_item->notes . ' '; + $ledger_string .= $credit_line_item->notes.' '; $line_items[] = $credit_line_item; } @@ -172,7 +170,7 @@ trait Refundable if ($gateway) { $response = $gateway->driver($this->client)->refund($this, $total_refund); - if (!$response) { + if (! $response) { throw new PaymentRefundFailed(); } } @@ -191,7 +189,6 @@ trait Refundable $this->client->paid_to_date -= $data['amount']; $this->client->save(); - return $this; } @@ -209,7 +206,7 @@ trait Refundable if (isset($data['invoices'])) { foreach ($data['invoices'] as $invoice) { $fields->invoice_id = $invoice->id; - + $activity_repo->save($fields, $this, Ninja::eventVars()); } } else { @@ -217,7 +214,6 @@ trait Refundable } } - private function buildCreditNote(array $data) :?Credit { $credit_note = CreditFactory::create($this->company_id, $this->user_id); diff --git a/app/Utils/Traits/PaymentEmailBuilder.php b/app/Utils/Traits/PaymentEmailBuilder.php index f25cda278d5e..825dbcf956b0 100644 --- a/app/Utils/Traits/PaymentEmailBuilder.php +++ b/app/Utils/Traits/PaymentEmailBuilder.php @@ -1,6 +1,6 @@ client; - - //Need to determine which email template we are producing return $this->generateTemplateData($reminder_template, $contact); } @@ -51,13 +46,13 @@ trait PaymentEmailBuilder /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { - $body_template = trans('texts.payment_message', ['amount'=>$this->present()->amount(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $body_template = trans('texts.payment_message', ['amount'=>$this->present()->amount(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } $subject_template = $client->getSetting('payment_subject'); if (iconv_strlen($subject_template) == 0) { - $subject_template = trans('texts.invoice_subject', ['number'=>$this->present()->invoice_number(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $subject_template = trans('texts.invoice_subject', ['number'=>$this->present()->invoice_number(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } $data['body'] = $this->parseTemplate($body_template, false, $contact); @@ -70,7 +65,7 @@ trait PaymentEmailBuilder return $data; } - private function parseTemplate(string $template_data, bool $is_markdown = true, $contact) :string + private function parseTemplate(string $template_data, bool $is_markdown, $contact) :string { $invoice_variables = $this->makeValues($contact); diff --git a/app/Utils/Traits/Pdf/PdfMaker.php b/app/Utils/Traits/Pdf/PdfMaker.php index a761d4559198..8cbcc409273c 100644 --- a/app/Utils/Traits/Pdf/PdfMaker.php +++ b/app/Utils/Traits/Pdf/PdfMaker.php @@ -1,6 +1,6 @@ setNodeBinary(config('ninja.system.node_path')); + } - if(config('ninja.system.npm_path')) + if (config('ninja.system.npm_path')) { $browser->setNpmBinary(config('ninja.system.npm_path')); + } return $browser->deviceScaleFactor(1) ->showBackground() ->deviceScaleFactor(1) ->waitUntilNetworkIdle(true) ->pdf(); - } } - // if($header && $footer){ // $browser = Browsershot::html($html) // ->headerHtml($header) @@ -62,8 +60,8 @@ trait PdfMaker // else { // $browser = Browsershot::html($html); // } - // - // + // + // // // return Browsershot::html($html) // //->showBrowserHeaderAndFooter() // //->headerHtml($header) @@ -73,6 +71,6 @@ trait PdfMaker // ->waitUntilNetworkIdle(true) ->pdf(); // //->margins(10,10,10,10) // //->savePdf('test.pdf'); - // + // // $browser->format('A4'); - // $browser->landscape(); \ No newline at end of file + // $browser->landscape(); diff --git a/app/Utils/Traits/QuoteEmailBuilder.php b/app/Utils/Traits/QuoteEmailBuilder.php index e259b46e6456..851c6544e65a 100644 --- a/app/Utils/Traits/QuoteEmailBuilder.php +++ b/app/Utils/Traits/QuoteEmailBuilder.php @@ -1,6 +1,6 @@ client; - if (!$reminder_template) { + if (! $reminder_template) { $reminder_template = $this->calculateTemplate(); } @@ -53,16 +50,16 @@ trait QuoteEmailBuilder /* Use default translations if a custom message has not been set*/ if (iconv_strlen($body_template) == 0) { - $body_template = trans('texts.quote_message', ['amount'=>$this->present()->amount(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $body_template = trans('texts.quote_message', ['amount'=>$this->present()->amount(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } $subject_template = $client->getSetting('email_subject_'.$reminder_template); if (iconv_strlen($subject_template) == 0) { if ($reminder_template == 'quote') { - $subject_template = trans('texts.quote_subject', ['number'=>$this->present()->invoice_number(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $subject_template = trans('texts.quote_subject', ['number'=>$this->present()->invoice_number(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } else { - $subject_template = trans('texts.reminder_subject', ['number'=>$this->present()->invoice_number(),'account'=>$this->company->present()->name()], null, $this->client->locale()); + $subject_template = trans('texts.reminder_subject', ['number'=>$this->present()->invoice_number(), 'account'=>$this->company->present()->name()], null, $this->client->locale()); } } @@ -76,7 +73,7 @@ trait QuoteEmailBuilder return $data; } - private function parseTemplate(string $template_data, bool $is_markdown = true, $contact) :string + private function parseTemplate(string $template_data, bool $is_markdown, $contact) :string { $quote_variables = $this->makeValues($contact); @@ -133,7 +130,7 @@ trait QuoteEmailBuilder return Carbon::parse($this->due_date)->addDays($num_days_reminder)->startOfDay()->eq(Carbon::now()->startOfDay()); break; default: - # code... + // code... break; } } diff --git a/app/Utils/Traits/SavesDocuments.php b/app/Utils/Traits/SavesDocuments.php index 1a0644fb311f..4b46743998d6 100644 --- a/app/Utils/Traits/SavesDocuments.php +++ b/app/Utils/Traits/SavesDocuments.php @@ -1,6 +1,6 @@ company; } - if (!$account->hasFeature(Account::FEATURE_DOCUMENTS)) { + if (! $account->hasFeature(Account::FEATURE_DOCUMENTS)) { return false; } diff --git a/app/Utils/Traits/SettingsSaver.php b/app/Utils/Traits/SettingsSaver.php index 7f15b93d70ad..41fa06c39d4c 100644 --- a/app/Utils/Traits/SettingsSaver.php +++ b/app/Utils/Traits/SettingsSaver.php @@ -1,6 +1,6 @@ $value) { if (in_array($key, CompanySettings::$string_casts)) { - $value = "string"; - if (!property_exists($settings, $key)) { + $value = 'string'; + if (! property_exists($settings, $key)) { continue; - } elseif (!$this->checkAttribute($value, $settings->{$key})) { + } elseif (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } @@ -48,10 +47,10 @@ trait SettingsSaver } /*Separate loop if it is a _id field which is an integer cast as a string*/ elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') { - $value = "integer"; - if (!property_exists($settings, $key)) { + $value = 'integer'; + if (! property_exists($settings, $key)) { continue; - } elseif (!$this->checkAttribute($value, $settings->{$key})) { + } elseif (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } @@ -61,13 +60,12 @@ trait SettingsSaver } /* Handles unset settings or blank strings */ - if (!property_exists($settings, $key) || is_null($settings->{$key}) || !isset($settings->{$key}) || $settings->{$key} == '') { + if (! property_exists($settings, $key) || is_null($settings->{$key}) || ! isset($settings->{$key}) || $settings->{$key} == '') { continue; } - /*Catch all filter */ - if (!$this->checkAttribute($value, $settings->{$key})) { + if (! $this->checkAttribute($value, $settings->{$key})) { return [$key, $value, $settings->{$key}]; } } @@ -102,7 +100,8 @@ trait SettingsSaver return is_array($value); case 'json': json_decode($string); - return (json_last_error() == JSON_ERROR_NONE); + + return json_last_error() == JSON_ERROR_NONE; default: return false; } diff --git a/app/Utils/Traits/SystemLogTrait.php b/app/Utils/Traits/SystemLogTrait.php index 78a179cac5cd..088ecdf560cd 100644 --- a/app/Utils/Traits/SystemLogTrait.php +++ b/app/Utils/Traits/SystemLogTrait.php @@ -1,6 +1,6 @@ $day) { $error_email = config('ninja.error_email'); if ($error_email && ! Cache::get("throttle_notified:{$key}")) { - Mail::raw('Account Throttle: ' . $company->company_key, function ($message) use ($error_email, $company) { + Mail::raw('Account Throttle: '.$company->company_key, function ($message) use ($error_email, $company) { $message->to($error_email) ->from(config('ninja.contact.email')) - ->subject("Email throttle triggered for company " . $company->id); + ->subject('Email throttle triggered for company '.$company->id); }); } Cache::put("throttle_notified:{$key}", true, 60 * 24); - + return true; } diff --git a/app/Utils/Traits/Uploadable.php b/app/Utils/Traits/Uploadable.php index fb3debeca3eb..b802bb5e10d6 100644 --- a/app/Utils/Traits/Uploadable.php +++ b/app/Utils/Traits/Uploadable.php @@ -1,6 +1,6 @@ company_key); -info("the path {$path}"); + info("the path {$path}"); if ($path) { $settings = $entity->settings; diff --git a/app/Utils/Traits/UserSessionAttributes.php b/app/Utils/Traits/UserSessionAttributes.php index d8432b7fe5c7..b54370fafcbe 100644 --- a/app/Utils/Traits/UserSessionAttributes.php +++ b/app/Utils/Traits/UserSessionAttributes.php @@ -1,6 +1,6 @@ sort_field === $field - ? $this->sort_asc = !$this->sort_asc + ? $this->sort_asc = ! $this->sort_asc : $this->sort_asc = true; $this->sort_field = $field; diff --git a/app/Utils/TranslationHelper.php b/app/Utils/TranslationHelper.php index 42ac91ea3dbb..ea9161511a64 100644 --- a/app/Utils/TranslationHelper.php +++ b/app/Utils/TranslationHelper.php @@ -1,6 +1,6 @@ each(function ($currency) { - $currency->name = ctrans('texts.currency_' . Str::slug($currency->name, '_')); + $currency->name = ctrans('texts.currency_'.Str::slug($currency->name, '_')); })->sortBy(function ($currency) { return $currency->name; }); @@ -65,7 +65,8 @@ class TranslationHelper public static function getPaymentTerms() { return PaymentTerm::getCompanyTerms()->map(function ($term) { - $term['name'] = ctrans('texts.payment_terms_net') . ' ' . $term['num_days']; + $term['name'] = ctrans('texts.payment_terms_net').' '.$term['num_days']; + return $term; }); } diff --git a/bootstrap/app.php b/bootstrap/app.php index f2801adf6f14..037e17df03b0 100755 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -12,7 +12,7 @@ */ $app = new Illuminate\Foundation\Application( - realpath(__DIR__.'/../') + $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) ); /* diff --git a/composer.json b/composer.json index aa719713617a..b70d3e5bf3bd 100644 --- a/composer.json +++ b/composer.json @@ -26,49 +26,53 @@ "cleverit/ubl_invoice": "^1.3", "composer/composer": "^1.10", "czproject/git-php": "^3.17", - "dacastro4/laravel-gmail": "^3.2", + "dacastro4/laravel-gmail": "^4.0", "doctrine/dbal": "^2.10", - "fedeisas/laravel-mail-css-inliner": "2.3", - "fideloper/proxy": "^4.0", + "fedeisas/laravel-mail-css-inliner": "^3", + "fideloper/proxy": "^4.2", "fzaninotto/faker": "^1.4", - "google/apiclient": "^2.0", + "google/apiclient": "^2.7", "guzzlehttp/guzzle": "^6.5", "hashids/hashids": "^3.0", - "intervention/image": "^2.4", + "intervention/image": "^2.5", "laracasts/presenter": "^0.2.1", - "laravel/framework": "^6", - "laravel/slack-notification-channel": "^2.0", - "laravel/socialite": "^4.0", - "laravel/tinker": "^1.0", + "laravel/framework": "^7.27", + "laravel/slack-notification-channel": "^2.2", + "laravel/socialite": "^4.4", + "laravel/tinker": "^2.0", "league/flysystem-aws-s3-v3": "~1.0", - "league/flysystem-cached-adapter": "~1.0", + "league/flysystem-cached-adapter": "^1.1", "league/fractal": "^0.17.0", "league/omnipay": "^3.0", - "livewire/livewire": "^1.0", + "livewire/livewire": "^1.3", "maennchen/zipstream-php": "^1.2", "nwidart/laravel-modules": "^6.0", "omnipay/paypal": "^3.0", "omnipay/stripe": "^3.0", "predis/predis": "^1.1", - "sentry/sentry-laravel": "^1.0", - "spatie/browsershot": "^3.29", + "sentry/sentry-laravel": "^1.8", + "spatie/browsershot": "^3.37", "staudenmeir/eloquent-has-many-deep": "^1.11", - "stripe/stripe-php": "^7.0", + "stripe/stripe-php": "^7.50", "turbo124/beacon": "^1", - "webpatser/laravel-countries": "dev-master#75992ad" + "webpatser/laravel-countries": "dev-master#75992ad", + "laravel/ui": "^2.0", + "fruitcake/laravel-cors": "^2.0" }, "require-dev": { "laravelcollective/html": "^6", "wildbit/postmark-php": "^2.6", "anahkiasen/former": "^4.2", - "barryvdh/laravel-debugbar": "^3.2", - "beyondcode/laravel-dump-server": "^1.0", - "darkaonline/l5-swagger": "^6.0", - "filp/whoops": "^2.0", - "laravel/dusk": "^5.0", - "mockery/mockery": "^1.0", - "nunomaduro/collision": "^2.0", - "phpunit/phpunit": "^7.0" + "barryvdh/laravel-debugbar": "^3.4", + "beyondcode/laravel-dump-server": "^1.4", + "darkaonline/l5-swagger": "^7.0", + "filp/whoops": "^2.7", + "laravel/dusk": "^6.5", + "mockery/mockery": "^1.3.1", + "nunomaduro/collision": "^4.1", + "phpunit/phpunit": "^8.5", + "fzaninotto/faker": "^1.9.1", + "facade/ignition": "^2.0" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index d47da2b8936b..e8f87a8c7615 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b5bc7e52c66bdc139b03788a007dfbb5", + "content-hash": "4d039108d962b9867965e21ed58eec6a", "packages": [ { "name": "asgrim/ofxparser", @@ -62,6 +62,58 @@ ], "time": "2018-10-29T10:10:13+00:00" }, + { + "name": "asm89/stack-cors", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/asm89/stack-cors.git", + "reference": "23f469e81c65e2fb7fc7bce371fbdc363fe32adf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/asm89/stack-cors/zipball/23f469e81c65e2fb7fc7bce371fbdc363fe32adf", + "reference": "23f469e81c65e2fb7fc7bce371fbdc363fe32adf", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/http-foundation": "~2.7|~3.0|~4.0|~5.0", + "symfony/http-kernel": "~2.7|~3.0|~4.0|~5.0" + }, + "require-dev": { + "phpunit/phpunit": "^6|^7|^8|^9", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Asm89\\Stack\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexander", + "email": "iam.asm89@gmail.com" + } + ], + "description": "Cross-origin resource sharing library and stack middleware", + "homepage": "https://github.com/asm89/stack-cors", + "keywords": [ + "cors", + "stack" + ], + "time": "2020-05-31T07:17:05+00:00" + }, { "name": "authorizenet/authorizenet", "version": "2.0.0", @@ -107,16 +159,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.149.0", + "version": "3.152.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "0ab4ac60f94d53d55f2c7374deb75d9a58961970" + "reference": "c5b43109dc0ecf77c4a18a8504ca3023f705b306" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0ab4ac60f94d53d55f2c7374deb75d9a58961970", - "reference": "0ab4ac60f94d53d55f2c7374deb75d9a58961970", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c5b43109dc0ecf77c4a18a8504ca3023f705b306", + "reference": "c5b43109dc0ecf77c4a18a8504ca3023f705b306", "shasum": "" }, "require": { @@ -188,7 +240,59 @@ "s3", "sdk" ], - "time": "2020-08-13T18:10:50+00:00" + "time": "2020-09-04T18:16:32+00:00" + }, + { + "name": "brick/math", + "version": "0.9.1", + "source": { + "type": "git", + "url": "https://github.com/brick/math.git", + "reference": "283a40c901101e66de7061bd359252c013dcc43c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brick/math/zipball/283a40c901101e66de7061bd359252c013dcc43c", + "reference": "283a40c901101e66de7061bd359252c013dcc43c", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1|^8.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^7.5.15|^8.5", + "vimeo/psalm": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Brick\\Math\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Arbitrary-precision arithmetic library", + "keywords": [ + "Arbitrary-precision", + "BigInteger", + "BigRational", + "arithmetic", + "bigdecimal", + "bignum", + "brick", + "math" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/brick/math", + "type": "tidelift" + } + ], + "time": "2020-08-18T23:57:15+00:00" }, { "name": "checkout/checkout-sdk-php", @@ -354,16 +458,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.2.7", + "version": "1.2.8", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" + "reference": "8a7ecad675253e4654ea05505233285377405215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215", + "reference": "8a7ecad675253e4654ea05505233285377405215", "shasum": "" }, "require": { @@ -411,12 +515,16 @@ "url": "https://packagist.com", "type": "custom" }, + { + "url": "https://github.com/composer", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/composer/composer", "type": "tidelift" } ], - "time": "2020-04-08T08:27:21+00:00" + "time": "2020-08-23T12:54:47+00:00" }, { "name": "composer/composer", @@ -514,16 +622,16 @@ }, { "name": "composer/package-versions-deprecated", - "version": "1.10.99.1", + "version": "1.11.99", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "68c9b502036e820c33445ff4d174327f6bb87486" + "reference": "c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/68c9b502036e820c33445ff4d174327f6bb87486", - "reference": "68c9b502036e820c33445ff4d174327f6bb87486", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855", + "reference": "c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855", "shasum": "" }, "require": { @@ -531,7 +639,7 @@ "php": "^7 || ^8" }, "replace": { - "ocramius/package-versions": "1.10.99" + "ocramius/package-versions": "1.11.99" }, "require-dev": { "composer/composer": "^1.9.3 || ^2.0@dev", @@ -579,7 +687,7 @@ "type": "tidelift" } ], - "time": "2020-08-13T12:55:41+00:00" + "time": "2020-08-25T05:50:16+00:00" }, { "name": "composer/semver", @@ -718,16 +826,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ebd27a9866ae8254e873866f795491f02418c5a5", + "reference": "ebd27a9866ae8254e873866f795491f02418c5a5", "shasum": "" }, "require": { @@ -772,51 +880,7 @@ "type": "tidelift" } ], - "time": "2020-06-04T11:16:35+00:00" - }, - { - "name": "cweagans/composer-patches", - "version": "1.6.7", - "source": { - "type": "git", - "url": "https://github.com/cweagans/composer-patches.git", - "reference": "2e6f72a2ad8d59cd7e2b729f218bf42adb14f590" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/2e6f72a2ad8d59cd7e2b729f218bf42adb14f590", - "reference": "2e6f72a2ad8d59cd7e2b729f218bf42adb14f590", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": ">=5.3.0" - }, - "require-dev": { - "composer/composer": "~1.0", - "phpunit/phpunit": "~4.6" - }, - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" - }, - "autoload": { - "psr-4": { - "cweagans\\Composer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Cameron Eagans", - "email": "me@cweagans.net" - } - ], - "description": "Provides a way to patch Composer packages.", - "time": "2019-08-29T20:11:49+00:00" + "time": "2020-08-19T10:27:58+00:00" }, { "name": "czproject/git-php", @@ -862,33 +926,33 @@ }, { "name": "dacastro4/laravel-gmail", - "version": "v3.2.6", + "version": "v4.0.4", "source": { "type": "git", "url": "https://github.com/dacastro4/laravel-gmail.git", - "reference": "f91c05e7df970d4f90d2c184527d4329f28db6cb" + "reference": "a9c786908f9b6dd127293050f703734e2aa2effa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dacastro4/laravel-gmail/zipball/f91c05e7df970d4f90d2c184527d4329f28db6cb", - "reference": "f91c05e7df970d4f90d2c184527d4329f28db6cb", + "url": "https://api.github.com/repos/dacastro4/laravel-gmail/zipball/a9c786908f9b6dd127293050f703734e2aa2effa", + "reference": "a9c786908f9b6dd127293050f703734e2aa2effa", "shasum": "" }, "require": { - "google/apiclient": "^2.4", - "illuminate/auth": "~5.8|^6.0", - "illuminate/config": "~5.8|^6.0", - "illuminate/database": "~5.8|^6.0", - "illuminate/routing": "~5.8|^6.0", - "illuminate/session": "~5.8|^6.0", - "illuminate/support": "~5.8|^6.0", + "google/apiclient": "^2.5", + "illuminate/auth": "~5.8|^6.0|^7.0", + "illuminate/config": "~5.8|^6.0|^7.0", + "illuminate/database": "~5.8|^6.0|^7.0", + "illuminate/routing": "~5.8|^6.0|^7.0", + "illuminate/session": "~5.8|^6.0|^7.0", + "illuminate/support": "~5.8|^6.0|^7.0", "php": "^7.2", "swiftmailer/swiftmailer": "~5.8|^6.0" }, "require-dev": { "mockery/mockery": "^1.0", "orchestra/testbench": "^4.0", - "phpunit/phpunit": "^8.0", + "phpunit/phpunit": "^8.5", "squizlabs/php_codesniffer": "~3.4" }, "type": "library", @@ -924,7 +988,7 @@ "gmail", "laravel" ], - "time": "2020-02-03T16:39:50+00:00" + "time": "2020-06-26T19:04:57+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -1057,16 +1121,16 @@ }, { "name": "doctrine/dbal", - "version": "2.10.2", + "version": "2.10.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "aab745e7b6b2de3b47019da81e7225e14dcfdac8" + "reference": "03ca23afc2ee062f5d3e32426ad37c34a4770dcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/aab745e7b6b2de3b47019da81e7225e14dcfdac8", - "reference": "aab745e7b6b2de3b47019da81e7225e14dcfdac8", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/03ca23afc2ee062f5d3e32426ad37c34a4770dcf", + "reference": "03ca23afc2ee062f5d3e32426ad37c34a4770dcf", "shasum": "" }, "require": { @@ -1076,13 +1140,14 @@ "php": "^7.2" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.1", "jetbrains/phpstorm-stubs": "^2019.1", "nikic/php-parser": "^4.4", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^8.4.1", + "phpstan/phpstan": "^0.12.40", + "phpunit/phpunit": "^8.5.5", + "psalm/plugin-phpunit": "^0.10.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "^3.11" + "vimeo/psalm": "^3.14.2" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -1147,7 +1212,21 @@ "sqlserver", "sqlsrv" ], - "time": "2020-04-20T17:19:26+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2020-09-02T01:35:42+00:00" }, { "name": "doctrine/event-manager", @@ -1520,27 +1599,27 @@ }, { "name": "fedeisas/laravel-mail-css-inliner", - "version": "2.3", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/fedeisas/laravel-mail-css-inliner.git", - "reference": "c1cbdbecfebc3d737f31ed87266172c4eee9635b" + "reference": "f414cb31536dcb132338042c8b7fd43e73fbb1b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fedeisas/laravel-mail-css-inliner/zipball/c1cbdbecfebc3d737f31ed87266172c4eee9635b", - "reference": "c1cbdbecfebc3d737f31ed87266172c4eee9635b", + "url": "https://api.github.com/repos/fedeisas/laravel-mail-css-inliner/zipball/f414cb31536dcb132338042c8b7fd43e73fbb1b9", + "reference": "f414cb31536dcb132338042c8b7fd43e73fbb1b9", "shasum": "" }, "require": { - "illuminate/support": "~5.0|^6.0", - "php": ">=5.4.0", + "ext-dom": "*", + "illuminate/support": "^7.4", + "php": "^7.2.5", "tijsverkoyen/css-to-inline-styles": "~2.0" }, "require-dev": { - "phpunit/phpunit": "~5.7", - "squizlabs/php_codesniffer": "^2.3", - "swiftmailer/swiftmailer": "~5.0" + "phpunit/phpunit": "^8.5", + "swiftmailer/swiftmailer": "^6.0" }, "type": "library", "extra": { @@ -1571,7 +1650,7 @@ "laravel", "mailer" ], - "time": "2019-09-13T23:11:54+00:00" + "time": "2020-04-08T17:22:14+00:00" }, { "name": "fideloper/proxy", @@ -1677,6 +1756,82 @@ ], "time": "2020-03-25T18:49:23+00:00" }, + { + "name": "fruitcake/laravel-cors", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/fruitcake/laravel-cors.git", + "reference": "dbfc311b25d4873c3c2382b26860be3567492bd6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fruitcake/laravel-cors/zipball/dbfc311b25d4873c3c2382b26860be3567492bd6", + "reference": "dbfc311b25d4873c3c2382b26860be3567492bd6", + "shasum": "" + }, + "require": { + "asm89/stack-cors": "^2.0.1", + "illuminate/contracts": "^5.6|^6.0|^7.0|^8.0", + "illuminate/support": "^5.6|^6.0|^7.0|^8.0", + "php": ">=7.1", + "symfony/http-foundation": "^4.0|^5.0", + "symfony/http-kernel": "^4.0|^5.0" + }, + "require-dev": { + "laravel/framework": "^5.5|^6.0|^7.0|^8.0", + "orchestra/dusk-updater": "^1.2", + "orchestra/testbench": "^3.5|^4.0|^5.0|^6.0", + "orchestra/testbench-dusk": "^5.1", + "phpro/grumphp": "^0.16|^0.17", + "phpunit/phpunit": "^6.0|^7.0|^8.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + }, + "laravel": { + "providers": [ + "Fruitcake\\Cors\\CorsServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Fruitcake\\Cors\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fruitcake", + "homepage": "https://fruitcake.nl" + }, + { + "name": "Barry vd. Heuvel", + "email": "barryvdh@gmail.com" + } + ], + "description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application", + "keywords": [ + "api", + "cors", + "crossdomain", + "laravel" + ], + "funding": [ + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2020-05-31T07:30:16+00:00" + }, { "name": "fzaninotto/faker", "version": "v1.9.1", @@ -1791,16 +1946,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.142", + "version": "v0.144", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "3baf0a665cd08975314214b075f28765c97282ae" + "reference": "74c5fc850d9ce441c6b3e52af11b986cd11d379a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/3baf0a665cd08975314214b075f28765c97282ae", - "reference": "3baf0a665cd08975314214b075f28765c97282ae", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/74c5fc850d9ce441c6b3e52af11b986cd11d379a", + "reference": "74c5fc850d9ce441c6b3e52af11b986cd11d379a", "shasum": "" }, "require": { @@ -1824,7 +1979,7 @@ "keywords": [ "google" ], - "time": "2020-07-28T00:24:58+00:00" + "time": "2020-08-30T00:24:57+00:00" }, { "name": "google/auth", @@ -2253,96 +2408,6 @@ ], "time": "2019-11-02T09:15:47+00:00" }, - { - "name": "jakub-onderka/php-console-color", - "version": "v0.2", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "d5deaecff52a0d61ccb613bb3804088da0307191" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191", - "reference": "d5deaecff52a0d61ccb613bb3804088da0307191", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "1.0", - "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "~4.3", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "JakubOnderka\\PhpConsoleColor\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com" - } - ], - "abandoned": "php-parallel-lint/php-console-color", - "time": "2018-09-29T17:23:10+00:00" - }, - { - "name": "jakub-onderka/php-console-highlighter", - "version": "v0.4", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", - "reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/9f7a229a69d52506914b4bc61bfdb199d90c5547", - "reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "jakub-onderka/php-console-color": "~0.2", - "php": ">=5.4.0" - }, - "require-dev": { - "jakub-onderka/php-code-style": "~1.0", - "jakub-onderka/php-parallel-lint": "~1.0", - "jakub-onderka/php-var-dump-check": "~0.1", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "JakubOnderka\\PhpConsoleHighlighter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "acci@acci.cz", - "homepage": "http://www.acci.cz/" - } - ], - "description": "Highlight PHP code in terminal", - "abandoned": "php-parallel-lint/php-console-highlighter", - "time": "2018-09-29T18:48:56+00:00" - }, { "name": "jean85/pretty-package-versions", "version": "1.5.0", @@ -2508,16 +2573,16 @@ }, { "name": "laravel/framework", - "version": "v6.18.35", + "version": "v7.27.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "baec6c2d7f433594cb858c35c2a2946df7ecac13" + "reference": "17777a92da9b3cf0026f26462d289d596420e6d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/baec6c2d7f433594cb858c35c2a2946df7ecac13", - "reference": "baec6c2d7f433594cb858c35c2a2946df7ecac13", + "url": "https://api.github.com/repos/laravel/framework/zipball/17777a92da9b3cf0026f26462d289d596420e6d0", + "reference": "17777a92da9b3cf0026f26462d289d596420e6d0", "shasum": "" }, "require": { @@ -2529,29 +2594,34 @@ "ext-openssl": "*", "league/commonmark": "^1.3", "league/flysystem": "^1.0.34", - "monolog/monolog": "^1.12|^2.0", - "nesbot/carbon": "^2.0", + "monolog/monolog": "^2.0", + "nesbot/carbon": "^2.17", "opis/closure": "^3.1", - "php": "^7.2", + "php": "^7.2.5", "psr/container": "^1.0", "psr/simple-cache": "^1.0", - "ramsey/uuid": "^3.7", + "ramsey/uuid": "^3.7|^4.0", "swiftmailer/swiftmailer": "^6.0", - "symfony/console": "^4.3.4", - "symfony/debug": "^4.3.4", - "symfony/finder": "^4.3.4", - "symfony/http-foundation": "^4.3.4", - "symfony/http-kernel": "^4.3.4", + "symfony/console": "^5.0", + "symfony/error-handler": "^5.0", + "symfony/finder": "^5.0", + "symfony/http-foundation": "^5.0", + "symfony/http-kernel": "^5.0", + "symfony/mime": "^5.0", "symfony/polyfill-php73": "^1.17", - "symfony/process": "^4.3.4", - "symfony/routing": "^4.3.4", - "symfony/var-dumper": "^4.3.4", - "tijsverkoyen/css-to-inline-styles": "^2.2.1", - "vlucas/phpdotenv": "^3.3" + "symfony/process": "^5.0", + "symfony/routing": "^5.0", + "symfony/var-dumper": "^5.0", + "tijsverkoyen/css-to-inline-styles": "^2.2.2", + "vlucas/phpdotenv": "^4.0", + "voku/portable-ascii": "^1.4.8" }, "conflict": { "tightenco/collect": "<5.5.33" }, + "provide": { + "psr/container-implementation": "1.0" + }, "replace": { "illuminate/auth": "self.version", "illuminate/broadcasting": "self.version", @@ -2578,6 +2648,7 @@ "illuminate/routing": "self.version", "illuminate/session": "self.version", "illuminate/support": "self.version", + "illuminate/testing": "self.version", "illuminate/translation": "self.version", "illuminate/validation": "self.version", "illuminate/view": "self.version" @@ -2586,15 +2657,15 @@ "aws/aws-sdk-php": "^3.0", "doctrine/dbal": "^2.6", "filp/whoops": "^2.4", - "guzzlehttp/guzzle": "^6.3|^7.0", + "guzzlehttp/guzzle": "^6.3.1|^7.0", "league/flysystem-cached-adapter": "^1.0", "mockery/mockery": "^1.3.1", "moontoast/math": "^1.1", - "orchestra/testbench-core": "^4.0", + "orchestra/testbench-core": "^5.0", "pda/pheanstalk": "^4.0", - "phpunit/phpunit": "^7.5.15|^8.4|^9.0", + "phpunit/phpunit": "^8.4|^9.0", "predis/predis": "^1.1.1", - "symfony/cache": "^4.3.4" + "symfony/cache": "^5.0" }, "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).", @@ -2607,24 +2678,28 @@ "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", "filp/whoops": "Required for friendly error pages in development (^2.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).", - "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.0|^7.0).", + "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.3.1|^7.0).", "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "mockery/mockery": "Required to use mocking (^1.3.1).", "moontoast/math": "Required to use ordered UUIDs (^1.1).", "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", + "phpunit/phpunit": "Required to use assertions and run tests (^8.4|^9.0).", + "predis/predis": "Required to use the predis connector (^1.1.2).", "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", - "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", + "symfony/cache": "Required to PSR-6 cache bridge (^5.0).", + "symfony/filesystem": "Required to create relative storage directory symbolic links (^5.0).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).", "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { @@ -2652,30 +2727,30 @@ "framework", "laravel" ], - "time": "2020-08-07T15:06:09+00:00" + "time": "2020-09-01T13:41:48+00:00" }, { "name": "laravel/slack-notification-channel", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/laravel/slack-notification-channel.git", - "reference": "d0a7f53342a5daa74e43e1b08dc8a7e83db152d8" + "reference": "98e0fe5c8dda645e6af914285af7b742e167462a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/d0a7f53342a5daa74e43e1b08dc8a7e83db152d8", - "reference": "d0a7f53342a5daa74e43e1b08dc8a7e83db152d8", + "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/98e0fe5c8dda645e6af914285af7b742e167462a", + "reference": "98e0fe5c8dda645e6af914285af7b742e167462a", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^6.0|^7.0", - "illuminate/notifications": "~5.8.0|^6.0|^7.0", + "illuminate/notifications": "~5.8.0|^6.0|^7.0|^8.0", "php": "^7.1.3" }, "require-dev": { "mockery/mockery": "^1.0", - "phpunit/phpunit": "^7.0|^8.0" + "phpunit/phpunit": "^7.0|^8.0|^9.0" }, "type": "library", "extra": { @@ -2709,7 +2784,7 @@ "notifications", "slack" ], - "time": "2020-06-30T20:34:53+00:00" + "time": "2020-08-25T18:21:34+00:00" }, { "name": "laravel/socialite", @@ -2778,36 +2853,37 @@ }, { "name": "laravel/tinker", - "version": "v1.0.10", + "version": "v2.4.2", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "ad571aacbac1539c30d480908f9d0c9614eaf1a7" + "reference": "58424c24e8aec31c3a3ac54eb3adb15e8a0a067b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/ad571aacbac1539c30d480908f9d0c9614eaf1a7", - "reference": "ad571aacbac1539c30d480908f9d0c9614eaf1a7", + "url": "https://api.github.com/repos/laravel/tinker/zipball/58424c24e8aec31c3a3ac54eb3adb15e8a0a067b", + "reference": "58424c24e8aec31c3a3ac54eb3adb15e8a0a067b", "shasum": "" }, "require": { - "illuminate/console": "~5.1|^6.0", - "illuminate/contracts": "~5.1|^6.0", - "illuminate/support": "~5.1|^6.0", - "php": ">=5.5.9", - "psy/psysh": "0.7.*|0.8.*|0.9.*", - "symfony/var-dumper": "~3.0|~4.0" + "illuminate/console": "^6.0|^7.0|^8.0", + "illuminate/contracts": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0", + "php": "^7.2", + "psy/psysh": "^0.10.3", + "symfony/var-dumper": "^4.3|^5.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "mockery/mockery": "^1.3.1", + "phpunit/phpunit": "^8.4|^9.0" }, "suggest": { - "illuminate/database": "The Illuminate Database package (~5.1)." + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.x-dev" }, "laravel": { "providers": [ @@ -2837,20 +2913,75 @@ "laravel", "psysh" ], - "time": "2019-08-07T15:10:45+00:00" + "time": "2020-08-11T19:28:08+00:00" }, { - "name": "league/commonmark", - "version": "1.5.3", + "name": "laravel/ui", + "version": "v2.2.0", "source": { "type": "git", - "url": "https://github.com/thephpleague/commonmark.git", - "reference": "2574454b97e4103dc4e36917bd783b25624aefcd" + "url": "https://github.com/laravel/ui.git", + "reference": "fb1404f04ece6eee128e3fb750d3a1e064238b33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/2574454b97e4103dc4e36917bd783b25624aefcd", - "reference": "2574454b97e4103dc4e36917bd783b25624aefcd", + "url": "https://api.github.com/repos/laravel/ui/zipball/fb1404f04ece6eee128e3fb750d3a1e064238b33", + "reference": "fb1404f04ece6eee128e3fb750d3a1e064238b33", + "shasum": "" + }, + "require": { + "illuminate/console": "^7.0|^8.0", + "illuminate/filesystem": "^7.0|^8.0", + "illuminate/support": "^7.0|^8.0", + "php": "^7.2.5" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^8.0|^9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Ui\\UiServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Ui\\": "src/", + "Illuminate\\Foundation\\Auth\\": "auth-backend/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Laravel UI utilities and presets.", + "keywords": [ + "laravel", + "ui" + ], + "time": "2020-08-25T18:30:43+00:00" + }, + { + "name": "league/commonmark", + "version": "1.5.4", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "21819c989e69bab07e933866ad30c7e3f32984ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/21819c989e69bab07e933866ad30c7e3f32984ba", + "reference": "21819c989e69bab07e933866ad30c7e3f32984ba", "shasum": "" }, "require": { @@ -2932,20 +3063,20 @@ "type": "tidelift" } ], - "time": "2020-07-19T22:47:30+00:00" + "time": "2020-08-18T01:19:12+00:00" }, { "name": "league/flysystem", - "version": "1.1.1", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710" + "reference": "9be3b16c877d477357c015cec057548cf9b2a14a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/6e96f54d82e71f71c4108da33ee96a7f57083710", - "reference": "6e96f54d82e71f71c4108da33ee96a7f57083710", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a", + "reference": "9be3b16c877d477357c015cec057548cf9b2a14a", "shasum": "" }, "require": { @@ -3023,24 +3154,24 @@ "type": "other" } ], - "time": "2020-08-12T14:23:41+00:00" + "time": "2020-08-23T07:39:11+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "1.0.25", + "version": "1.0.28", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "d409b97a50bf85fbde30cbc9fc10237475e696ea" + "reference": "af7384a12f7cd7d08183390d930c9d0ec629c990" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/d409b97a50bf85fbde30cbc9fc10237475e696ea", - "reference": "d409b97a50bf85fbde30cbc9fc10237475e696ea", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/af7384a12f7cd7d08183390d930c9d0ec629c990", + "reference": "af7384a12f7cd7d08183390d930c9d0ec629c990", "shasum": "" }, "require": { - "aws/aws-sdk-php": "^3.0.0", + "aws/aws-sdk-php": "^3.20.0", "league/flysystem": "^1.0.40", "php": ">=5.5.0" }, @@ -3070,7 +3201,7 @@ } ], "description": "Flysystem adapter for the AWS S3 SDK v3.x", - "time": "2020-06-02T18:41:58+00:00" + "time": "2020-08-22T08:43:01+00:00" }, { "name": "league/flysystem-cached-adapter", @@ -3297,36 +3428,44 @@ }, { "name": "league/oauth1-client", - "version": "1.7.0", + "version": "v1.8.1", "source": { "type": "git", "url": "https://github.com/thephpleague/oauth1-client.git", - "reference": "fca5f160650cb74d23fc11aa570dd61f86dcf647" + "reference": "3a68155c3f27a91f4b66a2dc03996cd6f3281c9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/fca5f160650cb74d23fc11aa570dd61f86dcf647", - "reference": "fca5f160650cb74d23fc11aa570dd61f86dcf647", + "url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/3a68155c3f27a91f4b66a2dc03996cd6f3281c9f", + "reference": "3a68155c3f27a91f4b66a2dc03996cd6f3281c9f", "shasum": "" }, "require": { - "guzzlehttp/guzzle": "^6.0", - "php": ">=5.5.0" + "ext-json": "*", + "ext-openssl": "*", + "guzzlehttp/guzzle": "^6.0|^7.0", + "php": ">=7.1" }, "require-dev": { - "mockery/mockery": "^0.9", - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.0" + "ext-simplexml": "*", + "friendsofphp/php-cs-fixer": "^2.16.1", + "mockery/mockery": "^1.3", + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-simplexml": "For decoding XML-based responses." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.0-dev", + "dev-develop": "2.0-dev" } }, "autoload": { "psr-4": { - "League\\OAuth1\\": "src/" + "League\\OAuth1\\Client\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -3356,7 +3495,7 @@ "tumblr", "twitter" ], - "time": "2016-08-17T00:36:58+00:00" + "time": "2020-09-04T11:07:03+00:00" }, { "name": "league/omnipay", @@ -3412,16 +3551,16 @@ }, { "name": "livewire/livewire", - "version": "v1.3.2", + "version": "v1.3.3", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "07f0b2d41a7837b4d6199da7b591169a84fbaabe" + "reference": "d3df4ec046d2886bbf43d4cd8d8d9858e422e2ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/07f0b2d41a7837b4d6199da7b591169a84fbaabe", - "reference": "07f0b2d41a7837b4d6199da7b591169a84fbaabe", + "url": "https://api.github.com/repos/livewire/livewire/zipball/d3df4ec046d2886bbf43d4cd8d8d9858e422e2ce", + "reference": "d3df4ec046d2886bbf43d4cd8d8d9858e422e2ce", "shasum": "" }, "require": { @@ -3471,7 +3610,7 @@ "type": "github" } ], - "time": "2020-07-16T14:43:11+00:00" + "time": "2020-08-21T15:57:49+00:00" }, { "name": "maennchen/zipstream-php", @@ -3812,16 +3951,16 @@ }, { "name": "nesbot/carbon", - "version": "2.38.0", + "version": "2.39.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "d8f6a6a91d1eb9304527b040500f61923e97674b" + "reference": "7af467873250583cc967a59ee9df29fabab193c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d8f6a6a91d1eb9304527b040500f61923e97674b", - "reference": "d8f6a6a91d1eb9304527b040500f61923e97674b", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7af467873250583cc967a59ee9df29fabab193c1", + "reference": "7af467873250583cc967a59ee9df29fabab193c1", "shasum": "" }, "require": { @@ -3834,7 +3973,7 @@ "doctrine/orm": "^2.7", "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", "kylekatarnls/multi-tester": "^2.0", - "phpmd/phpmd": "^2.8", + "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12.35", "phpunit/phpunit": "^7.5 || ^8.0", @@ -3897,20 +4036,20 @@ "type": "tidelift" } ], - "time": "2020-08-04T19:12:46+00:00" + "time": "2020-09-04T13:11:37+00:00" }, { "name": "nikic/php-parser", - "version": "v4.8.0", + "version": "v4.9.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8c58eb4cd4f3883f82611abeac2efbc3dbed787e" + "reference": "88e519766fc58bd46b8265561fb79b54e2e00b28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8c58eb4cd4f3883f82611abeac2efbc3dbed787e", - "reference": "8c58eb4cd4f3883f82611abeac2efbc3dbed787e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/88e519766fc58bd46b8265561fb79b54e2e00b28", + "reference": "88e519766fc58bd46b8265561fb79b54e2e00b28", "shasum": "" }, "require": { @@ -3918,7 +4057,7 @@ "php": ">=7.0" }, "require-dev": { - "ircmaxell/php-yacc": "^0.0.6", + "ircmaxell/php-yacc": "^0.0.7", "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ @@ -3927,7 +4066,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -3949,7 +4088,7 @@ "parser", "php" ], - "time": "2020-08-09T10:23:20+00:00" + "time": "2020-08-30T16:15:20+00:00" }, { "name": "nwidart/laravel-modules", @@ -4402,16 +4541,16 @@ }, { "name": "php-http/discovery", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "64a18cc891957e05d91910b3c717d6bd11fbede9" + "reference": "88ff14cad4a0db68b343260fa7ac3f1599703660" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/64a18cc891957e05d91910b3c717d6bd11fbede9", - "reference": "64a18cc891957e05d91910b3c717d6bd11fbede9", + "url": "https://api.github.com/repos/php-http/discovery/zipball/88ff14cad4a0db68b343260fa7ac3f1599703660", + "reference": "88ff14cad4a0db68b343260fa7ac3f1599703660", "shasum": "" }, "require": { @@ -4463,7 +4602,7 @@ "message", "psr7" ], - "time": "2020-07-13T15:44:45+00:00" + "time": "2020-09-04T08:41:23+00:00" }, { "name": "php-http/guzzle6-adapter", @@ -4588,20 +4727,20 @@ }, { "name": "php-http/message", - "version": "1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "ce8f43ac1e294b54aabf5808515c3554a19c1e1c" + "reference": "2c7256e3c1aba0bfca70f099810f1c7712e00945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/ce8f43ac1e294b54aabf5808515c3554a19c1e1c", - "reference": "ce8f43ac1e294b54aabf5808515c3554a19c1e1c", + "url": "https://api.github.com/repos/php-http/message/zipball/2c7256e3c1aba0bfca70f099810f1c7712e00945", + "reference": "2c7256e3c1aba0bfca70f099810f1c7712e00945", "shasum": "" }, "require": { - "clue/stream-filter": "^1.4", + "clue/stream-filter": "^1.4.1", "php": "^7.1", "php-http/message-factory": "^1.0.2", "psr/http-message": "^1.0" @@ -4612,6 +4751,7 @@ "require-dev": { "akeneo/phpspec-skip-example-extension": "^1.0", "coduo/phpspec-data-provider-extension": "^1.0", + "ergebnis/composer-normalize": "^2.1", "ext-zlib": "*", "guzzlehttp/psr7": "^1.0", "henrikbjorn/phpspec-code-coverage": "^1.0", @@ -4656,7 +4796,7 @@ "message", "psr-7" ], - "time": "2019-08-05T06:55:08+00:00" + "time": "2020-08-17T06:33:14+00:00" }, { "name": "php-http/message-factory", @@ -4934,23 +5074,23 @@ }, { "name": "predis/predis", - "version": "v1.1.2", + "version": "v1.1.4", "source": { "type": "git", - "url": "https://github.com/predishq/predis.git", - "reference": "82eb18c6c3860849cb6e2ff34b0c4b39d5daee46" + "url": "https://github.com/predis/predis.git", + "reference": "8be2418f0116572f1937083daf5cceb1bddc9f0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predishq/predis/zipball/82eb18c6c3860849cb6e2ff34b0c4b39d5daee46", - "reference": "82eb18c6c3860849cb6e2ff34b0c4b39d5daee46", + "url": "https://api.github.com/repos/predis/predis/zipball/8be2418f0116572f1937083daf5cceb1bddc9f0d", + "reference": "8be2418f0116572f1937083daf5cceb1bddc9f0d", "shasum": "" }, "require": { - "cweagans/composer-patches": "^1.6", "php": ">=5.3.9" }, "require-dev": { + "cweagans/composer-patches": "^1.6", "phpunit/phpunit": "~4.8" }, "suggest": { @@ -4983,11 +5123,17 @@ { "name": "Daniele Alessandri", "email": "suppakilla@gmail.com", - "homepage": "http://clorophilla.net" + "homepage": "http://clorophilla.net", + "role": "Creator & Maintainer" + }, + { + "name": "Till Krüss", + "homepage": "https://till.im", + "role": "Maintainer" } ], "description": "Flexible and feature-complete Redis client for PHP and HHVM", - "homepage": "http://github.com/nrk/predis", + "homepage": "http://github.com/predis/predis", "keywords": [ "nosql", "predis", @@ -4995,15 +5141,11 @@ ], "funding": [ { - "url": "https://www.paypal.me/tillkruss", - "type": "custom" - }, - { - "url": "https://github.com/tillkruss", + "url": "https://github.com/sponsors/tillkruss", "type": "github" } ], - "time": "2020-08-11T17:28:15+00:00" + "time": "2020-08-29T22:15:08+00:00" }, { "name": "psr/cache", @@ -5100,6 +5242,52 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "psr/http-client", "version": "1.0.1", @@ -5348,32 +5536,30 @@ }, { "name": "psy/psysh", - "version": "v0.9.12", + "version": "v0.10.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "90da7f37568aee36b116a030c5f99c915267edd4" + "reference": "a8aec1b2981ab66882a01cce36a49b6317dc3560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/90da7f37568aee36b116a030c5f99c915267edd4", - "reference": "90da7f37568aee36b116a030c5f99c915267edd4", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/a8aec1b2981ab66882a01cce36a49b6317dc3560", + "reference": "a8aec1b2981ab66882a01cce36a49b6317dc3560", "shasum": "" }, "require": { "dnoegel/php-xdg-base-dir": "0.1.*", "ext-json": "*", "ext-tokenizer": "*", - "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*", - "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0", - "php": ">=5.4.0", - "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0|~5.0", - "symfony/var-dumper": "~2.7|~3.0|~4.0|~5.0" + "nikic/php-parser": "~4.0|~3.0|~2.0|~1.3", + "php": "^8.0 || ^7.0 || ^5.5.9", + "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10", + "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.2", - "hoa/console": "~2.15|~3.16", - "phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0" + "hoa/console": "3.17.*" }, "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", @@ -5388,7 +5574,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-develop": "0.9.x-dev" + "dev-master": "0.10.x-dev" } }, "autoload": { @@ -5418,7 +5604,7 @@ "interactive", "shell" ], - "time": "2019-12-06T14:19:43+00:00" + "time": "2020-05-03T19:32:03+00:00" }, { "name": "ralouphie/getallheaders", @@ -5461,54 +5647,132 @@ "time": "2019-03-08T08:55:37+00:00" }, { - "name": "ramsey/uuid", - "version": "3.9.3", + "name": "ramsey/collection", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "7e1633a6964b48589b142d60542f9ed31bd37a92" + "url": "https://github.com/ramsey/collection.git", + "reference": "044184884e3c803e4cbb6451386cb71562939b18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/7e1633a6964b48589b142d60542f9ed31bd37a92", - "reference": "7e1633a6964b48589b142d60542f9ed31bd37a92", + "url": "https://api.github.com/repos/ramsey/collection/zipball/044184884e3c803e4cbb6451386cb71562939b18", + "reference": "044184884e3c803e4cbb6451386cb71562939b18", "shasum": "" }, "require": { + "php": "^7.2 || ^8" + }, + "require-dev": { + "captainhook/captainhook": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "ergebnis/composer-normalize": "^2.6", + "fzaninotto/faker": "^1.5", + "hamcrest/hamcrest-php": "^2", + "jangregor/phpstan-prophecy": "^0.6", + "mockery/mockery": "^1.3", + "phpstan/extension-installer": "^1", + "phpstan/phpstan": "^0.12.32", + "phpstan/phpstan-mockery": "^0.12.5", + "phpstan/phpstan-phpunit": "^0.12.11", + "phpunit/phpunit": "^8.5", + "psy/psysh": "^0.10.4", + "slevomat/coding-standard": "^6.3", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^3.12.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ramsey\\Collection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "A PHP 7.2+ library for representing and manipulating collections.", + "keywords": [ + "array", + "collection", + "hash", + "map", + "queue", + "set" + ], + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + } + ], + "time": "2020-08-11T00:57:21+00:00" + }, + { + "name": "ramsey/uuid", + "version": "4.1.1", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "cd4032040a750077205918c86049aa0f43d22947" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/cd4032040a750077205918c86049aa0f43d22947", + "reference": "cd4032040a750077205918c86049aa0f43d22947", + "shasum": "" + }, + "require": { + "brick/math": "^0.8 || ^0.9", "ext-json": "*", - "paragonie/random_compat": "^1 | ^2 | 9.99.99", - "php": "^5.4 | ^7 | ^8", + "php": "^7.2 || ^8", + "ramsey/collection": "^1.0", "symfony/polyfill-ctype": "^1.8" }, "replace": { "rhumsaa/uuid": "self.version" }, "require-dev": { - "codeception/aspect-mock": "^1 | ^2", - "doctrine/annotations": "^1.2", - "goaop/framework": "1.0.0-alpha.2 | ^1 | ^2.1", - "jakub-onderka/php-parallel-lint": "^1", - "mockery/mockery": "^0.9.11 | ^1", + "codeception/aspect-mock": "^3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", + "doctrine/annotations": "^1.8", + "goaop/framework": "^2", + "mockery/mockery": "^1.3", "moontoast/math": "^1.1", "paragonie/random-lib": "^2", - "php-mock/php-mock-phpunit": "^0.3 | ^1.1", - "phpunit/phpunit": "^4.8 | ^5.4 | ^6.5", - "squizlabs/php_codesniffer": "^3.5" + "php-mock/php-mock-mockery": "^1.3", + "php-mock/php-mock-phpunit": "^2.5", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpbench/phpbench": "^0.17.1", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-mockery": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^8.5", + "psy/psysh": "^0.10.0", + "slevomat/coding-standard": "^6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "3.9.4" }, "suggest": { - "ext-ctype": "Provides support for PHP Ctype functions", - "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", - "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", - "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", - "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", + "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", + "ext-ctype": "Enables faster processing of character classification using ctype functions.", + "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", + "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { @@ -5523,29 +5787,20 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - }, - { - "name": "Marijn Huizendveld", - "email": "marijn.huizendveld@gmail.com" - }, - { - "name": "Thibaud Fabre", - "email": "thibaud@aztech.io" - } - ], - "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", + "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", "homepage": "https://github.com/ramsey/uuid", "keywords": [ "guid", "identifier", "uuid" ], - "time": "2020-02-21T04:36:14+00:00" + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + } + ], + "time": "2020-08-18T17:17:46+00:00" }, { "name": "sabre/uri", @@ -5663,16 +5918,16 @@ }, { "name": "seld/jsonlint", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd" + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/3d5eb71705adfa34bd34b993400622932b2f62fd", - "reference": "3d5eb71705adfa34bd34b993400622932b2f62fd", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/590cfec960b77fd55e39b7d9246659e95dd6d337", + "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337", "shasum": "" }, "require": { @@ -5718,7 +5973,7 @@ "type": "tidelift" } ], - "time": "2020-08-13T09:07:59+00:00" + "time": "2020-08-25T06:56:57+00:00" }, { "name": "seld/phar-utils", @@ -5799,16 +6054,16 @@ }, { "name": "sentry/sentry", - "version": "2.4.2", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "b3b4f4a08b184c3f22b208f357e8720ef42938b0" + "reference": "89fd1f91657b33ec9139f33f8a201eb086276103" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/b3b4f4a08b184c3f22b208f357e8720ef42938b0", - "reference": "b3b4f4a08b184c3f22b208f357e8720ef42938b0", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/89fd1f91657b33ec9139f33f8a201eb086276103", + "reference": "89fd1f91657b33ec9139f33f8a201eb086276103", "shasum": "" }, "require": { @@ -5892,7 +6147,7 @@ "type": "custom" } ], - "time": "2020-07-24T07:02:19+00:00" + "time": "2020-08-13T10:54:32+00:00" }, { "name": "sentry/sentry-laravel", @@ -6187,27 +6442,27 @@ }, { "name": "staudenmeir/eloquent-has-many-deep", - "version": "v1.11", + "version": "v1.12", "source": { "type": "git", "url": "https://github.com/staudenmeir/eloquent-has-many-deep.git", - "reference": "c87e8fb03071666d656e136c43b40a58d02950c8" + "reference": "7417572873c9fb4fa84e894ebbf324629cbc63c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staudenmeir/eloquent-has-many-deep/zipball/c87e8fb03071666d656e136c43b40a58d02950c8", - "reference": "c87e8fb03071666d656e136c43b40a58d02950c8", + "url": "https://api.github.com/repos/staudenmeir/eloquent-has-many-deep/zipball/7417572873c9fb4fa84e894ebbf324629cbc63c0", + "reference": "7417572873c9fb4fa84e894ebbf324629cbc63c0", "shasum": "" }, "require": { - "illuminate/database": "^6.0", - "php": "^7.2" + "illuminate/database": "^7.0", + "php": "^7.2.5" }, "require-dev": { - "illuminate/pagination": "^6.0", - "laravel/homestead": "^9.0", - "phpunit/phpunit": "^8.0", - "staudenmeir/eloquent-eager-limit": "^1.4" + "illuminate/pagination": "^7.0", + "laravel/homestead": "^10.0", + "phpunit/phpunit": "^8.5", + "staudenmeir/eloquent-eager-limit": "^1.5" }, "type": "library", "autoload": { @@ -6225,21 +6480,21 @@ "email": "mail@jonas-staudenmeir.de" } ], - "description": "Laravel Eloquent HasManyThrough relationship with unlimited levels", - "time": "2019-09-21T19:48:04+00:00" + "description": "Laravel Eloquent HasManyThrough relationships with unlimited levels", + "time": "2020-01-31T12:37:57+00:00" }, { "name": "stripe/stripe-php", - "version": "v7.47.0", + "version": "v7.51.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "b51656cb398d081fcee53a76f6edb8fd5c1a5306" + "reference": "879a3545126ebc77218c53d2055572b7e473fbcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/b51656cb398d081fcee53a76f6edb8fd5c1a5306", - "reference": "b51656cb398d081fcee53a76f6edb8fd5c1a5306", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/879a3545126ebc77218c53d2055572b7e473fbcf", + "reference": "879a3545126ebc77218c53d2055572b7e473fbcf", "shasum": "" }, "require": { @@ -6283,7 +6538,7 @@ "payment processing", "stripe" ], - "time": "2020-08-13T22:35:56+00:00" + "time": "2020-09-02T21:04:02+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -6349,42 +6604,44 @@ }, { "name": "symfony/console", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "55d07021da933dd0d633ffdab6f45d5b230c7e02" + "reference": "186f395b256065ba9b890c0a4e48a91d598fa2cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/55d07021da933dd0d633ffdab6f45d5b230c7e02", - "reference": "55d07021da933dd0d633ffdab6f45d5b230c7e02", + "url": "https://api.github.com/repos/symfony/console/zipball/186f395b256065ba9b890c0a4e48a91d598fa2cf", + "reference": "186f395b256065ba9b890c0a4e48a91d598fa2cf", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2" + "symfony/service-contracts": "^1.1|^2", + "symfony/string": "^5.1" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", "symfony/lock": "<4.4", - "symfony/process": "<3.3" + "symfony/process": "<4.4" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -6395,7 +6652,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -6436,11 +6693,11 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:18:39+00:00" + "time": "2020-09-02T07:07:40+00:00" }, { "name": "symfony/css-selector", - "version": "v5.1.3", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -6505,77 +6762,6 @@ ], "time": "2020-05-20T17:43:50+00:00" }, - { - "name": "symfony/debug", - "version": "v4.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "47aa9064d75db36389692dd4d39895a0820f00f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/47aa9064d75db36389692dd4d39895a0820f00f2", - "reference": "47aa9064d75db36389692dd4d39895a0820f00f2", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-23T08:31:43+00:00" - }, { "name": "symfony/deprecation-contracts", "version": "v2.1.3", @@ -6642,33 +6828,33 @@ }, { "name": "symfony/error-handler", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "66f151360550ec2b3273b3746febb12e6ba0348b" + "reference": "525636d4b84e06c6ca72d96b6856b5b169416e6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/66f151360550ec2b3273b3746febb12e6ba0348b", - "reference": "66f151360550ec2b3273b3746febb12e6ba0348b", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/525636d4b84e06c6ca72d96b6856b5b169416e6a", + "reference": "525636d4b84e06c6ca72d96b6856b5b169416e6a", "shasum": "" }, "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/debug": "^4.4.5", + "php": ">=7.2.5", + "psr/log": "^1.0", "symfony/polyfill-php80": "^1.15", "symfony/var-dumper": "^4.4|^5.0" }, "require-dev": { + "symfony/deprecation-contracts": "^2.1", "symfony/http-kernel": "^4.4|^5.0", "symfony/serializer": "^4.4|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -6709,41 +6895,43 @@ "type": "tidelift" } ], - "time": "2020-07-23T08:35:20+00:00" + "time": "2020-08-17T10:01:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "6140fc7047dafc5abbe84ba16a34a86c0b0229b8" + "reference": "94871fc0a69c3c5da57764187724cdce0755899c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/6140fc7047dafc5abbe84ba16a34a86c0b0229b8", - "reference": "6140fc7047dafc5abbe84ba16a34a86c0b0229b8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/94871fc0a69c3c5da57764187724cdce0755899c", + "reference": "94871fc0a69c3c5da57764187724cdce0755899c", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/event-dispatcher-contracts": "^2", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<4.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -6752,7 +6940,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -6793,33 +6981,33 @@ "type": "tidelift" } ], - "time": "2020-06-18T17:59:13+00:00" + "time": "2020-08-13T14:19:42+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.9", + "version": "v2.1.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" + "reference": "f6f613d74cfc5a623fc36294d3451eb7fa5a042b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f6f613d74cfc5a623fc36294d3451eb7fa5a042b", + "reference": "f6f613d74cfc5a623fc36294d3451eb7fa5a042b", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/event-dispatcher": "", "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -6869,20 +7057,20 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:19:58+00:00" + "time": "2020-07-06T13:23:11+00:00" }, { "name": "symfony/filesystem", - "version": "v5.1.3", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "6e4320f06d5f2cce0d96530162491f4465179157" + "reference": "f7b9ed6142a34252d219801d9767dedbd711da1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/6e4320f06d5f2cce0d96530162491f4465179157", - "reference": "6e4320f06d5f2cce0d96530162491f4465179157", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/f7b9ed6142a34252d219801d9767dedbd711da1a", + "reference": "f7b9ed6142a34252d219801d9767dedbd711da1a", "shasum": "" }, "require": { @@ -6933,29 +7121,29 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:35:19+00:00" + "time": "2020-08-21T17:19:47+00:00" }, { "name": "symfony/finder", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "2727aa35fddfada1dd37599948528e9b152eb742" + "reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/2727aa35fddfada1dd37599948528e9b152eb742", - "reference": "2727aa35fddfada1dd37599948528e9b152eb742", + "url": "https://api.github.com/repos/symfony/finder/zipball/2b765f0cf6612b3636e738c0689b29aa63088d5d", + "reference": "2b765f0cf6612b3636e738c0689b29aa63088d5d", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -6996,35 +7184,41 @@ "type": "tidelift" } ], - "time": "2020-07-05T09:39:30+00:00" + "time": "2020-08-17T10:01:29+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3675676b6a47f3e71d3ab10bcf53fb9239eb77e6" + "reference": "41a4647f12870e9d41d9a7d72ff0614a27208558" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3675676b6a47f3e71d3ab10bcf53fb9239eb77e6", - "reference": "3675676b6a47f3e71d3ab10bcf53fb9239eb77e6", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/41a4647f12870e9d41d9a7d72ff0614a27208558", + "reference": "41a4647f12870e9d41d9a7d72ff0614a27208558", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/mime": "^4.3|^5.0", - "symfony/polyfill-mbstring": "~1.1" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.15" }, "require-dev": { "predis/predis": "~1.0", - "symfony/expression-language": "^3.4|^4.0|^5.0" + "symfony/cache": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/mime": "^4.4|^5.0" + }, + "suggest": { + "symfony/mime": "To use the file extension guesser" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -7065,60 +7259,68 @@ "type": "tidelift" } ], - "time": "2020-07-23T09:48:09+00:00" + "time": "2020-08-17T07:48:54+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "a675d2bf04a9328f164910cae6e3918b295151f3" + "reference": "3e32676e6cb5d2081c91a56783471ff8a7f7110b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a675d2bf04a9328f164910cae6e3918b295151f3", - "reference": "a675d2bf04a9328f164910cae6e3918b295151f3", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3e32676e6cb5d2081c91a56783471ff8a7f7110b", + "reference": "3e32676e6cb5d2081c91a56783471ff8a7f7110b", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "psr/log": "~1.0", - "symfony/error-handler": "^4.4", - "symfony/event-dispatcher": "^4.4", + "symfony/deprecation-contracts": "^2.1", + "symfony/error-handler": "^4.4|^5.0", + "symfony/event-dispatcher": "^5.0", "symfony/http-foundation": "^4.4|^5.0", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-php73": "^1.9", "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/browser-kit": "<4.3", - "symfony/config": "<3.4", - "symfony/console": ">=5", - "symfony/dependency-injection": "<4.3", - "symfony/translation": "<4.2", - "twig/twig": "<1.34|<2.4,>=2" + "symfony/browser-kit": "<4.4", + "symfony/cache": "<5.0", + "symfony/config": "<5.0", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<4.4", + "symfony/doctrine-bridge": "<5.0", + "symfony/form": "<5.0", + "symfony/http-client": "<5.0", + "symfony/mailer": "<5.0", + "symfony/messenger": "<5.0", + "symfony/translation": "<5.0", + "symfony/twig-bridge": "<5.0", + "symfony/validator": "<5.0", + "twig/twig": "<2.4" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/cache": "~1.0", - "symfony/browser-kit": "^4.3|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^4.3|^5.0", - "symfony/dom-crawler": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/routing": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2|^5.0", + "symfony/browser-kit": "^4.4|^5.0", + "symfony/config": "^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/css-selector": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/dom-crawler": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/routing": "^4.4|^5.0", + "symfony/stopwatch": "^4.4|^5.0", + "symfony/translation": "^4.4|^5.0", "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^1.34|^2.4|^3.0" + "twig/twig": "^2.4|^3.0" }, "suggest": { "symfony/browser-kit": "", @@ -7129,7 +7331,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -7170,20 +7372,20 @@ "type": "tidelift" } ], - "time": "2020-07-24T04:10:09+00:00" + "time": "2020-09-02T08:15:18+00:00" }, { "name": "symfony/mime", - "version": "v5.1.3", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "149fb0ad35aae3c7637b496b38478797fa6a7ea6" + "reference": "89a2c9b4cb7b5aa516cf55f5194c384f444c81dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/149fb0ad35aae3c7637b496b38478797fa6a7ea6", - "reference": "149fb0ad35aae3c7637b496b38478797fa6a7ea6", + "url": "https://api.github.com/repos/symfony/mime/zipball/89a2c9b4cb7b5aa516cf55f5194c384f444c81dc", + "reference": "89a2c9b4cb7b5aa516cf55f5194c384f444c81dc", "shasum": "" }, "require": { @@ -7247,11 +7449,11 @@ "type": "tidelift" } ], - "time": "2020-07-23T10:04:31+00:00" + "time": "2020-08-17T10:01:29+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.1.3", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -7472,6 +7674,84 @@ ], "time": "2020-07-14T12:35:20+00:00" }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "b740103edbdcc39602239ee8860f0f45a8eb9aa5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b740103edbdcc39602239ee8860f0f45a8eb9aa5", + "reference": "b740103edbdcc39602239ee8860f0f45a8eb9aa5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, { "name": "symfony/polyfill-intl-idn", "version": "v1.18.1", @@ -8100,25 +8380,26 @@ }, { "name": "symfony/process", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" + "reference": "1864216226af21eb76d9477f691e7cbf198e0402" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", - "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", + "url": "https://api.github.com/repos/symfony/process/zipball/1864216226af21eb76d9477f691e7cbf198e0402", + "reference": "1864216226af21eb76d9477f691e7cbf198e0402", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -8159,38 +8440,40 @@ "type": "tidelift" } ], - "time": "2020-07-23T08:31:43+00:00" + "time": "2020-07-23T08:36:24+00:00" }, { "name": "symfony/routing", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e103381a4c2f0731c14589041852bf979e97c7af" + "reference": "47b0218344cb6af25c93ca8ee1137fafbee5005d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e103381a4c2f0731c14589041852bf979e97c7af", - "reference": "e103381a4c2f0731c14589041852bf979e97c7af", + "url": "https://api.github.com/repos/symfony/routing/zipball/47b0218344cb6af25c93ca8ee1137fafbee5005d", + "reference": "47b0218344cb6af25c93ca8ee1137fafbee5005d", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/config": "<4.2", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" + "symfony/config": "<5.0", + "symfony/dependency-injection": "<4.4", + "symfony/yaml": "<4.4" }, "require-dev": { "doctrine/annotations": "~1.2", "psr/log": "~1.0", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/config": "^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", @@ -8202,7 +8485,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -8249,7 +8532,7 @@ "type": "tidelift" } ], - "time": "2020-07-05T09:39:30+00:00" + "time": "2020-08-10T08:03:57+00:00" }, { "name": "symfony/service-contracts", @@ -8328,43 +8611,130 @@ "time": "2020-07-06T13:23:11+00:00" }, { - "name": "symfony/translation", - "version": "v4.4.11", + "name": "symfony/string", + "version": "v5.1.5", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "a8ea9d97353294eb6783f2894ef8cee99a045822" + "url": "https://github.com/symfony/string.git", + "reference": "0de4cc1e18bb596226c06a82e2e7e9bc6001a63a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a8ea9d97353294eb6783f2894ef8cee99a045822", - "reference": "a8ea9d97353294eb6783f2894ef8cee99a045822", + "url": "https://api.github.com/repos/symfony/string/zipball/0de4cc1e18bb596226c06a82e2e7e9bc6001a63a", + "reference": "0de4cc1e18bb596226c06a82e2e7e9bc6001a63a", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.6|^2" + "symfony/polyfill-php80": "~1.15" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-client": "^4.4|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony String component", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-08-17T07:48:54+00:00" + }, + { + "name": "symfony/translation", + "version": "v5.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "917b02cdc5f33e0309b8e9d33ee1480b20687413" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/917b02cdc5f33e0309b8e9d33ee1480b20687413", + "reference": "917b02cdc5f33e0309b8e9d33ee1480b20687413", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.15", + "symfony/translation-contracts": "^2" }, "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" + "symfony/config": "<4.4", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" }, "provide": { - "symfony/translation-implementation": "1.0" + "symfony/translation-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/http-kernel": "^5.0", + "symfony/intl": "^4.4|^5.0", "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -8374,7 +8744,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -8415,7 +8785,7 @@ "type": "tidelift" } ], - "time": "2020-07-23T08:31:43+00:00" + "time": "2020-08-17T10:01:29+00:00" }, { "name": "symfony/translation-contracts", @@ -8494,33 +8864,32 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.11", + "version": "v5.1.5", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "2125805a1a4e57f2340bc566c3013ca94d2722dc" + "reference": "b43a3905262bcf97b2510f0621f859ca4f5287be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2125805a1a4e57f2340bc566c3013ca94d2722dc", - "reference": "2125805a1a4e57f2340bc566c3013ca94d2722dc", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b43a3905262bcf97b2510f0621f859ca4f5287be", + "reference": "b43a3905262bcf97b2510f0621f859ca4f5287be", "shasum": "" }, "require": { - "php": ">=7.1.3", + "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5", "symfony/polyfill-php80": "^1.15" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", + "symfony/console": "^4.4|^5.0", "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.34|^2.4|^3.0" + "twig/twig": "^2.4|^3.0" }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", @@ -8533,7 +8902,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -8581,7 +8950,7 @@ "type": "tidelift" } ], - "time": "2020-06-24T13:34:53+00:00" + "time": "2020-08-17T07:42:30+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -8694,24 +9063,25 @@ }, { "name": "vlucas/phpdotenv", - "version": "v3.6.7", + "version": "v4.1.8", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2065beda6cbe75e2603686907b2e45f6f3a5ad82" + "reference": "572af79d913627a9d70374d27a6f5d689a35de32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2065beda6cbe75e2603686907b2e45f6f3a5ad82", - "reference": "2065beda6cbe75e2603686907b2e45f6f3a5ad82", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/572af79d913627a9d70374d27a6f5d689a35de32", + "reference": "572af79d913627a9d70374d27a6f5d689a35de32", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "phpoption/phpoption": "^1.5.2", + "php": "^5.5.9 || ^7.0 || ^8.0", + "phpoption/phpoption": "^1.7.3", "symfony/polyfill-ctype": "^1.17" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", "ext-pcre": "*", "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0" @@ -8723,7 +9093,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.6-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -8763,7 +9133,77 @@ "type": "tidelift" } ], - "time": "2020-07-14T19:04:52+00:00" + "time": "2020-07-14T19:22:52+00:00" + }, + { + "name": "voku/portable-ascii", + "version": "1.5.3", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "25bcbf01678930251fd572891447d9e318a6e2b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/25bcbf01678930251fd572891447d9e318a6e2b8", + "reference": "25bcbf01678930251fd572891447d9e318a6e2b8", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", + "type": "tidelift" + } + ], + "time": "2020-07-22T23:32:04+00:00" }, { "name": "webpatser/laravel-countries", @@ -8946,16 +9386,16 @@ }, { "name": "barryvdh/laravel-debugbar", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "9e785aa5584e8839fd43070202dd7f2e912db51c" + "reference": "91ee8b3acf0d72a4937f4855bd245acbda9910ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/9e785aa5584e8839fd43070202dd7f2e912db51c", - "reference": "9e785aa5584e8839fd43070202dd7f2e912db51c", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/91ee8b3acf0d72a4937f4855bd245acbda9910ac", + "reference": "91ee8b3acf0d72a4937f4855bd245acbda9910ac", "shasum": "" }, "require": { @@ -9017,28 +9457,28 @@ "type": "github" } ], - "time": "2020-08-11T10:30:51+00:00" + "time": "2020-08-30T07:08:17+00:00" }, { "name": "beyondcode/laravel-dump-server", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/beyondcode/laravel-dump-server.git", - "reference": "fcc88fa66895f8c1ff83f6145a5eff5fa2a0739a" + "reference": "1f1d18a2e43f96fd67c9f0269c53f8c3814867d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beyondcode/laravel-dump-server/zipball/fcc88fa66895f8c1ff83f6145a5eff5fa2a0739a", - "reference": "fcc88fa66895f8c1ff83f6145a5eff5fa2a0739a", + "url": "https://api.github.com/repos/beyondcode/laravel-dump-server/zipball/1f1d18a2e43f96fd67c9f0269c53f8c3814867d9", + "reference": "1f1d18a2e43f96fd67c9f0269c53f8c3814867d9", "shasum": "" }, "require": { - "illuminate/console": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/http": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/support": "5.6.*|5.7.*|5.8.*|^6.0", + "illuminate/console": "5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/http": "5.6.*|5.7.*|5.8.*|^6.0|^7.0", + "illuminate/support": "5.6.*|5.7.*|5.8.*|^6.0|^7.0", "php": "^7.1", - "symfony/var-dumper": "^4.1.1" + "symfony/var-dumper": "^5.0" }, "require-dev": { "larapack/dd": "^1.0", @@ -9078,32 +9518,32 @@ "beyondcode", "laravel-dump-server" ], - "time": "2019-08-11T13:17:40+00:00" + "time": "2020-03-04T15:23:26+00:00" }, { "name": "darkaonline/l5-swagger", - "version": "6.0.4", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/DarkaOnLine/L5-Swagger.git", - "reference": "690a2db0db6091139504f454c42fcdfb7a46f405" + "reference": "64e9cfaa0065f1c9d9b85c203a1de893698c7336" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DarkaOnLine/L5-Swagger/zipball/690a2db0db6091139504f454c42fcdfb7a46f405", - "reference": "690a2db0db6091139504f454c42fcdfb7a46f405", + "url": "https://api.github.com/repos/DarkaOnLine/L5-Swagger/zipball/64e9cfaa0065f1c9d9b85c203a1de893698c7336", + "reference": "64e9cfaa0065f1c9d9b85c203a1de893698c7336", "shasum": "" }, "require": { - "laravel/framework": "^6.0", + "laravel/framework": "^7.0", "php": "^7.2", "swagger-api/swagger-ui": "^3.0", - "symfony/yaml": "^4.1", + "symfony/yaml": "^5.0", "zircote/swagger-php": "~2.0|3.*" }, "require-dev": { "mockery/mockery": "1.*", - "orchestra/testbench": "4.*", + "orchestra/testbench": "5.*", "php-coveralls/php-coveralls": "^2.0", "phpunit/phpunit": "8.*" }, @@ -9115,7 +9555,10 @@ "laravel": { "providers": [ "L5Swagger\\L5SwaggerServiceProvider" - ] + ], + "aliases": { + "L5Swagger": "L5Swagger\\L5SwaggerFacade" + } } }, "autoload": { @@ -9148,7 +9591,7 @@ "type": "github" } ], - "time": "2020-06-05T05:07:26+00:00" + "time": "2020-08-18T06:29:25+00:00" }, { "name": "doctrine/annotations", @@ -9290,6 +9733,189 @@ ], "time": "2020-05-29T17:27:14+00:00" }, + { + "name": "facade/flare-client-php", + "version": "1.3.5", + "source": { + "type": "git", + "url": "https://github.com/facade/flare-client-php.git", + "reference": "25907a113bfc212a38d458ae365bfb902b4e7fb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/25907a113bfc212a38d458ae365bfb902b4e7fb8", + "reference": "25907a113bfc212a38d458ae365bfb902b4e7fb8", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "~1.0", + "illuminate/pipeline": "^5.5|^6.0|^7.0|^8.0", + "php": "^7.1", + "symfony/http-foundation": "^3.3|^4.1|^5.0", + "symfony/mime": "^3.4|^4.0|^5.1", + "symfony/var-dumper": "^3.4|^4.0|^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "larapack/dd": "^1.1", + "phpunit/phpunit": "^7.5.16", + "spatie/phpunit-snapshot-assertions": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Facade\\FlareClient\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/facade/flare-client-php", + "keywords": [ + "exception", + "facade", + "flare", + "reporting" + ], + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2020-08-26T18:06:23+00:00" + }, + { + "name": "facade/ignition", + "version": "2.3.6", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition.git", + "reference": "d7d05dba5a0bdbf018a2cb7be268f22f5d73eb81" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition/zipball/d7d05dba5a0bdbf018a2cb7be268f22f5d73eb81", + "reference": "d7d05dba5a0bdbf018a2cb7be268f22f5d73eb81", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facade/flare-client-php": "^1.0", + "facade/ignition-contracts": "^1.0", + "filp/whoops": "^2.4", + "illuminate/support": "^7.0|^8.0", + "monolog/monolog": "^2.0", + "php": "^7.2.5", + "scrivo/highlight.php": "^9.15", + "symfony/console": "^5.0", + "symfony/var-dumper": "^5.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "mockery/mockery": "^1.3", + "orchestra/testbench": "5.0", + "psalm/plugin-laravel": "^1.2" + }, + "suggest": { + "laravel/telescope": "^3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Facade\\Ignition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Facade\\Ignition\\Facades\\Flare" + } + } + }, + "autoload": { + "psr-4": { + "Facade\\Ignition\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://github.com/facade/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], + "time": "2020-08-10T13:50:38+00:00" + }, + { + "name": "facade/ignition-contracts", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition-contracts.git", + "reference": "aeab1ce8b68b188a43e81758e750151ad7da796b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/aeab1ce8b68b188a43e81758e750151ad7da796b", + "reference": "aeab1ce8b68b188a43e81758e750151ad7da796b", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "phpunit/phpunit": "^7.5|^8.0", + "vimeo/psalm": "^3.12" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facade\\IgnitionContracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://flareapp.io", + "role": "Developer" + } + ], + "description": "Solution contracts for Ignition", + "homepage": "https://github.com/facade/ignition-contracts", + "keywords": [ + "contracts", + "flare", + "ignition" + ], + "time": "2020-07-14T10:10:28+00:00" + }, { "name": "filp/whoops", "version": "2.7.3", @@ -9400,34 +10026,34 @@ }, { "name": "laravel/dusk", - "version": "v5.11.0", + "version": "v6.5.1", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "e07cc46a1e39767739e8197189780b4c2639806d" + "reference": "ebf081d312bc1e702337668e13831d25ab324ce3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/e07cc46a1e39767739e8197189780b4c2639806d", - "reference": "e07cc46a1e39767739e8197189780b4c2639806d", + "url": "https://api.github.com/repos/laravel/dusk/zipball/ebf081d312bc1e702337668e13831d25ab324ce3", + "reference": "ebf081d312bc1e702337668e13831d25ab324ce3", "shasum": "" }, "require": { "ext-json": "*", "ext-zip": "*", - "illuminate/console": "~5.7.0|~5.8.0|^6.0|^7.0", - "illuminate/support": "~5.7.0|~5.8.0|^6.0|^7.0", - "nesbot/carbon": "^1.20|^2.0", - "php": ">=7.1.0", + "illuminate/console": "^6.0|^7.0|^8.0", + "illuminate/support": "^6.0|^7.0|^8.0", + "nesbot/carbon": "^2.0", + "php": "^7.2", "php-webdriver/webdriver": "^1.8.1", - "symfony/console": "^4.0|^5.0", - "symfony/finder": "^4.0|^5.0", - "symfony/process": "^4.0|^5.0", - "vlucas/phpdotenv": "^2.2|^3.0|^4.0" + "symfony/console": "^4.3|^5.0", + "symfony/finder": "^4.3|^5.0", + "symfony/process": "^4.3|^5.0", + "vlucas/phpdotenv": "^3.0|^4.0|^5.0" }, "require-dev": { "mockery/mockery": "^1.0", - "phpunit/phpunit": "^7.5|^8.0" + "phpunit/phpunit": "^7.5.15|^8.4|^9.0" }, "suggest": { "ext-pcntl": "Used to gracefully terminate Dusk when tests are running." @@ -9435,7 +10061,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "6.x-dev" }, "laravel": { "providers": [ @@ -9464,7 +10090,7 @@ "testing", "webdriver" ], - "time": "2020-03-24T16:21:49+00:00" + "time": "2020-08-28T14:37:02+00:00" }, { "name": "laravelcollective/html", @@ -9597,30 +10223,33 @@ }, { "name": "mockery/mockery", - "version": "1.3.3", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d" + "reference": "20cab678faed06fac225193be281ea0fddb43b93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/60fa2f67f6e4d3634bb4a45ff3171fa52215800d", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/20cab678faed06fac225193be281ea0fddb43b93", + "reference": "20cab678faed06fac225193be281ea0fddb43b93", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": "^7.3 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpunit/phpunit": "^8.5 || ^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -9658,7 +10287,7 @@ "test double", "testing" ], - "time": "2020-08-11T18:10:21+00:00" + "time": "2020-08-11T18:10:13+00:00" }, { "name": "myclabs/deep-copy", @@ -9716,29 +10345,35 @@ }, { "name": "nunomaduro/collision", - "version": "v2.1.1", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "b5feb0c0d92978ec7169232ce5d70d6da6b29f63" + "reference": "d50490417eded97be300a92cd7df7badc37a9018" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/b5feb0c0d92978ec7169232ce5d70d6da6b29f63", - "reference": "b5feb0c0d92978ec7169232ce5d70d6da6b29f63", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/d50490417eded97be300a92cd7df7badc37a9018", + "reference": "d50490417eded97be300a92cd7df7badc37a9018", "shasum": "" }, "require": { - "filp/whoops": "^2.1.4", - "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*", - "php": "^7.1", - "symfony/console": "~2.8|~3.3|~4.0" + "facade/ignition-contracts": "^1.0", + "filp/whoops": "^2.4", + "php": "^7.2.5", + "symfony/console": "^5.0" }, "require-dev": { - "laravel/framework": "5.7.*", - "nunomaduro/larastan": "^0.3.0", - "phpstan/phpstan": "^0.10", - "phpunit/phpunit": "~7.3" + "facade/ignition": "^2.0", + "fideloper/proxy": "^4.2", + "friendsofphp/php-cs-fixer": "^2.16", + "fruitcake/laravel-cors": "^1.0", + "laravel/framework": "^7.0", + "laravel/tinker": "^2.0", + "nunomaduro/larastan": "^0.5", + "orchestra/testbench": "^5.0", + "phpstan/phpstan": "^0.12.3", + "phpunit/phpunit": "^8.5.1 || ^9.0" }, "type": "library", "extra": { @@ -9776,7 +10411,21 @@ "php", "symfony" ], - "time": "2018-11-21T21:40:54+00:00" + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2020-04-04T19:56:08+00:00" }, { "name": "phar-io/manifest", @@ -9996,16 +10645,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.0", + "version": "5.2.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "3170448f5769fe19f456173d833734e0ff1b84df" + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df", - "reference": "3170448f5769fe19f456173d833734e0ff1b84df", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", "shasum": "" }, "require": { @@ -10044,7 +10693,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-07-20T20:05:34+00:00" + "time": "2020-08-15T11:14:08+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -10156,40 +10805,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -10215,7 +10864,7 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "time": "2019-11-20T13:55:58+00:00" }, { "name": "phpunit/php-file-iterator", @@ -10404,57 +11053,57 @@ "keywords": [ "tokenizer" ], + "abandoned": true, "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "8.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "34c18baa6a44f1d1fbf0338907139e9dce95b997" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/34c18baa6a44f1d1fbf0338907139e9dce95b997", + "reference": "34c18baa6a44f1d1fbf0338907139e9dce95b997", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^7.0.7", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.1", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -10462,7 +11111,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -10488,7 +11137,92 @@ "testing", "xunit" ], - "time": "2020-01-08T08:45:45+00:00" + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-22T07:06:58+00:00" + }, + { + "name": "scrivo/highlight.php", + "version": "v9.18.1.2", + "source": { + "type": "git", + "url": "https://github.com/scrivo/highlight.php.git", + "reference": "efb6e445494a9458aa59b0af5edfa4bdcc6809d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/efb6e445494a9458aa59b0af5edfa4bdcc6809d9", + "reference": "efb6e445494a9458aa59b0af5edfa4bdcc6809d9", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.7", + "sabberworm/php-css-parser": "^8.3", + "symfony/finder": "^2.8|^3.4", + "symfony/var-dumper": "^2.8|^3.4" + }, + "suggest": { + "ext-dom": "Needed to make use of the features in the utilities namespace" + }, + "type": "library", + "autoload": { + "psr-0": { + "Highlight\\": "", + "HighlightUtilities\\": "" + }, + "files": [ + "HighlightUtilities/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Geert Bergman", + "homepage": "http://www.scrivo.org/", + "role": "Project Author" + }, + { + "name": "Vladimir Jimenez", + "homepage": "https://allejo.io", + "role": "Maintainer" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Contributor" + } + ], + "description": "Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js", + "keywords": [ + "code", + "highlight", + "highlight.js", + "highlight.php", + "syntax" + ], + "funding": [ + { + "url": "https://github.com/allejo", + "type": "github" + } + ], + "time": "2020-08-27T03:24:44+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -10777,23 +11511,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -10801,7 +11538,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -10824,7 +11561,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -11013,6 +11750,52 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "time": "2018-10-04T04:07:39+00:00" }, + { + "name": "sebastian/type", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-07-02T08:10:15+00:00" + }, { "name": "sebastian/version", "version": "2.0.1", @@ -11058,16 +11841,16 @@ }, { "name": "swagger-api/swagger-ui", - "version": "v3.31.1", + "version": "v3.32.5", "source": { "type": "git", "url": "https://github.com/swagger-api/swagger-ui.git", - "reference": "752488edf7ff5b3f98fde2d069e4cd5eff150cd0" + "reference": "57f39bd5724956d96af43a86439e2808b981fb18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/752488edf7ff5b3f98fde2d069e4cd5eff150cd0", - "reference": "752488edf7ff5b3f98fde2d069e4cd5eff150cd0", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/57f39bd5724956d96af43a86439e2808b981fb18", + "reference": "57f39bd5724956d96af43a86439e2808b981fb18", "shasum": "" }, "type": "library", @@ -11111,34 +11894,32 @@ "swagger", "ui" ], - "time": "2020-07-30T18:09:18+00:00" + "time": "2020-08-27T20:11:06+00:00" }, { - "name": "symfony/yaml", - "version": "v4.4.11", + "name": "symfony/debug", + "version": "v4.4.13", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a" + "url": "https://github.com/symfony/debug.git", + "reference": "aeb73aca16a8f1fe958230fe44e6cf4c84cbb85e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", - "reference": "c2d2cc66e892322cfcc03f8f12f8340dbd7a3f8a", + "url": "https://api.github.com/repos/symfony/debug/zipball/aeb73aca16a8f1fe958230fe44e6cf4c84cbb85e", + "reference": "aeb73aca16a8f1fe958230fe44e6cf4c84cbb85e", "shasum": "" }, "require": { "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8" + "psr/log": "~1.0", + "symfony/polyfill-php80": "^1.15" }, "conflict": { - "symfony/console": "<3.4" + "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "symfony/http-kernel": "^3.4|^4.0|^5.0" }, "type": "library", "extra": { @@ -11146,6 +11927,83 @@ "dev-master": "4.4-dev" } }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-08-10T07:47:39+00:00" + }, + { + "name": "symfony/yaml", + "version": "v5.1.5", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "a44bd3a91bfbf8db12367fa6ffac9c3eb1a8804a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a44bd3a91bfbf8db12367fa6ffac9c3eb1a8804a", + "reference": "a44bd3a91bfbf8db12367fa6ffac9c3eb1a8804a", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<4.4" + }, + "require-dev": { + "symfony/console": "^4.4|^5.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" @@ -11184,7 +12042,7 @@ "type": "tidelift" } ], - "time": "2020-05-20T08:37:50+00:00" + "time": "2020-08-26T08:30:57+00:00" }, { "name": "theseer/tokenizer", @@ -11317,28 +12175,28 @@ }, { "name": "zircote/swagger-php", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/zircote/swagger-php.git", - "reference": "fa47d62c22c95272625624fbf8109fa46ffac43b" + "reference": "9d172471e56433b5c7061006b9a766f262a3edfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/fa47d62c22c95272625624fbf8109fa46ffac43b", - "reference": "fa47d62c22c95272625624fbf8109fa46ffac43b", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/9d172471e56433b5c7061006b9a766f262a3edfd", + "reference": "9d172471e56433b5c7061006b9a766f262a3edfd", "shasum": "" }, "require": { "doctrine/annotations": "*", + "ext-json": "*", "php": ">=7.2", "symfony/finder": ">=2.2", "symfony/yaml": ">=3.3" }, "require-dev": { - "phpunit/phpunit": ">=8", - "squizlabs/php_codesniffer": ">=3.3", - "zendframework/zend-form": "<2.8" + "friendsofphp/php-cs-fixer": "^2.16", + "phpunit/phpunit": ">=8" }, "bin": [ "bin/openapi" @@ -11359,13 +12217,17 @@ "authors": [ { "name": "Robert Allen", - "email": "zircote@gmail.com", - "homepage": "http://www.zircote.com" + "email": "zircote@gmail.com" }, { "name": "Bob Fanger", "email": "bfanger@gmail.com", - "homepage": "http://bfanger.nl" + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" } ], "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", @@ -11376,7 +12238,7 @@ "rest", "service discovery" ], - "time": "2020-05-07T09:10:49+00:00" + "time": "2020-09-03T20:18:43+00:00" } ], "aliases": [], diff --git a/config/auth.php b/config/auth.php index dc92eeb0c348..64eda056b1c2 100644 --- a/config/auth.php +++ b/config/auth.php @@ -40,14 +40,18 @@ return [ 'driver' => 'session', 'provider' => 'users', ], + 'api' => [ 'driver' => 'token', 'provider' => 'users', + 'hash' => false, ], + 'user' => [ 'driver' => 'session', 'provider' => 'users', ], + 'contact' => [ 'driver' => 'session', 'provider' => 'contacts', @@ -76,6 +80,7 @@ return [ 'driver' => 'eloquent', 'model' => App\Models\User::class, ], + 'contacts' => [ 'driver' => 'eloquent', 'model' => App\Models\ClientContact::class, @@ -107,7 +112,9 @@ return [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, + 'throttle' => 60, ], + 'contacts' => [ 'provider' => 'contacts', 'table' => 'password_resets', @@ -115,4 +122,17 @@ return [ ], ], + /* + |-------------------------------------------------------------------------- + | Password Confirmation Timeout + |-------------------------------------------------------------------------- + | + | Here you may define the amount of seconds before a password confirmation + | times out and the user is prompted to re-enter their password via the + | confirmation screen. By default, the timeout lasts for three hours. + | + */ + + 'password_timeout' => 10800, + ]; diff --git a/config/beacon.php b/config/beacon.php index 9a36b523987b..9eba649c678e 100644 --- a/config/beacon.php +++ b/config/beacon.php @@ -2,34 +2,34 @@ return [ - /** + /* * Enable or disable the beacon */ 'enabled' => env('BEACON_ENABLED', false), - /** + /* * The API endpoint for logs */ 'endpoint' => 'https://app.lightlogs.com/api', - /** + /* * Your API key */ - 'api_key' => env('BEACON_API_KEY',''), + 'api_key' => env('BEACON_API_KEY', ''), - /** + /* * Should batch requests */ 'batch' => true, - /** + /* * The default key used to store * metrics for batching */ 'cache_key' => 'beacon', - /** - * Determines whether to log the + /* + * Determines whether to log the * host system variables using * the built in metrics. */ @@ -37,7 +37,7 @@ return [ 'Turbo124\Beacon\Jobs\System\CpuMetric', 'Turbo124\Beacon\Jobs\System\HdMetric', 'Turbo124\Beacon\Jobs\System\MemMetric', - 'App\Jobs\Ninja\CheckDbStatus', + App\Jobs\Ninja\CheckDbStatus::class, ], -]; \ No newline at end of file +]; diff --git a/config/cache.php b/config/cache.php index 69b6a4165cff..4f41fdf966b5 100644 --- a/config/cache.php +++ b/config/cache.php @@ -13,7 +13,8 @@ return [ | using this caching library. This connection is used when another is | not explicitly specified when executing a given caching function. | - | Supported: "apc", "array", "database", "file", "memcached", "redis" + | Supported: "apc", "array", "database", "file", + | "memcached", "redis", "dynamodb" | */ @@ -38,6 +39,7 @@ return [ 'array' => [ 'driver' => 'array', + 'serialize' => false, ], 'database' => [ @@ -59,7 +61,7 @@ return [ env('MEMCACHED_PASSWORD'), ], 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, + // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ @@ -75,6 +77,15 @@ return [ 'connection' => 'cache', ], + 'dynamodb' => [ + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), + ], + ], /* @@ -88,9 +99,6 @@ return [ | */ - 'prefix' => env( - 'CACHE_PREFIX', - Str::slug(env('APP_NAME', 'laravel'), '_').'_cache' - ), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), ]; diff --git a/config/cors.php b/config/cors.php new file mode 100644 index 000000000000..558369dca41b --- /dev/null +++ b/config/cors.php @@ -0,0 +1,34 @@ + ['api/*'], + + 'allowed_methods' => ['*'], + + 'allowed_origins' => ['*'], + + 'allowed_origins_patterns' => [], + + 'allowed_headers' => ['*'], + + 'exposed_headers' => [], + + 'max_age' => 0, + + 'supports_credentials' => false, + +]; diff --git a/config/css-inliner.php b/config/css-inliner.php index 6f7362b26dd1..f9e314f876fd 100644 --- a/config/css-inliner.php +++ b/config/css-inliner.php @@ -2,19 +2,19 @@ return [ - /* - |-------------------------------------------------------------------------- - | Css Files - |-------------------------------------------------------------------------- - | - | Css file of your style for your emails - | The content of these files will be added directly into the inliner - | Use absolute paths, ie. public_path('css/main.css') - | - */ + /* + |-------------------------------------------------------------------------- + | Css Files + |-------------------------------------------------------------------------- + | + | Css file of your style for your emails + | The content of these files will be added directly into the inliner + | Use absolute paths, ie. public_path('css/main.css') + | + */ - 'css-files' => [ - public_path('css/app.css'), - ], + 'css-files' => [ + public_path('css/app.css'), + ], ]; diff --git a/config/filesystems.php b/config/filesystems.php index 346015849214..88314fa6121d 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -13,7 +13,7 @@ return [ | */ - 'default' => env('FILESYSTEM_DRIVER', 'public'), + 'default' => env('FILESYSTEM_DRIVER', 'local'), /* |-------------------------------------------------------------------------- @@ -37,7 +37,7 @@ return [ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | - | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3" | */ @@ -81,10 +81,11 @@ return [ 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), - 'endpoint' => env('AWS_ENDPOINT'), 'url' => env('AWS_URL'), 'visibility' => 'public', + 'endpoint' => env('AWS_ENDPOINT'), ], + 'gcs' => [ 'driver' => 'gcs', 'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'), @@ -94,6 +95,22 @@ return [ 'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below 'visibility' => 'public', // optional: public|private ], + + ], + + /* + |-------------------------------------------------------------------------- + | Symbolic Links + |-------------------------------------------------------------------------- + | + | Here you may configure the symbolic links that will be created when the + | `storage:link` Artisan command is executed. The array keys should be + | the locations of the links and the values should be their targets. + | + */ + + 'links' => [ + public_path('storage') => storage_path('app/public'), ], ]; diff --git a/config/former.php b/config/former.php index d054ff2b0b01..8bb2efd91831 100644 --- a/config/former.php +++ b/config/former.php @@ -1,4 +1,6 @@ - true, // An array of attributes to automatically translate - 'translatable' => array( + 'translatable' => [ 'help', 'inlineHelp', 'blockHelp', 'placeholder', 'data_placeholder', 'label', - ), + ], // Framework //////////////////////////////////////////////////////////////////// @@ -67,141 +69,140 @@ // The framework to be used by Former 'framework' => 'TwitterBootstrap4', - 'TwitterBootstrap4' => array( + 'TwitterBootstrap4' => [ // Map Former-supported viewports to Bootstrap 4 equivalents - 'viewports' => array( + 'viewports' => [ 'large' => 'lg', 'medium' => 'md', 'small' => 'sm', 'mini' => 'xs', - ), + ], // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( + 'labelWidths' => [ 'large' => 2, 'small' => 4, - ), + ], // HTML markup and classes used by Bootstrap 5 for icons - 'icon' => array( + 'icon' => [ 'tag' => 'i', 'set' => 'fa', 'prefix' => 'fa', - ), + ], - ), + ], - 'TwitterBootstrap3' => array( + 'TwitterBootstrap3' => [ // Map Former-supported viewports to Bootstrap 3 equivalents - 'viewports' => array( + 'viewports' => [ 'large' => 'lg', 'medium' => 'md', 'small' => 'sm', 'mini' => 'xs', - ), + ], // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( + 'labelWidths' => [ 'large' => 2, 'small' => 4, - ), + ], // HTML markup and classes used by Bootstrap 3 for icons - 'icon' => array( + 'icon' => [ 'tag' => 'span', 'set' => 'glyphicon', 'prefix' => 'glyphicon', - ), + ], - ), + ], - 'Nude' => array( // No-framework markup - 'icon' => array( + 'Nude' => [ // No-framework markup + 'icon' => [ 'tag' => 'i', 'set' => null, 'prefix' => 'icon', - ), - ), + ], + ], - 'TwitterBootstrap' => array( // Twitter Bootstrap version 2 - 'icon' => array( + 'TwitterBootstrap' => [ // Twitter Bootstrap version 2 + 'icon' => [ 'tag' => 'i', 'set' => null, 'prefix' => 'icon', - ), - ), + ], + ], - 'ZurbFoundation5' => array( + 'ZurbFoundation5' => [ // Map Former-supported viewports to Foundation 5 equivalents - 'viewports' => array( + 'viewports' => [ 'large' => 'large', 'medium' => null, 'small' => 'small', 'mini' => null, - ), + ], // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( + 'labelWidths' => [ 'small' => 3, - ), + ], // Classes to be applied to wrapped labels in horizontal forms - 'wrappedLabelClasses' => array('right', 'inline'), + 'wrappedLabelClasses' => ['right', 'inline'], // HTML markup and classes used by Foundation 5 for icons - 'icon' => array( + 'icon' => [ 'tag' => 'i', 'set' => null, 'prefix' => 'fi', - ), + ], // CSS for inline validation errors - 'error_classes' => array('class' => 'error'), - ), + 'error_classes' => ['class' => 'error'], + ], - 'ZurbFoundation4' => array( + 'ZurbFoundation4' => [ // Foundation 4 also has an experimental "medium" breakpoint // explained at http://foundation.zurb.com/docs/components/grid.html - 'viewports' => array( + 'viewports' => [ 'large' => 'large', 'medium' => null, 'small' => 'small', 'mini' => null, - ), + ], // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( + 'labelWidths' => [ 'small' => 3, - ), + ], // Classes to be applied to wrapped labels in horizontal forms - 'wrappedLabelClasses' => array('right', 'inline'), + 'wrappedLabelClasses' => ['right', 'inline'], // HTML markup and classes used by Foundation 4 for icons - 'icon' => array( + 'icon' => [ 'tag' => 'i', 'set' => 'general', 'prefix' => 'foundicon', - ), + ], // CSS for inline validation errors - 'error_classes' => array('class' => 'alert-box radius warning'), - ), + 'error_classes' => ['class' => 'alert-box radius warning'], + ], - 'ZurbFoundation' => array( // Foundation 3 - 'viewports' => array( + 'ZurbFoundation' => [ // Foundation 3 + 'viewports' => [ 'large' => '', 'medium' => null, 'small' => 'mobile-', 'mini' => null, - ), + ], // Width of labels for horizontal forms expressed as viewport => grid columns - 'labelWidths' => array( + 'labelWidths' => [ 'large' => 2, 'small' => 4, - ), + ], // Classes to be applied to wrapped labels in horizontal forms - 'wrappedLabelClasses' => array('right', 'inline'), + 'wrappedLabelClasses' => ['right', 'inline'], // HTML markup and classes used by Foundation 3 for icons - 'icon' => array( + 'icon' => [ 'tag' => 'i', 'set' => null, 'prefix' => 'fi', - ), + ], // CSS for inline validation errors // should work for Zurb 2 and 3 - 'error_classes' => array('class' => 'alert-box alert error'), - ), + 'error_classes' => ['class' => 'alert-box alert error'], + ], - -); +]; diff --git a/config/logging.php b/config/logging.php index 400bc7f4640c..088c204e2994 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,6 +1,8 @@ [ 'driver' => 'stack', 'channels' => ['single'], + 'ignore_exceptions' => false, ], 'single' => [ @@ -48,7 +51,7 @@ return [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', - 'days' => 7, + 'days' => 14, ], 'slack' => [ @@ -59,9 +62,20 @@ return [ 'level' => 'critical', ], + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + 'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], @@ -76,6 +90,15 @@ return [ 'driver' => 'errorlog', 'level' => 'debug', ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], ], ]; diff --git a/config/mail.php b/config/mail.php index 124c11687888..54299aabf8ad 100644 --- a/config/mail.php +++ b/config/mail.php @@ -4,45 +4,73 @@ return [ /* |-------------------------------------------------------------------------- - | Mail Driver + | Default Mailer |-------------------------------------------------------------------------- | - | Laravel supports both SMTP and PHP's "mail" function as drivers for the - | sending of e-mail. You may specify which one you're using throughout - | your application here. By default, Laravel is setup for SMTP mail. - | - | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", - | "sparkpost", "log", "array", "gmail" + | This option controls the default mailer that is used to send any email + | messages sent by your application. Alternative mailers may be setup + | and used as needed; however, this mailer will be used by default. | */ - 'driver' => env('MAIL_DRIVER', 'smtp'), + 'default' => env('MAIL_MAILER', 'smtp'), /* |-------------------------------------------------------------------------- - | SMTP Host Address + | Mailer Configurations |-------------------------------------------------------------------------- | - | Here you may provide the host address of the SMTP server used by your - | applications. A default option is provided that is compatible with - | the Mailgun mail service which will provide reliable deliveries. + | Here you may configure all of the mailers used by your application plus + | their respective settings. Several examples have been configured for + | you and you are free to add your own as your application requires. + | + | Laravel supports a variety of mail "transport" drivers to be used while + | sending an e-mail. You will specify which one you are using for your + | mailers below. You are free to add additional mailers as required. + | + | Supported: "smtp", "sendmail", "mailgun", "ses", + | "postmark", "log", "array" | */ - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'mailers' => [ + 'smtp' => [ + 'transport' => 'smtp', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, + 'auth_mode' => null, + ], - /* - |-------------------------------------------------------------------------- - | SMTP Host Port - |-------------------------------------------------------------------------- - | - | This is the SMTP port used by your application to deliver e-mails to - | users of the application. Like the host we have set this value to - | stay compatible with the Mailgun e-mail application by default. - | - */ + 'ses' => [ + 'transport' => 'ses', + ], - 'port' => env('MAIL_PORT', 587), + 'mailgun' => [ + 'transport' => 'mailgun', + ], + + 'postmark' => [ + 'transport' => 'postmark', + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => '/usr/sbin/sendmail -bs', + ], + + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], + + 'array' => [ + 'transport' => 'array', + ], + ], /* |-------------------------------------------------------------------------- @@ -60,47 +88,6 @@ return [ 'name' => env('MAIL_FROM_NAME', 'Example'), ], - /* - |-------------------------------------------------------------------------- - | E-Mail Encryption Protocol - |-------------------------------------------------------------------------- - | - | Here you may specify the encryption protocol that should be used when - | the application send e-mail messages. A sensible default using the - | transport layer security protocol should provide great security. - | - */ - - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - - /* - |-------------------------------------------------------------------------- - | SMTP Server Username - |-------------------------------------------------------------------------- - | - | If your SMTP server requires a username for authentication, you should - | set it here. This will get used to authenticate with your server on - | connection. You may also set the "password" value below this one. - | - */ - - 'username' => env('MAIL_USERNAME'), - - 'password' => env('MAIL_PASSWORD'), - - /* - |-------------------------------------------------------------------------- - | Sendmail System Path - |-------------------------------------------------------------------------- - | - | When using the "sendmail" driver to send e-mails, we will need to know - | the path to where Sendmail lives on this server. A default path has - | been provided here, which will work well on most of your systems. - | - */ - - 'sendmail' => '/usr/sbin/sendmail -bs', - /* |-------------------------------------------------------------------------- | Markdown Mail Settings diff --git a/config/ninja.php b/config/ninja.php index 8f8d544ce5f4..bd41c6af1971 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -10,7 +10,7 @@ return [ 'app_name' => env('APP_NAME'), 'app_env' => env('APP_ENV', 'selfhosted'), 'require_https' => env('REQUIRE_HTTPS', true), - 'app_url' => rtrim(env('APP_URL', ''), '/') . '/', + 'app_url' => rtrim(env('APP_URL', ''), '/').'/', 'app_domain' => env('APP_DOMAIN', ''), 'app_version' => '5.0.13', 'minimum_client_version' => '5.0.13', @@ -25,7 +25,7 @@ return [ 'error_email' => env('ERROR_EMAIL', ''), 'company_id' => 0, 'hash_salt' => env('HASH_SALT', ''), - 'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID',''), + 'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''), 'enabled_modules' => 32767, 'phantomjs_key' => env('PHANTOMJS_KEY', false), 'phantomjs_secret' => env('PHANTOMJS_SECRET', false), @@ -59,10 +59,10 @@ return [ 'datetime_format_id' => env('DEFAULT_DATETIME_FORMAT_ID', '1'), 'locale' => env('DEFAULT_LOCALE', 'en'), 'map_zoom' => env('DEFAULT_MAP_ZOOM', 10), - 'payment_terms' => env('DEFAULT_PAYMENT_TERMS', ""), + 'payment_terms' => env('DEFAULT_PAYMENT_TERMS', ''), 'military_time' => env('MILITARY_TIME', 0), 'first_day_of_week' => env('FIRST_DATE_OF_WEEK', 0), - 'first_month_of_year' => env('FIRST_MONTH_OF_YEAR', '2000-01-01') + 'first_month_of_year' => env('FIRST_MONTH_OF_YEAR', '2000-01-01'), ], 'testvars' => [ @@ -71,8 +71,8 @@ return [ 'password' => 'password', 'stripe' => env('STRIPE_KEYS', ''), 'paypal' => env('PAYPAL_KEYS', ''), - 'authorize' => env('AUTHORIZE_KEYS',''), - 'checkout' => env('CHECKOUT_KEYS',''), + 'authorize' => env('AUTHORIZE_KEYS', ''), + 'checkout' => env('CHECKOUT_KEYS', ''), 'travis' => env('TRAVIS', false), 'test_email' => env('TEST_EMAIL', 'test@example.com'), ], @@ -82,18 +82,18 @@ return [ 'ninja_official_contact' => env('NINJA_OFFICIAL_CONTACT', 'contact@invoiceninja.com'), ], 'cached_tables' => [ - 'banks' => 'App\Models\Bank', - 'countries' => 'App\Models\Country', - 'currencies' => 'App\Models\Currency', - 'date_formats' => 'App\Models\DateFormat', - 'datetime_formats' => 'App\Models\DatetimeFormat', - 'gateways' => 'App\Models\Gateway', - 'gateway_types' => 'App\Models\GatewayType', - 'industries' => 'App\Models\Industry', - 'languages' => 'App\Models\Language', - 'payment_types' => 'App\Models\PaymentType', - 'sizes' => 'App\Models\Size', - 'timezones' => 'App\Models\Timezone', + 'banks' => App\Models\Bank::class, + 'countries' => App\Models\Country::class, + 'currencies' => App\Models\Currency::class, + 'date_formats' => App\Models\DateFormat::class, + 'datetime_formats' => App\Models\DatetimeFormat::class, + 'gateways' => App\Models\Gateway::class, + 'gateway_types' => App\Models\GatewayType::class, + 'industries' => App\Models\Industry::class, + 'languages' => App\Models\Language::class, + 'payment_types' => App\Models\PaymentType::class, + 'sizes' => App\Models\Size::class, + 'timezones' => App\Models\Timezone::class, //'invoiceDesigns' => 'App\Models\InvoiceDesign', //'invoiceStatus' => 'App\Models\InvoiceStatus', //'frequencies' => 'App\Models\Frequency', @@ -117,17 +117,17 @@ return [ ], 'enterprise' => [ 'daily_emails' => 200, - ] + ], ], 'auth' => [ 'google' => [ 'client_id' => env('GOOGLE_CLIENT_ID', ''), - 'client_secret' => env('GOOGLE_CLIENT_SECRET','') - ] + 'client_secret' => env('GOOGLE_CLIENT_SECRET', ''), + ], ], 'system' => [ 'node_path' => env('NODE_PATH', false), - 'npm_path' => env('NPM_PATH', false) + 'npm_path' => env('NPM_PATH', false), ], 'designs' => [ 'base_path' => resource_path('views/pdf-designs/'), diff --git a/config/queue.php b/config/queue.php index 38326efffa7e..00b76d651812 100644 --- a/config/queue.php +++ b/config/queue.php @@ -46,21 +46,23 @@ return [ 'host' => 'localhost', 'queue' => 'default', 'retry_after' => 90, + 'block_for' => 0, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => env('SQS_KEY', 'your-public-key'), - 'secret' => env('SQS_SECRET', 'your-secret-key'), + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'queue' => env('SQS_QUEUE', 'your-queue-name'), - 'region' => env('SQS_REGION', 'us-east-1'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, 'block_for' => null, ], @@ -79,6 +81,7 @@ return [ */ 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], diff --git a/config/session.php b/config/session.php index 45f629a2e7d0..4e0f66cda64c 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,7 @@ 'ninja_session', + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + ), /* |-------------------------------------------------------------------------- @@ -161,7 +168,7 @@ return [ | */ - 'secure' => env('SESSION_SECURE_COOKIE', false), + 'secure' => env('SESSION_SECURE_COOKIE'), /* |-------------------------------------------------------------------------- @@ -183,12 +190,12 @@ return [ | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we - | do not enable this as other CSRF protection services are in place. + | will set this value to "lax" since this is a secure default value. | - | Supported: "lax", "strict" + | Supported: "lax", "strict", "none", null | */ - 'same_site' => null, + 'same_site' => 'lax', ]; diff --git a/config/view.php b/config/view.php index 2acfd9cc9c44..22b8a18d3258 100644 --- a/config/view.php +++ b/config/view.php @@ -28,6 +28,9 @@ return [ | */ - 'compiled' => realpath(storage_path('framework/views')), + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), ]; diff --git a/database/factories/ClientFactory.php b/database/factories/ClientFactory.php index 38618ff630de..b30259928009 100644 --- a/database/factories/ClientFactory.php +++ b/database/factories/ClientFactory.php @@ -5,7 +5,6 @@ use App\DataMapper\CompanySettings; use Faker\Generator as Faker; $factory->define(App\Models\Client::class, function (Faker $faker) { - return [ 'name' => $faker->company(), 'website' => $faker->url, diff --git a/database/factories/ClientLocationFactory.php b/database/factories/ClientLocationFactory.php index 84b8be8ff24c..179da5ebc6d9 100644 --- a/database/factories/ClientLocationFactory.php +++ b/database/factories/ClientLocationFactory.php @@ -13,6 +13,6 @@ $factory->define(App\Models\ClientLocation::class, function (Faker $faker) { 'latitude' => $faker->latitude, 'longitude' => $faker->longitude, 'description' => $faker->paragraph, - 'private_notes' => $faker->paragraph + 'private_notes' => $faker->paragraph, ]; }); diff --git a/database/factories/CreditFactory.php b/database/factories/CreditFactory.php index d45111fe2d58..e24b867432b3 100644 --- a/database/factories/CreditFactory.php +++ b/database/factories/CreditFactory.php @@ -9,7 +9,7 @@ $factory->define(App\Models\Credit::class, function (Faker $faker) { return [ 'status_id' => App\Models\Credit::STATUS_DRAFT, 'discount' => $faker->numberBetween(1, 10), - 'is_amount_discount' => (bool)random_int(0, 1), + 'is_amount_discount' => (bool) random_int(0, 1), 'tax_name1' => 'GST', 'tax_rate1' => 10, 'tax_name2' => 'VAT', diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index 30ea4ac8e96c..61d416af41ef 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -10,7 +10,7 @@ $factory->define(App\Models\Invoice::class, function (Faker $faker) { 'status_id' => App\Models\Invoice::STATUS_SENT, 'number' => $faker->ean13(), 'discount' => $faker->numberBetween(1, 10), - 'is_amount_discount' => (bool)random_int(0, 1), + 'is_amount_discount' => (bool) random_int(0, 1), 'tax_name1' => 'GST', 'tax_rate1' => 10, 'tax_name2' => 'VAT', diff --git a/database/factories/PaymentFactory.php b/database/factories/PaymentFactory.php index f5721965f3ed..32c6b10315f0 100644 --- a/database/factories/PaymentFactory.php +++ b/database/factories/PaymentFactory.php @@ -12,6 +12,6 @@ $factory->define(App\Models\Payment::class, function (Faker $faker) { 'date' => $faker->date(), 'transaction_reference' => $faker->text(10), 'type_id' => Payment::TYPE_CREDIT_CARD, - 'status_id' => Payment::STATUS_COMPLETED + 'status_id' => Payment::STATUS_COMPLETED, ]; }); diff --git a/database/factories/RecurringInvoiceFactory.php b/database/factories/RecurringInvoiceFactory.php index 89635014cccb..bbd8ef4b65d2 100644 --- a/database/factories/RecurringInvoiceFactory.php +++ b/database/factories/RecurringInvoiceFactory.php @@ -29,7 +29,7 @@ $factory->define(App\Models\RecurringInvoice::class, function (Faker $faker) { 'last_sent_date' => $faker->date(), 'next_send_date' => $faker->date(), 'remaining_cycles' => $faker->numberBetween(1, 10), - 'amount' => $faker->randomFloat(2, $min = 1, $max = 1000) // 48.8932 + 'amount' => $faker->randomFloat(2, $min = 1, $max = 1000), // 48.8932 ]; }); diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 2dda97aaabdf..4bc99fdf7db5 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -14,8 +14,8 @@ class CreateUsersTable extends Migration */ public function up() { - DB::raw("SET GLOBAL innodb_file_per_table=1;"); - DB::raw("SET GLOBAL innodb_file_format=Barracuda;"); + DB::raw('SET GLOBAL innodb_file_per_table=1;'); + DB::raw('SET GLOBAL innodb_file_format=Barracuda;'); Schema::create('languages', function ($table) { $table->increments('id'); @@ -105,7 +105,7 @@ class CreateUsersTable extends Migration $table->date('plan_expires')->nullable(); $table->string('user_agent')->nullable(); $table->string('key')->nullable(); - + $table->unsignedInteger('payment_id')->nullable()->index(); $table->unsignedInteger('default_company_id'); @@ -127,7 +127,7 @@ class CreateUsersTable extends Migration $table->timestamps(6); }); - + Schema::create('companies', function (Blueprint $table) { $table->increments('id'); //$table->string('name')->nullable(); @@ -141,7 +141,7 @@ class CreateUsersTable extends Migration $table->boolean('update_products')->default(true); $table->boolean('show_product_details')->default(true); $table->boolean('client_can_register')->default(false); - + $table->boolean('custom_surcharge_taxes1')->default(false); $table->boolean('custom_surcharge_taxes2')->default(false); $table->boolean('custom_surcharge_taxes3')->default(false); @@ -150,7 +150,7 @@ class CreateUsersTable extends Migration $table->boolean('show_product_cost')->default(false); $table->unsignedInteger('enabled_tax_rates')->default(0); $table->unsignedInteger('enabled_modules')->default(0); - + $table->boolean('enable_product_cost')->default(0); $table->boolean('enable_product_quantity')->default(1); $table->boolean('default_quantity')->default(1); @@ -166,13 +166,13 @@ class CreateUsersTable extends Migration $table->smallInteger('enable_modules')->default(0); $table->mediumText('custom_fields'); $table->mediumText('settings'); - + $table->string('slack_webhook_url'); $table->string('google_analytics_url'); $table->timestamps(6); //$table->softDeletes('deleted_at', 6); - + //$table->foreign('country_id')->references('id')->on('countries'); $table->foreign('industry_id')->references('id')->on('industries'); $table->foreign('size_id')->references('id')->on('sizes'); @@ -181,7 +181,6 @@ class CreateUsersTable extends Migration //DB::statement('ALTER table companies key_block_size=8 row_format=compressed'); - Schema::create('company_user', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('company_id'); @@ -202,9 +201,9 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); // $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); - + $table->unique(['company_id', 'user_id']); - $table->index(['account_id', 'company_id','deleted_at']); + $table->index(['account_id', 'company_id', 'deleted_at']); }); Schema::create('documents', function (Blueprint $table) { @@ -236,7 +235,7 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); }); - + Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('account_id')->index(); @@ -279,7 +278,6 @@ class CreateUsersTable extends Migration $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('company_tokens', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('company_id')->index(); @@ -295,7 +293,7 @@ class CreateUsersTable extends Migration $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); }); - + Schema::create('clients', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('company_id')->index(); @@ -388,7 +386,7 @@ class CreateUsersTable extends Migration $table->softDeletes('deleted_at', 6); $table->index(['company_id', 'deleted_at']); $table->index(['company_id', 'email', 'deleted_at']); - + $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); //$table->unique(['company_id', 'email']); }); @@ -415,13 +413,11 @@ class CreateUsersTable extends Migration $table->softDeletes('deleted_at', 6); $table->index(['company_id', 'deleted_at']); - $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('gateway_key')->references('key')->on('gateways'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('invoices', function ($t) { $t->increments('id'); $t->unsignedInteger('client_id')->index(); @@ -465,7 +461,7 @@ class CreateUsersTable extends Migration $t->decimal('total_taxes', 13, 3)->default(0); $t->boolean('uses_inclusive_taxes')->default(0); - + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -543,7 +539,7 @@ class CreateUsersTable extends Migration $t->decimal('total_taxes', 13, 3)->default(0); $t->boolean('uses_inclusive_taxes')->default(0); - + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -578,7 +574,6 @@ class CreateUsersTable extends Migration $t->unique(['company_id', 'number']); }); - Schema::create('credit_invitations', function ($t) { $t->increments('id'); $t->unsignedInteger('company_id'); @@ -604,7 +599,7 @@ class CreateUsersTable extends Migration $t->timestamps(6); $t->softDeletes('deleted_at', 6); - $t->index(['deleted_at', 'credit_id','company_id']); + $t->index(['deleted_at', 'credit_id', 'company_id']); $t->unique(['client_contact_id', 'credit_id']); }); @@ -636,7 +631,6 @@ class CreateUsersTable extends Migration $t->text('private_notes')->nullable(); $t->text('terms')->nullable(); - $t->string('tax_name1')->nullable(); $t->decimal('tax_rate1', 13, 3)->default(0); @@ -648,7 +642,6 @@ class CreateUsersTable extends Migration $t->decimal('total_taxes', 13, 3)->default(0); - $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -672,8 +665,6 @@ class CreateUsersTable extends Migration $t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - - }); Schema::create('recurring_quotes', function ($t) { @@ -715,7 +706,6 @@ class CreateUsersTable extends Migration $t->decimal('total_taxes', 13, 3)->default(0); - $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -738,8 +728,6 @@ class CreateUsersTable extends Migration $t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - - }); Schema::create('quotes', function ($t) { @@ -762,7 +750,7 @@ class CreateUsersTable extends Migration $t->string('po_number')->nullable(); $t->date('date')->nullable(); $t->date('last_sent_date')->nullable(); - + $t->datetime('due_date')->nullable(); $t->datetime('next_send_date')->nullable(); @@ -788,7 +776,7 @@ class CreateUsersTable extends Migration $t->decimal('total_taxes', 13, 3)->default(0); $t->boolean('uses_inclusive_taxes')->default(0); - + $t->string('custom_value1')->nullable(); $t->string('custom_value2')->nullable(); $t->string('custom_value3')->nullable(); @@ -851,8 +839,6 @@ class CreateUsersTable extends Migration $t->unique(['client_contact_id', 'invoice_id']); }); - - Schema::create('quote_invitations', function ($t) { $t->increments('id'); $t->unsignedInteger('company_id'); @@ -878,8 +864,7 @@ class CreateUsersTable extends Migration $t->timestamps(6); $t->softDeletes('deleted_at', 6); - - $t->index(['deleted_at', 'quote_id','company_id']); + $t->index(['deleted_at', 'quote_id', 'company_id']); $t->unique(['client_contact_id', 'quote_id']); }); @@ -899,7 +884,6 @@ class CreateUsersTable extends Migration $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('products', function ($t) { $t->increments('id'); $t->unsignedInteger('company_id')->index(); @@ -933,11 +917,8 @@ class CreateUsersTable extends Migration $t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - - }); - Schema::create('payments', function ($t) { $t->increments('id'); $t->unsignedInteger('company_id')->index(); @@ -989,7 +970,6 @@ class CreateUsersTable extends Migration $table->foreign('payment_id')->references('id')->on('payments')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('payment_libraries', function ($t) { $t->increments('id'); $t->timestamps(6); @@ -998,7 +978,6 @@ class CreateUsersTable extends Migration $t->boolean('visible')->default(true); }); - Schema::create('banks', function ($table) { $table->increments('id'); $table->string('name')->nullable(); @@ -1024,7 +1003,6 @@ class CreateUsersTable extends Migration $table->foreign('bank_id')->references('id')->on('banks'); }); - Schema::create('bank_subcompanies', function ($table) { $table->increments('id'); $table->unsignedInteger('company_id'); @@ -1061,7 +1039,6 @@ class CreateUsersTable extends Migration $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('activities', function ($table) { $table->increments('id'); $table->unsignedInteger('user_id')->nullable(); @@ -1084,7 +1061,6 @@ class CreateUsersTable extends Migration $table->text('notes'); $table->timestamps(6); - $table->index(['vendor_id', 'company_id']); $table->index(['project_id', 'company_id']); $table->index(['user_id', 'company_id']); @@ -1137,7 +1113,6 @@ class CreateUsersTable extends Migration $table->string('name')->nullable(); }); - Schema::create('client_gateway_tokens', function ($table) { $table->increments('id'); $table->unsignedInteger('company_id'); @@ -1173,7 +1148,6 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('date_formats', function ($table) { $table->increments('id'); $table->string('format'); @@ -1232,7 +1206,7 @@ class CreateUsersTable extends Migration $table->string('custom_value4')->nullable(); $table->index(['company_id', 'deleted_at']); - + $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('country_id')->references('id')->on('countries'); @@ -1274,7 +1248,6 @@ class CreateUsersTable extends Migration $table->string('name')->nullable(); $table->index(['company_id', 'deleted_at']); - }); Schema::create('expenses', function (Blueprint $table) { @@ -1325,7 +1298,6 @@ class CreateUsersTable extends Migration $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('projects', function ($t) { $t->increments('id'); $t->unsignedInteger('user_id'); @@ -1344,10 +1316,10 @@ class CreateUsersTable extends Migration $t->text('custom_value4')->nullable(); $t->timestamps(6); $t->softDeletes(); - + $t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); - + $t->index(['company_id', 'deleted_at']); $t->unique(['company_id', 'name']); @@ -1385,7 +1357,6 @@ class CreateUsersTable extends Migration $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); }); - Schema::create('designs', function ($table) { $table->increments('id'); @@ -1404,7 +1375,7 @@ class CreateUsersTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade'); }); } - + /** * Reverse the migrations. * diff --git a/database/migrations/2020_04_08_234530_add_is_deleted_column_to_company_tokens_table.php b/database/migrations/2020_04_08_234530_add_is_deleted_column_to_company_tokens_table.php index e9ba5d74ed78..382e124fb1b8 100644 --- a/database/migrations/2020_04_08_234530_add_is_deleted_column_to_company_tokens_table.php +++ b/database/migrations/2020_04_08_234530_add_is_deleted_column_to_company_tokens_table.php @@ -33,7 +33,6 @@ class AddIsDeletedColumnToCompanyTokensTable extends Migration $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade'); $table->index(['event_id', 'company_id']); - }); Schema::table('companies', function (Blueprint $table) { diff --git a/database/migrations/2020_05_13_035355_add_google_refresh_token_to_users_table.php b/database/migrations/2020_05_13_035355_add_google_refresh_token_to_users_table.php index 20e97c469cf3..3e83effac8e8 100644 --- a/database/migrations/2020_05_13_035355_add_google_refresh_token_to_users_table.php +++ b/database/migrations/2020_05_13_035355_add_google_refresh_token_to_users_table.php @@ -18,12 +18,11 @@ class AddGoogleRefreshTokenToUsersTable extends Migration $table->string('oauth_user_refresh_token')->nullable(); }); - DB::statement("alter table users modify column oauth_user_token text"); + DB::statement('alter table users modify column oauth_user_token text'); - Schema::table('companies', function (Blueprint $table){ + Schema::table('companies', function (Blueprint $table) { $table->integer('enabled_item_tax_rates')->default(0); }); - } /** @@ -33,6 +32,5 @@ class AddGoogleRefreshTokenToUsersTable extends Migration */ public function down() { - } } diff --git a/database/migrations/2020_07_05_084934_company_too_large_attribute.php b/database/migrations/2020_07_05_084934_company_too_large_attribute.php index 7086b7139ce2..901b17b2debf 100644 --- a/database/migrations/2020_07_05_084934_company_too_large_attribute.php +++ b/database/migrations/2020_07_05_084934_company_too_large_attribute.php @@ -13,7 +13,6 @@ class CompanyTooLargeAttribute extends Migration */ public function up() { - Schema::table('companies', function (Blueprint $table) { $table->boolean('is_large')->default(0); }); @@ -23,7 +22,6 @@ class CompanyTooLargeAttribute extends Migration }); Schema::rename('subscriptions', 'webhooks'); - } /** diff --git a/database/migrations/2020_07_08_065301_add_token_id_to_activity_table.php b/database/migrations/2020_07_08_065301_add_token_id_to_activity_table.php index ed2ff8940e6e..bb3ff9cc571b 100644 --- a/database/migrations/2020_07_08_065301_add_token_id_to_activity_table.php +++ b/database/migrations/2020_07_08_065301_add_token_id_to_activity_table.php @@ -29,6 +29,5 @@ class AddTokenIdToActivityTable extends Migration */ public function down() { - } } diff --git a/database/migrations/2020_07_21_112424_update_enabled_modules_value.php b/database/migrations/2020_07_21_112424_update_enabled_modules_value.php index 8acb3e848777..e35edfa3abb6 100644 --- a/database/migrations/2020_07_21_112424_update_enabled_modules_value.php +++ b/database/migrations/2020_07_21_112424_update_enabled_modules_value.php @@ -14,7 +14,7 @@ class UpdateEnabledModulesValue extends Migration */ public function up() { - Company::cursor()->each(function ($company){ + Company::cursor()->each(function ($company) { $company->enabled_modules = 32767; $company->save(); }); diff --git a/database/migrations/2020_08_04_080851_add_is_deleted_to_group_settings.php b/database/migrations/2020_08_04_080851_add_is_deleted_to_group_settings.php index b4dd919df03d..c9842463e258 100644 --- a/database/migrations/2020_08_04_080851_add_is_deleted_to_group_settings.php +++ b/database/migrations/2020_08_04_080851_add_is_deleted_to_group_settings.php @@ -25,6 +25,5 @@ class AddIsDeletedToGroupSettings extends Migration */ public function down() { - } } diff --git a/database/migrations/2020_08_11_221627_add_is_deleted_flag_to_client_gateway_token_table.php b/database/migrations/2020_08_11_221627_add_is_deleted_flag_to_client_gateway_token_table.php index 07e27953a6a1..6e577081f807 100644 --- a/database/migrations/2020_08_11_221627_add_is_deleted_flag_to_client_gateway_token_table.php +++ b/database/migrations/2020_08_11_221627_add_is_deleted_flag_to_client_gateway_token_table.php @@ -25,6 +25,5 @@ class AddIsDeletedFlagToClientGatewayTokenTable extends Migration */ public function down() { - } } diff --git a/database/migrations/2020_08_13_095946_remove_photo_design.php b/database/migrations/2020_08_13_095946_remove_photo_design.php index 299a0f46460d..2c97331d02cd 100644 --- a/database/migrations/2020_08_13_095946_remove_photo_design.php +++ b/database/migrations/2020_08_13_095946_remove_photo_design.php @@ -16,8 +16,9 @@ class RemovePhotoDesign extends Migration { $design = Design::find(10); - if($design) + if ($design) { $design->forceDelete(); + } } /** diff --git a/database/migrations/2020_08_13_212702_add_reminder_sent_fields_to_entity_tables.php b/database/migrations/2020_08_13_212702_add_reminder_sent_fields_to_entity_tables.php index 8019e76efd53..69cad71f2de9 100644 --- a/database/migrations/2020_08_13_212702_add_reminder_sent_fields_to_entity_tables.php +++ b/database/migrations/2020_08_13_212702_add_reminder_sent_fields_to_entity_tables.php @@ -37,7 +37,6 @@ class AddReminderSentFieldsToEntityTables extends Migration $table->date('reminder3_sent')->nullable(); $table->date('reminder_last_sent')->nullable(); }); - } /** @@ -47,6 +46,5 @@ class AddReminderSentFieldsToEntityTables extends Migration */ public function down() { - } } diff --git a/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php b/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php index 9eda7ef60bdc..d3ed44854c1f 100644 --- a/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php +++ b/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php @@ -13,7 +13,6 @@ class AddIsPublicToDocumentsTable extends Migration */ public function up() { - Schema::table('documents', function (Blueprint $table) { $table->boolean('is_public')->default(true); }); @@ -23,18 +22,18 @@ class AddIsPublicToDocumentsTable extends Migration }); Schema::table('company_gateways', function (Blueprint $table) { - $table->enum('token_billing', ['off', 'always','optin','optout'])->default('off'); + $table->enum('token_billing', ['off', 'always', 'optin', 'optout'])->default('off'); $table->string('label', 255)->nullable(); }); Schema::table('payments', function (Blueprint $table) { $table->text('meta')->nullable(); }); - + Schema::table('system_logs', function (Blueprint $table) { $table->softDeletes('deleted_at', 6); }); - + Schema::create('payment_hashes', function ($table) { $table->increments('id'); $table->string('hash', 255); @@ -53,9 +52,8 @@ class AddIsPublicToDocumentsTable extends Migration // }); Schema::table('companies', function ($table) { - $table->enum('default_auto_bill', ['off', 'always','optin','optout'])->default('off'); + $table->enum('default_auto_bill', ['off', 'always', 'optin', 'optout'])->default('off'); }); - } /** @@ -65,6 +63,5 @@ class AddIsPublicToDocumentsTable extends Migration */ public function down() { - } } diff --git a/database/seeds/ConstantsSeeder.php b/database/seeds/ConstantsSeeder.php index a385d3698081..66d6607ca701 100644 --- a/database/seeds/ConstantsSeeder.php +++ b/database/seeds/ConstantsSeeder.php @@ -140,7 +140,7 @@ class ConstantsSeeder extends Seeder $timezones[] = ['name'=>'Pacific/Auckland', 'location' => '(GMT+12:00) Auckland', 'utc_offset' => 43200]; $timezones[] = ['name'=>'Pacific/Fiji', 'location' => '(GMT+12:00) Fiji', 'utc_offset' => 43200]; - $x=1; + $x = 1; foreach ($timezones as $timezone) { Timezone::create([ 'id' => $x, diff --git a/database/seeds/CountriesSeeder.php b/database/seeds/CountriesSeeder.php index 720bd2df7c6b..02405c06e2a9 100644 --- a/database/seeds/CountriesSeeder.php +++ b/database/seeds/CountriesSeeder.php @@ -193,6 +193,5 @@ class CountriesSeeder extends Seeder $p = Country::where('country_code', 275)->first(); $p->name = 'Palestine'; $p->save(); - } } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 2f9dd5c22978..7786a4997dd8 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -16,6 +16,7 @@ class DatabaseSeeder extends Seeder if (Timezone::count()) { $this->command->info('Skipping: already run'); + return; } diff --git a/database/seeds/DesignSeeder.php b/database/seeds/DesignSeeder.php index 06ce6dd89776..511abad31de0 100644 --- a/database/seeds/DesignSeeder.php +++ b/database/seeds/DesignSeeder.php @@ -31,13 +31,13 @@ class DesignSeeder extends Seeder foreach ($designs as $design) { $d = Design::find($design['id']); - if (!$d) { + if (! $d) { Design::create($design); } } foreach (Design::all() as $design) { - $template = new PdfMakerDesign(strtolower($design->name)); + $template = new PdfMakerDesign(strtolower($design->name)); $template->document(); $design_object = new \stdClass; diff --git a/database/seeds/PaymentLibrariesSeeder.php b/database/seeds/PaymentLibrariesSeeder.php index c3960d1d2853..5bc195dad84f 100644 --- a/database/seeds/PaymentLibrariesSeeder.php +++ b/database/seeds/PaymentLibrariesSeeder.php @@ -25,10 +25,10 @@ class PaymentLibrariesSeeder extends Seeder ['id' => 10, 'name' => 'NetBanx', 'provider' => 'NetBanx', 'key' => '334d419939c06bd99b4dfd8a49243f0f', 'fields' => '{"accountNumber":"","storeId":"","storePassword":"","testMode":false}'], ['id' => 11, 'name' => 'PayFast', 'provider' => 'PayFast', 'is_offsite' => true, 'key' => 'd6814fc83f45d2935e7777071e629ef9', 'fields' => '{"merchantId":"","merchantKey":"","pdtKey":"","passphrase":"","testMode":false}'], ['id' => 12, 'name' => 'Payflow Pro', 'provider' => 'Payflow_Pro', 'key' => '0d97c97d227f91c5d0cb86d01e4a52c9', 'fields' => '{"username":"","password":"","vendor":"","partner":"","testMode":false}'], - ['id' => 13, 'name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay', 'key' => 'a66b7062f4c8212d2c428209a34aa6bf', 'fields' => '{"username":"","password":"","pxPostUsername":"","pxPostPassword":"","testMode":false}','default_gateway_type_id' => GatewayType::PAYPAL], - ['id' => 14, 'name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost', 'key' => '7e6fc08b89467518a5953a4839f8baba', 'fields' => '{"username":"","password":"","testMode":false}','default_gateway_type_id' => GatewayType::PAYPAL], - ['id' => 15, 'name' => 'PayPal Express', 'provider' => 'PayPal_Express', 'is_offsite' => true, 'sort_order' => 4, 'key' => '38f2c48af60c7dd69e04248cbb24c36e', 'fields' => '{"username":"","password":"","signature":"","testMode":false,"solutionType":["Sole","Mark"],"landingPage":["Billing","Login"],"brandName":"","headerImageUrl":"","logoImageUrl":"","borderColor":""}','default_gateway_type_id' => GatewayType::PAYPAL], - ['id' => 16, 'name' => 'PayPal Pro', 'provider' => 'PayPal_Pro', 'key' => '80af24a6a69f5c0bbec33e930ab40665', 'fields' => '{"username":"","password":"","signature":"","testMode":false}','default_gateway_type_id' => GatewayType::PAYPAL], + ['id' => 13, 'name' => 'PaymentExpress PxPay', 'provider' => 'PaymentExpress_PxPay', 'key' => 'a66b7062f4c8212d2c428209a34aa6bf', 'fields' => '{"username":"","password":"","pxPostUsername":"","pxPostPassword":"","testMode":false}', 'default_gateway_type_id' => GatewayType::PAYPAL], + ['id' => 14, 'name' => 'PaymentExpress PxPost', 'provider' => 'PaymentExpress_PxPost', 'key' => '7e6fc08b89467518a5953a4839f8baba', 'fields' => '{"username":"","password":"","testMode":false}', 'default_gateway_type_id' => GatewayType::PAYPAL], + ['id' => 15, 'name' => 'PayPal Express', 'provider' => 'PayPal_Express', 'is_offsite' => true, 'sort_order' => 4, 'key' => '38f2c48af60c7dd69e04248cbb24c36e', 'fields' => '{"username":"","password":"","signature":"","testMode":false,"solutionType":["Sole","Mark"],"landingPage":["Billing","Login"],"brandName":"","headerImageUrl":"","logoImageUrl":"","borderColor":""}', 'default_gateway_type_id' => GatewayType::PAYPAL], + ['id' => 16, 'name' => 'PayPal Pro', 'provider' => 'PayPal_Pro', 'key' => '80af24a6a69f5c0bbec33e930ab40665', 'fields' => '{"username":"","password":"","signature":"","testMode":false}', 'default_gateway_type_id' => GatewayType::PAYPAL], ['id' => 17, 'name' => 'Pin', 'provider' => 'Pin', 'key' => '0749cb92a6b36c88bd9ff8aabd2efcab', 'fields' => '{"secretKey":"","testMode":false}'], ['id' => 18, 'name' => 'SagePay Direct', 'provider' => 'SagePay_Direct', 'key' => '4c8f4e5d0f353a122045eb9a60cc0f2d', 'fields' => '{"vendor":"","testMode":false,"referrerId":""}'], ['id' => 19, 'name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost', 'key' => '8036a5aadb2bdaafb23502da8790b6a2', 'fields' => '{"merchantId":"","transactionPassword":"","testMode":false,"enable_ach":"","enable_sofort":"","enable_apple_pay":"","enable_alipay":""}'], diff --git a/database/seeds/PaymentTermsSeeder.php b/database/seeds/PaymentTermsSeeder.php index 899e3e8ac6b3..8964832d4835 100644 --- a/database/seeds/PaymentTermsSeeder.php +++ b/database/seeds/PaymentTermsSeeder.php @@ -23,6 +23,5 @@ class PaymentTermsSeeder extends Seeder foreach ($paymentTerms as $paymentTerm) { PaymentTerm::create($paymentTerm); } - } } diff --git a/database/seeds/PaymentTypesSeeder.php b/database/seeds/PaymentTypesSeeder.php index b2c42b9a7cf8..57df0455feb3 100644 --- a/database/seeds/PaymentTypesSeeder.php +++ b/database/seeds/PaymentTypesSeeder.php @@ -59,7 +59,7 @@ class PaymentTypesSeeder extends Seeder ['name' => 'Crypto', 'gateway_type_id' => self::GATEWAY_TYPE_CRYPTO], ]; - $x=1; + $x = 1; foreach ($paymentTypes as $paymentType) { $record = PaymentType::where('name', '=', $paymentType['name'])->first(); diff --git a/database/seeds/RandomDataSeeder.php b/database/seeds/RandomDataSeeder.php index 79affea2bba8..932e5edb6efd 100644 --- a/database/seeds/RandomDataSeeder.php +++ b/database/seeds/RandomDataSeeder.php @@ -36,6 +36,7 @@ use Illuminate\Support\Str; class RandomDataSeeder extends Seeder { use \App\Utils\Traits\MakesHash; + /** * Run the database seeds. * @@ -69,7 +70,6 @@ class RandomDataSeeder extends Seeder } } - $this->command->info('Running RandomDataSeeder'); Eloquent::unguard(); @@ -87,7 +87,7 @@ class RandomDataSeeder extends Seeder $user = factory(\App\Models\User::class)->create([ 'email' => $faker->email, 'account_id' => $account->id, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); $company_token = CompanyToken::create([ @@ -110,13 +110,12 @@ class RandomDataSeeder extends Seeder $u2 = User::where('email', 'demo@invoiceninja.com')->first(); - if(!$u2){ - + if (! $u2) { $u2 = factory(\App\Models\User::class)->create([ 'email' => 'demo@invoiceninja.com', 'password' => Hash::make('demo'), 'account_id' => $account->id, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); $company_token = CompanyToken::create([ @@ -140,10 +139,9 @@ class RandomDataSeeder extends Seeder $client = factory(\App\Models\Client::class)->create([ 'user_id' => $user->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); - ClientContact::create([ 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, @@ -157,26 +155,25 @@ class RandomDataSeeder extends Seeder 'contact_key' => \Illuminate\Support\Str::random(40), ]); - factory(\App\Models\Client::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 5)->create([ 'user_id' => $user->id, 'client_id' => $c->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); }); - /** Product Factory */ + /* Product Factory */ factory(\App\Models\Product::class, 2)->create(['user_id' => $user->id, 'company_id' => $company->id]); - /** Invoice Factory */ + /* Invoice Factory */ factory(\App\Models\Invoice::class, 2)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); $invoices = Invoice::all(); @@ -198,7 +195,7 @@ class RandomDataSeeder extends Seeder //event(new CreateInvoiceInvitation($invoice)); $invoice->service()->createInvitations()->markSent()->save(); - + $invoice->ledger()->updateInvoiceBalance($invoice->balance); if (rand(0, 1)) { @@ -215,12 +212,12 @@ class RandomDataSeeder extends Seeder $payment->invoices()->save($invoice); - $payment_hash = new PaymentHash; - $payment_hash->hash = Str::random(128); - $payment_hash->data = [['invoice_id' => $invoice->hashed_id, 'amount' => $invoice->balance]]; - $payment_hash->fee_total = 0; - $payment_hash->fee_invoice_id = $invoice->id; - $payment_hash->save(); + $payment_hash = new PaymentHash; + $payment_hash->hash = Str::random(128); + $payment_hash->data = [['invoice_id' => $invoice->hashed_id, 'amount' => $invoice->balance]]; + $payment_hash->fee_total = 0; + $payment_hash->fee_invoice_id = $invoice->id; + $payment_hash->save(); event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars())); @@ -255,7 +252,7 @@ class RandomDataSeeder extends Seeder //$invoice->markSent()->save(); }); - /** Recurring Invoice Factory */ + /* Recurring Invoice Factory */ factory(\App\Models\RecurringInvoice::class, 1)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]); // factory(\App\Models\Payment::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'settings' => ClientSettings::buildClientSettings($company->settings, $client->settings)]); @@ -284,7 +281,6 @@ class RandomDataSeeder extends Seeder //$invoice->markSent()->save(); }); - $clients = Client::all(); foreach ($clients as $client) { @@ -293,7 +289,6 @@ class RandomDataSeeder extends Seeder $client->save(); } - GroupSetting::create([ 'company_id' => $company->id, 'user_id' => $user->id, @@ -301,7 +296,6 @@ class RandomDataSeeder extends Seeder 'name' => 'Default Client Settings', ]); - if (config('ninja.testvars.stripe')) { $cg = new CompanyGateway; $cg->company_id = $company->id; @@ -339,7 +333,7 @@ class RandomDataSeeder extends Seeder $cg->save(); } - if(config('ninja.testvars.checkout')) { + if (config('ninja.testvars.checkout')) { $cg = new CompanyGateway; $cg->company_id = $company->id; $cg->user_id = $user->id; @@ -352,7 +346,7 @@ class RandomDataSeeder extends Seeder $cg->save(); } - if(config('ninja.testvars.authorize')) { + if (config('ninja.testvars.authorize')) { $cg = new CompanyGateway; $cg->company_id = $company->id; $cg->user_id = $user->id; @@ -364,6 +358,5 @@ class RandomDataSeeder extends Seeder $cg->config = encrypt(config('ninja.testvars.authorize')); $cg->save(); } - } } diff --git a/database/seeds/UsersTableSeeder.php b/database/seeds/UsersTableSeeder.php index de4908c6a8e8..b50278132e6c 100644 --- a/database/seeds/UsersTableSeeder.php +++ b/database/seeds/UsersTableSeeder.php @@ -12,6 +12,7 @@ use Illuminate\Database\Seeder; class UsersTableSeeder extends Seeder { use \App\Utils\Traits\MakesHash; + /** * Run the database seeds. * @@ -36,20 +37,18 @@ class UsersTableSeeder extends Seeder $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); - $userPermissions = collect([ 'view_invoice', 'view_client', 'edit_client', 'edit_invoice', 'create_invoice', - 'create_client' + 'create_client', ]); - $user->companies()->attach($company->id, [ 'account_id' => $account->id, 'is_owner' => 1, @@ -62,10 +61,9 @@ class UsersTableSeeder extends Seeder $client = factory(\App\Models\Client::class)->create([ 'user_id' => $user->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); - ClientContact::create([ 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, @@ -76,19 +74,18 @@ class UsersTableSeeder extends Seeder 'client_id' =>$client->id, ]); - factory(\App\Models\Client::class, 20)->create(['user_id' => $user->id, 'company_id' => $company->id])->each(function ($c) use ($user, $company) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 10)->create([ 'user_id' => $user->id, 'client_id' => $c->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); }); } diff --git a/phpunit.xml b/phpunit.xml index a83e2f358c30..f1f54561c8b9 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -61,7 +61,7 @@ - + diff --git a/resources/lang/ca/texts.php b/resources/lang/ca/texts.php index 9776c718ebc6..5302d2431d11 100644 --- a/resources/lang/ca/texts.php +++ b/resources/lang/ca/texts.php @@ -1,6 +1,6 @@ 'Organization', 'name' => 'Name', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1306,7 +1304,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2865,6 +2862,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/cs/texts.php b/resources/lang/cs/texts.php index 2689e3ba015e..814c1fda5e42 100644 --- a/resources/lang/cs/texts.php +++ b/resources/lang/cs/texts.php @@ -1,6 +1,6 @@ 'Organizace', 'name' => 'Jméno', @@ -1018,7 +1018,6 @@ $LANG = array( 'trial_success' => '14-ti denní zkušební lhůta úspěšně nastavena', 'overdue' => 'Po termínu', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'Pro úpravu emailových notifikací prosím navštivte :link', 'reset_password_footer' => 'Pokud jste nepožádali o resetování hesla, prosím kontaktujte naši podporu na: :email', @@ -1198,7 +1197,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1308,7 +1306,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2867,6 +2864,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/da/pagination.php b/resources/lang/da/pagination.php index 6e20cbfa387e..93753491af17 100644 --- a/resources/lang/da/pagination.php +++ b/resources/lang/da/pagination.php @@ -1,6 +1,6 @@ 'Næste »', -); +]; diff --git a/resources/lang/da/reminders.php b/resources/lang/da/reminders.php index 2c17b1ffeccc..4a0dd6dd0b96 100644 --- a/resources/lang/da/reminders.php +++ b/resources/lang/da/reminders.php @@ -1,6 +1,6 @@ "Passwords skal minimum være 6 tegn og matche sikkerhedstjekket.", + 'password' => 'Passwords skal minimum være 6 tegn og matche sikkerhedstjekket.', - "user" => "Vi kan ikke finde en bruger med den email-adresse.", + 'user' => 'Vi kan ikke finde en bruger med den email-adresse.', - "token" => "Password-nulstillingskoden er ugyldig.", + 'token' => 'Password-nulstillingskoden er ugyldig.', - "sent" => "Password-påmindelse sendt!", + 'sent' => 'Password-påmindelse sendt!', - "reset" => "Password has been reset!", + 'reset' => 'Password has been reset!', -); +]; diff --git a/resources/lang/da/texts.php b/resources/lang/da/texts.php index f7502ac9c0cd..79beac915f27 100644 --- a/resources/lang/da/texts.php +++ b/resources/lang/da/texts.php @@ -1,6 +1,6 @@ 'Organisation', 'name' => 'Navn', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'For at justere varslings indstillingene besøg venligst :link', 'reset_password_footer' => 'Hvis du ikke bad om at få nulstillet din adgangskode kontakt venligst kundeservice: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Vend tilbage til appen', - // Payment updates 'refund_payment' => 'Refunder betaling', 'refund_max' => 'Max:', @@ -1305,7 +1303,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2864,6 +2861,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/da/validation.php b/resources/lang/da/validation.php index c345b4353ed9..01cd4644358d 100644 --- a/resources/lang/da/validation.php +++ b/resources/lang/da/validation.php @@ -1,6 +1,6 @@ ":attribute skal accepteres.", - "active_url" => ":attribute er ikke en valid URL.", - "after" => ":attribute skal være en dato efter :date.", - "alpha" => ":attribute må kun bestå af bogstaver.", - "alpha_dash" => ":attribute må kun bestå af bogstaver, tal og bindestreger.", - "alpha_num" => ":attribute må kun bestå af bogstaver og tal.", - "array" => ":attribute skal være et array.", - "before" => ":attribute skal være en dato før :date.", - "between" => array( - "numeric" => ":attribute skal være imellem :min - :max.", - "file" => ":attribute skal være imellem :min - :max kilobytes.", - "string" => ":attribute skal være imellem :min - :max tegn.", - "array" => ":attribute skal indeholde mellem :min - :max elementer.", - ), - "boolean" => ":attribute skal være sandt eller falsk", - "confirmed" => ":attribute er ikke det samme som bekræftelsesfeltet.", - "date" => ":attribute er ikke en gyldig dato.", - "date_format" => ":attribute matcher ikke formatet :format.", - "different" => ":attribute og :other skal være forskellige.", - "digits" => ":attribute skal have :digits cifre.", - "digits_between" => ":attribute skal have mellem :min og :max cifre.", - "email" => ":attribute skal være en gyldig e-mailadresse.", - "exists" => "Det valgte :attribute er ugyldig.", - "image" => ":attribute skal være et billede.", - "in" => "Det valgte :attribute er ugyldig.", - "integer" => ":attribute skal være et heltal.", - "ip" => ":attribute skal være en gyldig IP adresse.", - "max" => array( - "numeric" => ":attribute skal være højest :max.", - "file" => ":attribute skal være højest :max kilobytes.", - "string" => ":attribute skal være højest :max tegn.", - "array" => ":attribute må ikke indeholde mere end :max elementer.", - ), - "mimes" => ":attribute skal være en fil af typen: :values.", - "min" => array( - "numeric" => ":attribute skal være mindst :min.", - "file" => ":attribute skal være mindst :min kilobytes.", - "string" => ":attribute skal være mindst :min tegn.", - "array" => ":attribute skal indeholde mindst :min elementer.", - ), - "not_in" => "Den valgte :attribute er ugyldig.", - "numeric" => ":attribute skal være et tal.", - "regex" => ":attribute formatet er ugyldigt.", - "required" => ":attribute skal udfyldes.", - "required_if" => ":attribute skal udfyldes når :other er :value.", - "required_with" => ":attribute skal udfyldes når :values er udfyldt.", - "required_with_all" => ":attribute skal udfyldes når :values er udfyldt.", - "required_without" => ":attribute skal udfyldes når :values ikke er udfyldt.", - "required_without_all" => ":attribute skal udfyldes når ingen af :values er udfyldt.", - "same" => ":attribute og :other skal være ens.", - "size" => array( - "numeric" => ":attribute skal være :size.", - "file" => ":attribute skal være :size kilobytes.", - "string" => ":attribute skal være :size tegn lang.", - "array" => ":attribute skal indeholde :size elementer.", - ), - "timezone" => "The :attribute must be a valid zone.", - "unique" => ":attribute er allerede taget.", - "url" => ":attribute formatet er ugyldigt.", + 'accepted' => ':attribute skal accepteres.', + 'active_url' => ':attribute er ikke en valid URL.', + 'after' => ':attribute skal være en dato efter :date.', + 'alpha' => ':attribute må kun bestå af bogstaver.', + 'alpha_dash' => ':attribute må kun bestå af bogstaver, tal og bindestreger.', + 'alpha_num' => ':attribute må kun bestå af bogstaver og tal.', + 'array' => ':attribute skal være et array.', + 'before' => ':attribute skal være en dato før :date.', + 'between' => [ + 'numeric' => ':attribute skal være imellem :min - :max.', + 'file' => ':attribute skal være imellem :min - :max kilobytes.', + 'string' => ':attribute skal være imellem :min - :max tegn.', + 'array' => ':attribute skal indeholde mellem :min - :max elementer.', + ], + 'boolean' => ':attribute skal være sandt eller falsk', + 'confirmed' => ':attribute er ikke det samme som bekræftelsesfeltet.', + 'date' => ':attribute er ikke en gyldig dato.', + 'date_format' => ':attribute matcher ikke formatet :format.', + 'different' => ':attribute og :other skal være forskellige.', + 'digits' => ':attribute skal have :digits cifre.', + 'digits_between' => ':attribute skal have mellem :min og :max cifre.', + 'email' => ':attribute skal være en gyldig e-mailadresse.', + 'exists' => 'Det valgte :attribute er ugyldig.', + 'image' => ':attribute skal være et billede.', + 'in' => 'Det valgte :attribute er ugyldig.', + 'integer' => ':attribute skal være et heltal.', + 'ip' => ':attribute skal være en gyldig IP adresse.', + 'max' => [ + 'numeric' => ':attribute skal være højest :max.', + 'file' => ':attribute skal være højest :max kilobytes.', + 'string' => ':attribute skal være højest :max tegn.', + 'array' => ':attribute må ikke indeholde mere end :max elementer.', + ], + 'mimes' => ':attribute skal være en fil af typen: :values.', + 'min' => [ + 'numeric' => ':attribute skal være mindst :min.', + 'file' => ':attribute skal være mindst :min kilobytes.', + 'string' => ':attribute skal være mindst :min tegn.', + 'array' => ':attribute skal indeholde mindst :min elementer.', + ], + 'not_in' => 'Den valgte :attribute er ugyldig.', + 'numeric' => ':attribute skal være et tal.', + 'regex' => ':attribute formatet er ugyldigt.', + 'required' => ':attribute skal udfyldes.', + 'required_if' => ':attribute skal udfyldes når :other er :value.', + 'required_with' => ':attribute skal udfyldes når :values er udfyldt.', + 'required_with_all' => ':attribute skal udfyldes når :values er udfyldt.', + 'required_without' => ':attribute skal udfyldes når :values ikke er udfyldt.', + 'required_without_all' => ':attribute skal udfyldes når ingen af :values er udfyldt.', + 'same' => ':attribute og :other skal være ens.', + 'size' => [ + 'numeric' => ':attribute skal være :size.', + 'file' => ':attribute skal være :size kilobytes.', + 'string' => ':attribute skal være :size tegn lang.', + 'array' => ':attribute skal indeholde :size elementer.', + ], + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => ':attribute er allerede taget.', + 'url' => ':attribute formatet er ugyldigt.', - "positive" => "The :attribute must be greater than zero.", - "has_credit" => "The client does not have enough credit.", - "notmasked" => "The values are masked", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'positive' => 'The :attribute must be greater than zero.', + 'has_credit' => 'The client does not have enough credit.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -92,11 +92,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -109,6 +109,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/de/pagination.php b/resources/lang/de/pagination.php index 5bb69029e529..8b5c48f54bf7 100644 --- a/resources/lang/de/pagination.php +++ b/resources/lang/de/pagination.php @@ -1,6 +1,6 @@ 'weiter »', -); +]; diff --git a/resources/lang/de/passwords.php b/resources/lang/de/passwords.php index 976cc6ba4b4f..a33e78ecf2ba 100644 --- a/resources/lang/de/passwords.php +++ b/resources/lang/de/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "Beide Passwörter müssen übereinstimmen und mindestens 6 Zeichen lang sein.", - "user" => "Wir können keinen Nutzer mit dieser E-Mail Adresse finden.", - "token" => "Der Code zum Zurücksetzen des Passworts ist ungültig oder abgelaufen.", - "sent" => "Es wurde soeben eine E-Mail verschickt, die einen Link zum Zurücksetzen des Passworts enthält!", - "reset" => "Das Passwort wurde zurückgesetzt!", + 'password' => 'Beide Passwörter müssen übereinstimmen und mindestens 6 Zeichen lang sein.', + 'user' => 'Wir können keinen Nutzer mit dieser E-Mail Adresse finden.', + 'token' => 'Der Code zum Zurücksetzen des Passworts ist ungültig oder abgelaufen.', + 'sent' => 'Es wurde soeben eine E-Mail verschickt, die einen Link zum Zurücksetzen des Passworts enthält!', + 'reset' => 'Das Passwort wurde zurückgesetzt!', ]; diff --git a/resources/lang/de/reminders.php b/resources/lang/de/reminders.php index f96428eff43b..0dacc43557fd 100644 --- a/resources/lang/de/reminders.php +++ b/resources/lang/de/reminders.php @@ -1,6 +1,6 @@ "Passwörter müssen 6 Zeichen lang sein und korrekt bestätigt werden.", + 'password' => 'Passwörter müssen 6 Zeichen lang sein und korrekt bestätigt werden.', - "user" => "Wir konnten leider keinen Nutzer mit dieser E-Mail Adresse finden.", + 'user' => 'Wir konnten leider keinen Nutzer mit dieser E-Mail Adresse finden.', - "token" => "Der Passwort-Wiederherstellungs-Schlüssel ist ungültig.", + 'token' => 'Der Passwort-Wiederherstellungs-Schlüssel ist ungültig.', - "sent" => "Passworterinnerung wurde versendet!", + 'sent' => 'Passworterinnerung wurde versendet!', -); +]; diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index 7c8ba1e8e9d3..e7da1afbcebc 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -1,6 +1,6 @@ 'Unternehmen', 'name' => 'Name', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Erfolgreich eine 2-Wochen Testversion aktiviert', 'overdue' => 'Überfällig', - 'white_label_text' => 'Kaufen Sie eine Ein-Jahres-"White Label"-Lizenz für $:price um das Invoice Ninja Branding von den Rechnungen und dem Kundenportal zu entfernen.', 'user_email_footer' => 'Um deine E-Mail-Benachrichtigungen anzupassen besuche bitte :link', 'reset_password_footer' => 'Wenn du das Zurücksetzen des Passworts nicht beantragt hast, benachrichtige bitte unseren Support: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'Der Enterprise-Plan fügt Unterstützung für mehrere Nutzer und Dateianhänge hinzu. :link um die vollständige Liste der Features zu sehen.', 'return_to_app' => 'Zurück zur App', - // Payment updates 'refund_payment' => 'Zahlung erstatten', 'refund_max' => 'Max:', @@ -1306,7 +1304,6 @@ Sobald Sie die Beträge erhalten haben, kommen Sie bitte wieder zurück zu diese 'token_billing_braintree_paypal' => 'Zahlungsdetails speichern', 'add_paypal_account' => 'PayPal Konto hinzufügen', - 'no_payment_method_specified' => 'Keine Zahlungsart angegeben', 'chart_type' => 'Diagrammtyp', 'format' => 'Format', @@ -2865,6 +2862,6 @@ Sobald Sie die Beträge erhalten haben, kommen Sie bitte wieder zurück zu diese 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/de/validation.php b/resources/lang/de/validation.php index 11051273e2f5..2d99a9c31cf4 100644 --- a/resources/lang/de/validation.php +++ b/resources/lang/de/validation.php @@ -1,6 +1,6 @@ ":attribute muss akzeptiert werden.", - "active_url" => ":attribute ist keine gültige Internet-Adresse.", - "after" => ":attribute muss ein Datum nach dem :date sein.", - "alpha" => ":attribute darf nur aus Buchstaben bestehen.", - "alpha_dash" => ":attribute darf nur aus Buchstaben, Zahlen, Binde- und Unterstrichen bestehen. Umlaute (ä, ö, ü) und Eszett (ß) sind nicht erlaubt.", - "alpha_num" => ":attribute darf nur aus Buchstaben und Zahlen bestehen.", - "array" => ":attribute muss ein Array sein.", - "before" => ":attribute muss ein Datum vor dem :date sein.", - "between" => array( - "numeric" => ":attribute muss zwischen :min & :max liegen.", - "file" => ":attribute muss zwischen :min & :max Kilobytes groß sein.", - "string" => ":attribute muss zwischen :min & :max Zeichen lang sein.", - "array" => ":attribute muss zwischen :min & :max Elemente haben.", - ), - "confirmed" => ":attribute stimmt nicht mit der Bestätigung überein.", - "date" => ":attribute muss ein gültiges Datum sein.", - "date_format" => ":attribute entspricht nicht dem gültigen Format für :format.", - "different" => ":attribute und :other müssen sich unterscheiden.", - "digits" => ":attribute muss :digits Stellen haben.", - "digits_between" => ":attribute muss zwischen :min und :max Stellen haben.", - "email" => ":attribute Format ist ungültig.", - "exists" => "Der gewählte Wert für :attribute ist ungültig.", - "image" => ":attribute muss ein Bild sein.", - "in" => "Der gewählte Wert für :attribute ist ungültig.", - "integer" => ":attribute muss eine ganze Zahl sein.", - "ip" => ":attribute muss eine gültige IP-Adresse sein.", - "max" => array( - "numeric" => ":attribute darf maximal :max sein.", - "file" => ":attribute darf maximal :max Kilobytes groß sein.", - "string" => ":attribute darf maximal :max Zeichen haben.", - "array" => ":attribute darf nicht mehr als :max Elemente haben.", - ), - "mimes" => ":attribute muss den Dateityp :values haben.", - "min" => array( - "numeric" => ":attribute muss mindestens :min sein.", - "file" => ":attribute muss mindestens :min Kilobytes groß sein.", - "string" => ":attribute muss mindestens :min Zeichen lang sein.", - "array" => ":attribute muss mindestens :min Elemente haben.", - ), - "not_in" => "Der gewählte Wert für :attribute ist ungültig.", - "numeric" => ":attribute muss eine Zahl sein.", - "regex" => ":attribute Format ist ungültig.", - "required" => ":attribute muss ausgefüllt sein.", - "required_if" => ":attribute muss ausgefüllt sein wenn :other :value ist.", - "required_with" => ":attribute muss angegeben werden wenn :values ausgefüllt wurde.", - "required_with_all" => ":attribute muss ausgefüllt werden, wenn :values vorhanden ist.", - "required_without" => ":attribute muss angegeben werden wenn :values nicht ausgefüllt wurde.", - "required_without_all" => ":attribute muss angegeben werden wenn keines der Felder :values ausgefüllt wurde.", - "same" => ":attribute und :other müssen übereinstimmen.", - "size" => array( - "numeric" => ":attribute muss gleich :size sein.", - "file" => ":attribute muss :size Kilobyte groß sein.", - "string" => ":attribute muss :size Zeichen lang sein.", - "array" => ":attribute muss genau :size Elemente haben.", - ), - "unique" => ":attribute ist schon vergeben.", - "url" => "Das Format von :attribute ist ungültig.", + 'accepted' => ':attribute muss akzeptiert werden.', + 'active_url' => ':attribute ist keine gültige Internet-Adresse.', + 'after' => ':attribute muss ein Datum nach dem :date sein.', + 'alpha' => ':attribute darf nur aus Buchstaben bestehen.', + 'alpha_dash' => ':attribute darf nur aus Buchstaben, Zahlen, Binde- und Unterstrichen bestehen. Umlaute (ä, ö, ü) und Eszett (ß) sind nicht erlaubt.', + 'alpha_num' => ':attribute darf nur aus Buchstaben und Zahlen bestehen.', + 'array' => ':attribute muss ein Array sein.', + 'before' => ':attribute muss ein Datum vor dem :date sein.', + 'between' => [ + 'numeric' => ':attribute muss zwischen :min & :max liegen.', + 'file' => ':attribute muss zwischen :min & :max Kilobytes groß sein.', + 'string' => ':attribute muss zwischen :min & :max Zeichen lang sein.', + 'array' => ':attribute muss zwischen :min & :max Elemente haben.', + ], + 'confirmed' => ':attribute stimmt nicht mit der Bestätigung überein.', + 'date' => ':attribute muss ein gültiges Datum sein.', + 'date_format' => ':attribute entspricht nicht dem gültigen Format für :format.', + 'different' => ':attribute und :other müssen sich unterscheiden.', + 'digits' => ':attribute muss :digits Stellen haben.', + 'digits_between' => ':attribute muss zwischen :min und :max Stellen haben.', + 'email' => ':attribute Format ist ungültig.', + 'exists' => 'Der gewählte Wert für :attribute ist ungültig.', + 'image' => ':attribute muss ein Bild sein.', + 'in' => 'Der gewählte Wert für :attribute ist ungültig.', + 'integer' => ':attribute muss eine ganze Zahl sein.', + 'ip' => ':attribute muss eine gültige IP-Adresse sein.', + 'max' => [ + 'numeric' => ':attribute darf maximal :max sein.', + 'file' => ':attribute darf maximal :max Kilobytes groß sein.', + 'string' => ':attribute darf maximal :max Zeichen haben.', + 'array' => ':attribute darf nicht mehr als :max Elemente haben.', + ], + 'mimes' => ':attribute muss den Dateityp :values haben.', + 'min' => [ + 'numeric' => ':attribute muss mindestens :min sein.', + 'file' => ':attribute muss mindestens :min Kilobytes groß sein.', + 'string' => ':attribute muss mindestens :min Zeichen lang sein.', + 'array' => ':attribute muss mindestens :min Elemente haben.', + ], + 'not_in' => 'Der gewählte Wert für :attribute ist ungültig.', + 'numeric' => ':attribute muss eine Zahl sein.', + 'regex' => ':attribute Format ist ungültig.', + 'required' => ':attribute muss ausgefüllt sein.', + 'required_if' => ':attribute muss ausgefüllt sein wenn :other :value ist.', + 'required_with' => ':attribute muss angegeben werden wenn :values ausgefüllt wurde.', + 'required_with_all' => ':attribute muss ausgefüllt werden, wenn :values vorhanden ist.', + 'required_without' => ':attribute muss angegeben werden wenn :values nicht ausgefüllt wurde.', + 'required_without_all' => ':attribute muss angegeben werden wenn keines der Felder :values ausgefüllt wurde.', + 'same' => ':attribute und :other müssen übereinstimmen.', + 'size' => [ + 'numeric' => ':attribute muss gleich :size sein.', + 'file' => ':attribute muss :size Kilobyte groß sein.', + 'string' => ':attribute muss :size Zeichen lang sein.', + 'array' => ':attribute muss genau :size Elemente haben.', + ], + 'unique' => ':attribute ist schon vergeben.', + 'url' => 'Das Format von :attribute ist ungültig.', - "positive" => ":attribute muss größer als null sein.", - "has_credit" => "Der Kunde hat nicht genug Guthaben.", - "notmasked" => "Die Werte sind maskiert", - "less_than" => ':attribute muss weniger als :value sein', - "has_counter" => 'Der Wert muss {$counter} beinhalten', - "valid_contacts" => "Alle Kontakte müssen entweder einen Namen oder eine E-Mail Adresse haben", - "valid_invoice_items" => "Die Rechnung übersteigt den maximalen Betrag", + 'positive' => ':attribute muss größer als null sein.', + 'has_credit' => 'Der Kunde hat nicht genug Guthaben.', + 'notmasked' => 'Die Werte sind maskiert', + 'less_than' => ':attribute muss weniger als :value sein', + 'has_counter' => 'Der Wert muss {$counter} beinhalten', + 'valid_contacts' => 'Alle Kontakte müssen entweder einen Namen oder eine E-Mail Adresse haben', + 'valid_invoice_items' => 'Die Rechnung übersteigt den maximalen Betrag', /* |-------------------------------------------------------------------------- @@ -90,11 +90,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -107,6 +107,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/el/texts.php b/resources/lang/el/texts.php index 465513d6e0f0..ec6077e07990 100644 --- a/resources/lang/el/texts.php +++ b/resources/lang/el/texts.php @@ -1,6 +1,6 @@ 'Οργανισμός', 'name' => 'Επωνυμία', @@ -1016,7 +1016,6 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'trial_success' => 'Επιτυχής ενεργοποίηση δωρεάν δοκιμαστικής περιόδου δύο εβδομάδων στο επαγγελματικό πλάνο.', 'overdue' => 'Εκπρόθεσμος', - 'white_label_text' => 'Προμηθευτείτε μια ΕΤΗΣΙΑ άδεια χρήσης λευκής ετικέτας με $:price για να αφαιρέσετε το λογότυπο Ninja από το τιμολόγιο και το portal του πελάτη.', 'user_email_footer' => 'Για να προσαρμόσετε τις ρυθμίσεις ειδοποίησης μέσω email, παρακαλώ κάντε κλικ εδώ :link', 'reset_password_footer' => 'Αν δεν αιτηθήκατε αυτή την επαναφορά κωδικού πρόσβασης, παρακαλώ ενημερώστε την υποστήριξη στο :email', @@ -1196,7 +1195,6 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'enterprise_plan_features' => 'Το Εταιρικό πλάνο προσθέτει υποστήριξη για πολλαπλούς χρήστες και συνημμένα αρχεία, :link για να δείτε την πλήρη λίστα με τα χαρακτηριστικά.', 'return_to_app' => 'Επιστροφή στην Εφαρμοφή', - // Payment updates 'refund_payment' => 'Επιστροφή Πληρωμής', 'refund_max' => 'Μέγιστο:', @@ -1306,7 +1304,6 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'token_billing_braintree_paypal' => 'Αποθήκευση στοιχείων πληρωμής', 'add_paypal_account' => 'Προσθήκη Λογαριασμού PayPal', - 'no_payment_method_specified' => 'Δεν έχει οριστεί τρόπος πληρωμής', 'chart_type' => 'Τύπος Διαγράμματος', 'format' => 'Μορφή', @@ -2865,6 +2862,6 @@ email που είναι συνδεδεμένη με το λογαριασμό σ 'mobile_refresh_warning' => 'Εάν χρησιμοποιείτε την εφαρμογή κινητού ίσως χρειαστεί να κάνετε μία πλήρη ανανέωση.', 'enable_proposals_for_background' => 'Για να ανεβάσετε μια εικόνα φόντου :link για να ενεργοποιήσετε τη λειτουργική μονάδα προτάσεων.', -); +]; return $LANG; diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index e91870828307..b30cd4dc14ec 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1047,7 +1047,6 @@ return [ 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1228,7 +1227,6 @@ return [ 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1341,7 +1339,6 @@ return [ 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', diff --git a/resources/lang/en_GB/pagination.php b/resources/lang/en_GB/pagination.php index b573b51e9158..b9940a133ac2 100644 --- a/resources/lang/en_GB/pagination.php +++ b/resources/lang/en_GB/pagination.php @@ -1,6 +1,6 @@ 'Next »', -); +]; diff --git a/resources/lang/en_GB/passwords.php b/resources/lang/en_GB/passwords.php index 0e9f9bdaf519..7c10cba1a030 100644 --- a/resources/lang/en_GB/passwords.php +++ b/resources/lang/en_GB/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "Passwords must be at least six characters and match the confirmation.", - "user" => "We can't find a user with that e-mail address.", - "token" => "This password reset token is invalid.", - "sent" => "We have e-mailed your password reset link!", - "reset" => "Your password has been reset!", + 'password' => 'Passwords must be at least six characters and match the confirmation.', + 'user' => "We can't find a user with that e-mail address.", + 'token' => 'This password reset token is invalid.', + 'sent' => 'We have e-mailed your password reset link!', + 'reset' => 'Your password has been reset!', ]; diff --git a/resources/lang/en_GB/reminders.php b/resources/lang/en_GB/reminders.php index b35b56e9584e..627942480603 100644 --- a/resources/lang/en_GB/reminders.php +++ b/resources/lang/en_GB/reminders.php @@ -1,6 +1,6 @@ "Passwords must be at least six characters and match the confirmation.", + 'password' => 'Passwords must be at least six characters and match the confirmation.', - "user" => "We can't find a user with that e-mail address.", + 'user' => "We can't find a user with that e-mail address.", - "token" => "This password reset token is invalid.", + 'token' => 'This password reset token is invalid.', - "sent" => "Password reminder sent!", + 'sent' => 'Password reminder sent!', -); +]; diff --git a/resources/lang/en_GB/texts.php b/resources/lang/en_GB/texts.php index 9141fa078d51..e65373a070a8 100644 --- a/resources/lang/en_GB/texts.php +++ b/resources/lang/en_GB/texts.php @@ -1,6 +1,6 @@ 'Organization', 'name' => 'Name', @@ -1017,7 +1017,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1197,7 +1196,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1307,7 +1305,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2867,6 +2864,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/en_GB/validation.php b/resources/lang/en_GB/validation.php index 59f06ad7668a..7de753cbb4c1 100644 --- a/resources/lang/en_GB/validation.php +++ b/resources/lang/en_GB/validation.php @@ -1,6 +1,6 @@ "The :attribute must be accepted.", - "active_url" => "The :attribute is not a valid URL.", - "after" => "The :attribute must be a date after :date.", - "alpha" => "The :attribute may only contain letters.", - "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", - "alpha_num" => "The :attribute may only contain letters and numbers.", - "array" => "The :attribute must be an array.", - "before" => "The :attribute must be a date before :date.", - "between" => array( - "numeric" => "The :attribute must be between :min - :max.", - "file" => "The :attribute must be between :min - :max kilobytes.", - "string" => "The :attribute must be between :min - :max characters.", - "array" => "The :attribute must have between :min - :max items.", - ), - "confirmed" => "The :attribute confirmation does not match.", - "date" => "The :attribute is not a valid date.", - "date_format" => "The :attribute does not match the format :format.", - "different" => "The :attribute and :other must be different.", - "digits" => "The :attribute must be :digits digits.", - "digits_between" => "The :attribute must be between :min and :max digits.", - "email" => "The :attribute format is invalid.", - "exists" => "The selected :attribute is invalid.", - "image" => "The :attribute must be an image.", - "in" => "The selected :attribute is invalid.", - "integer" => "The :attribute must be an integer.", - "ip" => "The :attribute must be a valid IP address.", - "max" => array( - "numeric" => "The :attribute may not be greater than :max.", - "file" => "The :attribute may not be greater than :max kilobytes.", - "string" => "The :attribute may not be greater than :max characters.", - "array" => "The :attribute may not have more than :max items.", - ), - "mimes" => "The :attribute must be a file of type: :values.", - "min" => array( - "numeric" => "The :attribute must be at least :min.", - "file" => "The :attribute must be at least :min kilobytes.", - "string" => "The :attribute must be at least :min characters.", - "array" => "The :attribute must have at least :min items.", - ), - "not_in" => "The selected :attribute is invalid.", - "numeric" => "The :attribute must be a number.", - "regex" => "The :attribute format is invalid.", - "required" => "The :attribute field is required.", - "required_if" => "The :attribute field is required when :other is :value.", - "required_with" => "The :attribute field is required when :values is present.", - "required_without" => "The :attribute field is required when :values is not present.", - "same" => "The :attribute and :other must match.", - "size" => array( - "numeric" => "The :attribute must be :size.", - "file" => "The :attribute must be :size kilobytes.", - "string" => "The :attribute must be :size characters.", - "array" => "The :attribute must contain :size items.", - ), - "unique" => "The :attribute has already been taken.", - "url" => "The :attribute format is invalid.", + 'accepted' => 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'between' => [ + 'numeric' => 'The :attribute must be between :min - :max.', + 'file' => 'The :attribute must be between :min - :max kilobytes.', + 'string' => 'The :attribute must be between :min - :max characters.', + 'array' => 'The :attribute must have between :min - :max items.', + ], + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'email' => 'The :attribute format is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'max' => [ + 'numeric' => 'The :attribute may not be greater than :max.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', + ], + 'mimes' => 'The :attribute must be a file of type: :values.', + 'min' => [ + 'numeric' => 'The :attribute must be at least :min.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', + ], + 'not_in' => 'The selected :attribute is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'same' => 'The :attribute and :other must match.', + 'size' => [ + 'numeric' => 'The :attribute must be :size.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', + ], + 'unique' => 'The :attribute has already been taken.', + 'url' => 'The :attribute format is invalid.', - "positive" => "The :attribute must be greater than zero.", - "has_credit" => "The client does not have enough credit.", - "notmasked" => "The values are masked", - "less_than" => "The :attribute must be less than :value", - "has_counter" => "To ensure all invoice numbers are unique the pattern needs to contain either {\$counter} or {\$clientIdNumber} and {\$clientCounter}", - "valid_contacts" => "The contact must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", - "valid_subdomain" => "The subdomain is restricted", + 'positive' => 'The :attribute must be greater than zero.', + 'has_credit' => 'The client does not have enough credit.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'To ensure all invoice numbers are unique the pattern needs to contain either {$counter} or {$clientIdNumber} and {$clientCounter}', + 'valid_contacts' => 'The contact must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', + 'valid_subdomain' => 'The subdomain is restricted', /* |-------------------------------------------------------------------------- @@ -89,7 +89,7 @@ return array( | */ - 'custom' => array(), + 'custom' => [], /* |-------------------------------------------------------------------------- @@ -102,6 +102,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/es/pagination.php b/resources/lang/es/pagination.php index 9cbe91da3011..72a72392ab53 100644 --- a/resources/lang/es/pagination.php +++ b/resources/lang/es/pagination.php @@ -1,6 +1,6 @@ 'Siguiente »', -); +]; diff --git a/resources/lang/es/reminders.php b/resources/lang/es/reminders.php index 094e8788814b..cfa1c46b91e2 100644 --- a/resources/lang/es/reminders.php +++ b/resources/lang/es/reminders.php @@ -1,6 +1,6 @@ "Las contraseñas deben contener al menos 6 caracteres y coincidir.", + 'password' => 'Las contraseñas deben contener al menos 6 caracteres y coincidir.', - "user" => "No podemos encontrar a un usuario con ese correo electrónico.", + 'user' => 'No podemos encontrar a un usuario con ese correo electrónico.', - "token" => "Este token de recuperación de contraseña es inválido.", + 'token' => 'Este token de recuperación de contraseña es inválido.', - "sent" => "¡Recordatorio de contraseña enviado!", + 'sent' => '¡Recordatorio de contraseña enviado!', -); +]; diff --git a/resources/lang/es/texts.php b/resources/lang/es/texts.php index c93c1d795828..69186b3421ed 100644 --- a/resources/lang/es/texts.php +++ b/resources/lang/es/texts.php @@ -1,6 +1,6 @@ 'Empresa', 'name' => 'Nombre', @@ -1014,7 +1014,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'Para ajustar la configuración de las notificaciones de tu correo, visita :link', 'reset_password_footer' => 'Si no has solicitado un cambio de contraseña, por favor contactate con nosostros: :email', @@ -1194,7 +1193,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Regresar a la App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1304,7 +1302,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2863,6 +2860,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/es/validation.php b/resources/lang/es/validation.php index 2e2e55921911..9f2d392a85ed 100644 --- a/resources/lang/es/validation.php +++ b/resources/lang/es/validation.php @@ -1,6 +1,6 @@ ":attribute debe ser aceptado.", - "active_url" => ":attribute no es una URL válida.", - "after" => ":attribute debe ser una fecha posterior a :date.", - "alpha" => ":attribute solo debe contener letras.", - "alpha_dash" => ":attribute solo debe contener letras, números y guiones.", - "alpha_num" => ":attribute solo debe contener letras y números.", - "array" => ":attribute debe ser un conjunto.", - "before" => ":attribute debe ser una fecha anterior a :date.", - "between" => array( - "numeric" => ":attribute tiene que estar entre :min - :max.", - "file" => ":attribute debe pesar entre :min - :max kilobytes.", - "string" => ":attribute tiene que tener entre :min - :max caracteres.", - "array" => ":attribute tiene que tener entre :min - :max ítems.", - ), - "confirmed" => "La confirmación de :attribute no coincide.", - "date" => ":attribute no es una fecha válida.", - "date_format" => ":attribute no corresponde al formato :format.", - "different" => ":attribute y :other deben ser diferentes.", - "digits" => ":attribute debe tener :digits dígitos.", - "digits_between" => ":attribute debe tener entre :min y :max dígitos.", - "email" => ":attribute no es un correo válido", - "exists" => ":attribute es inválido.", - "image" => ":attribute debe ser una imagen.", - "in" => ":attribute es inválido.", - "integer" => ":attribute debe ser un número entero.", - "ip" => ":attribute debe ser una dirección IP válida.", - "max" => array( - "numeric" => ":attribute no debe ser mayor a :max.", - "file" => ":attribute no debe ser mayor que :max kilobytes.", - "string" => ":attribute no debe ser mayor que :max caracteres.", - "array" => ":attribute no debe tener más de :max elementos.", - ), - "mimes" => ":attribute debe ser un archivo con formato: :values.", - "min" => array( - "numeric" => "El tamaño de :attribute debe ser de al menos :min.", - "file" => "El tamaño de :attribute debe ser de al menos :min kilobytes.", - "string" => ":attribute debe contener al menos :min caracteres.", - "array" => ":attribute debe tener al menos :min elementos.", - ), - "not_in" => ":attribute es inválido.", - "numeric" => ":attribute debe ser numérico.", - "regex" => "El formato de :attribute es inválido.", - "required" => "El campo :attribute es obligatorio.", - "required_if" => "El campo :attribute es obligatorio cuando :other es :value.", - "required_with" => "El campo :attribute es obligatorio cuando :values está presente.", - "required_with_all" => "The :attribute field is required when :values is present.", - "required_without" => "El campo :attribute es obligatorio cuando :values no está presente.", - "required_without_all" => "The :attribute field is required when none of :values are present.", - "same" => ":attribute y :other deben coincidir.", - "size" => array( - "numeric" => "El tamaño de :attribute debe ser :size.", - "file" => "El tamaño de :attribute debe ser :size kilobytes.", - "string" => ":attribute debe contener :size caracteres.", - "array" => ":attribute debe contener :size elementos.", - ), - "unique" => ":attribute ya ha sido registrado.", - "url" => "El formato :attribute es inválido.", - "positive" => ":attribute debe ser mayor que cero.", - "has_credit" => "el cliente no tiene crédito suficiente.", - "notmasked" => "The values are masked", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'accepted' => ':attribute debe ser aceptado.', + 'active_url' => ':attribute no es una URL válida.', + 'after' => ':attribute debe ser una fecha posterior a :date.', + 'alpha' => ':attribute solo debe contener letras.', + 'alpha_dash' => ':attribute solo debe contener letras, números y guiones.', + 'alpha_num' => ':attribute solo debe contener letras y números.', + 'array' => ':attribute debe ser un conjunto.', + 'before' => ':attribute debe ser una fecha anterior a :date.', + 'between' => [ + 'numeric' => ':attribute tiene que estar entre :min - :max.', + 'file' => ':attribute debe pesar entre :min - :max kilobytes.', + 'string' => ':attribute tiene que tener entre :min - :max caracteres.', + 'array' => ':attribute tiene que tener entre :min - :max ítems.', + ], + 'confirmed' => 'La confirmación de :attribute no coincide.', + 'date' => ':attribute no es una fecha válida.', + 'date_format' => ':attribute no corresponde al formato :format.', + 'different' => ':attribute y :other deben ser diferentes.', + 'digits' => ':attribute debe tener :digits dígitos.', + 'digits_between' => ':attribute debe tener entre :min y :max dígitos.', + 'email' => ':attribute no es un correo válido', + 'exists' => ':attribute es inválido.', + 'image' => ':attribute debe ser una imagen.', + 'in' => ':attribute es inválido.', + 'integer' => ':attribute debe ser un número entero.', + 'ip' => ':attribute debe ser una dirección IP válida.', + 'max' => [ + 'numeric' => ':attribute no debe ser mayor a :max.', + 'file' => ':attribute no debe ser mayor que :max kilobytes.', + 'string' => ':attribute no debe ser mayor que :max caracteres.', + 'array' => ':attribute no debe tener más de :max elementos.', + ], + 'mimes' => ':attribute debe ser un archivo con formato: :values.', + 'min' => [ + 'numeric' => 'El tamaño de :attribute debe ser de al menos :min.', + 'file' => 'El tamaño de :attribute debe ser de al menos :min kilobytes.', + 'string' => ':attribute debe contener al menos :min caracteres.', + 'array' => ':attribute debe tener al menos :min elementos.', + ], + 'not_in' => ':attribute es inválido.', + 'numeric' => ':attribute debe ser numérico.', + 'regex' => 'El formato de :attribute es inválido.', + 'required' => 'El campo :attribute es obligatorio.', + 'required_if' => 'El campo :attribute es obligatorio cuando :other es :value.', + 'required_with' => 'El campo :attribute es obligatorio cuando :values está presente.', + 'required_with_all' => 'The :attribute field is required when :values is present.', + 'required_without' => 'El campo :attribute es obligatorio cuando :values no está presente.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => ':attribute y :other deben coincidir.', + 'size' => [ + 'numeric' => 'El tamaño de :attribute debe ser :size.', + 'file' => 'El tamaño de :attribute debe ser :size kilobytes.', + 'string' => ':attribute debe contener :size caracteres.', + 'array' => ':attribute debe contener :size elementos.', + ], + 'unique' => ':attribute ya ha sido registrado.', + 'url' => 'El formato :attribute es inválido.', + 'positive' => ':attribute debe ser mayor que cero.', + 'has_credit' => 'el cliente no tiene crédito suficiente.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -89,11 +89,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -106,6 +106,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/es_ES/pagination.php b/resources/lang/es_ES/pagination.php index 9cbe91da3011..72a72392ab53 100644 --- a/resources/lang/es_ES/pagination.php +++ b/resources/lang/es_ES/pagination.php @@ -1,6 +1,6 @@ 'Siguiente »', -); +]; diff --git a/resources/lang/es_ES/reminders.php b/resources/lang/es_ES/reminders.php index 094e8788814b..cfa1c46b91e2 100644 --- a/resources/lang/es_ES/reminders.php +++ b/resources/lang/es_ES/reminders.php @@ -1,6 +1,6 @@ "Las contraseñas deben contener al menos 6 caracteres y coincidir.", + 'password' => 'Las contraseñas deben contener al menos 6 caracteres y coincidir.', - "user" => "No podemos encontrar a un usuario con ese correo electrónico.", + 'user' => 'No podemos encontrar a un usuario con ese correo electrónico.', - "token" => "Este token de recuperación de contraseña es inválido.", + 'token' => 'Este token de recuperación de contraseña es inválido.', - "sent" => "¡Recordatorio de contraseña enviado!", + 'sent' => '¡Recordatorio de contraseña enviado!', -); +]; diff --git a/resources/lang/es_ES/texts.php b/resources/lang/es_ES/texts.php index bdd4fabfde3c..2fe2c0e86d63 100644 --- a/resources/lang/es_ES/texts.php +++ b/resources/lang/es_ES/texts.php @@ -1,6 +1,6 @@ 'Empresa', 'name' => 'Nombre', @@ -1006,7 +1006,6 @@ $LANG = array( 'trial_success' => 'Habilitado correctamente el periodo de dos semanas de prueba Pro ', 'overdue' => 'Atraso', - 'white_label_text' => 'Compra UN AÑO de Licencia de Marca Blanca por $:price y elimina la marca Invoice Ninja de la Factura y del Portal de Cliente.', 'user_email_footer' => 'Para ajustar la configuración de las notificaciones de tu email, visita :link', 'reset_password_footer' => 'Si no has solicitado un cambio de contraseña, por favor contactate con nosostros: :email', @@ -1186,7 +1185,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Regresar a la Applicacion', - // Payment updates 'refund_payment' => 'Reembolsar Pago', 'refund_max' => 'Max:', @@ -1296,7 +1294,6 @@ Una vez que tenga los montos, vuelva a esta página de métodos de pago y haga c 'token_billing_braintree_paypal' => 'Guardar detalles de pago', 'add_paypal_account' => 'Añadir Cuenta de PayPal ', - 'no_payment_method_specified' => 'Metodo de pago no especificado', 'chart_type' => 'Tipo de Grafica', 'format' => 'Formato', @@ -2855,6 +2852,6 @@ Una vez que tenga los montos, vuelva a esta página de métodos de pago y haga c 'mobile_refresh_warning' => 'Si estás usando la app móvil necesitarás hacer un refresco completo.', 'enable_proposals_for_background' => 'Para subir una imagen de fondo :link para activar el módulo de propuestas.', -); +]; return $LANG; diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php index 2e2e55921911..9f2d392a85ed 100644 --- a/resources/lang/es_ES/validation.php +++ b/resources/lang/es_ES/validation.php @@ -1,6 +1,6 @@ ":attribute debe ser aceptado.", - "active_url" => ":attribute no es una URL válida.", - "after" => ":attribute debe ser una fecha posterior a :date.", - "alpha" => ":attribute solo debe contener letras.", - "alpha_dash" => ":attribute solo debe contener letras, números y guiones.", - "alpha_num" => ":attribute solo debe contener letras y números.", - "array" => ":attribute debe ser un conjunto.", - "before" => ":attribute debe ser una fecha anterior a :date.", - "between" => array( - "numeric" => ":attribute tiene que estar entre :min - :max.", - "file" => ":attribute debe pesar entre :min - :max kilobytes.", - "string" => ":attribute tiene que tener entre :min - :max caracteres.", - "array" => ":attribute tiene que tener entre :min - :max ítems.", - ), - "confirmed" => "La confirmación de :attribute no coincide.", - "date" => ":attribute no es una fecha válida.", - "date_format" => ":attribute no corresponde al formato :format.", - "different" => ":attribute y :other deben ser diferentes.", - "digits" => ":attribute debe tener :digits dígitos.", - "digits_between" => ":attribute debe tener entre :min y :max dígitos.", - "email" => ":attribute no es un correo válido", - "exists" => ":attribute es inválido.", - "image" => ":attribute debe ser una imagen.", - "in" => ":attribute es inválido.", - "integer" => ":attribute debe ser un número entero.", - "ip" => ":attribute debe ser una dirección IP válida.", - "max" => array( - "numeric" => ":attribute no debe ser mayor a :max.", - "file" => ":attribute no debe ser mayor que :max kilobytes.", - "string" => ":attribute no debe ser mayor que :max caracteres.", - "array" => ":attribute no debe tener más de :max elementos.", - ), - "mimes" => ":attribute debe ser un archivo con formato: :values.", - "min" => array( - "numeric" => "El tamaño de :attribute debe ser de al menos :min.", - "file" => "El tamaño de :attribute debe ser de al menos :min kilobytes.", - "string" => ":attribute debe contener al menos :min caracteres.", - "array" => ":attribute debe tener al menos :min elementos.", - ), - "not_in" => ":attribute es inválido.", - "numeric" => ":attribute debe ser numérico.", - "regex" => "El formato de :attribute es inválido.", - "required" => "El campo :attribute es obligatorio.", - "required_if" => "El campo :attribute es obligatorio cuando :other es :value.", - "required_with" => "El campo :attribute es obligatorio cuando :values está presente.", - "required_with_all" => "The :attribute field is required when :values is present.", - "required_without" => "El campo :attribute es obligatorio cuando :values no está presente.", - "required_without_all" => "The :attribute field is required when none of :values are present.", - "same" => ":attribute y :other deben coincidir.", - "size" => array( - "numeric" => "El tamaño de :attribute debe ser :size.", - "file" => "El tamaño de :attribute debe ser :size kilobytes.", - "string" => ":attribute debe contener :size caracteres.", - "array" => ":attribute debe contener :size elementos.", - ), - "unique" => ":attribute ya ha sido registrado.", - "url" => "El formato :attribute es inválido.", - "positive" => ":attribute debe ser mayor que cero.", - "has_credit" => "el cliente no tiene crédito suficiente.", - "notmasked" => "The values are masked", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'accepted' => ':attribute debe ser aceptado.', + 'active_url' => ':attribute no es una URL válida.', + 'after' => ':attribute debe ser una fecha posterior a :date.', + 'alpha' => ':attribute solo debe contener letras.', + 'alpha_dash' => ':attribute solo debe contener letras, números y guiones.', + 'alpha_num' => ':attribute solo debe contener letras y números.', + 'array' => ':attribute debe ser un conjunto.', + 'before' => ':attribute debe ser una fecha anterior a :date.', + 'between' => [ + 'numeric' => ':attribute tiene que estar entre :min - :max.', + 'file' => ':attribute debe pesar entre :min - :max kilobytes.', + 'string' => ':attribute tiene que tener entre :min - :max caracteres.', + 'array' => ':attribute tiene que tener entre :min - :max ítems.', + ], + 'confirmed' => 'La confirmación de :attribute no coincide.', + 'date' => ':attribute no es una fecha válida.', + 'date_format' => ':attribute no corresponde al formato :format.', + 'different' => ':attribute y :other deben ser diferentes.', + 'digits' => ':attribute debe tener :digits dígitos.', + 'digits_between' => ':attribute debe tener entre :min y :max dígitos.', + 'email' => ':attribute no es un correo válido', + 'exists' => ':attribute es inválido.', + 'image' => ':attribute debe ser una imagen.', + 'in' => ':attribute es inválido.', + 'integer' => ':attribute debe ser un número entero.', + 'ip' => ':attribute debe ser una dirección IP válida.', + 'max' => [ + 'numeric' => ':attribute no debe ser mayor a :max.', + 'file' => ':attribute no debe ser mayor que :max kilobytes.', + 'string' => ':attribute no debe ser mayor que :max caracteres.', + 'array' => ':attribute no debe tener más de :max elementos.', + ], + 'mimes' => ':attribute debe ser un archivo con formato: :values.', + 'min' => [ + 'numeric' => 'El tamaño de :attribute debe ser de al menos :min.', + 'file' => 'El tamaño de :attribute debe ser de al menos :min kilobytes.', + 'string' => ':attribute debe contener al menos :min caracteres.', + 'array' => ':attribute debe tener al menos :min elementos.', + ], + 'not_in' => ':attribute es inválido.', + 'numeric' => ':attribute debe ser numérico.', + 'regex' => 'El formato de :attribute es inválido.', + 'required' => 'El campo :attribute es obligatorio.', + 'required_if' => 'El campo :attribute es obligatorio cuando :other es :value.', + 'required_with' => 'El campo :attribute es obligatorio cuando :values está presente.', + 'required_with_all' => 'The :attribute field is required when :values is present.', + 'required_without' => 'El campo :attribute es obligatorio cuando :values no está presente.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => ':attribute y :other deben coincidir.', + 'size' => [ + 'numeric' => 'El tamaño de :attribute debe ser :size.', + 'file' => 'El tamaño de :attribute debe ser :size kilobytes.', + 'string' => ':attribute debe contener :size caracteres.', + 'array' => ':attribute debe contener :size elementos.', + ], + 'unique' => ':attribute ya ha sido registrado.', + 'url' => 'El formato :attribute es inválido.', + 'positive' => ':attribute debe ser mayor que cero.', + 'has_credit' => 'el cliente no tiene crédito suficiente.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -89,11 +89,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -106,6 +106,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/fi/texts.php b/resources/lang/fi/texts.php index e5e9be198627..b7bda7449b5e 100644 --- a/resources/lang/fi/texts.php +++ b/resources/lang/fi/texts.php @@ -1,6 +1,6 @@ 'Yritys', 'name' => 'Nimi', @@ -1018,7 +1018,6 @@ Lasku poistettiin (if only one, alternative)', 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1198,7 +1197,6 @@ Lasku poistettiin (if only one, alternative)', 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1308,7 +1306,6 @@ Lasku poistettiin (if only one, alternative)', 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2867,6 +2864,6 @@ Lasku poistettiin (if only one, alternative)', 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/fr/pagination.php b/resources/lang/fr/pagination.php index 76976c0ef428..a564b040cb79 100644 --- a/resources/lang/fr/pagination.php +++ b/resources/lang/fr/pagination.php @@ -1,6 +1,6 @@ 'Suivant »', -); +]; diff --git a/resources/lang/fr/reminders.php b/resources/lang/fr/reminders.php index 69cdcdafb273..5ece416a42ba 100644 --- a/resources/lang/fr/reminders.php +++ b/resources/lang/fr/reminders.php @@ -1,6 +1,6 @@ "Les mots de passe doivent avoir au moins six caractères et doivent être identiques.", + 'password' => 'Les mots de passe doivent avoir au moins six caractères et doivent être identiques.', - "user" => "Nous ne pouvons trouver cet utilisateur avec cette adresse e-mail.", + 'user' => 'Nous ne pouvons trouver cet utilisateur avec cette adresse e-mail.', - "token" => "Ce jeton de réinitialisation du mot de passe n'est pas valide.", + 'token' => "Ce jeton de réinitialisation du mot de passe n'est pas valide.", - "sent" => "Rappel du mot de passe envoyé !", + 'sent' => 'Rappel du mot de passe envoyé !', -); +]; diff --git a/resources/lang/fr/texts.php b/resources/lang/fr/texts.php index a9f560f7df51..eb5c6454105e 100644 --- a/resources/lang/fr/texts.php +++ b/resources/lang/fr/texts.php @@ -1,6 +1,6 @@ 'Entreprise', 'name' => 'Nom', @@ -1010,7 +1010,6 @@ $LANG = array( 'trial_success' => 'Crédit d\'un essai gratuit de 2 semaines de notre Plan pro avec succès', 'overdue' => 'Impayé', - 'white_label_text' => 'Achetez une licence en marque blanche d\'UN AN au coût de $:price pour retirer la marque de Invoice Ninja des factures et du portail client.', 'user_email_footer' => 'Pour modifier vos paramètres de notification par courriel, veuillez visiter :link', 'reset_password_footer' => 'Si vous n\'avez pas effectué de demande de réinitalisation de mot de passe veuillez contacter notre support : :email', @@ -1190,7 +1189,6 @@ $LANG = array( 'enterprise_plan_features' => 'Le plan entreprise ajoute le support pour de multiples utilisateurs ainsi que l\'ajout de pièces jointes, :link pour voir la liste complète des fonctionnalités.', 'return_to_app' => 'Retourner à l\'App', - // Payment updates 'refund_payment' => 'Remboursement du paiement', 'refund_max' => 'Max :', @@ -1300,7 +1298,6 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'token_billing_braintree_paypal' => 'Sauvegarder les détails du paiement', 'add_paypal_account' => 'Ajouter un compte PayPal', - 'no_payment_method_specified' => 'Aucune méthode de paiement spécifiée', 'chart_type' => 'Type de graphique', 'format' => 'Format', @@ -2859,6 +2856,6 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index 3ca6271f5790..a6ce31da3cdc 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -1,6 +1,6 @@ "Le champ :attribute doit être accepté.", - "active_url" => "Le champ :attribute n'est pas une URL valide.", - "after" => "Le champ :attribute doit être une date postérieure au :date.", - "alpha" => "Le champ :attribute doit seulement contenir des lettres.", - "alpha_dash" => "Le champ :attribute doit seulement contenir des lettres, des chiffres et des tirets.", - "alpha_num" => "Le champ :attribute doit seulement contenir des chiffres et des lettres.", - "array" => "Le champ :attribute doit être un tableau.", - "before" => "Le champ :attribute doit être une date antérieure au :date.", - "between" => array( - "numeric" => "La valeur de :attribute doit être comprise entre :min et :max.", - "file" => "Le fichier :attribute doit avoir une taille entre :min et :max kilobytes.", - "string" => "Le texte :attribute doit avoir entre :min et :max caractères.", - "array" => "Le champ :attribute doit avoir entre :min et :max éléments.", - ), - "confirmed" => "Le champ de confirmation :attribute ne correspond pas.", - "date" => "Le champ :attribute n'est pas une date valide.", - "date_format" => "Le champ :attribute ne correspond pas au format :format.", - "different" => "Les champs :attribute et :other doivent être différents.", - "digits" => "Le champ :attribute doit avoir :digits chiffres.", - "digits_between" => "Le champ :attribute doit avoir entre :min and :max chiffres.", - "email" => "Le champ :attribute doit être une adresse email valide.", - "exists" => "Le champ :attribute sélectionné est invalide.", - "image" => "Le champ :attribute doit être une image.", - "in" => "Le champ :attribute est invalide.", - "integer" => "Le champ :attribute doit être un entier.", - "ip" => "Le champ :attribute doit être une adresse IP valide.", - "max" => array( - "numeric" => "La valeur de :attribute ne peut être supérieure à :max.", - "file" => "Le fichier :attribute ne peut être plus gros que :max kilobytes.", - "string" => "Le texte de :attribute ne peut contenir plus de :max caractères.", - "array" => "Le champ :attribute ne peut avoir plus de :max éléments.", - ), - "mimes" => "Le champ :attribute doit être un fichier de type : :values.", - "min" => array( - "numeric" => "La valeur de :attribute doit être supérieure à :min.", - "file" => "Le fichier :attribute doit être plus que gros que :min kilobytes.", - "string" => "Le texte :attribute doit contenir au moins :min caractères.", - "array" => "Le champ :attribute doit avoir au moins :min éléments.", - ), - "not_in" => "Le champ :attribute sélectionné n'est pas valide.", - "numeric" => "Le champ :attribute doit contenir un nombre.", - "regex" => "Le format du champ :attribute est invalide.", - "required" => "Le champ :attribute est obligatoire.", - "required_if" => "Le champ :attribute est obligatoire quand la valeur de :other est :value.", - "required_with" => "Le champ :attribute est obligatoire quand :values est présent.", - "required_with_all" => "Le champ :attribute est obligatoire quand :values est présent.", - "required_without" => "Le champ :attribute est obligatoire quand :values n'est pas présent.", - "required_without_all" => "Le champ :attribute est requis quand aucun de :values n'est présent.", - "same" => "Les champs :attribute et :other doivent être identiques.", - "size" => array( - "numeric" => "La valeur de :attribute doit être :size.", - "file" => "La taille du fichier de :attribute doit être de :size kilobytes.", - "string" => "Le texte de :attribute doit contenir :size caractères.", - "array" => "Le champ :attribute doit contenir :size éléments.", - ), - "unique" => "La valeur du champ :attribute est déjà utilisée.", - "url" => "Le format de l'URL de :attribute n'est pas valide.", + 'accepted' => 'Le champ :attribute doit être accepté.', + 'active_url' => "Le champ :attribute n'est pas une URL valide.", + 'after' => 'Le champ :attribute doit être une date postérieure au :date.', + 'alpha' => 'Le champ :attribute doit seulement contenir des lettres.', + 'alpha_dash' => 'Le champ :attribute doit seulement contenir des lettres, des chiffres et des tirets.', + 'alpha_num' => 'Le champ :attribute doit seulement contenir des chiffres et des lettres.', + 'array' => 'Le champ :attribute doit être un tableau.', + 'before' => 'Le champ :attribute doit être une date antérieure au :date.', + 'between' => [ + 'numeric' => 'La valeur de :attribute doit être comprise entre :min et :max.', + 'file' => 'Le fichier :attribute doit avoir une taille entre :min et :max kilobytes.', + 'string' => 'Le texte :attribute doit avoir entre :min et :max caractères.', + 'array' => 'Le champ :attribute doit avoir entre :min et :max éléments.', + ], + 'confirmed' => 'Le champ de confirmation :attribute ne correspond pas.', + 'date' => "Le champ :attribute n'est pas une date valide.", + 'date_format' => 'Le champ :attribute ne correspond pas au format :format.', + 'different' => 'Les champs :attribute et :other doivent être différents.', + 'digits' => 'Le champ :attribute doit avoir :digits chiffres.', + 'digits_between' => 'Le champ :attribute doit avoir entre :min and :max chiffres.', + 'email' => 'Le champ :attribute doit être une adresse email valide.', + 'exists' => 'Le champ :attribute sélectionné est invalide.', + 'image' => 'Le champ :attribute doit être une image.', + 'in' => 'Le champ :attribute est invalide.', + 'integer' => 'Le champ :attribute doit être un entier.', + 'ip' => 'Le champ :attribute doit être une adresse IP valide.', + 'max' => [ + 'numeric' => 'La valeur de :attribute ne peut être supérieure à :max.', + 'file' => 'Le fichier :attribute ne peut être plus gros que :max kilobytes.', + 'string' => 'Le texte de :attribute ne peut contenir plus de :max caractères.', + 'array' => 'Le champ :attribute ne peut avoir plus de :max éléments.', + ], + 'mimes' => 'Le champ :attribute doit être un fichier de type : :values.', + 'min' => [ + 'numeric' => 'La valeur de :attribute doit être supérieure à :min.', + 'file' => 'Le fichier :attribute doit être plus que gros que :min kilobytes.', + 'string' => 'Le texte :attribute doit contenir au moins :min caractères.', + 'array' => 'Le champ :attribute doit avoir au moins :min éléments.', + ], + 'not_in' => "Le champ :attribute sélectionné n'est pas valide.", + 'numeric' => 'Le champ :attribute doit contenir un nombre.', + 'regex' => 'Le format du champ :attribute est invalide.', + 'required' => 'Le champ :attribute est obligatoire.', + 'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.', + 'required_with' => 'Le champ :attribute est obligatoire quand :values est présent.', + 'required_with_all' => 'Le champ :attribute est obligatoire quand :values est présent.', + 'required_without' => "Le champ :attribute est obligatoire quand :values n'est pas présent.", + 'required_without_all' => "Le champ :attribute est requis quand aucun de :values n'est présent.", + 'same' => 'Les champs :attribute et :other doivent être identiques.', + 'size' => [ + 'numeric' => 'La valeur de :attribute doit être :size.', + 'file' => 'La taille du fichier de :attribute doit être de :size kilobytes.', + 'string' => 'Le texte de :attribute doit contenir :size caractères.', + 'array' => 'Le champ :attribute doit contenir :size éléments.', + ], + 'unique' => 'La valeur du champ :attribute est déjà utilisée.', + 'url' => "Le format de l'URL de :attribute n'est pas valide.", - "positive" => "The :attribute must be greater than zero.", - "has_credit" => "The client does not have enough credit.", - "notmasked" => "The values are masked", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'positive' => 'The :attribute must be greater than zero.', + 'has_credit' => 'The client does not have enough credit.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -90,11 +90,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -107,36 +107,36 @@ return array( | */ - 'attributes' => array( - "name" => "Nom", - "username" => "Pseudo", - "email" => "E-mail", - "first_name" => "Prénom", - "last_name" => "Nom", - "password" => "Mot de passe", - "password_confirmation" => "Confirmation du mot de passe", - "city" => "Ville", - "country" => "Pays", - "address" => "Adresse", - "phone" => "Téléphone", - "mobile" => "Portable", - "age" => "Age", - "sex" => "Sexe", - "gender" => "Genre", - "day" => "Jour", - "month" => "Mois", - "year" => "Année", - "hour" => "Heure", - "minute" => "Minute", - "second" => "Seconde", - "title" => "Titre", - "content" => "Contenu", - "description" => "Description", - "excerpt" => "Extrait", - "date" => "Date", - "time" => "Heure", - "available" => "Disponible", - "size" => "Taille", - ), + 'attributes' => [ + 'name' => 'Nom', + 'username' => 'Pseudo', + 'email' => 'E-mail', + 'first_name' => 'Prénom', + 'last_name' => 'Nom', + 'password' => 'Mot de passe', + 'password_confirmation' => 'Confirmation du mot de passe', + 'city' => 'Ville', + 'country' => 'Pays', + 'address' => 'Adresse', + 'phone' => 'Téléphone', + 'mobile' => 'Portable', + 'age' => 'Age', + 'sex' => 'Sexe', + 'gender' => 'Genre', + 'day' => 'Jour', + 'month' => 'Mois', + 'year' => 'Année', + 'hour' => 'Heure', + 'minute' => 'Minute', + 'second' => 'Seconde', + 'title' => 'Titre', + 'content' => 'Contenu', + 'description' => 'Description', + 'excerpt' => 'Extrait', + 'date' => 'Date', + 'time' => 'Heure', + 'available' => 'Disponible', + 'size' => 'Taille', + ], -); +]; diff --git a/resources/lang/fr_CA/pagination.php b/resources/lang/fr_CA/pagination.php index 76976c0ef428..a564b040cb79 100644 --- a/resources/lang/fr_CA/pagination.php +++ b/resources/lang/fr_CA/pagination.php @@ -1,6 +1,6 @@ 'Suivant »', -); +]; diff --git a/resources/lang/fr_CA/reminders.php b/resources/lang/fr_CA/reminders.php index cbc4a09123a2..f50b26f2ed25 100644 --- a/resources/lang/fr_CA/reminders.php +++ b/resources/lang/fr_CA/reminders.php @@ -1,6 +1,6 @@ "Les mots de passe doivent avoir au moins six caractères et doivent être identiques.", + 'password' => 'Les mots de passe doivent avoir au moins six caractères et doivent être identiques.', - "user" => "Nous ne pouvons trouver cet utilisateur avec cette adresse courriel.", + 'user' => 'Nous ne pouvons trouver cet utilisateur avec cette adresse courriel.', - "token" => "Ce jeton de réinitialisation du mot de passe n'est pas valide.", + 'token' => "Ce jeton de réinitialisation du mot de passe n'est pas valide.", - "sent" => "Rappel du mot de passe envoyé !", + 'sent' => 'Rappel du mot de passe envoyé !', -); +]; diff --git a/resources/lang/fr_CA/texts.php b/resources/lang/fr_CA/texts.php index 3a4754eac8aa..a58b61a9278c 100644 --- a/resources/lang/fr_CA/texts.php +++ b/resources/lang/fr_CA/texts.php @@ -1,6 +1,6 @@ 'Entreprise', 'name' => 'Nom', @@ -1007,7 +1007,6 @@ $LANG = array( 'trial_success' => 'Le Plan Pro, version d\'essai gratuit pour 2 semaines a été activé', 'overdue' => 'En souffrance', - 'white_label_text' => 'Achetez une licence sans pub d\'UN AN au coût de $:price pour retirer la marque de Invoice Ninja des factures et du portail client.', 'user_email_footer' => 'Pour modifier vos paramètres de notification par courriel, veuillez visiter :link', 'reset_password_footer' => 'Si vous n\'avez pas effectué de demande de réinitalisation de mot de passe veuillez contacter notre support : :email', @@ -1187,7 +1186,6 @@ $LANG = array( 'enterprise_plan_features' => 'Le Plan entreprise offre le support pour de multiple utilisateurs ainsi que l\'ajout de pièces jointes, :link pour voir la liste complète des fonctionnalités.', 'return_to_app' => 'Retour à l\'app', - // Payment updates 'refund_payment' => 'Remboursement', 'refund_max' => 'Max:', @@ -1297,7 +1295,6 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'token_billing_braintree_paypal' => 'Sauvegarder les détails du paiement', 'add_paypal_account' => 'Ajouter un compte PayPal', - 'no_payment_method_specified' => 'Aucune méthode de paiement spécifiée', 'chart_type' => 'Type de graphique', 'format' => 'Format', @@ -2857,6 +2854,6 @@ Lorsque les montant apparaîtront sur votre relevé, veuillez revenir sur cette 'mobile_refresh_warning' => 'Si vous utilisez l\'app mobile, vous devez faire une actualisation complète.', 'enable_proposals_for_background' => 'Pour téléverser une image de fond :link pour activer le module de propositions.', -); +]; return $LANG; diff --git a/resources/lang/fr_CA/validation.php b/resources/lang/fr_CA/validation.php index ff2ffb19a377..7953962fc5e0 100644 --- a/resources/lang/fr_CA/validation.php +++ b/resources/lang/fr_CA/validation.php @@ -1,6 +1,6 @@ "Le champ :attribute doit être accepté.", - "active_url" => "Le champ :attribute n'est pas une URL valide.", - "after" => "Le champ :attribute doit être une date postérieure au :date.", - "alpha" => "Le champ :attribute doit seulement contenir des lettres.", - "alpha_dash" => "Le champ :attribute doit seulement contenir des lettres, des chiffres et des tirets.", - "alpha_num" => "Le champ :attribute doit seulement contenir des chiffres et des lettres.", - "array" => "Le champ :attribute doit être un tableau.", - "before" => "Le champ :attribute doit être une date antérieure au :date.", - "between" => array( - "numeric" => "La valeur de :attribute doit être comprise entre :min et :max.", - "file" => "Le fichier :attribute doit avoir une taille entre :min et :max kilobytes.", - "string" => "Le texte :attribute doit avoir entre :min et :max caractères.", - "array" => "Le champ :attribute doit avoir entre :min et :max éléments.", - ), - "confirmed" => "Le champ de confirmation :attribute ne correspond pas.", - "date" => "Le champ :attribute n'est pas une date valide.", - "date_format" => "Le champ :attribute ne correspond pas au format :format.", - "different" => "Les champs :attribute et :other doivent être différents.", - "digits" => "Le champ :attribute doit avoir :digits chiffres.", - "digits_between" => "Le champ :attribute doit avoir entre :min and :max chiffres.", - "email" => "Le champ :attribute doit être une adresse email valide.", - "exists" => "Le champ :attribute sélectionné est invalide.", - "image" => "Le champ :attribute doit être une image.", - "in" => "Le champ :attribute est invalide.", - "integer" => "Le champ :attribute doit être un entier.", - "ip" => "Le champ :attribute doit être une adresse IP valide.", - "max" => array( - "numeric" => "La valeur de :attribute ne peut être supérieure à :max.", - "file" => "Le fichier :attribute ne peut être plus gros que :max kilobytes.", - "string" => "Le texte de :attribute ne peut contenir plus de :max caractères.", - "array" => "Le champ :attribute ne peut avoir plus de :max éléments.", - ), - "mimes" => "Le champ :attribute doit être un fichier de type : :values.", - "min" => array( - "numeric" => "La valeur de :attribute doit être supérieure à :min.", - "file" => "Le fichier :attribute doit être plus que gros que :min kilobytes.", - "string" => "Le texte :attribute doit contenir au moins :min caractères.", - "array" => "Le champ :attribute doit avoir au moins :min éléments.", - ), - "not_in" => "Le champ :attribute sélectionné n'est pas valide.", - "numeric" => "Le champ :attribute doit contenir un nombre.", - "regex" => "Le format du champ :attribute est invalide.", - "required" => "Le champ :attribute est obligatoire.", - "required_if" => "Le champ :attribute est obligatoire quand la valeur de :other est :value.", - "required_with" => "Le champ :attribute est obligatoire quand :values est présent.", - "required_with_all" => "Le champ :attribute est obligatoire quand :values est présent.", - "required_without" => "Le champ :attribute est obligatoire quand :values n'est pas présent.", - "required_without_all" => "Le champ :attribute est requis quand aucun de :values n'est présent.", - "same" => "Les champs :attribute et :other doivent être identiques.", - "size" => array( - "numeric" => "La valeur de :attribute doit être :size.", - "file" => "La taille du fichier de :attribute doit être de :size kilobytes.", - "string" => "Le texte de :attribute doit contenir :size caractères.", - "array" => "Le champ :attribute doit contenir :size éléments.", - ), - "unique" => "La valeur du champ :attribute est déjà utilisée.", - "url" => "Le format de l'URL de :attribute n'est pas valide.", + 'accepted' => 'Le champ :attribute doit être accepté.', + 'active_url' => "Le champ :attribute n'est pas une URL valide.", + 'after' => 'Le champ :attribute doit être une date postérieure au :date.', + 'alpha' => 'Le champ :attribute doit seulement contenir des lettres.', + 'alpha_dash' => 'Le champ :attribute doit seulement contenir des lettres, des chiffres et des tirets.', + 'alpha_num' => 'Le champ :attribute doit seulement contenir des chiffres et des lettres.', + 'array' => 'Le champ :attribute doit être un tableau.', + 'before' => 'Le champ :attribute doit être une date antérieure au :date.', + 'between' => [ + 'numeric' => 'La valeur de :attribute doit être comprise entre :min et :max.', + 'file' => 'Le fichier :attribute doit avoir une taille entre :min et :max kilobytes.', + 'string' => 'Le texte :attribute doit avoir entre :min et :max caractères.', + 'array' => 'Le champ :attribute doit avoir entre :min et :max éléments.', + ], + 'confirmed' => 'Le champ de confirmation :attribute ne correspond pas.', + 'date' => "Le champ :attribute n'est pas une date valide.", + 'date_format' => 'Le champ :attribute ne correspond pas au format :format.', + 'different' => 'Les champs :attribute et :other doivent être différents.', + 'digits' => 'Le champ :attribute doit avoir :digits chiffres.', + 'digits_between' => 'Le champ :attribute doit avoir entre :min and :max chiffres.', + 'email' => 'Le champ :attribute doit être une adresse email valide.', + 'exists' => 'Le champ :attribute sélectionné est invalide.', + 'image' => 'Le champ :attribute doit être une image.', + 'in' => 'Le champ :attribute est invalide.', + 'integer' => 'Le champ :attribute doit être un entier.', + 'ip' => 'Le champ :attribute doit être une adresse IP valide.', + 'max' => [ + 'numeric' => 'La valeur de :attribute ne peut être supérieure à :max.', + 'file' => 'Le fichier :attribute ne peut être plus gros que :max kilobytes.', + 'string' => 'Le texte de :attribute ne peut contenir plus de :max caractères.', + 'array' => 'Le champ :attribute ne peut avoir plus de :max éléments.', + ], + 'mimes' => 'Le champ :attribute doit être un fichier de type : :values.', + 'min' => [ + 'numeric' => 'La valeur de :attribute doit être supérieure à :min.', + 'file' => 'Le fichier :attribute doit être plus que gros que :min kilobytes.', + 'string' => 'Le texte :attribute doit contenir au moins :min caractères.', + 'array' => 'Le champ :attribute doit avoir au moins :min éléments.', + ], + 'not_in' => "Le champ :attribute sélectionné n'est pas valide.", + 'numeric' => 'Le champ :attribute doit contenir un nombre.', + 'regex' => 'Le format du champ :attribute est invalide.', + 'required' => 'Le champ :attribute est obligatoire.', + 'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.', + 'required_with' => 'Le champ :attribute est obligatoire quand :values est présent.', + 'required_with_all' => 'Le champ :attribute est obligatoire quand :values est présent.', + 'required_without' => "Le champ :attribute est obligatoire quand :values n'est pas présent.", + 'required_without_all' => "Le champ :attribute est requis quand aucun de :values n'est présent.", + 'same' => 'Les champs :attribute et :other doivent être identiques.', + 'size' => [ + 'numeric' => 'La valeur de :attribute doit être :size.', + 'file' => 'La taille du fichier de :attribute doit être de :size kilobytes.', + 'string' => 'Le texte de :attribute doit contenir :size caractères.', + 'array' => 'Le champ :attribute doit contenir :size éléments.', + ], + 'unique' => 'La valeur du champ :attribute est déjà utilisée.', + 'url' => "Le format de l'URL de :attribute n'est pas valide.", - "positive" => ":attribute doit être supérieur à zero.", - "has_credit" => "Le client n'a pas un crédit suffisant.", - "notmasked" => "Les valeurs sont masquées", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'positive' => ':attribute doit être supérieur à zero.', + 'has_credit' => "Le client n'a pas un crédit suffisant.", + 'notmasked' => 'Les valeurs sont masquées', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -90,11 +90,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -107,36 +107,36 @@ return array( | */ - 'attributes' => array( - "name" => "Nom", - "username" => "Pseudo", - "email" => "Courriel", - "first_name" => "Prénom", - "last_name" => "Nom", - "password" => "Mot de passe", - "password_confirmation" => "Confirmation du mot de passe", - "city" => "Ville", - "country" => "Pays", - "address" => "Adresse", - "phone" => "Téléphone", - "mobile" => "Mobile", - "age" => "Âge", - "sex" => "Sexe", - "gender" => "Genre", - "day" => "Jour", - "month" => "Mois", - "year" => "Année", - "hour" => "Heure", - "minute" => "Minute", - "second" => "Seconde", - "title" => "Titre", - "content" => "Contenu", - "description" => "Description", - "excerpt" => "Extrait", - "date" => "Date", - "time" => "Heure", - "available" => "Disponible", - "size" => "Taille", - ), + 'attributes' => [ + 'name' => 'Nom', + 'username' => 'Pseudo', + 'email' => 'Courriel', + 'first_name' => 'Prénom', + 'last_name' => 'Nom', + 'password' => 'Mot de passe', + 'password_confirmation' => 'Confirmation du mot de passe', + 'city' => 'Ville', + 'country' => 'Pays', + 'address' => 'Adresse', + 'phone' => 'Téléphone', + 'mobile' => 'Mobile', + 'age' => 'Âge', + 'sex' => 'Sexe', + 'gender' => 'Genre', + 'day' => 'Jour', + 'month' => 'Mois', + 'year' => 'Année', + 'hour' => 'Heure', + 'minute' => 'Minute', + 'second' => 'Seconde', + 'title' => 'Titre', + 'content' => 'Contenu', + 'description' => 'Description', + 'excerpt' => 'Extrait', + 'date' => 'Date', + 'time' => 'Heure', + 'available' => 'Disponible', + 'size' => 'Taille', + ], -); +]; diff --git a/resources/lang/hr/texts.php b/resources/lang/hr/texts.php index 6a15fe84ee31..bddad15bdcb0 100644 --- a/resources/lang/hr/texts.php +++ b/resources/lang/hr/texts.php @@ -1,6 +1,6 @@ 'Organizacija', 'name' => 'Ime', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Uspješno je omogućeno dva tjedna besplatnog probnog pro plan roka', 'overdue' => 'Van valute', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1197,7 +1196,6 @@ Nevažeći kontakt email', 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1307,7 +1305,6 @@ Nevažeći kontakt email', 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2866,6 +2863,6 @@ Nevažeći kontakt email', 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/it/pagination.php b/resources/lang/it/pagination.php index 54f2c22efeaa..83f78bc12a72 100644 --- a/resources/lang/it/pagination.php +++ b/resources/lang/it/pagination.php @@ -1,6 +1,6 @@ 'Successivo »', -); +]; diff --git a/resources/lang/it/reminders.php b/resources/lang/it/reminders.php index a7ea42a5a159..49ea05f94262 100644 --- a/resources/lang/it/reminders.php +++ b/resources/lang/it/reminders.php @@ -1,6 +1,6 @@ "Le password devono essere di almeno 6 caratteri e devono coincidere.", + 'password' => 'Le password devono essere di almeno 6 caratteri e devono coincidere.', - "user" => "Non esiste un utente associato a questo indirizzo e-mail.", + 'user' => 'Non esiste un utente associato a questo indirizzo e-mail.', - "token" => "Questo token per la reimpostazione della password non è valido.", + 'token' => 'Questo token per la reimpostazione della password non è valido.', - "sent" => "Promemoria della password inviato!", + 'sent' => 'Promemoria della password inviato!', -); +]; diff --git a/resources/lang/it/texts.php b/resources/lang/it/texts.php index 6b64efd0f0e3..1b167bc102f3 100644 --- a/resources/lang/it/texts.php +++ b/resources/lang/it/texts.php @@ -1,6 +1,6 @@ 'Organizzazione', 'name' => 'Nome', @@ -1010,7 +1010,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'Per modificare le impostazioni di notifiche via email per favore accedi a: :link', 'reset_password_footer' => 'Se non sei stato tu a voler resettare la password per favore invia un\'email di assistenza a: :email', @@ -1190,7 +1189,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Rimborsa Pagamento', 'refund_max' => 'Massimo:', @@ -1299,7 +1297,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Salva i dettagli del pagamento', 'add_paypal_account' => 'Aggiungi un account Paypal', - 'no_payment_method_specified' => 'Nessun metodo di pagamento specificato', 'chart_type' => 'Tipo di grafico', 'format' => 'Formato', @@ -2858,6 +2855,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/it/validation.php b/resources/lang/it/validation.php index 98490593e021..a7ea0a3cb03f 100644 --- a/resources/lang/it/validation.php +++ b/resources/lang/it/validation.php @@ -1,6 +1,6 @@ ":attribute deve essere accettato.", - "active_url" => ":attribute non è un URL valido.", - "after" => ":attribute deve essere una data successiva al :date.", - "alpha" => ":attribute può contenere solo lettere.", - "alpha_dash" => ":attribute può contenere solo lettere, numeri e trattini.", - "alpha_num" => ":attribute può contenere solo lettere e numeri.", - "array" => ":attribute deve essere un array.", - "before" => ":attribute deve essere una data precedente al :date.", - "between" => array( - "numeric" => ":attribute deve trovarsi tra :min - :max.", - "file" => ":attribute deve trovarsi tra :min - :max kilobytes.", - "string" => ":attribute deve trovarsi tra :min - :max caratteri.", - "array" => ":attribute deve avere tra :min - :max elementi.", - ), - "confirmed" => "Il campo di conferma per :attribute non coincide.", - "date" => ":attribute non è una data valida.", - "date_format" => ":attribute non coincide con il formato :format.", - "different" => ":attribute e :other devono essere differenti.", - "digits" => ":attribute deve essere di :digits cifre.", - "digits_between" => ":attribute deve essere tra :min e :max cifre.", - "email" => ":attribute non è valido.", - "exists" => ":attribute selezionato/a non è valido.", - "image" => ":attribute deve essere un'immagine.", - "in" => ":attribute selezionato non è valido.", - "integer" => ":attribute deve essere intero.", - "ip" => ":attribute deve essere un indirizzo IP valido.", - "max" => array( - "numeric" => ":attribute deve essere minore di :max.", - "file" => ":attribute non deve essere più grande di :max kilobytes.", - "string" => ":attribute non può contenere più di :max caratteri.", - "array" => ":attribute non può avere più di :max elementi.", - ), - "mimes" => ":attribute deve essere del tipo: :values.", - "min" => array( - "numeric" => ":attribute deve valere almeno :min.", - "file" => ":attribute deve essere più grande di :min kilobytes.", - "string" => ":attribute deve contenere almeno :min caratteri.", - "array" => ":attribute deve avere almeno :min elementi.", - ), - "not_in" => "Il valore selezionato per :attribute non è valido.", - "numeric" => ":attribute deve essere un numero.", - "regex" => "Il formato del campo :attribute non è valido.", - "required" => ":attribute è richiesto.", - "required_if" => "Il campo :attribute è richiesto quando :other è :value.", - "required_with" => "Il campo :attribute è richiesto quando :values è presente.", - "required_with_all" => "The :attribute field is required when :values is present.", - "required_without" => "Il campo :attribute è richiesto quando :values non è presente.", - "required_without_all" => "The :attribute field is required when none of :values are present.", - "same" => ":attribute e :other devono coincidere.", - "size" => array( - "numeric" => ":attribute deve valere :size.", - "file" => ":attribute deve essere grande :size kilobytes.", - "string" => ":attribute deve contenere :size caratteri.", - "array" => ":attribute deve contenere :size elementi.", - ), - "unique" => ":attribute è stato già utilizzato.", - "url" => ":attribute deve essere un URL.", + 'accepted' => ':attribute deve essere accettato.', + 'active_url' => ':attribute non è un URL valido.', + 'after' => ':attribute deve essere una data successiva al :date.', + 'alpha' => ':attribute può contenere solo lettere.', + 'alpha_dash' => ':attribute può contenere solo lettere, numeri e trattini.', + 'alpha_num' => ':attribute può contenere solo lettere e numeri.', + 'array' => ':attribute deve essere un array.', + 'before' => ':attribute deve essere una data precedente al :date.', + 'between' => [ + 'numeric' => ':attribute deve trovarsi tra :min - :max.', + 'file' => ':attribute deve trovarsi tra :min - :max kilobytes.', + 'string' => ':attribute deve trovarsi tra :min - :max caratteri.', + 'array' => ':attribute deve avere tra :min - :max elementi.', + ], + 'confirmed' => 'Il campo di conferma per :attribute non coincide.', + 'date' => ':attribute non è una data valida.', + 'date_format' => ':attribute non coincide con il formato :format.', + 'different' => ':attribute e :other devono essere differenti.', + 'digits' => ':attribute deve essere di :digits cifre.', + 'digits_between' => ':attribute deve essere tra :min e :max cifre.', + 'email' => ':attribute non è valido.', + 'exists' => ':attribute selezionato/a non è valido.', + 'image' => ":attribute deve essere un'immagine.", + 'in' => ':attribute selezionato non è valido.', + 'integer' => ':attribute deve essere intero.', + 'ip' => ':attribute deve essere un indirizzo IP valido.', + 'max' => [ + 'numeric' => ':attribute deve essere minore di :max.', + 'file' => ':attribute non deve essere più grande di :max kilobytes.', + 'string' => ':attribute non può contenere più di :max caratteri.', + 'array' => ':attribute non può avere più di :max elementi.', + ], + 'mimes' => ':attribute deve essere del tipo: :values.', + 'min' => [ + 'numeric' => ':attribute deve valere almeno :min.', + 'file' => ':attribute deve essere più grande di :min kilobytes.', + 'string' => ':attribute deve contenere almeno :min caratteri.', + 'array' => ':attribute deve avere almeno :min elementi.', + ], + 'not_in' => 'Il valore selezionato per :attribute non è valido.', + 'numeric' => ':attribute deve essere un numero.', + 'regex' => 'Il formato del campo :attribute non è valido.', + 'required' => ':attribute è richiesto.', + 'required_if' => 'Il campo :attribute è richiesto quando :other è :value.', + 'required_with' => 'Il campo :attribute è richiesto quando :values è presente.', + 'required_with_all' => 'The :attribute field is required when :values is present.', + 'required_without' => 'Il campo :attribute è richiesto quando :values non è presente.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => ':attribute e :other devono coincidere.', + 'size' => [ + 'numeric' => ':attribute deve valere :size.', + 'file' => ':attribute deve essere grande :size kilobytes.', + 'string' => ':attribute deve contenere :size caratteri.', + 'array' => ':attribute deve contenere :size elementi.', + ], + 'unique' => ':attribute è stato già utilizzato.', + 'url' => ':attribute deve essere un URL.', - "positive" => "The :attribute must be greater than zero.", - "has_credit" => "The client does not have enough credit.", - "notmasked" => "The values are masked", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'positive' => 'The :attribute must be greater than zero.', + 'has_credit' => 'The client does not have enough credit.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -89,11 +89,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -106,6 +106,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/ja/pagination.php b/resources/lang/ja/pagination.php index 57e5dea529dd..ef46643d6c88 100644 --- a/resources/lang/ja/pagination.php +++ b/resources/lang/ja/pagination.php @@ -1,6 +1,6 @@ '次へ »', -); +]; diff --git a/resources/lang/ja/passwords.php b/resources/lang/ja/passwords.php index c1901734d19a..ad4224520d5b 100644 --- a/resources/lang/ja/passwords.php +++ b/resources/lang/ja/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "パスワードは6文字以上必要です。またパスワードの確認と一致している必要があります。", - "user" => "そのEメールアドレスのユーザは存在しません。", - "token" => "このパスワード・リセット・トークンは正しくありません。", - "sent" => "パスワードリセットのためのリンクをメールしました!", - "reset" => "パスワードはリセットされました!", + 'password' => 'パスワードは6文字以上必要です。またパスワードの確認と一致している必要があります。', + 'user' => 'そのEメールアドレスのユーザは存在しません。', + 'token' => 'このパスワード・リセット・トークンは正しくありません。', + 'sent' => 'パスワードリセットのためのリンクをメールしました!', + 'reset' => 'パスワードはリセットされました!', ]; diff --git a/resources/lang/ja/reminders.php b/resources/lang/ja/reminders.php index 22248f4acab2..c29b6df45be2 100644 --- a/resources/lang/ja/reminders.php +++ b/resources/lang/ja/reminders.php @@ -1,6 +1,6 @@ "パスワードは6文字以上必要です。またパスワードの確認と一致している必要があります。", + 'password' => 'パスワードは6文字以上必要です。またパスワードの確認と一致している必要があります。', - "user" => "そのEメールアドレスのユーザは存在しません。", + 'user' => 'そのEメールアドレスのユーザは存在しません。', - "token" => "このパスワード・リセット・トークンは正しくありません。", + 'token' => 'このパスワード・リセット・トークンは正しくありません。', - "sent" => "パスワードリマインダーが送信されました!", + 'sent' => 'パスワードリマインダーが送信されました!', -); +]; diff --git a/resources/lang/ja/texts.php b/resources/lang/ja/texts.php index 5f0239178d89..0816f4491bee 100644 --- a/resources/lang/ja/texts.php +++ b/resources/lang/ja/texts.php @@ -1,6 +1,6 @@ '組織', 'name' => '名前', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1306,7 +1304,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2865,6 +2862,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/ja/validation.php b/resources/lang/ja/validation.php index f300682c76d7..98225e53b563 100644 --- a/resources/lang/ja/validation.php +++ b/resources/lang/ja/validation.php @@ -1,6 +1,6 @@ ":attribute はmust be accepted.", - "active_url" => ":attribute は正しいURLではありません。", - "after" => ":attribute は:date以降の日付である必要があります。", - "alpha" => ":attribute は半角英字のみ可能です。", - "alpha_dash" => ":attribute は半角英数字およびハイフンのみ可能です。", - "alpha_num" => ":attribute は半角英数字のみ可能です。", - "array" => "The :attribute must be an array.", - "before" => ":attribute は:date以前の日付である必要があります。", - "between" => array( - "numeric" => ":attribute は :min - :max の範囲です。", - "file" => ":attribute は :min - :max KBの範囲です。", - "string" => ":attribute は :min - :max 文字の範囲です。", - "array" => ":attribute は :min - :max 個の範囲です。", - ), - "confirmed" => "The :attribute confirmation does not match.", - "date" => "The :attribute is not a valid date.", - "date_format" => "The :attribute does not match the format :format.", - "different" => "The :attribute and :other must be different.", - "digits" => "The :attribute must be :digits digits.", - "digits_between" => "The :attribute must be between :min and :max digits.", - "email" => "The :attribute format is invalid.", - "exists" => "The selected :attribute is invalid.", - "image" => "The :attribute must be an image.", - "in" => "The selected :attribute is invalid.", - "integer" => "The :attribute must be an integer.", - "ip" => "The :attribute must be a valid IP address.", - "max" => array( - "numeric" => ":attribute は:max 以下の必要があります。", - "file" => ":attribute は:max KB以下の必要があります。", - "string" => ":attribute は:max 文字以下の必要があります。", - "array" => ":attribute は:max 個以下の必要があります。", - ), - "mimes" => ":attribute は以下のファイル・タイプの必要があります。 :values.", - "min" => array( - "numeric" => ":attribute は:min 以上の必要があります。", - "file" => ":attribute は:min KB以上の必要があります。", - "string" => ":attribute は:min 文字以上の必要があります。", - "array" => ":attribute は:min 個以上の必要があります。", - ), - "not_in" => "選択された :attribute は正しくありません。", - "numeric" => ":attribute は数値の必要があります。", - "regex" => ":attribute のフォーマットが正しくありません。", - "required" => ":attribute フィールドが必要です。", - "required_if" => ":other が :valueの場合、:attribute フィールドが必要です。", - "required_with" => "The :attribute field is required when :values is present.", - "required_without" => "The :attribute field is required when :values is not present.", - "same" => ":attribute と :other が一致していません。", - "size" => array( - "numeric" => "The :attribute must be :size.", - "file" => "The :attribute must be :size kilobytes.", - "string" => "The :attribute must be :size characters.", - "array" => "The :attribute must contain :size items.", - ), - "unique" => ":attribute は既に使われています。", - "url" => ":attribute のフォーマットが正しくありません。", + 'accepted' => ':attribute はmust be accepted.', + 'active_url' => ':attribute は正しいURLではありません。', + 'after' => ':attribute は:date以降の日付である必要があります。', + 'alpha' => ':attribute は半角英字のみ可能です。', + 'alpha_dash' => ':attribute は半角英数字およびハイフンのみ可能です。', + 'alpha_num' => ':attribute は半角英数字のみ可能です。', + 'array' => 'The :attribute must be an array.', + 'before' => ':attribute は:date以前の日付である必要があります。', + 'between' => [ + 'numeric' => ':attribute は :min - :max の範囲です。', + 'file' => ':attribute は :min - :max KBの範囲です。', + 'string' => ':attribute は :min - :max 文字の範囲です。', + 'array' => ':attribute は :min - :max 個の範囲です。', + ], + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'email' => 'The :attribute format is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'max' => [ + 'numeric' => ':attribute は:max 以下の必要があります。', + 'file' => ':attribute は:max KB以下の必要があります。', + 'string' => ':attribute は:max 文字以下の必要があります。', + 'array' => ':attribute は:max 個以下の必要があります。', + ], + 'mimes' => ':attribute は以下のファイル・タイプの必要があります。 :values.', + 'min' => [ + 'numeric' => ':attribute は:min 以上の必要があります。', + 'file' => ':attribute は:min KB以上の必要があります。', + 'string' => ':attribute は:min 文字以上の必要があります。', + 'array' => ':attribute は:min 個以上の必要があります。', + ], + 'not_in' => '選択された :attribute は正しくありません。', + 'numeric' => ':attribute は数値の必要があります。', + 'regex' => ':attribute のフォーマットが正しくありません。', + 'required' => ':attribute フィールドが必要です。', + 'required_if' => ':other が :valueの場合、:attribute フィールドが必要です。', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'same' => ':attribute と :other が一致していません。', + 'size' => [ + 'numeric' => 'The :attribute must be :size.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', + ], + 'unique' => ':attribute は既に使われています。', + 'url' => ':attribute のフォーマットが正しくありません。', - "positive" => "The :attribute must be greater than zero.", - "has_credit" => "The client does not have enough credit.", - "notmasked" => "The values are masked", - "less_than" => "The :attribute must be less than :value", - "has_counter" => "The value must contain {\$counter}", - "valid_contacts" => "The contact must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'positive' => 'The :attribute must be greater than zero.', + 'has_credit' => 'The client does not have enough credit.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'The contact must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- @@ -88,7 +88,7 @@ return array( | */ - 'custom' => array(), + 'custom' => [], /* |-------------------------------------------------------------------------- @@ -101,6 +101,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/lt/reminders.php b/resources/lang/lt/reminders.php index 05af271289f3..cebb017edafd 100644 --- a/resources/lang/lt/reminders.php +++ b/resources/lang/lt/reminders.php @@ -13,9 +13,9 @@ return [ | */ - "password" => "Slaptažodis turi būti bent šešių simbolių ir sutapti su patvirtinimu.", - "user" => "Vartotojas su tokiu el. pašu nerastas.", - "token" => "Šis slaptažodžio raktas yra neteisingas.", - "sent" => "Naujo slaptažodžio nustatymo nuoroda išsiųsta", - "reset" => "Nustatytas naujas slaptažodis!", + 'password' => 'Slaptažodis turi būti bent šešių simbolių ir sutapti su patvirtinimu.', + 'user' => 'Vartotojas su tokiu el. pašu nerastas.', + 'token' => 'Šis slaptažodžio raktas yra neteisingas.', + 'sent' => 'Naujo slaptažodžio nustatymo nuoroda išsiųsta', + 'reset' => 'Nustatytas naujas slaptažodis!', ]; diff --git a/resources/lang/lt/texts.php b/resources/lang/lt/texts.php index 2a6c775d9ef8..3f02d7c2b708 100644 --- a/resources/lang/lt/texts.php +++ b/resources/lang/lt/texts.php @@ -1,6 +1,6 @@ 'Įmonė', 'name' => 'Pavadinimas', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Grąžinti', 'refund_max' => 'Maks.:', @@ -1306,7 +1304,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Išsaugoti mokėjimo duomenis', 'add_paypal_account' => 'Nauja Paypal sąskaita', - 'no_payment_method_specified' => 'Nėra nurodyta mokėjimo būdo', 'chart_type' => 'Diagramos tipas', 'format' => 'Formatas', @@ -2865,6 +2862,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/lt/validation.php b/resources/lang/lt/validation.php index 7a76d1c22a8b..9aa6617b8701 100644 --- a/resources/lang/lt/validation.php +++ b/resources/lang/lt/validation.php @@ -13,67 +13,67 @@ return [ | */ - "accepted" => "Laukas :attribute turi būti priimtas.", - "active_url" => "Laukas :attribute nėra galiojantis internetinis adresas.", - "after" => "Laukelyje :attribute turi būti data po :date.", - "alpha" => "Laukas :attribute gali turėti tik raides.", - "alpha_dash" => "Laukas :attribute gali turėti tik raides, skaičius ir brūkšnelius.", - "alpha_num" => "Laukas :attribute gali turėti tik raides ir skaičius.", - "array" => "Laukas :attribute turi būti masyvas.", - "before" => "Laukas :attribute turi būti data prieš :date.", - "between" => [ - "numeric" => "Lauko :attribute reikšmė turi būti tarp :min ir :max.", - "file" => "Failo dydis lauke :attribute turi būti tarp :min ir :max kilobaitų.", - "string" => "Simbolių skaičius lauke :attribute turi būti tarp :min ir :max.", - "array" => "Elementų skaičius lauke :attribute turi turėti nuo :min iki :max.", + 'accepted' => 'Laukas :attribute turi būti priimtas.', + 'active_url' => 'Laukas :attribute nėra galiojantis internetinis adresas.', + 'after' => 'Laukelyje :attribute turi būti data po :date.', + 'alpha' => 'Laukas :attribute gali turėti tik raides.', + 'alpha_dash' => 'Laukas :attribute gali turėti tik raides, skaičius ir brūkšnelius.', + 'alpha_num' => 'Laukas :attribute gali turėti tik raides ir skaičius.', + 'array' => 'Laukas :attribute turi būti masyvas.', + 'before' => 'Laukas :attribute turi būti data prieš :date.', + 'between' => [ + 'numeric' => 'Lauko :attribute reikšmė turi būti tarp :min ir :max.', + 'file' => 'Failo dydis lauke :attribute turi būti tarp :min ir :max kilobaitų.', + 'string' => 'Simbolių skaičius lauke :attribute turi būti tarp :min ir :max.', + 'array' => 'Elementų skaičius lauke :attribute turi turėti nuo :min iki :max.', ], - "boolean" => "Lauko reikšmė :attribute turi būti 'taip' arba 'ne'.", - "confirmed" => "Lauko :attribute patvirtinimas nesutampa.", - "date" => "Lauko :attribute reikšmė nėra galiojanti data.", - "date_format" => "Lauko :attribute reikšmė neatitinka formato :format.", - "different" => "Laukų :attribute ir :other reikšmės turi skirtis.", - "digits" => "Laukas :attribute turi būti sudarytas iš :digits skaitmenų.", - "digits_between" => "Laukas :attribute tuti turėti nuo :min iki :max skaitmenų.", - "email" => "Lauko :attribute reikšmė turi būti galiojantis el. pašto adresas.", - "filled" => "Laukas :attribute turi būti užpildytas.", - "exists" => "Pasirinkta negaliojanti :attribute reikšmė.", - "image" => "Lauko :attribute reikšmė turi būti paveikslėlis.", - "in" => "Pasirinkta negaliojanti :attribute reikšmė.", - "integer" => "Lauko :attribute reikšmė turi būti veikasis skaičius.", - "ip" => "Lauko :attribute reikšmė turi būti galiojantis IP adresas.", - "max" => [ - "numeric" => "Lauko :attribute reikšmė negali būti didesnė nei :max.", - "file" => "Failo dydis lauke :attribute reikšmė negali būti didesnė nei :max kilobaitų.", - "string" => "Simbolių kiekis lauke :attribute reikšmė negali būti didesnė nei :max simbolių.", - "array" => "Elementų kiekis lauke :attribute negali turėti daugiau nei :max elementų.", + 'boolean' => "Lauko reikšmė :attribute turi būti 'taip' arba 'ne'.", + 'confirmed' => 'Lauko :attribute patvirtinimas nesutampa.', + 'date' => 'Lauko :attribute reikšmė nėra galiojanti data.', + 'date_format' => 'Lauko :attribute reikšmė neatitinka formato :format.', + 'different' => 'Laukų :attribute ir :other reikšmės turi skirtis.', + 'digits' => 'Laukas :attribute turi būti sudarytas iš :digits skaitmenų.', + 'digits_between' => 'Laukas :attribute tuti turėti nuo :min iki :max skaitmenų.', + 'email' => 'Lauko :attribute reikšmė turi būti galiojantis el. pašto adresas.', + 'filled' => 'Laukas :attribute turi būti užpildytas.', + 'exists' => 'Pasirinkta negaliojanti :attribute reikšmė.', + 'image' => 'Lauko :attribute reikšmė turi būti paveikslėlis.', + 'in' => 'Pasirinkta negaliojanti :attribute reikšmė.', + 'integer' => 'Lauko :attribute reikšmė turi būti veikasis skaičius.', + 'ip' => 'Lauko :attribute reikšmė turi būti galiojantis IP adresas.', + 'max' => [ + 'numeric' => 'Lauko :attribute reikšmė negali būti didesnė nei :max.', + 'file' => 'Failo dydis lauke :attribute reikšmė negali būti didesnė nei :max kilobaitų.', + 'string' => 'Simbolių kiekis lauke :attribute reikšmė negali būti didesnė nei :max simbolių.', + 'array' => 'Elementų kiekis lauke :attribute negali turėti daugiau nei :max elementų.', ], - "mimes" => "Lauko reikšmė :attribute turi būti failas vieno iš sekančių tipų: :values.", - "min" => [ - "numeric" => "Lauko :attribute reikšmė turi būti ne mažesnė nei :min.", - "file" => "Failo dydis lauke :attribute turi būti ne mažesnis nei :min kilobaitų.", - "string" => "Simbolių kiekis lauke :attribute turi būti ne mažiau nei :min.", - "array" => "Elementų kiekis lauke :attribute turi būti ne mažiau nei :min.", + 'mimes' => 'Lauko reikšmė :attribute turi būti failas vieno iš sekančių tipų: :values.', + 'min' => [ + 'numeric' => 'Lauko :attribute reikšmė turi būti ne mažesnė nei :min.', + 'file' => 'Failo dydis lauke :attribute turi būti ne mažesnis nei :min kilobaitų.', + 'string' => 'Simbolių kiekis lauke :attribute turi būti ne mažiau nei :min.', + 'array' => 'Elementų kiekis lauke :attribute turi būti ne mažiau nei :min.', ], - "not_in" => "Pasirinkta negaliojanti reikšmė :attribute.", - "numeric" => "Lauko :attribute reikšmė turi būti skaičius.", - "regex" => "Negaliojantis lauko :attribute formatas.", - "required" => "Privaloma užpildyti lauką :attribute.", - "required_if" => "Privaloma užpildyti lauką :attribute kai :other yra :value.", - "required_with" => "Privaloma užpildyti lauką :attribute kai pateikta :values.", - "required_with_all" => "Privaloma užpildyti lauką :attribute kai pateikta :values.", - "required_without" => "Privaloma užpildyti lauką :attribute kai nepateikta :values.", - "required_without_all" => "Privaloma užpildyti lauką :attribute kai nepateikta nei viena iš reikšmių :values.", - "same" => "Laukai :attribute ir :other turi sutapti.", - "size" => [ - "numeric" => "Lauko :attribute reikšmė turi būti :size.", - "file" => "Failo dydis lauke :attribute turi būti :size kilobaitai.", - "string" => "Simbolių skaičius lauke :attribute turi būti :size.", - "array" => "Elementų kiekis lauke :attribute turi būti :size.", + 'not_in' => 'Pasirinkta negaliojanti reikšmė :attribute.', + 'numeric' => 'Lauko :attribute reikšmė turi būti skaičius.', + 'regex' => 'Negaliojantis lauko :attribute formatas.', + 'required' => 'Privaloma užpildyti lauką :attribute.', + 'required_if' => 'Privaloma užpildyti lauką :attribute kai :other yra :value.', + 'required_with' => 'Privaloma užpildyti lauką :attribute kai pateikta :values.', + 'required_with_all' => 'Privaloma užpildyti lauką :attribute kai pateikta :values.', + 'required_without' => 'Privaloma užpildyti lauką :attribute kai nepateikta :values.', + 'required_without_all' => 'Privaloma užpildyti lauką :attribute kai nepateikta nei viena iš reikšmių :values.', + 'same' => 'Laukai :attribute ir :other turi sutapti.', + 'size' => [ + 'numeric' => 'Lauko :attribute reikšmė turi būti :size.', + 'file' => 'Failo dydis lauke :attribute turi būti :size kilobaitai.', + 'string' => 'Simbolių skaičius lauke :attribute turi būti :size.', + 'array' => 'Elementų kiekis lauke :attribute turi būti :size.', ], - "string" => "The :attribute must be a string.", - "timezone" => "Lauko :attribute reikšmė turi būti galiojanti laiko zona.", - "unique" => "Tokia :attribute reikšmė jau pasirinkta.", - "url" => "Negaliojantis lauko :attribute formatas.", + 'string' => 'The :attribute must be a string.', + 'timezone' => 'Lauko :attribute reikšmė turi būti galiojanti laiko zona.', + 'unique' => 'Tokia :attribute reikšmė jau pasirinkta.', + 'url' => 'Negaliojantis lauko :attribute formatas.', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/mk_MK/texts.php b/resources/lang/mk_MK/texts.php index c3354774afae..8186e7fd6981 100644 --- a/resources/lang/mk_MK/texts.php +++ b/resources/lang/mk_MK/texts.php @@ -1,6 +1,6 @@ 'Организација', 'name' => 'Име', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Успешно овозможен и две недели за бесплатен пробен период на Pro план', 'overdue' => 'Задоцнето', - 'white_label_text' => 'Купете ЕДНОГОДИШЕН ПЛАН за брендирана лиценца за $:price за да го отстраните брендирањето на Invoice Ninja од клиентскиот портал.', 'user_email_footer' => 'За прилагодување на вашите поставки за известувања преку е-пошта ве молиме посетете :link', 'reset_password_footer' => 'Ако не поднесовте барање за ресетирање на лозинка ве молиме пратете е-пошта на нашата поддршка :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'Планот за претпријатија дава поддршка за повеќе корисници и прикачувања на документи, :link за да ја видите целата листа на придобивки ', 'return_to_app' => 'Врати се на апликација', - // Payment updates 'refund_payment' => 'Рефундирај плаќање', 'refund_max' => 'Максимално:', @@ -1306,7 +1304,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Зачувај детали за плаќање', 'add_paypal_account' => 'Додај PayPal сметка', - 'no_payment_method_specified' => 'Нема одредено начин на плаќање', 'chart_type' => 'Тип на графикон', 'format' => 'Формат', @@ -2865,6 +2862,6 @@ $LANG = array( 'mobile_refresh_warning' => 'Ако ја користите мобилната апликација можеби ќе треба да направите целосно освежување.', 'enable_proposals_for_background' => 'За да прикажите позадинска слика :link за овозможување на модулот за предлози.', -); +]; return $LANG; diff --git a/resources/lang/nb_NO/pagination.php b/resources/lang/nb_NO/pagination.php index ef922b207966..74e8ebbddd8a 100644 --- a/resources/lang/nb_NO/pagination.php +++ b/resources/lang/nb_NO/pagination.php @@ -1,6 +1,6 @@ 'Neste »', -); +]; diff --git a/resources/lang/nb_NO/reminders.php b/resources/lang/nb_NO/reminders.php index bc5787cbf711..35bde15fff4e 100644 --- a/resources/lang/nb_NO/reminders.php +++ b/resources/lang/nb_NO/reminders.php @@ -1,6 +1,6 @@ "Passord må være minst seks tegn og samsvare med bekreftelsen.", + 'password' => 'Passord må være minst seks tegn og samsvare med bekreftelsen.', - "user" => "Vi kan ikke finne en bruker med den e-postadressen.", + 'user' => 'Vi kan ikke finne en bruker med den e-postadressen.', - "token" => "Denne tilbakestillingsnøkkelen er ugyldig.", + 'token' => 'Denne tilbakestillingsnøkkelen er ugyldig.', - "sent" => "Passord påminnelse sendt!", + 'sent' => 'Passord påminnelse sendt!', -); +]; diff --git a/resources/lang/nb_NO/texts.php b/resources/lang/nb_NO/texts.php index fe239ee18b2a..fd81a3687f78 100644 --- a/resources/lang/nb_NO/texts.php +++ b/resources/lang/nb_NO/texts.php @@ -1,6 +1,6 @@ 'Organisasjon', 'name' => 'Navn', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Forfalt', - 'white_label_text' => 'Kjøp ett års white-label-lisens for $:price for å fjerne Invoice Ninja branding fra fakturaer og kundeportal.', 'user_email_footer' => 'For å justere varslingsinnstillingene vennligst besøk :link', 'reset_password_footer' => 'Hvis du ikke ba om å få nullstillt ditt passord, vennligst kontakt kundeservice: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'Enterprise-planen gir mulighet for flere brukere og filvedlegg, :link for å se hele listen med funksjoner.', 'return_to_app' => 'Tilbake til App', - // Payment updates 'refund_payment' => 'Refunder Betaling', 'refund_max' => 'Maks:', @@ -1306,7 +1304,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'Lagre betalingsdetaljer', 'add_paypal_account' => 'Legg til PayPal-konto', - 'no_payment_method_specified' => 'Ingen betalingsmåte er spesifisert', 'chart_type' => 'Chart Type', 'format' => 'Formater', @@ -2865,6 +2862,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/nb_NO/validation.php b/resources/lang/nb_NO/validation.php index 8ac62538cdc2..61600ee0992b 100644 --- a/resources/lang/nb_NO/validation.php +++ b/resources/lang/nb_NO/validation.php @@ -1,6 +1,6 @@ ":attribute må være akseptert.", - "active_url" => ":attribute er ikke en gyldig nettadresse.", - "after" => ":attribute må være en dato etter :date.", - "alpha" => ":attribute kan kun inneholde bokstaver.", - "alpha_dash" => ":attribute kan kun inneholde bokstaver, sifre, og bindestreker.", - "alpha_num" => ":attribute kan kun inneholde bokstaver og sifre.", - "array" => ":attribute må være en matrise.", - "before" => ":attribute må være en dato før :date.", - "between" => array( - "numeric" => ":attribute må være mellom :min - :max.", - "file" => ":attribute må være mellom :min - :max kilobytes.", - "string" => ":attribute må være mellom :min - :max tegn.", - "array" => ":attribute må ha mellom :min - :max elementer.", - ), - "confirmed" => ":attribute bekreftelsen stemmer ikke", - "date" => ":attribute er ikke en gyldig dato.", - "date_format" => ":attribute samsvarer ikke med formatet :format.", - "different" => ":attribute og :other må være forskjellig.", - "digits" => ":attribute må være :digits sifre.", - "digits_between" => ":attribute må være mellom :min og :max sifre.", - "email" => ":attribute formatet er ugyldig.", - "exists" => "Valgt :attribute er ugyldig.", - "image" => ":attribute må være et bilde.", - "in" => "Valgt :attribute er ugyldig.", - "integer" => ":attribute må være heltall.", - "ip" => ":attribute må være en gyldig IP-adresse.", - "max" => array( - "numeric" => ":attribute kan ikke være høyere enn :max.", - "file" => ":attribute kan ikke være større enn :max kilobytes.", - "string" => ":attribute kan ikke være mer enn :max tegn.", - "array" => ":attribute kan ikke inneholde mer enn :max elementer.", - ), - "mimes" => ":attribute må være av filtypen: :values.", - "min" => array( - "numeric" => ":attribute må minimum være :min.", - "file" => ":attribute må minimum være :min kilobytes.", - "string" => ":attribute må minimum være :min tegn.", - "array" => ":attribute må inneholde minimum :min elementer.", - ), - "not_in" => "Valgt :attribute er ugyldig.", - "numeric" => ":attribute må være et siffer.", - "regex" => ":attribute formatet er ugyldig.", - "required" => ":attribute er påkrevd.", - "required_if" => ":attribute er påkrevd når :other er :value.", - "required_with" => ":attribute er påkrevd når :values er valgt.", - "required_without" => ":attribute er påkrevd når :values ikke er valgt.", - "same" => ":attribute og :other må samsvare.", - "size" => array( - "numeric" => ":attribute må være :size.", - "file" => ":attribute må være :size kilobytes.", - "string" => ":attribute må være :size tegn.", - "array" => ":attribute må inneholde :size elementer.", - ), - "unique" => ":attribute er allerede blitt tatt.", - "url" => ":attribute formatet er ugyldig.", + 'accepted' => ':attribute må være akseptert.', + 'active_url' => ':attribute er ikke en gyldig nettadresse.', + 'after' => ':attribute må være en dato etter :date.', + 'alpha' => ':attribute kan kun inneholde bokstaver.', + 'alpha_dash' => ':attribute kan kun inneholde bokstaver, sifre, og bindestreker.', + 'alpha_num' => ':attribute kan kun inneholde bokstaver og sifre.', + 'array' => ':attribute må være en matrise.', + 'before' => ':attribute må være en dato før :date.', + 'between' => [ + 'numeric' => ':attribute må være mellom :min - :max.', + 'file' => ':attribute må være mellom :min - :max kilobytes.', + 'string' => ':attribute må være mellom :min - :max tegn.', + 'array' => ':attribute må ha mellom :min - :max elementer.', + ], + 'confirmed' => ':attribute bekreftelsen stemmer ikke', + 'date' => ':attribute er ikke en gyldig dato.', + 'date_format' => ':attribute samsvarer ikke med formatet :format.', + 'different' => ':attribute og :other må være forskjellig.', + 'digits' => ':attribute må være :digits sifre.', + 'digits_between' => ':attribute må være mellom :min og :max sifre.', + 'email' => ':attribute formatet er ugyldig.', + 'exists' => 'Valgt :attribute er ugyldig.', + 'image' => ':attribute må være et bilde.', + 'in' => 'Valgt :attribute er ugyldig.', + 'integer' => ':attribute må være heltall.', + 'ip' => ':attribute må være en gyldig IP-adresse.', + 'max' => [ + 'numeric' => ':attribute kan ikke være høyere enn :max.', + 'file' => ':attribute kan ikke være større enn :max kilobytes.', + 'string' => ':attribute kan ikke være mer enn :max tegn.', + 'array' => ':attribute kan ikke inneholde mer enn :max elementer.', + ], + 'mimes' => ':attribute må være av filtypen: :values.', + 'min' => [ + 'numeric' => ':attribute må minimum være :min.', + 'file' => ':attribute må minimum være :min kilobytes.', + 'string' => ':attribute må minimum være :min tegn.', + 'array' => ':attribute må inneholde minimum :min elementer.', + ], + 'not_in' => 'Valgt :attribute er ugyldig.', + 'numeric' => ':attribute må være et siffer.', + 'regex' => ':attribute formatet er ugyldig.', + 'required' => ':attribute er påkrevd.', + 'required_if' => ':attribute er påkrevd når :other er :value.', + 'required_with' => ':attribute er påkrevd når :values er valgt.', + 'required_without' => ':attribute er påkrevd når :values ikke er valgt.', + 'same' => ':attribute og :other må samsvare.', + 'size' => [ + 'numeric' => ':attribute må være :size.', + 'file' => ':attribute må være :size kilobytes.', + 'string' => ':attribute må være :size tegn.', + 'array' => ':attribute må inneholde :size elementer.', + ], + 'unique' => ':attribute er allerede blitt tatt.', + 'url' => ':attribute formatet er ugyldig.', - "positive" => ":attribute må være mer enn null.", - "has_credit" => "Klienten har ikke høy nok kreditt.", - "notmasked" => "Verdiene er skjult", - "less_than" => ':attribute må være mindre enn :value', - "has_counter" => 'Verdien må inneholde {$counter}', + 'positive' => ':attribute må være mer enn null.', + 'has_credit' => 'Klienten har ikke høy nok kreditt.', + 'notmasked' => 'Verdiene er skjult', + 'less_than' => ':attribute må være mindre enn :value', + 'has_counter' => 'Verdien må inneholde {$counter}', /* |-------------------------------------------------------------------------- @@ -86,7 +86,7 @@ return array( | */ - 'custom' => array(), + 'custom' => [], /* |-------------------------------------------------------------------------- @@ -99,6 +99,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/nl/pagination.php b/resources/lang/nl/pagination.php index 6f99c193afa5..d3fef03af5fb 100644 --- a/resources/lang/nl/pagination.php +++ b/resources/lang/nl/pagination.php @@ -1,6 +1,6 @@ 'Volgende »', -); +]; diff --git a/resources/lang/nl/passwords.php b/resources/lang/nl/passwords.php index 822259335ca9..93bcdfc09093 100644 --- a/resources/lang/nl/passwords.php +++ b/resources/lang/nl/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "Het wachtwoord moet minimaal zes tekens lang zijn en moet overeenkomen met de bevestiging.", - "user" => "We kunnen geen gebruiker vinden met het opgegeven e-mailadres.", - "token" => "Het wachtwoord reset token is ongeldig.", - "sent" => "We hebben u een wachtwoord reset link gemaild!", - "reset" => "Je wachtwoord is opnieuw ingesteld!", + 'password' => 'Het wachtwoord moet minimaal zes tekens lang zijn en moet overeenkomen met de bevestiging.', + 'user' => 'We kunnen geen gebruiker vinden met het opgegeven e-mailadres.', + 'token' => 'Het wachtwoord reset token is ongeldig.', + 'sent' => 'We hebben u een wachtwoord reset link gemaild!', + 'reset' => 'Je wachtwoord is opnieuw ingesteld!', ]; diff --git a/resources/lang/nl/reminders.php b/resources/lang/nl/reminders.php index 1a517a658edd..ae921af912b6 100644 --- a/resources/lang/nl/reminders.php +++ b/resources/lang/nl/reminders.php @@ -1,6 +1,6 @@ "Wachtwoord moet minimaal zes tekens lang zijn en de wachtwoorden moeten overeenkomen.", + 'password' => 'Wachtwoord moet minimaal zes tekens lang zijn en de wachtwoorden moeten overeenkomen.', - "user" => "Geen gebruiker bekend met dat e-mailadres.", + 'user' => 'Geen gebruiker bekend met dat e-mailadres.', - "token" => "Dit wachtwoord reset token is niet geldig.", + 'token' => 'Dit wachtwoord reset token is niet geldig.', - "sent" => "Wachtwoord herinnering verzonden!", + 'sent' => 'Wachtwoord herinnering verzonden!', -); +]; diff --git a/resources/lang/nl/texts.php b/resources/lang/nl/texts.php index 28e03c5663a9..d9387d8e9a6b 100644 --- a/resources/lang/nl/texts.php +++ b/resources/lang/nl/texts.php @@ -1,6 +1,6 @@ 'Organisatie', 'name' => 'Naam', @@ -1007,7 +1007,6 @@ $LANG = array( 'trial_success' => 'De gratis twee weken durende probeerversie van het pro plan is succesvol geactiveerd.', 'overdue' => 'Verlopen', - 'white_label_text' => 'Koop een white label licentie voor één jaar voor $:price om de Invoice Ninja reclame te verwijderen van facturen en het klantenportaal.', 'user_email_footer' => 'Ga alstublieft naar :link om uw e-mail notificatie instellingen aan te passen', 'reset_password_footer' => 'Neem a.u.b. contact op met onze helpdesk indien u deze wachtwoordreset niet heeft aangevraagd. Het e-mailadres van de helpdesk is :email', @@ -1187,7 +1186,6 @@ $LANG = array( 'enterprise_plan_features' => 'Het zakelijke abonnement voegt ondersteuning toe voor meerdere gebruikers en bijlagen, :link om een volledige lijst van de mogelijkheden te bekijken.', 'return_to_app' => 'Terug naar de app', - // Payment updates 'refund_payment' => 'Terugbetalen', 'refund_max' => 'Max:', @@ -1297,7 +1295,6 @@ Kom terug naar deze betalingsmethode pagina zodra u de bedragen heeft ontvangen 'token_billing_braintree_paypal' => 'Betalingsgegevens opslaan', 'add_paypal_account' => 'PayPal rekening toevoegen', - 'no_payment_method_specified' => 'Geen betalingsmethode gespecificeerd', 'chart_type' => 'Grafiektype', 'format' => 'Formaat', @@ -2857,6 +2854,6 @@ Kom terug naar deze betalingsmethode pagina zodra u de bedragen heeft ontvangen 'mobile_refresh_warning' => 'Als u de mobiele app gebruikt, moet u mogelijk een volledige vernieuwing uitvoeren.', 'enable_proposals_for_background' => 'Een achtergrondafbeelding uploaden :link om de voorstellenmodule in te schakelen.', -); +]; return $LANG; diff --git a/resources/lang/nl/validation.php b/resources/lang/nl/validation.php index 4a4aebfa41d6..137097ac82d4 100644 --- a/resources/lang/nl/validation.php +++ b/resources/lang/nl/validation.php @@ -1,6 +1,6 @@ ":attribute moet geaccepteerd zijn.", - "active_url" => ":attribute is geen geldige URL.", - "after" => ":attribute moet een datum na :date zijn.", - "alpha" => ":attribute mag alleen letters bevatten.", - "alpha_dash" => ":attribute mag alleen letters, nummers, lage streep (_) en liggende streep (-) bevatten.", - "alpha_num" => ":attribute mag alleen letters en nummers bevatten.", - "array" => ":attribute moet geselecteerde elementen bevatten.", - "before" => ":attribute moet een datum voor :date zijn.", - "between" => array( - "numeric" => ":attribute moet tussen :min en :max zijn.", - "file" => ":attribute moet tussen :min en :max kilobytes zijn.", - "string" => ":attribute moet tussen :min en :max tekens zijn.", - "array" => ":attribute moet tussen :min en :max items bevatten.", - ), - "confirmed" => ":attribute bevestiging komt niet overeen.", - "count" => ":attribute moet precies :count geselecteerde elementen bevatten.", - "countbetween" => ":attribute moet tussen :min en :max geselecteerde elementen bevatten.", - "countmax" => ":attribute moet minder dan :max geselecteerde elementen bevatten.", - "countmin" => ":attribute moet minimaal :min geselecteerde elementen bevatten.", - "date" => ":attribute is een ongeldige datum.", - "date_format" => ":attribute moet een geldig datum formaat bevatten.", - "different" => ":attribute en :other moeten verschillend zijn.", - "digits" => ":attribute moet :digits cijfers bevatten.", - "digits_between" => ":attribute moet minimaal :min en maximaal :max cijfers bevatten.", - "email" => ":attribute is geen geldig e-mailadres.", - "exists" => ":attribute bestaat niet.", - "image" => ":attribute moet een afbeelding zijn.", - "in" => ":attribute is ongeldig.", - "integer" => ":attribute moet een getal zijn.", - "ip" => ":attribute moet een geldig IP-adres zijn.", - "match" => "Het formaat van :attribute is ongeldig.", - "max" => array( - "numeric" => ":attribute moet minder dan :max zijn.", - "file" => ":attribute moet minder dan :max kilobytes zijn.", - "string" => ":attribute moet minder dan :max tekens zijn.", - "array" => ":attribute mag maximaal :max items bevatten.", - ), - "mimes" => ":attribute moet een bestand zijn van het bestandstype :values.", - "min" => array( - "numeric" => ":attribute moet minimaal :min zijn.", - "file" => ":attribute moet minimaal :min kilobytes zijn.", - "string" => ":attribute moet minimaal :min tekens zijn.", - "array" => ":attribute moet minimaal :min items bevatten.", - ), - "not_in" => "Het geselecteerde :attribute is ongeldig.", - "numeric" => ":attribute moet een nummer zijn.", - "regex" => ":attribute formaat is ongeldig.", - "required" => ":attribute is verplicht.", - "required_if" => ":attribute is verplicht wanneer in het veld :other gekozen is voor :value.", - "required_with" => ":attribute is verplicht wanneer :values ingevuld is.", - "required_with_all" => ":attribute is verplicht i.c.m. :values", - "required_without" => ":attribute is verplicht als :values niet ingevuld is.", - "required_without_all" => ":attribute is verplicht als :values niet ingevuld zijn.", - "same" => ":attribute en :other moeten overeenkomen.", - "size" => array( - "numeric" => ":attribute moet :size zijn.", - "file" => ":attribute moet :size kilobyte zijn.", - "string" => ":attribute moet :size tekens lang zijn.", - "array" => ":attribute moet :size items bevatten.", - ), - "unique" => ":attribute is al in gebruik.", - "url" => ":attribute is geen geldige URL.", + 'accepted' => ':attribute moet geaccepteerd zijn.', + 'active_url' => ':attribute is geen geldige URL.', + 'after' => ':attribute moet een datum na :date zijn.', + 'alpha' => ':attribute mag alleen letters bevatten.', + 'alpha_dash' => ':attribute mag alleen letters, nummers, lage streep (_) en liggende streep (-) bevatten.', + 'alpha_num' => ':attribute mag alleen letters en nummers bevatten.', + 'array' => ':attribute moet geselecteerde elementen bevatten.', + 'before' => ':attribute moet een datum voor :date zijn.', + 'between' => [ + 'numeric' => ':attribute moet tussen :min en :max zijn.', + 'file' => ':attribute moet tussen :min en :max kilobytes zijn.', + 'string' => ':attribute moet tussen :min en :max tekens zijn.', + 'array' => ':attribute moet tussen :min en :max items bevatten.', + ], + 'confirmed' => ':attribute bevestiging komt niet overeen.', + 'count' => ':attribute moet precies :count geselecteerde elementen bevatten.', + 'countbetween' => ':attribute moet tussen :min en :max geselecteerde elementen bevatten.', + 'countmax' => ':attribute moet minder dan :max geselecteerde elementen bevatten.', + 'countmin' => ':attribute moet minimaal :min geselecteerde elementen bevatten.', + 'date' => ':attribute is een ongeldige datum.', + 'date_format' => ':attribute moet een geldig datum formaat bevatten.', + 'different' => ':attribute en :other moeten verschillend zijn.', + 'digits' => ':attribute moet :digits cijfers bevatten.', + 'digits_between' => ':attribute moet minimaal :min en maximaal :max cijfers bevatten.', + 'email' => ':attribute is geen geldig e-mailadres.', + 'exists' => ':attribute bestaat niet.', + 'image' => ':attribute moet een afbeelding zijn.', + 'in' => ':attribute is ongeldig.', + 'integer' => ':attribute moet een getal zijn.', + 'ip' => ':attribute moet een geldig IP-adres zijn.', + 'match' => 'Het formaat van :attribute is ongeldig.', + 'max' => [ + 'numeric' => ':attribute moet minder dan :max zijn.', + 'file' => ':attribute moet minder dan :max kilobytes zijn.', + 'string' => ':attribute moet minder dan :max tekens zijn.', + 'array' => ':attribute mag maximaal :max items bevatten.', + ], + 'mimes' => ':attribute moet een bestand zijn van het bestandstype :values.', + 'min' => [ + 'numeric' => ':attribute moet minimaal :min zijn.', + 'file' => ':attribute moet minimaal :min kilobytes zijn.', + 'string' => ':attribute moet minimaal :min tekens zijn.', + 'array' => ':attribute moet minimaal :min items bevatten.', + ], + 'not_in' => 'Het geselecteerde :attribute is ongeldig.', + 'numeric' => ':attribute moet een nummer zijn.', + 'regex' => ':attribute formaat is ongeldig.', + 'required' => ':attribute is verplicht.', + 'required_if' => ':attribute is verplicht wanneer in het veld :other gekozen is voor :value.', + 'required_with' => ':attribute is verplicht wanneer :values ingevuld is.', + 'required_with_all' => ':attribute is verplicht i.c.m. :values', + 'required_without' => ':attribute is verplicht als :values niet ingevuld is.', + 'required_without_all' => ':attribute is verplicht als :values niet ingevuld zijn.', + 'same' => ':attribute en :other moeten overeenkomen.', + 'size' => [ + 'numeric' => ':attribute moet :size zijn.', + 'file' => ':attribute moet :size kilobyte zijn.', + 'string' => ':attribute moet :size tekens lang zijn.', + 'array' => ':attribute moet :size items bevatten.', + ], + 'unique' => ':attribute is al in gebruik.', + 'url' => ':attribute is geen geldige URL.', - "positive" => ":attribute moet groter zijn dan nul.", - "has_credit" => "De klant heeft niet voldoende krediet.", - "notmasked" => "De waarden zijn verborgen", - "less_than" => 'Het :attribute moet minder zijn dan :value', - "has_counter" => 'De waarde moet {$counter} bevatten', - "valid_contacts" => "Alle contactpersonen moeten een e-mailadres of een naam hebben", - "valid_invoice_items" => "De factuur overschrijd het maximale aantal", + 'positive' => ':attribute moet groter zijn dan nul.', + 'has_credit' => 'De klant heeft niet voldoende krediet.', + 'notmasked' => 'De waarden zijn verborgen', + 'less_than' => 'Het :attribute moet minder zijn dan :value', + 'has_counter' => 'De waarde moet {$counter} bevatten', + 'valid_contacts' => 'Alle contactpersonen moeten een e-mailadres of een naam hebben', + 'valid_invoice_items' => 'De factuur overschrijd het maximale aantal', /* |-------------------------------------------------------------------------- @@ -95,11 +95,11 @@ return array( | */ - 'custom' => array( - 'attribute-name' => array( + 'custom' => [ + 'attribute-name' => [ 'rule-name' => 'custom-message', - ), - ), + ], + ], /* |-------------------------------------------------------------------------- @@ -112,6 +112,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/pl/pagination.php b/resources/lang/pl/pagination.php index 950c5e96cc41..4cc49e3371ac 100644 --- a/resources/lang/pl/pagination.php +++ b/resources/lang/pl/pagination.php @@ -1,6 +1,6 @@ 'Następny »', -); +]; diff --git a/resources/lang/pl/passwords.php b/resources/lang/pl/passwords.php index b820fe537050..89e71656f6ed 100644 --- a/resources/lang/pl/passwords.php +++ b/resources/lang/pl/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "Hasło musi mieć conajmniej sześć znaków i być takie samo jak potwierdzające.", - "user" => "Użytkownik o podanym adresie e-mail nie istnieje.", - "token" => "Wprowadzony token jest nieprawidłowy.", - "sent" => "Link do resetowania hasła został wysłany.", - "reset" => "Twoje hasło zostało zresetowane!", + 'password' => 'Hasło musi mieć conajmniej sześć znaków i być takie samo jak potwierdzające.', + 'user' => 'Użytkownik o podanym adresie e-mail nie istnieje.', + 'token' => 'Wprowadzony token jest nieprawidłowy.', + 'sent' => 'Link do resetowania hasła został wysłany.', + 'reset' => 'Twoje hasło zostało zresetowane!', ]; diff --git a/resources/lang/pl/reminders.php b/resources/lang/pl/reminders.php index f1b084e87328..fd0754cf7ee9 100644 --- a/resources/lang/pl/reminders.php +++ b/resources/lang/pl/reminders.php @@ -1,6 +1,6 @@ "Hasło musi mieć conajmniej sześć znaków i być takie samo jak potwierdzające.", + 'password' => 'Hasło musi mieć conajmniej sześć znaków i być takie samo jak potwierdzające.', - "user" => "Użytkownik o podanym adresie e-mail nie istnieje.", + 'user' => 'Użytkownik o podanym adresie e-mail nie istnieje.', - "token" => "Wprowadzony token jest nieprawidłowy.", + 'token' => 'Wprowadzony token jest nieprawidłowy.', - "sent" => "Przypomnienie hasła zostało wysłane!", + 'sent' => 'Przypomnienie hasła zostało wysłane!', -); +]; diff --git a/resources/lang/pl/texts.php b/resources/lang/pl/texts.php index 28ca0e9e0e1f..9393852f2546 100644 --- a/resources/lang/pl/texts.php +++ b/resources/lang/pl/texts.php @@ -1,6 +1,6 @@ 'Organizacja', 'name' => 'Nazwa', @@ -1016,7 +1016,6 @@ $LANG = array( 'trial_success' => 'Darmowy okres próbny został włączony', 'overdue' => 'Zaległość', - 'white_label_text' => 'Kup roczną licencję white label za $:price, aby usunąć wzmianki o Invoice Ninja z faktur i portalu klienta.', 'user_email_footer' => 'Aby dostosować ustawienia powiadomień email, zobacz :link', 'reset_password_footer' => 'Prosimy o kontakt, jeśli nie wysłałeś prośby o zresetowanie hasła: :email', @@ -1196,7 +1195,6 @@ $LANG = array( 'enterprise_plan_features' => 'Plan Enterprise dodaje wsparcie dla wielu użytkowników oraz obsługę załączników. Zobacz :link, by poznać wszystkie funkcjonalności.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Zwrot płatności', 'refund_max' => 'Max:', @@ -1306,7 +1304,6 @@ Gdy przelewy zostaną zaksięgowane na Twoim koncie, wróć do tej strony i klik 'token_billing_braintree_paypal' => 'Zapisz dane płatności', 'add_paypal_account' => 'Dodaj konto PayPal', - 'no_payment_method_specified' => 'Nie wybrano formy płatności', 'chart_type' => 'Typ wykresu', 'format' => 'Format', @@ -2865,6 +2862,6 @@ Gdy przelewy zostaną zaksięgowane na Twoim koncie, wróć do tej strony i klik 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/pl/validation.php b/resources/lang/pl/validation.php index 10f3c640d38f..80aa8a131d98 100644 --- a/resources/lang/pl/validation.php +++ b/resources/lang/pl/validation.php @@ -1,6 +1,6 @@ ":attribute musi być zaakceptowany.", - "active_url" => ":attribute nie jest poprawnym URL-em.", - "after" => ":attribute musi być datą za :date.", - "alpha" => ":attribute może zawierać tylko litery.", - "alpha_dash" => ":attribute może zawierać tylko litery, liczby i myślniki.", - "alpha_num" => ":attribute może zawierać tylko litery i liczby.", - "array" => ":attribute musi być tablicą.", - "before" => ":attribute musi być datą przed :date.", - "between" => array( - "numeric" => ":attribute musi być pomiędzy :min - :max.", - "file" => ":attribute musi mieć rozmiar pomiędzy :min - :max kilobajtów.", - "string" => ":attribute musi mieć pomiędzy :min - :max znaków.", - "array" => ":attribute musi zawierać :min - :max pozycji.", - ), - "confirmed" => ":attribute potwierdzenie nie jest zgodne.", - "date" => ":attribute nie jest prawidłową datą.", - "date_format" => ":attribute nie jest zgodne z formatem :format.", - "different" => ":attribute i :other muszą być różne.", - "digits" => ":attribute musi mieć :digits cyfr.", - "digits_between" => ":attribute musi być w przedziale od :min do :max cyfr.", - "email" => ":attribute format jest nieprawidłowy.", - "exists" => "Zaznaczony :attribute jest niepoprawny.", - "image" => ":attribute musi być zdjęciem.", - "in" => "Zaznaczony :attribute jest niepoprawny.", - "integer" => ":attribute musi być liczbą całkowitą.", - "ip" => ":attribute musi być poprawnym adresem IP.", - "max" => array( - "numeric" => ":attribute nie może być większy niż :max.", - "file" => ":attribute nie może być większy niż :max kilobajtów.", - "string" => ":attribute nie może być dłuższy niż :max znaków.", - "array" => ":attribute nie może zawierać więcej niż :max pozycji.", - ), - "mimes" => ":attribute musi być plikiem o typie: :values.", - "min" => array( - "numeric" => ":attribute musi być przynajmniej :min.", - "file" => ":attribute musi mieć przynajmniej :min kilobajtów.", - "string" => ":attribute musi mieć przynajmniej :min znaków.", - "array" => ":attribute musi zawierać przynajmniej :min pozycji.", - ), - "not_in" => "Zaznaczony :attribute jest niepoprawny.", - "numeric" => ":attribute musi być cyfrą.", - "regex" => ":attribute format jest niepoprawny.", - "required" => ":attribute pole jest wymagane.", - "required_if" => ":attribute pole jest wymagane jeśli :other ma :value.", - "required_with" => ":attribute pole jest wymagane kiedy :values jest obecne.", - "required_without" => ":attribute pole jest wymagane kiedy :values nie występuje.", - "same" => ":attribute i :other muszą być takie same.", - "size" => array( - "numeric" => ":attribute musi mieć :size.", - "file" => ":attribute musi mieć :size kilobajtów.", - "string" => ":attribute musi mieć :size znaków.", - "array" => ":attribute musi zawierać :size pozycji.", - ), - "unique" => ":attribute już istnieje.", - "url" => ":attribute format jest nieprawidłowy.", + 'accepted' => ':attribute musi być zaakceptowany.', + 'active_url' => ':attribute nie jest poprawnym URL-em.', + 'after' => ':attribute musi być datą za :date.', + 'alpha' => ':attribute może zawierać tylko litery.', + 'alpha_dash' => ':attribute może zawierać tylko litery, liczby i myślniki.', + 'alpha_num' => ':attribute może zawierać tylko litery i liczby.', + 'array' => ':attribute musi być tablicą.', + 'before' => ':attribute musi być datą przed :date.', + 'between' => [ + 'numeric' => ':attribute musi być pomiędzy :min - :max.', + 'file' => ':attribute musi mieć rozmiar pomiędzy :min - :max kilobajtów.', + 'string' => ':attribute musi mieć pomiędzy :min - :max znaków.', + 'array' => ':attribute musi zawierać :min - :max pozycji.', + ], + 'confirmed' => ':attribute potwierdzenie nie jest zgodne.', + 'date' => ':attribute nie jest prawidłową datą.', + 'date_format' => ':attribute nie jest zgodne z formatem :format.', + 'different' => ':attribute i :other muszą być różne.', + 'digits' => ':attribute musi mieć :digits cyfr.', + 'digits_between' => ':attribute musi być w przedziale od :min do :max cyfr.', + 'email' => ':attribute format jest nieprawidłowy.', + 'exists' => 'Zaznaczony :attribute jest niepoprawny.', + 'image' => ':attribute musi być zdjęciem.', + 'in' => 'Zaznaczony :attribute jest niepoprawny.', + 'integer' => ':attribute musi być liczbą całkowitą.', + 'ip' => ':attribute musi być poprawnym adresem IP.', + 'max' => [ + 'numeric' => ':attribute nie może być większy niż :max.', + 'file' => ':attribute nie może być większy niż :max kilobajtów.', + 'string' => ':attribute nie może być dłuższy niż :max znaków.', + 'array' => ':attribute nie może zawierać więcej niż :max pozycji.', + ], + 'mimes' => ':attribute musi być plikiem o typie: :values.', + 'min' => [ + 'numeric' => ':attribute musi być przynajmniej :min.', + 'file' => ':attribute musi mieć przynajmniej :min kilobajtów.', + 'string' => ':attribute musi mieć przynajmniej :min znaków.', + 'array' => ':attribute musi zawierać przynajmniej :min pozycji.', + ], + 'not_in' => 'Zaznaczony :attribute jest niepoprawny.', + 'numeric' => ':attribute musi być cyfrą.', + 'regex' => ':attribute format jest niepoprawny.', + 'required' => ':attribute pole jest wymagane.', + 'required_if' => ':attribute pole jest wymagane jeśli :other ma :value.', + 'required_with' => ':attribute pole jest wymagane kiedy :values jest obecne.', + 'required_without' => ':attribute pole jest wymagane kiedy :values nie występuje.', + 'same' => ':attribute i :other muszą być takie same.', + 'size' => [ + 'numeric' => ':attribute musi mieć :size.', + 'file' => ':attribute musi mieć :size kilobajtów.', + 'string' => ':attribute musi mieć :size znaków.', + 'array' => ':attribute musi zawierać :size pozycji.', + ], + 'unique' => ':attribute już istnieje.', + 'url' => ':attribute format jest nieprawidłowy.', - "positive" => ":attribute musi być większe niż zero.", - "has_credit" => "Klient ma niewystarczająco kredytu.", - "notmasked" => "Wartości są maskowane", - "less_than" => ":attribute musi być mniejsze od :value", - "has_counter" => "Wartość musi zawierać {\$counter}", - "valid_contacts" => "Kontakt musi posiadać e-mail lub nazwę", - "valid_invoice_items" => "Faktura przekracza maksymalną kwotę", + 'positive' => ':attribute musi być większe niż zero.', + 'has_credit' => 'Klient ma niewystarczająco kredytu.', + 'notmasked' => 'Wartości są maskowane', + 'less_than' => ':attribute musi być mniejsze od :value', + 'has_counter' => 'Wartość musi zawierać {$counter}', + 'valid_contacts' => 'Kontakt musi posiadać e-mail lub nazwę', + 'valid_invoice_items' => 'Faktura przekracza maksymalną kwotę', /* |-------------------------------------------------------------------------- @@ -88,7 +88,7 @@ return array( | */ - 'custom' => array(), + 'custom' => [], /* |-------------------------------------------------------------------------- @@ -101,6 +101,6 @@ return array( | */ - 'attributes' => array(), + 'attributes' => [], -); +]; diff --git a/resources/lang/pt_BR/pagination.php b/resources/lang/pt_BR/pagination.php index 39b1c02096a4..69dbeb74560e 100644 --- a/resources/lang/pt_BR/pagination.php +++ b/resources/lang/pt_BR/pagination.php @@ -1,6 +1,6 @@ 'Próximo »', -); +]; diff --git a/resources/lang/pt_BR/passwords.php b/resources/lang/pt_BR/passwords.php index bd575ee830e7..55acbe9bb274 100644 --- a/resources/lang/pt_BR/passwords.php +++ b/resources/lang/pt_BR/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "Senhas deve conter pelo menos seis caracteres e combinar com a confirmação.", - "user" => "Usuário não encontrado.", - "token" => "Token inválido.", - "sent" => "Link para reset da senha enviado por email!", - "reset" => "Senha resetada!", + 'password' => 'Senhas deve conter pelo menos seis caracteres e combinar com a confirmação.', + 'user' => 'Usuário não encontrado.', + 'token' => 'Token inválido.', + 'sent' => 'Link para reset da senha enviado por email!', + 'reset' => 'Senha resetada!', ]; diff --git a/resources/lang/pt_BR/reminders.php b/resources/lang/pt_BR/reminders.php index 9b6a07b0f536..0e6b063a27cf 100644 --- a/resources/lang/pt_BR/reminders.php +++ b/resources/lang/pt_BR/reminders.php @@ -1,6 +1,6 @@ "Senhas devem possuir no mínimo seis caracteres e devem ser iguais.", +'password' => 'Senhas devem possuir no mínimo seis caracteres e devem ser iguais.', -"user" => "Não foi encontrado um usuário com o endereço de e-mail informado.", +'user' => 'Não foi encontrado um usuário com o endereço de e-mail informado.', -"token" => "Este token de redefinição de senha é inválido.", +'token' => 'Este token de redefinição de senha é inválido.', -"sent" => "Lembrete de senha enviado!", +'sent' => 'Lembrete de senha enviado!', -); +]; diff --git a/resources/lang/pt_BR/texts.php b/resources/lang/pt_BR/texts.php index 07f2e5334bf9..3b125fad6067 100644 --- a/resources/lang/pt_BR/texts.php +++ b/resources/lang/pt_BR/texts.php @@ -1,6 +1,6 @@ 'Empresa', 'name' => 'Nome', @@ -1007,7 +1007,6 @@ $LANG = array( 'trial_success' => 'Duas semanas de testes foi habilitado com sucesso', 'overdue' => 'Vencido', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'Para ajustar suas configurações de notificações de e-mail acesse :link', 'reset_password_footer' => 'Se você não solicitou a redefinição de sua senha por favor envie um e-mail para o nosso suporte: :email', @@ -1187,7 +1186,6 @@ $LANG = array( 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Retornar ao App', - // Payment updates 'refund_payment' => 'Reembolsar Pagamento', 'refund_max' => 'Máx:', @@ -1297,7 +1295,6 @@ Quando tiver os valores dos depósitos, volte a esta pagina e complete a verific 'token_billing_braintree_paypal' => 'Salvar detalhes do pagamento', 'add_paypal_account' => 'Adicionar Conta do PayPal', - 'no_payment_method_specified' => 'Nenhum método de pagamento definido', 'chart_type' => 'Tipo de Gráfico', 'format' => 'Formato', @@ -2856,6 +2853,6 @@ Quando tiver os valores dos depósitos, volte a esta pagina e complete a verific 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/pt_BR/validation.php b/resources/lang/pt_BR/validation.php index 9b697397e3a9..33b3c73e3bba 100644 --- a/resources/lang/pt_BR/validation.php +++ b/resources/lang/pt_BR/validation.php @@ -1,6 +1,6 @@ ":attribute deve ser aceito.", -"active_url" => ":attribute não é uma URL válida.", -"after" => ":attribute deve ser uma data maior que :date.", -"alpha" => ":attribute deve conter apenas letras.", -"alpha_dash" => ":attribute pode conter apenas letras, número e hífens", -"alpha_num" => ":attribute pode conter apenas letras e números.", -"array" => ":attribute deve ser uma lista.", -"before" => ":attribute deve ser uma data anterior a :date.", -"between" => array( - "numeric" => ":attribute deve estar entre :min - :max.", - "file" => ":attribute deve estar entre :min - :max kilobytes.", - "string" => ":attribute deve estar entre :min - :max caracteres.", - "array" => ":attribute deve conter entre :min - :max itens.", - ), -"confirmed" => ":attribute confirmação não corresponde.", -"date" => ":attribute não é uma data válida.", -"date_format" => ":attribute não satisfaz o formato :format.", -"different" => ":attribute e :other devem ser diferentes.", -"digits" => ":attribute deve conter :digits dígitos.", -"digits_between" => ":attribute deve conter entre :min e :max dígitos.", -"email" => ":attribute está em um formato inválido.", -"exists" => "A opção selecionada :attribute é inválida.", -"image" => ":attribute deve ser uma imagem.", -"in" => "A opção selecionada :attribute é inválida.", -"integer" => ":attribute deve ser um número inteiro.", -"ip" => ":attribute deve ser um endereço IP válido.", -"max" => array( - "numeric" => ":attribute não pode ser maior que :max.", - "file" => ":attribute não pode ser maior que :max kilobytes.", - "string" => ":attribute não pode ser maior que :max caracteres.", - "array" => ":attribute não pode conter mais que :max itens.", - ), -"mimes" => ":attribute deve ser um arquivo do tipo: :values.", -"min" => array( - "numeric" => ":attribute não deve ser menor que :min.", - "file" => ":attribute deve ter no mínimo :min kilobytes.", - "string" => ":attribute deve conter no mínimo :min caracteres.", - "array" => ":attribute deve conter ao menos :min itens.", - ), -"not_in" => "A opção selecionada :attribute é inválida.", -"numeric" => ":attribute deve ser um número.", -"regex" => ":attribute está em um formato inválido.", -"required" => ":attribute é um campo obrigatório.", -"required_if" => ":attribute é necessário quando :other é :value.", -"required_with" => ":attribute é obrigatório quando :values está presente.", -"required_without" => ":attribute é obrigatório quando :values não está presente.", -"same" => ":attribute e :other devem corresponder.", -"size" => array( - "numeric" => ":attribute deve ter :size.", - "file" => ":attribute deve ter :size kilobytes.", - "string" => ":attribute deve conter :size caracteres.", - "array" => ":attribute deve conter :size itens.", - ), -"unique" => ":attribute já está sendo utilizado.", -"url" => ":attribute está num formato inválido.", +'accepted' => ':attribute deve ser aceito.', +'active_url' => ':attribute não é uma URL válida.', +'after' => ':attribute deve ser uma data maior que :date.', +'alpha' => ':attribute deve conter apenas letras.', +'alpha_dash' => ':attribute pode conter apenas letras, número e hífens', +'alpha_num' => ':attribute pode conter apenas letras e números.', +'array' => ':attribute deve ser uma lista.', +'before' => ':attribute deve ser uma data anterior a :date.', +'between' => [ + 'numeric' => ':attribute deve estar entre :min - :max.', + 'file' => ':attribute deve estar entre :min - :max kilobytes.', + 'string' => ':attribute deve estar entre :min - :max caracteres.', + 'array' => ':attribute deve conter entre :min - :max itens.', + ], +'confirmed' => ':attribute confirmação não corresponde.', +'date' => ':attribute não é uma data válida.', +'date_format' => ':attribute não satisfaz o formato :format.', +'different' => ':attribute e :other devem ser diferentes.', +'digits' => ':attribute deve conter :digits dígitos.', +'digits_between' => ':attribute deve conter entre :min e :max dígitos.', +'email' => ':attribute está em um formato inválido.', +'exists' => 'A opção selecionada :attribute é inválida.', +'image' => ':attribute deve ser uma imagem.', +'in' => 'A opção selecionada :attribute é inválida.', +'integer' => ':attribute deve ser um número inteiro.', +'ip' => ':attribute deve ser um endereço IP válido.', +'max' => [ + 'numeric' => ':attribute não pode ser maior que :max.', + 'file' => ':attribute não pode ser maior que :max kilobytes.', + 'string' => ':attribute não pode ser maior que :max caracteres.', + 'array' => ':attribute não pode conter mais que :max itens.', + ], +'mimes' => ':attribute deve ser um arquivo do tipo: :values.', +'min' => [ + 'numeric' => ':attribute não deve ser menor que :min.', + 'file' => ':attribute deve ter no mínimo :min kilobytes.', + 'string' => ':attribute deve conter no mínimo :min caracteres.', + 'array' => ':attribute deve conter ao menos :min itens.', + ], +'not_in' => 'A opção selecionada :attribute é inválida.', +'numeric' => ':attribute deve ser um número.', +'regex' => ':attribute está em um formato inválido.', +'required' => ':attribute é um campo obrigatório.', +'required_if' => ':attribute é necessário quando :other é :value.', +'required_with' => ':attribute é obrigatório quando :values está presente.', +'required_without' => ':attribute é obrigatório quando :values não está presente.', +'same' => ':attribute e :other devem corresponder.', +'size' => [ + 'numeric' => ':attribute deve ter :size.', + 'file' => ':attribute deve ter :size kilobytes.', + 'string' => ':attribute deve conter :size caracteres.', + 'array' => ':attribute deve conter :size itens.', + ], +'unique' => ':attribute já está sendo utilizado.', +'url' => ':attribute está num formato inválido.', -"positive" => ":attribute deve ser maior que zero.", -"has_credit" => "O cliente não possui crédito suficiente.", -"notmasked" => "Os valores são mascarados", -"less_than" => ':attribute deve ser menor que :value', -"has_counter" => 'O valor deve conter {$counter}', -"valid_contacts" => "Todos os contatos devem conter um e-mail ou nome", -"valid_invoice_items" => "Esta fatura excedeu o número mximo de itens", +'positive' => ':attribute deve ser maior que zero.', +'has_credit' => 'O cliente não possui crédito suficiente.', +'notmasked' => 'Os valores são mascarados', +'less_than' => ':attribute deve ser menor que :value', +'has_counter' => 'O valor deve conter {$counter}', +'valid_contacts' => 'Todos os contatos devem conter um e-mail ou nome', +'valid_invoice_items' => 'Esta fatura excedeu o número mximo de itens', /* |-------------------------------------------------------------------------- @@ -88,7 +88,7 @@ return array( | */ -'custom' => array(), +'custom' => [], /* |-------------------------------------------------------------------------- @@ -101,6 +101,6 @@ return array( | */ -'attributes' => array(), +'attributes' => [], -); +]; diff --git a/resources/lang/pt_PT/pagination.php b/resources/lang/pt_PT/pagination.php index 39b1c02096a4..69dbeb74560e 100644 --- a/resources/lang/pt_PT/pagination.php +++ b/resources/lang/pt_PT/pagination.php @@ -1,6 +1,6 @@ 'Próximo »', -); +]; diff --git a/resources/lang/pt_PT/passwords.php b/resources/lang/pt_PT/passwords.php index 71a5b54d51ce..ae1a6e1e24df 100644 --- a/resources/lang/pt_PT/passwords.php +++ b/resources/lang/pt_PT/passwords.php @@ -13,10 +13,10 @@ return [ | */ - "password" => "A palavra-passe deve conter pelo menos seis caracteres e combinar com a confirmação.", - "user" => "Utilizador não encontrado.", - "token" => "Token inválido.", - "sent" => "Link para reposição da palavra-passe enviado por email!", - "reset" => "Palavra-passe reposta!", + 'password' => 'A palavra-passe deve conter pelo menos seis caracteres e combinar com a confirmação.', + 'user' => 'Utilizador não encontrado.', + 'token' => 'Token inválido.', + 'sent' => 'Link para reposição da palavra-passe enviado por email!', + 'reset' => 'Palavra-passe reposta!', ]; diff --git a/resources/lang/pt_PT/reminders.php b/resources/lang/pt_PT/reminders.php index 4c0a422c77c6..eb56381a90b2 100644 --- a/resources/lang/pt_PT/reminders.php +++ b/resources/lang/pt_PT/reminders.php @@ -1,6 +1,6 @@ "As palavras-passe devem conter no mínimo seis caracteres e devem ser iguais.", +'password' => 'As palavras-passe devem conter no mínimo seis caracteres e devem ser iguais.', -"user" => "Não foi encontrado um utilizador com o endereço de email indicado.", +'user' => 'Não foi encontrado um utilizador com o endereço de email indicado.', -"token" => "Este token de redefinição de palavra-passe é inválido.", +'token' => 'Este token de redefinição de palavra-passe é inválido.', -"sent" => "Lembrete de palavra-passe enviado!", +'sent' => 'Lembrete de palavra-passe enviado!', -); +]; diff --git a/resources/lang/pt_PT/texts.php b/resources/lang/pt_PT/texts.php index 66a5347ee408..9d8388729581 100644 --- a/resources/lang/pt_PT/texts.php +++ b/resources/lang/pt_PT/texts.php @@ -1,6 +1,6 @@ 'Organização', 'name' => 'Nome', @@ -1007,7 +1007,6 @@ $LANG = array( 'trial_success' => 'Ativado duas semanas de teste para testar o plano Pro', 'overdue' => 'Vencido', - 'white_label_text' => 'Comprar UM ANO da licença de marca branca por $:price para remover o branding do Invoice Ninja das notas de pagamento e do portal do cliente.', 'user_email_footer' => 'Para ajustar as suas definições de notificações de e-mail aceda :link', 'reset_password_footer' => 'Se não solicitou a redefinição da palavra-passe por favor envie um e-mail para o nosso suporte: :email', @@ -1187,7 +1186,6 @@ $LANG = array( 'enterprise_plan_features' => 'O plano Enterprise adiciona suporte a multiplos utilizadores e anexos de ficheiros, :link para ver a lista completa de funcionalidades.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Reembolsar Pagamento', 'refund_max' => 'Máx:', @@ -1297,7 +1295,6 @@ Quando tiver os valores dos depósitos, volte a esta página e conclua a verific 'token_billing_braintree_paypal' => 'Guardar detalhes do pagamento', 'add_paypal_account' => 'Adicionar Conta PayPal', - 'no_payment_method_specified' => 'Nenhum método de pagamento definido', 'chart_type' => 'Tipo de Gráfico', 'format' => 'Formato', @@ -2857,6 +2854,6 @@ Quando tiver os valores dos depósitos, volte a esta página e conclua a verific 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/pt_PT/validation.php b/resources/lang/pt_PT/validation.php index d6df9e7d0358..1a741d05b6d3 100644 --- a/resources/lang/pt_PT/validation.php +++ b/resources/lang/pt_PT/validation.php @@ -1,6 +1,6 @@ ":attribute deve ser aceite.", -"active_url" => ":attribute não é um URL válido.", -"after" => ":attribute deve ser uma data maior que :date.", -"alpha" => ":attribute deve conter apenas letras.", -"alpha_dash" => ":attribute pode conter apenas letras, número e hífens", -"alpha_num" => ":attribute pode conter apenas letras e números.", -"array" => ":attribute deve ser uma lista.", -"before" => ":attribute deve ser uma data anterior a :date.", -"between" => array( - "numeric" => ":attribute deve estar entre :min - :max.", - "file" => ":attribute deve estar entre :min - :max kilobytes.", - "string" => ":attribute deve estar entre :min - :max caracteres.", - "array" => ":attribute deve conter entre :min - :max itens.", - ), -"confirmed" => ":attribute confirmação não corresponde.", -"date" => ":attribute não é uma data válida.", -"date_format" => ":attribute não satisfaz o formato :format.", -"different" => ":attribute e :other devem ser diferentes.", -"digits" => ":attribute deve conter :digits dígitos.", -"digits_between" => ":attribute deve conter entre :min e :max dígitos.", -"email" => ":attribute está em um formato inválido.", -"exists" => "A opção selecionada :attribute é inválida.", -"image" => ":attribute deve ser uma imagem.", -"in" => "A opção selecionada :attribute é inválida.", -"integer" => ":attribute deve ser um número inteiro.", -"ip" => ":attribute deve ser um endereço IP válido.", -"max" => array( - "numeric" => ":attribute não pode ser maior que :max.", - "file" => ":attribute não pode ser maior que :max kilobytes.", - "string" => ":attribute não pode ser maior que :max caracteres.", - "array" => ":attribute não pode conter mais que :max itens.", - ), -"mimes" => ":attribute deve ser um arquivo do tipo: :values.", -"min" => array( - "numeric" => ":attribute não deve ser menor que :min.", - "file" => ":attribute deve ter no mínimo :min kilobytes.", - "string" => ":attribute deve conter no mínimo :min caracteres.", - "array" => ":attribute deve conter ao menos :min itens.", - ), -"not_in" => "A opção selecionada :attribute é inválida.", -"numeric" => ":attribute deve ser um número.", -"regex" => ":attribute está em um formato inválido.", -"required" => ":attribute é um campo obrigatório.", -"required_if" => ":attribute é necessário quando :other é :value.", -"required_with" => ":attribute é obrigatório quando :values está presente.", -"required_without" => ":attribute é obrigatório quando :values não está presente.", -"same" => ":attribute e :other devem corresponder.", -"size" => array( - "numeric" => ":attribute deve ter :size.", - "file" => ":attribute deve ter :size kilobytes.", - "string" => ":attribute deve conter :size caracteres.", - "array" => ":attribute deve conter :size itens.", - ), -"unique" => ":attribute já está sendo utilizado.", -"url" => ":attribute está num formato inválido.", +'accepted' => ':attribute deve ser aceite.', +'active_url' => ':attribute não é um URL válido.', +'after' => ':attribute deve ser uma data maior que :date.', +'alpha' => ':attribute deve conter apenas letras.', +'alpha_dash' => ':attribute pode conter apenas letras, número e hífens', +'alpha_num' => ':attribute pode conter apenas letras e números.', +'array' => ':attribute deve ser uma lista.', +'before' => ':attribute deve ser uma data anterior a :date.', +'between' => [ + 'numeric' => ':attribute deve estar entre :min - :max.', + 'file' => ':attribute deve estar entre :min - :max kilobytes.', + 'string' => ':attribute deve estar entre :min - :max caracteres.', + 'array' => ':attribute deve conter entre :min - :max itens.', + ], +'confirmed' => ':attribute confirmação não corresponde.', +'date' => ':attribute não é uma data válida.', +'date_format' => ':attribute não satisfaz o formato :format.', +'different' => ':attribute e :other devem ser diferentes.', +'digits' => ':attribute deve conter :digits dígitos.', +'digits_between' => ':attribute deve conter entre :min e :max dígitos.', +'email' => ':attribute está em um formato inválido.', +'exists' => 'A opção selecionada :attribute é inválida.', +'image' => ':attribute deve ser uma imagem.', +'in' => 'A opção selecionada :attribute é inválida.', +'integer' => ':attribute deve ser um número inteiro.', +'ip' => ':attribute deve ser um endereço IP válido.', +'max' => [ + 'numeric' => ':attribute não pode ser maior que :max.', + 'file' => ':attribute não pode ser maior que :max kilobytes.', + 'string' => ':attribute não pode ser maior que :max caracteres.', + 'array' => ':attribute não pode conter mais que :max itens.', + ], +'mimes' => ':attribute deve ser um arquivo do tipo: :values.', +'min' => [ + 'numeric' => ':attribute não deve ser menor que :min.', + 'file' => ':attribute deve ter no mínimo :min kilobytes.', + 'string' => ':attribute deve conter no mínimo :min caracteres.', + 'array' => ':attribute deve conter ao menos :min itens.', + ], +'not_in' => 'A opção selecionada :attribute é inválida.', +'numeric' => ':attribute deve ser um número.', +'regex' => ':attribute está em um formato inválido.', +'required' => ':attribute é um campo obrigatório.', +'required_if' => ':attribute é necessário quando :other é :value.', +'required_with' => ':attribute é obrigatório quando :values está presente.', +'required_without' => ':attribute é obrigatório quando :values não está presente.', +'same' => ':attribute e :other devem corresponder.', +'size' => [ + 'numeric' => ':attribute deve ter :size.', + 'file' => ':attribute deve ter :size kilobytes.', + 'string' => ':attribute deve conter :size caracteres.', + 'array' => ':attribute deve conter :size itens.', + ], +'unique' => ':attribute já está sendo utilizado.', +'url' => ':attribute está num formato inválido.', -"positive" => ":attribute deve ser maior que zero.", -"has_credit" => "O cliente não possui crédito suficiente.", -"notmasked" => "Os valores são mascarados", -"less_than" => ':attribute deve ser menor que :value', -"has_counter" => 'O valor deve conter {$counter}', -"valid_contacts" => "Todos os contatos devem conter um email ou nome", -"valid_invoice_items" => "Esta fatura excedeu o número máximo de itens", +'positive' => ':attribute deve ser maior que zero.', +'has_credit' => 'O cliente não possui crédito suficiente.', +'notmasked' => 'Os valores são mascarados', +'less_than' => ':attribute deve ser menor que :value', +'has_counter' => 'O valor deve conter {$counter}', +'valid_contacts' => 'Todos os contatos devem conter um email ou nome', +'valid_invoice_items' => 'Esta fatura excedeu o número máximo de itens', /* |-------------------------------------------------------------------------- @@ -88,7 +88,7 @@ return array( | */ -'custom' => array(), +'custom' => [], /* |-------------------------------------------------------------------------- @@ -101,6 +101,6 @@ return array( | */ -'attributes' => array(), +'attributes' => [], -); +]; diff --git a/resources/lang/ro/texts.php b/resources/lang/ro/texts.php index e7b9a86e0355..855750d44796 100644 --- a/resources/lang/ro/texts.php +++ b/resources/lang/ro/texts.php @@ -1,6 +1,6 @@ 'Organizație', 'name' => 'Nume', @@ -1018,7 +1018,6 @@ Atentie: Folosește Legacy API Key, nu Token API', 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1198,7 +1197,6 @@ Atentie: Folosește Legacy API Key, nu Token API', 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1308,7 +1306,6 @@ Atentie: Folosește Legacy API Key, nu Token API', 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2867,6 +2864,6 @@ Atentie: Folosește Legacy API Key, nu Token API', 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/sl/texts.php b/resources/lang/sl/texts.php index d856d4cf6a9d..29b1ec364560 100644 --- a/resources/lang/sl/texts.php +++ b/resources/lang/sl/texts.php @@ -1,6 +1,6 @@ 'Organizacija', 'name' => 'Ime', @@ -1012,7 +1012,6 @@ Ne morete najti računa? Potrebujete dodatno pomoč? Z veseljem bomo pomagali. P 'trial_success' => 'Dva tedensko brezplačno poskusno obdobje uspešno omogočeno.', 'overdue' => 'Zapadlo', - 'white_label_text' => 'Za odstranitev Invoice Ninja znamke z računa in portala za stranke, zakupi enoletno "white Label" licenco v znesku $:price.', 'user_email_footer' => 'Za spremembo e-poštnih obvestil obiščite :link', 'reset_password_footer' => 'Če niste zahtevali ponastavitev gesla, nas prosim obvestite na naslov: :email', @@ -1193,7 +1192,6 @@ Velikost strani', 'enterprise_plan_features' => 'Podjetniški paket omogoča več uporabnikov in priponk. :link za ogled celotnega seznama funkcij.', 'return_to_app' => 'Nazaj na vrh', - // Payment updates 'refund_payment' => 'Vračilo plačila', 'refund_max' => 'Maksimalno:', @@ -1303,7 +1301,6 @@ Ko imate zneske, se vrnite na to stran plačilnega sredstva in kliknite na "Comp 'token_billing_braintree_paypal' => 'Shrani plačilne podatke', 'add_paypal_account' => 'Dodaj Paypal račun', - 'no_payment_method_specified' => 'Plačilno sredstvo ni izbrano.', 'chart_type' => 'Tip grafikona', 'format' => 'Oblika', @@ -2862,6 +2859,6 @@ Ko imate zneske, se vrnite na to stran plačilnega sredstva in kliknite na "Comp 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/sq/texts.php b/resources/lang/sq/texts.php index 0b3548edd739..c30e20dd85ee 100755 --- a/resources/lang/sq/texts.php +++ b/resources/lang/sq/texts.php @@ -1,6 +1,6 @@ 'Organizata', 'name' => 'Emri', @@ -1013,7 +1013,6 @@ $LANG = array( 'trial_success' => 'Periudha provuese dyjavore për pro planin është aktivizuar me sukses', 'overdue' => 'E vonuar', - 'white_label_text' => 'Bli nje license vjecare me cmimin $:price per te hequr logot dhe tekstet e Invoice Ninja nga fatura dhe portali i klientit. ', 'user_email_footer' => 'Për të ndryshuar lajmërimet tuaja me email vizitoni :link', 'reset_password_footer' => 'Nëse nuk keni kërkuar resetimin e fjalëkalimit ju lutem na shkruani në emailin tonë : :email', @@ -1194,7 +1193,6 @@ Fushat e njësive në faturë', 'enterprise_plan_features' => 'Plani Enterprise shton përkrahje për shumë përdorues dhe bashkangjithjen e fajllave, :link për të parë listën e të gjitha veçorive.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Rimburso pagesën', 'refund_max' => 'Maksimumi:', @@ -1304,7 +1302,6 @@ Pasi të keni pranuar shumat, kthehuni në faqen e metodave të pagesës dhe kli 'token_billing_braintree_paypal' => 'Ruaj detajet e pagesës', 'add_paypal_account' => 'Shto llogari PayPal', - 'no_payment_method_specified' => 'Nuk është caktuar metoda e pagesës', 'chart_type' => 'Lloji i grafikonit', 'format' => 'Format', @@ -2863,6 +2860,6 @@ Pasi të keni pranuar shumat, kthehuni në faqen e metodave të pagesës dhe kli 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/sv/passwords.php b/resources/lang/sv/passwords.php index 3239e8be9fb7..c25e38d554eb 100644 --- a/resources/lang/sv/passwords.php +++ b/resources/lang/sv/passwords.php @@ -13,14 +13,14 @@ return [ | */ - "password" => "Lösenord måste innehålla minst sex tecken och matcha varandra.", + 'password' => 'Lösenord måste innehålla minst sex tecken och matcha varandra.', - "user" => "Vi kan inte hitta en användare med den e-postadressen.", + 'user' => 'Vi kan inte hitta en användare med den e-postadressen.', - "token" => "Koden för lösenordsåterställning är ogiltig.", + 'token' => 'Koden för lösenordsåterställning är ogiltig.', - "sent" => "Lösenordspåminnelse skickad!", + 'sent' => 'Lösenordspåminnelse skickad!', - "reset" => "Lösenordet har blivit återställt!", + 'reset' => 'Lösenordet har blivit återställt!', ]; diff --git a/resources/lang/sv/reminders.php b/resources/lang/sv/reminders.php index b35b56e9584e..627942480603 100644 --- a/resources/lang/sv/reminders.php +++ b/resources/lang/sv/reminders.php @@ -1,6 +1,6 @@ "Passwords must be at least six characters and match the confirmation.", + 'password' => 'Passwords must be at least six characters and match the confirmation.', - "user" => "We can't find a user with that e-mail address.", + 'user' => "We can't find a user with that e-mail address.", - "token" => "This password reset token is invalid.", + 'token' => 'This password reset token is invalid.', - "sent" => "Password reminder sent!", + 'sent' => 'Password reminder sent!', -); +]; diff --git a/resources/lang/sv/texts.php b/resources/lang/sv/texts.php index 98f0eb726679..3cdc88027524 100644 --- a/resources/lang/sv/texts.php +++ b/resources/lang/sv/texts.php @@ -1,6 +1,6 @@ 'Organisation', 'name' => 'Namn', @@ -1015,7 +1015,6 @@ $LANG = array( 'trial_success' => 'Lyckades aktivera två veckors gratis testversion för Pro nivå', 'overdue' => 'Försenat', - 'white_label_text' => 'Köp ETT ÅR white label licens för $:price för att ta bort bort Invoice Ninja referens från faktura och klient portal.', 'user_email_footer' => 'För att anpassa dina e-post notifieringar gå till :link', 'reset_password_footer' => 'Om du inte begärt en återställning av ditt lösenord så var snäll och e-posta vår support: :email', @@ -1195,7 +1194,6 @@ $LANG = array( 'enterprise_plan_features' => 'Enterprise plan ger support för flera användare och bifogade filer, :link för att se lista av funktioner.', 'return_to_app' => 'Återgå till Appen', - // Payment updates 'refund_payment' => 'Återbetala betalning', 'refund_max' => 'Max:', @@ -1305,7 +1303,6 @@ När ni har pengarna, kom tillbaka till denna betalningsmetods sida och klicka p 'token_billing_braintree_paypal' => 'Spara betalnings detaljer', 'add_paypal_account' => 'Lägg till PayPal konto', - 'no_payment_method_specified' => 'Ingen betalningsmetod angiven', 'chart_type' => 'Diagramtyp', 'format' => 'Format', @@ -2872,6 +2869,6 @@ Den här funktionen kräver att en produkt skapas och en betalningsgateway är k 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/sv/validation.php b/resources/lang/sv/validation.php index a70f3ce8f165..a3a25c7448fc 100644 --- a/resources/lang/sv/validation.php +++ b/resources/lang/sv/validation.php @@ -12,74 +12,74 @@ return [ | such as the size rules. Feel free to tweak each of these messages. | */ - "accepted" => ":attribute måste accepteras.", - "active_url" => ":attribute är inte en giltig webbadress.", - "after" => ":attribute måste vara ett datum efter den :date.", - "alpha" => ":attribute får endast innehålla bokstäver.", - "alpha_dash" => ":attribute får endast innehålla bokstäver, siffror och bindestreck.", - "alpha_num" => ":attribute får endast innehålla bokstäver och siffror.", - "array" => ":attribute måste vara en array.", - "before" => ":attribute måste vara ett datum innan den :date.", - "between" => [ - "numeric" => ":attribute måste vara en siffra mellan :min och :max.", - "file" => ":attribute måste vara mellan :min till :max kilobyte stor.", - "string" => ":attribute måste innehålla :min till :max tecken.", - "array" => ":attribute måste innehålla mellan :min - :max objekt.", + 'accepted' => ':attribute måste accepteras.', + 'active_url' => ':attribute är inte en giltig webbadress.', + 'after' => ':attribute måste vara ett datum efter den :date.', + 'alpha' => ':attribute får endast innehålla bokstäver.', + 'alpha_dash' => ':attribute får endast innehålla bokstäver, siffror och bindestreck.', + 'alpha_num' => ':attribute får endast innehålla bokstäver och siffror.', + 'array' => ':attribute måste vara en array.', + 'before' => ':attribute måste vara ett datum innan den :date.', + 'between' => [ + 'numeric' => ':attribute måste vara en siffra mellan :min och :max.', + 'file' => ':attribute måste vara mellan :min till :max kilobyte stor.', + 'string' => ':attribute måste innehålla :min till :max tecken.', + 'array' => ':attribute måste innehålla mellan :min - :max objekt.', ], - "boolean" => ":attribute måste vara sant eller falskt", - "confirmed" => ":attribute bekräftelsen matchar inte.", - "date" => ":attribute är inte ett giltigt datum.", - "date_format" => ":attribute matchar inte formatet :format.", - "different" => ":attribute och :other får inte vara lika.", - "digits" => ":attribute måste vara minst :digits tecken.", - "digits_between" => ":attribute måste vara mellan :min och :max tecken.", - "email" => "Fältet :attribute måste innehålla en korrekt e-postadress.", - "exists" => "Det valda :attribute är ogiltigt.", - "filled" => "Fältet :attribute är obligatoriskt.", - "image" => ":attribute måste vara en bild.", - "in" => "Det valda :attribute är ogiltigt.", - "integer" => ":attribute måste vara en siffra.", - "ip" => ":attribute måste vara en giltig IP-adress.", - "max" => [ - "numeric" => ":attribute får inte vara större än :max.", - "file" => ":attribute får max vara :max kilobyte stor.", - "string" => ":attribute får max innehålla :max tecken.", - "array" => ":attribute får inte innehålla mer än :max objekt.", + 'boolean' => ':attribute måste vara sant eller falskt', + 'confirmed' => ':attribute bekräftelsen matchar inte.', + 'date' => ':attribute är inte ett giltigt datum.', + 'date_format' => ':attribute matchar inte formatet :format.', + 'different' => ':attribute och :other får inte vara lika.', + 'digits' => ':attribute måste vara minst :digits tecken.', + 'digits_between' => ':attribute måste vara mellan :min och :max tecken.', + 'email' => 'Fältet :attribute måste innehålla en korrekt e-postadress.', + 'exists' => 'Det valda :attribute är ogiltigt.', + 'filled' => 'Fältet :attribute är obligatoriskt.', + 'image' => ':attribute måste vara en bild.', + 'in' => 'Det valda :attribute är ogiltigt.', + 'integer' => ':attribute måste vara en siffra.', + 'ip' => ':attribute måste vara en giltig IP-adress.', + 'max' => [ + 'numeric' => ':attribute får inte vara större än :max.', + 'file' => ':attribute får max vara :max kilobyte stor.', + 'string' => ':attribute får max innehålla :max tecken.', + 'array' => ':attribute får inte innehålla mer än :max objekt.', ], - "mimes" => ":attribute måste vara en fil av typen: :values.", - "min" => [ - "numeric" => ":attribute måste vara större än :min.", - "file" => ":attribute måste vara minst :min kilobyte stor.", - "string" => ":attribute måste innehålla minst :min tecken.", - "array" => ":attribute måste innehålla minst :min objekt.", + 'mimes' => ':attribute måste vara en fil av typen: :values.', + 'min' => [ + 'numeric' => ':attribute måste vara större än :min.', + 'file' => ':attribute måste vara minst :min kilobyte stor.', + 'string' => ':attribute måste innehålla minst :min tecken.', + 'array' => ':attribute måste innehålla minst :min objekt.', ], - "not_in" => "Det valda :attribute är ogiltigt.", - "numeric" => ":attribute måste vara en siffra.", - "regex" => "Formatet för :attribute är ogiltigt.", - "required" => "Fältet :attribute är obligatoriskt.", - "required_if" => "Fältet :attribute är obligatoriskt då :other är :value.", - "required_with" => "Fältet :attribute är obligatoriskt då :values är ifyllt.", - "required_with_all" => "Fältet :attribute är obligatoriskt när :values är ifyllt.", - "required_without" => "Fältet :attribute är obligatoriskt då :values ej är ifyllt.", - "required_without_all" => "Fältet :attribute är obligatoriskt när ingen av :values är ifyllt.", - "same" => ":attribute och :other måste vara lika.", - "size" => [ - "numeric" => ":attribute måste vara :size.", - "file" => ":attribute får endast vara :size kilobyte stor.", - "string" => ":attribute måste innehålla :size tecken.", - "array" => ":attribute måste innehålla :size objekt.", + 'not_in' => 'Det valda :attribute är ogiltigt.', + 'numeric' => ':attribute måste vara en siffra.', + 'regex' => 'Formatet för :attribute är ogiltigt.', + 'required' => 'Fältet :attribute är obligatoriskt.', + 'required_if' => 'Fältet :attribute är obligatoriskt då :other är :value.', + 'required_with' => 'Fältet :attribute är obligatoriskt då :values är ifyllt.', + 'required_with_all' => 'Fältet :attribute är obligatoriskt när :values är ifyllt.', + 'required_without' => 'Fältet :attribute är obligatoriskt då :values ej är ifyllt.', + 'required_without_all' => 'Fältet :attribute är obligatoriskt när ingen av :values är ifyllt.', + 'same' => ':attribute och :other måste vara lika.', + 'size' => [ + 'numeric' => ':attribute måste vara :size.', + 'file' => ':attribute får endast vara :size kilobyte stor.', + 'string' => ':attribute måste innehålla :size tecken.', + 'array' => ':attribute måste innehålla :size objekt.', ], - "timezone" => ":attribute måste vara en giltig tidszon.", - "unique" => ":attribute används redan.", - "url" => "Formatet :attribute är ogiltigt.", + 'timezone' => ':attribute måste vara en giltig tidszon.', + 'unique' => ':attribute används redan.', + 'url' => 'Formatet :attribute är ogiltigt.', - "positive" => "The :attribute must be greater than zero.", - "has_credit" => "The client does not have enough credit.", - "notmasked" => "The values are masked", - "less_than" => 'The :attribute must be less than :value', - "has_counter" => 'The value must contain {$counter}', - "valid_contacts" => "All of the contacts must have either an email or name", - "valid_invoice_items" => "The invoice exceeds the maximum amount", + 'positive' => 'The :attribute must be greater than zero.', + 'has_credit' => 'The client does not have enough credit.', + 'notmasked' => 'The values are masked', + 'less_than' => 'The :attribute must be less than :value', + 'has_counter' => 'The value must contain {$counter}', + 'valid_contacts' => 'All of the contacts must have either an email or name', + 'valid_invoice_items' => 'The invoice exceeds the maximum amount', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/th/texts.php b/resources/lang/th/texts.php index a5ceefd0663f..5b6e6148361c 100644 --- a/resources/lang/th/texts.php +++ b/resources/lang/th/texts.php @@ -1,6 +1,6 @@ 'องค์กร', 'name' => 'ชื่อ', @@ -1018,7 +1018,6 @@ $LANG = array( 'trial_success' => 'เปิดใช้งานการทดลองใช้ฟรี Pro Plan สองสัปดาห์แล้ว', 'overdue' => 'เกินกำหนด', - 'white_label_text' => 'ชำระเงินสำหรับ white label ไลเซนต์ 1 ปี ราคา :price เพื่อเอา logo invoice ninja ออกจากใบแจ้งหนี้และพอร์ทัลของลูกค้า', 'user_email_footer' => 'หากต้องการปรับการตั้งค่าการแจ้งเตือนทางอีเมลโปรดไปที่ :link', 'reset_password_footer' => 'หากคุณไม่ได้ขอให้รีเซ็ตรหัสผ่านนี้โปรดส่งอีเมลถึงฝ่ายสนับสนุนของเรา: :email', @@ -1198,7 +1197,6 @@ $LANG = array( 'enterprise_plan_features' => 'แผน Enterprise เพิ่มการสนับสนุนสำหรับผู้ใช้หลายคนและไฟล์แนบ :link เพื่อดูรายการคุณสมบัติทั้งหมด', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'การชำระเงินคืน', 'refund_max' => 'สูงสุด:', @@ -1308,7 +1306,6 @@ $LANG = array( 'token_billing_braintree_paypal' => 'บันทึกรายละเอียดการชำระเงิน', 'add_paypal_account' => 'เพิ่มบัญชี PayPal', - 'no_payment_method_specified' => 'ไม่ระบุวิธีการชำระเงิน', 'chart_type' => 'ประเภทแผนภูมิ', 'format' => 'รูปแบบ', @@ -2867,6 +2864,6 @@ $LANG = array( 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/tr_TR/texts.php b/resources/lang/tr_TR/texts.php index 7571a3ecbd72..b00801e20df8 100644 --- a/resources/lang/tr_TR/texts.php +++ b/resources/lang/tr_TR/texts.php @@ -1,6 +1,6 @@ 'Şirket', 'name' => 'Ünvan', @@ -1015,7 +1015,6 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'trial_success' => 'Successfully enabled two week free pro plan trial', 'overdue' => 'Overdue', - 'white_label_text' => 'Purchase a ONE YEAR white label license for $:price to remove the Invoice Ninja branding from the invoice and client portal.', 'user_email_footer' => 'To adjust your email notification settings please visit :link', 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', @@ -1195,7 +1194,6 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'enterprise_plan_features' => 'The Enterprise plan adds support for multiple users and file attachments, :link to see the full list of features.', 'return_to_app' => 'Return To App', - // Payment updates 'refund_payment' => 'Refund Payment', 'refund_max' => 'Max:', @@ -1305,7 +1303,6 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'token_billing_braintree_paypal' => 'Save payment details', 'add_paypal_account' => 'Add PayPal Account', - 'no_payment_method_specified' => 'No payment method specified', 'chart_type' => 'Chart Type', 'format' => 'Format', @@ -2864,6 +2861,6 @@ adresine gönderildi. Müthiş tüm özelliklerin kilidini açmak için lütfen 'mobile_refresh_warning' => 'If you\'re using the mobile app you may need to do a full refresh.', 'enable_proposals_for_background' => 'To upload a background image :link to enable the proposals module.', -); +]; return $LANG; diff --git a/resources/lang/zh_TW/texts.php b/resources/lang/zh_TW/texts.php index 3390d4a6fefb..167b35f69177 100644 --- a/resources/lang/zh_TW/texts.php +++ b/resources/lang/zh_TW/texts.php @@ -1,6 +1,6 @@ '組織', 'name' => '姓名', @@ -1014,7 +1014,6 @@ $LANG = array( 'trial_success' => '已成功地啟用兩星期的專業版免費試用', 'overdue' => '逾期未付', - 'white_label_text' => '以 $:price 購買一年份的白牌授權,在發票與客戶的入口介面移除發票忍者的商標。', 'user_email_footer' => '欲調整您的電子郵件通知設定。請造訪 :link', 'reset_password_footer' => '若您未提出這項重設密碼的要求,請寫電子郵件給我們的客服: :email', @@ -1194,7 +1193,6 @@ $LANG = array( 'enterprise_plan_features' => '企業版進一步支援多使用者與附加檔案, :link 以查看其所有的功能一覽表。', 'return_to_app' => '返回APP', - // Payment updates 'refund_payment' => '已退款的支付', 'refund_max' => '最大值:', @@ -1304,7 +1302,6 @@ $LANG = array( 'token_billing_braintree_paypal' => '儲存付款的詳細資料', 'add_paypal_account' => '新增PayPal帳戶', - 'no_payment_method_specified' => '無指定之付款方式', 'chart_type' => '圖表類型', 'format' => '格式', @@ -2864,6 +2861,6 @@ $LANG = array( 'mobile_refresh_warning' => '若您使用行動裝置APP,您可能需要做一次重新整理。', 'enable_proposals_for_background' => '上傳一個背景圖像 :link以啟用提案模組。', -); +]; return $LANG; diff --git a/resources/views/vendor/mail/html/button.blade.php b/resources/views/vendor/mail/html/button.blade.php index 9d14d9b1619b..22d3868ea79d 100644 --- a/resources/views/vendor/mail/html/button.blade.php +++ b/resources/views/vendor/mail/html/button.blade.php @@ -1,19 +1,19 @@ - - - + + +
- - - - -
- - - - -
- {{ $slot }} -
-
-
+ + + + +
+ + + + +
+{{ $slot }} +
+
+
diff --git a/resources/views/vendor/mail/html/footer.blade.php b/resources/views/vendor/mail/html/footer.blade.php index c3f9360abd4a..bfdb72fef9f8 100644 --- a/resources/views/vendor/mail/html/footer.blade.php +++ b/resources/views/vendor/mail/html/footer.blade.php @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + diff --git a/resources/views/vendor/mail/html/header.blade.php b/resources/views/vendor/mail/html/header.blade.php index eefabab9248b..79971d9e8abf 100644 --- a/resources/views/vendor/mail/html/header.blade.php +++ b/resources/views/vendor/mail/html/header.blade.php @@ -1,7 +1,7 @@ - - - {{ $slot }} - - + + +{{ $slot }} + + diff --git a/resources/views/vendor/mail/html/layout.blade.php b/resources/views/vendor/mail/html/layout.blade.php index 4049a69c9dbb..9eff0f086998 100644 --- a/resources/views/vendor/mail/html/layout.blade.php +++ b/resources/views/vendor/mail/html/layout.blade.php @@ -1,54 +1,54 @@ - - + + - +@media only screen and (max-width: 500px) { +.button { +width: 100% !important; +} +} + - - - + + +{{ $footer ?? '' }} +
- - +
+ + + +
+ - - - - + + + - -
- - - - - -
- {{ Illuminate\Mail\Markdown::parse($slot) }} - {{ $subcopy ?? '' }} -
-
+ + + +
+{{ Illuminate\Mail\Markdown::parse($slot) }} - {{ $footer ?? '' }} -
-
+{{ $subcopy ?? '' }} +
+
+ + + diff --git a/resources/views/vendor/mail/html/message.blade.php b/resources/views/vendor/mail/html/message.blade.php index 1ae9ed8f1bf6..deec4a1f4160 100644 --- a/resources/views/vendor/mail/html/message.blade.php +++ b/resources/views/vendor/mail/html/message.blade.php @@ -1,27 +1,27 @@ @component('mail::layout') - {{-- Header --}} - @slot('header') - @component('mail::header', ['url' => config('app.url')]) - {{ config('app.name') }} - @endcomponent - @endslot - - {{-- Body --}} - {{ $slot }} - - {{-- Subcopy --}} - @isset($subcopy) - @slot('subcopy') - @component('mail::subcopy') - {{ $subcopy }} - @endcomponent - @endslot - @endisset - - {{-- Footer --}} - @slot('footer') - @component('mail::footer') - © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') - @endcomponent - @endslot +{{-- Header --}} +@slot('header') +@component('mail::header', ['url' => config('app.url')]) +{{ config('app.name') }} +@endcomponent +@endslot + +{{-- Body --}} +{{ $slot }} + +{{-- Subcopy --}} +@isset($subcopy) +@slot('subcopy') +@component('mail::subcopy') +{{ $subcopy }} +@endcomponent +@endslot +@endisset + +{{-- Footer --}} +@slot('footer') +@component('mail::footer') +© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') +@endcomponent +@endslot @endcomponent diff --git a/resources/views/vendor/mail/html/panel.blade.php b/resources/views/vendor/mail/html/panel.blade.php index f397080206e6..8eb7d137e4f3 100644 --- a/resources/views/vendor/mail/html/panel.blade.php +++ b/resources/views/vendor/mail/html/panel.blade.php @@ -1,13 +1,13 @@ - - - + + +
- - - - -
- {{ Illuminate\Mail\Markdown::parse($slot) }} -
-
+ + + + +
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
+
diff --git a/resources/views/vendor/mail/html/promotion.blade.php b/resources/views/vendor/mail/html/promotion.blade.php index 0debcf8a3811..c5f3ba4ec47f 100644 --- a/resources/views/vendor/mail/html/promotion.blade.php +++ b/resources/views/vendor/mail/html/promotion.blade.php @@ -1,7 +1,7 @@ - - - + + +
- {{ Illuminate\Mail\Markdown::parse($slot) }} -
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/promotion/button.blade.php b/resources/views/vendor/mail/html/promotion/button.blade.php index 8e79081c52ad..42604a64b049 100644 --- a/resources/views/vendor/mail/html/promotion/button.blade.php +++ b/resources/views/vendor/mail/html/promotion/button.blade.php @@ -1,13 +1,13 @@ - - - + + +
- - - - -
- {{ $slot }} -
-
+ + + + +
+{{ $slot }} +
+
diff --git a/resources/views/vendor/mail/html/subcopy.blade.php b/resources/views/vendor/mail/html/subcopy.blade.php index c3df7b4c0a5b..616ee3fb0bf9 100644 --- a/resources/views/vendor/mail/html/subcopy.blade.php +++ b/resources/views/vendor/mail/html/subcopy.blade.php @@ -1,7 +1,7 @@ - - - + + +
- {{ Illuminate\Mail\Markdown::parse($slot) }} -
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/themes/default.css b/resources/views/vendor/mail/html/themes/default.css index aa4afb266084..b88372dd5da1 100644 --- a/resources/views/vendor/mail/html/themes/default.css +++ b/resources/views/vendor/mail/html/themes/default.css @@ -1,290 +1,290 @@ /* Base */ body, body *:not(html):not(style):not(br):not(tr):not(code) { - font-family: Avenir, Helvetica, sans-serif; - box-sizing: border-box; +font-family: Avenir, Helvetica, sans-serif; +box-sizing: border-box; } body { - background-color: #f5f8fa; - color: #74787E; - height: 100%; - hyphens: auto; - line-height: 1.4; - margin: 0; - -moz-hyphens: auto; - -ms-word-break: break-all; - width: 100% !important; - -webkit-hyphens: auto; - -webkit-text-size-adjust: none; - word-break: break-all; - word-break: break-word; +background-color: #f5f8fa; +color: #74787E; +height: 100%; +hyphens: auto; +line-height: 1.4; +margin: 0; +-moz-hyphens: auto; +-ms-word-break: break-all; +width: 100% !important; +-webkit-hyphens: auto; +-webkit-text-size-adjust: none; +word-break: break-all; +word-break: break-word; } p, ul, ol, blockquote { - line-height: 1.4; - text-align: left; +line-height: 1.4; +text-align: left; } a { - color: #3869D4; +color: #3869D4; } a img { - border: none; +border: none; } /* Typography */ h1 { - color: #2F3133; - font-size: 19px; - font-weight: bold; - margin-top: 0; - text-align: left; +color: #2F3133; +font-size: 19px; +font-weight: bold; +margin-top: 0; +text-align: left; } h2 { - color: #2F3133; - font-size: 16px; - font-weight: bold; - margin-top: 0; - text-align: left; +color: #2F3133; +font-size: 16px; +font-weight: bold; +margin-top: 0; +text-align: left; } h3 { - color: #2F3133; - font-size: 14px; - font-weight: bold; - margin-top: 0; - text-align: left; +color: #2F3133; +font-size: 14px; +font-weight: bold; +margin-top: 0; +text-align: left; } p { - color: #74787E; - font-size: 16px; - line-height: 1.5em; - margin-top: 0; - text-align: left; +color: #74787E; +font-size: 16px; +line-height: 1.5em; +margin-top: 0; +text-align: left; } p.sub { - font-size: 12px; +font-size: 12px; } img { - max-width: 100%; +max-width: 100%; } /* Layout */ .wrapper { - background-color: #f5f8fa; - margin: 0; - padding: 0; - width: 100%; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; +background-color: #f5f8fa; +margin: 0; +padding: 0; +width: 100%; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 100%; } .content { - margin: 0; - padding: 0; - width: 100%; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; +margin: 0; +padding: 0; +width: 100%; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 100%; } /* Header */ .header { - padding: 25px 0; - text-align: center; +padding: 25px 0; +text-align: center; } .header a { - color: #bbbfc3; - font-size: 19px; - font-weight: bold; - text-decoration: none; - text-shadow: 0 1px 0 white; +color: #bbbfc3; +font-size: 19px; +font-weight: bold; +text-decoration: none; +text-shadow: 0 1px 0 white; } /* Body */ .body { - background-color: #FFFFFF; - border-bottom: 1px solid #EDEFF2; - border-top: 1px solid #EDEFF2; - margin: 0; - padding: 0; - width: 100%; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; +background-color: #FFFFFF; +border-bottom: 1px solid #EDEFF2; +border-top: 1px solid #EDEFF2; +margin: 0; +padding: 0; +width: 100%; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 100%; } .inner-body { - background-color: #FFFFFF; - margin: 0 auto; - padding: 0; - width: 570px; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 570px; +background-color: #FFFFFF; +margin: 0 auto; +padding: 0; +width: 570px; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 570px; } /* Subcopy */ .subcopy { - border-top: 1px solid #EDEFF2; - margin-top: 25px; - padding-top: 25px; +border-top: 1px solid #EDEFF2; +margin-top: 25px; +padding-top: 25px; } .subcopy p { - font-size: 12px; +font-size: 12px; } /* Footer */ .footer { - margin: 0 auto; - padding: 0; - text-align: center; - width: 570px; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 570px; +margin: 0 auto; +padding: 0; +text-align: center; +width: 570px; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 570px; } .footer p { - color: #AEAEAE; - font-size: 12px; - text-align: center; +color: #AEAEAE; +font-size: 12px; +text-align: center; } /* Tables */ .table table { - margin: 30px auto; - width: 100%; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; +margin: 30px auto; +width: 100%; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 100%; } .table th { - border-bottom: 1px solid #EDEFF2; - padding-bottom: 8px; - margin: 0; +border-bottom: 1px solid #EDEFF2; +padding-bottom: 8px; +margin: 0; } .table td { - color: #74787E; - font-size: 15px; - line-height: 18px; - padding: 10px 0; - margin: 0; +color: #74787E; +font-size: 15px; +line-height: 18px; +padding: 10px 0; +margin: 0; } .content-cell { - padding: 35px; +padding: 35px; } /* Buttons */ .action { - margin: 30px auto; - padding: 0; - text-align: center; - width: 100%; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; +margin: 30px auto; +padding: 0; +text-align: center; +width: 100%; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 100%; } .button { - border-radius: 3px; - box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); - color: #FFF; - display: inline-block; - text-decoration: none; - -webkit-text-size-adjust: none; +border-radius: 3px; +box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); +color: #FFF; +display: inline-block; +text-decoration: none; +-webkit-text-size-adjust: none; } .button-blue, .button-primary { - background-color: #3097D1; - border-top: 10px solid #3097D1; - border-right: 18px solid #3097D1; - border-bottom: 10px solid #3097D1; - border-left: 18px solid #3097D1; +background-color: #3097D1; +border-top: 10px solid #3097D1; +border-right: 18px solid #3097D1; +border-bottom: 10px solid #3097D1; +border-left: 18px solid #3097D1; } .button-green, .button-success { - background-color: #2ab27b; - border-top: 10px solid #2ab27b; - border-right: 18px solid #2ab27b; - border-bottom: 10px solid #2ab27b; - border-left: 18px solid #2ab27b; +background-color: #2ab27b; +border-top: 10px solid #2ab27b; +border-right: 18px solid #2ab27b; +border-bottom: 10px solid #2ab27b; +border-left: 18px solid #2ab27b; } .button-red, .button-error { - background-color: #bf5329; - border-top: 10px solid #bf5329; - border-right: 18px solid #bf5329; - border-bottom: 10px solid #bf5329; - border-left: 18px solid #bf5329; +background-color: #bf5329; +border-top: 10px solid #bf5329; +border-right: 18px solid #bf5329; +border-bottom: 10px solid #bf5329; +border-left: 18px solid #bf5329; } /* Panels */ .panel { - margin: 0 0 21px; +margin: 0 0 21px; } .panel-content { - background-color: #EDEFF2; - padding: 16px; +background-color: #EDEFF2; +padding: 16px; } .panel-item { - padding: 0; +padding: 0; } .panel-item p:last-of-type { - margin-bottom: 0; - padding-bottom: 0; +margin-bottom: 0; +padding-bottom: 0; } /* Promotions */ .promotion { - background-color: #FFFFFF; - border: 2px dashed #9BA2AB; - margin: 0; - margin-bottom: 25px; - margin-top: 25px; - padding: 24px; - width: 100%; - -premailer-cellpadding: 0; - -premailer-cellspacing: 0; - -premailer-width: 100%; +background-color: #FFFFFF; +border: 2px dashed #9BA2AB; +margin: 0; +margin-bottom: 25px; +margin-top: 25px; +padding: 24px; +width: 100%; +-premailer-cellpadding: 0; +-premailer-cellspacing: 0; +-premailer-width: 100%; } .promotion h1 { - text-align: center; +text-align: center; } .promotion p { - font-size: 15px; - text-align: center; +font-size: 15px; +text-align: center; } diff --git a/resources/views/vendor/mail/markdown/message.blade.php b/resources/views/vendor/mail/markdown/message.blade.php index 1ae9ed8f1bf6..deec4a1f4160 100644 --- a/resources/views/vendor/mail/markdown/message.blade.php +++ b/resources/views/vendor/mail/markdown/message.blade.php @@ -1,27 +1,27 @@ @component('mail::layout') - {{-- Header --}} - @slot('header') - @component('mail::header', ['url' => config('app.url')]) - {{ config('app.name') }} - @endcomponent - @endslot - - {{-- Body --}} - {{ $slot }} - - {{-- Subcopy --}} - @isset($subcopy) - @slot('subcopy') - @component('mail::subcopy') - {{ $subcopy }} - @endcomponent - @endslot - @endisset - - {{-- Footer --}} - @slot('footer') - @component('mail::footer') - © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') - @endcomponent - @endslot +{{-- Header --}} +@slot('header') +@component('mail::header', ['url' => config('app.url')]) +{{ config('app.name') }} +@endcomponent +@endslot + +{{-- Body --}} +{{ $slot }} + +{{-- Subcopy --}} +@isset($subcopy) +@slot('subcopy') +@component('mail::subcopy') +{{ $subcopy }} +@endcomponent +@endslot +@endisset + +{{-- Footer --}} +@slot('footer') +@component('mail::footer') +© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') +@endcomponent +@endslot @endcomponent diff --git a/resources/views/vendor/mail/text/message.blade.php b/resources/views/vendor/mail/text/message.blade.php index 1ae9ed8f1bf6..deec4a1f4160 100644 --- a/resources/views/vendor/mail/text/message.blade.php +++ b/resources/views/vendor/mail/text/message.blade.php @@ -1,27 +1,27 @@ @component('mail::layout') - {{-- Header --}} - @slot('header') - @component('mail::header', ['url' => config('app.url')]) - {{ config('app.name') }} - @endcomponent - @endslot - - {{-- Body --}} - {{ $slot }} - - {{-- Subcopy --}} - @isset($subcopy) - @slot('subcopy') - @component('mail::subcopy') - {{ $subcopy }} - @endcomponent - @endslot - @endisset - - {{-- Footer --}} - @slot('footer') - @component('mail::footer') - © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') - @endcomponent - @endslot +{{-- Header --}} +@slot('header') +@component('mail::header', ['url' => config('app.url')]) +{{ config('app.name') }} +@endcomponent +@endslot + +{{-- Body --}} +{{ $slot }} + +{{-- Subcopy --}} +@isset($subcopy) +@slot('subcopy') +@component('mail::subcopy') +{{ $subcopy }} +@endcomponent +@endslot +@endisset + +{{-- Footer --}} +@slot('footer') +@component('mail::footer') +© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') +@endcomponent +@endslot @endcomponent diff --git a/routes/api.php b/routes/api.php index 536fc19347e8..91ed5e17f3e3 100644 --- a/routes/api.php +++ b/routes/api.php @@ -22,7 +22,6 @@ Route::group(['api_secret_check', 'email_db'], function () { }); Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () { - Route::get('ping', 'PingController@index')->name('ping'); Route::get('health_check', 'PingController@health')->name('health_check'); @@ -30,11 +29,11 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::get('activities/download_entity/{activity}', 'ActivityController@downloadHistoricalEntity'); - Route::resource('clients', 'ClientController');// name = (clients. index / create / show / update / destroy / edit + Route::resource('clients', 'ClientController'); // name = (clients. index / create / show / update / destroy / edit Route::post('clients/bulk', 'ClientController@bulk')->name('clients.bulk'); - Route::resource('invoices', 'InvoiceController');// name = (invoices. index / create / show / update / destroy / edit + Route::resource('invoices', 'InvoiceController'); // name = (invoices. index / create / show / update / destroy / edit Route::get('invoices/{invoice}/{action}', 'InvoiceController@action')->name('invoices.action'); @@ -42,49 +41,49 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::post('invoices/bulk', 'InvoiceController@bulk')->name('invoices.bulk'); - Route::resource('credits', 'CreditController');// name = (credits. index / create / show / update / destroy / edit + Route::resource('credits', 'CreditController'); // name = (credits. index / create / show / update / destroy / edit Route::get('credits/{credit}/{action}', 'CreditController@action')->name('credits.action'); Route::post('credits/bulk', 'CreditController@bulk')->name('credits.bulk'); - Route::resource('products', 'ProductController');// name = (products. index / create / show / update / destroy / edit + Route::resource('products', 'ProductController'); // name = (products. index / create / show / update / destroy / edit Route::post('products/bulk', 'ProductController@bulk')->name('products.bulk'); - Route::resource('quotes', 'QuoteController');// name = (quotes. index / create / show / update / destroy / edit + Route::resource('quotes', 'QuoteController'); // name = (quotes. index / create / show / update / destroy / edit Route::get('quotes/{quote}/{action}', 'QuoteController@action')->name('quotes.action'); Route::post('quotes/bulk', 'QuoteController@bulk')->name('quotes.bulk'); - Route::resource('recurring_invoices', 'RecurringInvoiceController');// name = (recurring_invoices. index / create / show / update / destroy / edit + Route::resource('recurring_invoices', 'RecurringInvoiceController'); // name = (recurring_invoices. index / create / show / update / destroy / edit Route::post('recurring_invoices/bulk', 'RecurringInvoiceController@bulk')->name('recurring_invoices.bulk'); - Route::resource('recurring_quotes', 'RecurringQuoteController');// name = (recurring_invoices. index / create / show / update / destroy / edit + Route::resource('recurring_quotes', 'RecurringQuoteController'); // name = (recurring_invoices. index / create / show / update / destroy / edit Route::post('recurring_quotes/bulk', 'RecurringQuoteController@bulk')->name('recurring_quotes.bulk'); - Route::resource('expenses', 'ExpenseController');// name = (expenses. index / create / show / update / destroy / edit + Route::resource('expenses', 'ExpenseController'); // name = (expenses. index / create / show / update / destroy / edit Route::post('expenses/bulk', 'ExpenseController@bulk')->name('expenses.bulk'); - Route::resource('vendors', 'VendorController');// name = (vendors. index / create / show / update / destroy / edit + Route::resource('vendors', 'VendorController'); // name = (vendors. index / create / show / update / destroy / edit Route::post('vendors/bulk', 'VendorController@bulk')->name('vendors.bulk'); - Route::resource('documents', 'DocumentController');// name = (documents. index / create / show / update / destroy / edit + Route::resource('documents', 'DocumentController'); // name = (documents. index / create / show / update / destroy / edit Route::get('documents/{document}/download', 'DocumentController@download')->name('documents.download'); Route::post('documents/bulk', 'DocumentController@bulk')->name('documents.bulk'); - Route::resource('client_statement', 'ClientStatementController@statement');// name = (client_statement. index / create / show / update / destroy / edit + Route::resource('client_statement', 'ClientStatementController@statement'); // name = (client_statement. index / create / show / update / destroy / edit - Route::resource('payment_terms', 'PaymentTermController');// name = (payments. index / create / show / update / destroy / edit + Route::resource('payment_terms', 'PaymentTermController'); // name = (payments. index / create / show / update / destroy / edit Route::post('payment_terms/bulk', 'PaymentTermController@bulk')->name('payment_terms.bulk'); - Route::resource('payments', 'PaymentController');// name = (payments. index / create / show / update / destroy / edit + Route::resource('payments', 'PaymentController'); // name = (payments. index / create / show / update / destroy / edit Route::post('payments/refund', 'PaymentController@refund')->name('payments.refund'); @@ -92,7 +91,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::post('migrate', 'MigrationController@index')->name('migrate.start'); - Route::resource('designs', 'DesignController');// name = (payments. index / create / show / update / destroy / edit + Route::resource('designs', 'DesignController'); // name = (payments. index / create / show / update / destroy / edit Route::post('designs/bulk', 'DesignController@bulk')->name('designs.bulk'); Route::get('users', 'UserController@index'); @@ -109,14 +108,13 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::post('migration/start/{company}', 'MigrationController@startMigration'); - Route::resource('companies', 'CompanyController');// name = (companies. index / create / show / update / destroy / edit - - Route::resource('tokens', 'TokenController')->middleware('password_protected');// name = (tokens. index / create / show / update / destroy / edit + Route::resource('companies', 'CompanyController'); // name = (companies. index / create / show / update / destroy / edit + + Route::resource('tokens', 'TokenController')->middleware('password_protected'); // name = (tokens. index / create / show / update / destroy / edit Route::post('tokens/bulk', 'TokenController@bulk')->name('tokens.bulk')->middleware('password_protected'); - Route::resource('company_gateways', 'CompanyGatewayController'); - + Route::post('company_gateways/bulk', 'CompanyGatewayController@bulk')->name('company_gateways.bulk'); Route::put('company_users/{user}', 'CompanyUserController@update'); @@ -124,13 +122,13 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::resource('group_settings', 'GroupSettingController'); Route::post('group_settings/bulk', 'GroupSettingController@bulk'); - Route::resource('tax_rates', 'TaxRateController');// name = (tasks. index / create / show / update / destroy / edit + Route::resource('tax_rates', 'TaxRateController'); // name = (tasks. index / create / show / update / destroy / edit Route::post('tax_rates/bulk', 'TaxRateController@bulk')->name('tax_rates.bulk'); Route::post('refresh', 'Auth\LoginController@refresh'); Route::post('templates', 'TemplateController@show')->name('templates.show'); - + Route::post('preview', 'PreviewController@show')->name('preview.show'); Route::post('self-update', 'SelfUpdateController@update')->middleware('password_protected'); @@ -147,7 +145,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::resource('webhooks', 'WebhookController'); Route::resource('system_logs', 'SystemLogController'); - + Route::post('webhooks/bulk', 'WebhookController@bulk')->name('webhooks.bulk'); /*Company Ledger */ diff --git a/routes/client.php b/routes/client.php index b1a32d5d4ed9..c30b6217f1ee 100644 --- a/routes/client.php +++ b/routes/client.php @@ -2,7 +2,7 @@ use Illuminate\Support\Facades\Route; -Route::get('client', 'Auth\ContactLoginController@showLoginForm')->name('client.login'); //catch all +Route::get('client', 'Auth\ContactLoginController@showLoginForm')->name('client.catchall'); //catch all Route::get('client/login', 'Auth\ContactLoginController@showLoginForm')->name('client.login')->middleware('locale'); Route::post('client/login', 'Auth\ContactLoginController@login')->name('client.login.submit'); @@ -20,7 +20,7 @@ Route::get('view/{entity_type}/{invitation_key}/password', 'ClientPortal\EntityV Route::post('view/{entity_type}/{invitation_key}/password', 'ClientPortal\EntityViewController@handlePassword'); //todo implement domain DB -Route::group(['middleware' => ['auth:contact','locale'], 'prefix' => 'client', 'as' => 'client.'], function () { +Route::group(['middleware' => ['auth:contact', 'locale'], 'prefix' => 'client', 'as' => 'client.'], function () { Route::get('dashboard', 'ClientPortal\DashboardController@index')->name('dashboard'); // name = (dashboard. index / create / show / update / destroy / edit Route::get('invoices', 'ClientPortal\InvoiceController@index')->name('invoices.index')->middleware('portal_enabled'); @@ -46,7 +46,7 @@ Route::group(['middleware' => ['auth:contact','locale'], 'prefix' => 'client', ' Route::get('payment_methods/{payment_method}/verification', 'ClientPortal\PaymentMethodController@verify')->name('payment_methods.verification'); Route::post('payment_methods/{payment_method}/verification', 'ClientPortal\PaymentMethodController@processVerification'); - Route::resource('payment_methods', 'ClientPortal\PaymentMethodController');// name = (payment_methods. index / create / show / update / destroy / edit + Route::resource('payment_methods', 'ClientPortal\PaymentMethodController'); // name = (payment_methods. index / create / show / update / destroy / edit Route::match(['GET', 'POST'], 'quotes/approve', 'ClientPortal\QuoteController@bulk')->name('quotes.bulk'); Route::get('quotes', 'ClientPortal\QuoteController@index')->name('quotes.index')->middleware('portal_enabled'); @@ -79,9 +79,8 @@ Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'clie Route::get('{entity}/{client_hash}/{invitation_key}', 'ClientPortal\InvitationController@routerForIframe')->name('invoice.client_hash_and_invitation_key'); //should never need this Route::get('payment_hook/{company_gateway_id}/{gateway_type_id}', 'ClientPortal\PaymentHookController@process'); - }); -Route::get('phantom/{entity}/{invitation_key}', '\App\Utils\PhantomJS\Phantom@displayInvitation')->middleware(['invite_db','phantom_secret'])->name('phantom_view'); +Route::get('phantom/{entity}/{invitation_key}', '\App\Utils\PhantomJS\Phantom@displayInvitation')->middleware(['invite_db', 'phantom_secret'])->name('phantom_view'); Route::fallback('BaseController@notFoundClient'); diff --git a/routes/contact.php b/routes/contact.php index 22dcd9de7428..e20f5fef4346 100644 --- a/routes/contact.php +++ b/routes/contact.php @@ -17,6 +17,6 @@ Route::group(['middleware' => ['api_secret_check']], function () { Route::post('api/v1/contact/login', 'Contact\LoginController@apiLogin'); }); -Route::group(['middleware' => ['contact_db','api_secret_check','contact_token_auth'], 'prefix' =>'api/v1/contact', 'as' => 'api.contact.'], function () { +Route::group(['middleware' => ['contact_db', 'api_secret_check', 'contact_token_auth'], 'prefix' =>'api/v1/contact', 'as' => 'api.contact.'], function () { Route::get('invoices', 'Contact\InvoiceController@index'); // name = (clients. index / create / show / update / destroy / edit }); diff --git a/routes/shop.php b/routes/shop.php index da600175b427..a522eecb1276 100644 --- a/routes/shop.php +++ b/routes/shop.php @@ -2,13 +2,12 @@ use Illuminate\Support\Facades\Route; -Route::group(['middleware' => ['company_key_db','locale'], 'prefix' => 'api/v1'], function () { - - Route::get('shop/products', 'Shop\ProductController@index'); - Route::post('shop/clients', 'Shop\ClientController@store'); - Route::post('shop/invoices', 'Shop\InvoiceController@store'); - Route::get('shop/client/{contact_key}', 'Shop\ClientController@show'); - Route::get('shop/invoice/{invitation_key}', 'Shop\InvoiceController@show'); - Route::get('shop/product/{product_key}', 'Shop\ProductController@show'); - Route::get('shop/profile', 'Shop\ProfileController@show'); -}); \ No newline at end of file +Route::group(['middleware' => ['company_key_db', 'locale'], 'prefix' => 'api/v1'], function () { + Route::get('shop/products', 'Shop\ProductController@index'); + Route::post('shop/clients', 'Shop\ClientController@store'); + Route::post('shop/invoices', 'Shop\InvoiceController@store'); + Route::get('shop/client/{contact_key}', 'Shop\ClientController@show'); + Route::get('shop/invoice/{invitation_key}', 'Shop\InvoiceController@show'); + Route::get('shop/product/{product_key}', 'Shop\ProductController@show'); + Route::get('shop/profile', 'Shop\ProfileController@show'); +}); diff --git a/routes/web.php b/routes/web.php index 7776fe65edc2..e26102700eb3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,8 @@ use Illuminate\Support\Facades\Route; +//Auth::routes(['password.reset' => false]); + Route::get('/', 'BaseController@flutterRoute')->middleware('guest'); Route::get('setup', 'SetupController@index')->middleware('guest'); @@ -13,7 +15,7 @@ Route::post('setup/check_pdf', 'SetupController@checkPdf')->middleware('guest'); Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); -Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); +//Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update'); /* @@ -29,4 +31,4 @@ Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('passw Route::group(['middleware' => ['url_db']], function () { Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm'); Route::post('/user/confirm/{confirmation_code}', 'UserController@confirmWithPassword'); -}); \ No newline at end of file +}); diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 494cc8d72ab5..9deab17d51a3 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -2,10 +2,10 @@ namespace Tests; -use Laravel\Dusk\TestCase as BaseTestCase; use Facebook\WebDriver\Chrome\ChromeOptions; -use Facebook\WebDriver\Remote\RemoteWebDriver; use Facebook\WebDriver\Remote\DesiredCapabilities; +use Facebook\WebDriver\Remote\RemoteWebDriver; +use Laravel\Dusk\TestCase as BaseTestCase; abstract class DuskTestCase extends BaseTestCase { diff --git a/tests/Feature/CancelInvoiceTest.php b/tests/Feature/CancelInvoiceTest.php index 5e38385358d7..89667fb75739 100644 --- a/tests/Feature/CancelInvoiceTest.php +++ b/tests/Feature/CancelInvoiceTest.php @@ -26,7 +26,6 @@ use Tests\TestCase; * @test * @covers App\Services\Invoice\HandleCancellation */ - class CancelInvoiceTest extends TestCase { use MakesHash; diff --git a/tests/Feature/ClientApiTest.php b/tests/Feature/ClientApiTest.php index 6e9029acf388..18b284f151db 100644 --- a/tests/Feature/ClientApiTest.php +++ b/tests/Feature/ClientApiTest.php @@ -43,20 +43,17 @@ class ClientApiTest extends TestCase Model::reguard(); } - public function testClientPost() { $data = [ 'name' => $this->faker->firstName, ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients', $data); - $response->assertStatus(200); } @@ -67,13 +64,11 @@ class ClientApiTest extends TestCase 'id_number' => 'Coolio', ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->put('/api/v1/clients/'.$this->encodePrimaryKey($this->client->id), $data); - $response->assertStatus(200); } @@ -81,10 +76,9 @@ class ClientApiTest extends TestCase { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/clients/'.$this->encodePrimaryKey($this->client->id)); - $response->assertStatus(200); } @@ -92,7 +86,7 @@ class ClientApiTest extends TestCase { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/clients/'.$this->encodePrimaryKey($this->client->id)); $arr = $response->json(); @@ -106,27 +100,25 @@ class ClientApiTest extends TestCase 'ids' => [$this->encodePrimaryKey($this->client->id)], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/bulk?action=archive', $data); $arr = $response->json(); $this->assertNotNull($arr['data'][0]['archived_at']); } - + public function testClientRestored() { $data = [ 'ids' => [$this->encodePrimaryKey($this->client->id)], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/bulk?action=restore', $data); $arr = $response->json(); @@ -140,10 +132,9 @@ class ClientApiTest extends TestCase 'ids' => [$this->encodePrimaryKey($this->client->id)], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/bulk?action=delete', $data); $arr = $response->json(); diff --git a/tests/Feature/ClientModelTest.php b/tests/Feature/ClientModelTest.php index 86233e032386..1af904756153 100644 --- a/tests/Feature/ClientModelTest.php +++ b/tests/Feature/ClientModelTest.php @@ -19,19 +19,18 @@ class ClientModelTest extends TestCase public function setUp() :void { parent::setUp(); - + $this->makeTestData(); if (config('ninja.testvars.travis') !== false) { $this->markTestSkipped('Skip test for Travis'); } - if (!config('ninja.testvars.stripe')) { + if (! config('ninja.testvars.stripe')) { $this->markTestSkipped('Skip test no company gateways installed'); } } - public function testPaymentMethods() { $amount = 40; @@ -39,7 +38,7 @@ class ClientModelTest extends TestCase $company_gateways = $this->client->getSetting('company_gateway_ids'); //todo create a test where we actually SET a value in the settings->company_gateways object and test if we can harvest. - + if ($company_gateways) { $gateways = $this->company->company_gateways->whereIn('id', $payment_gateways); } else { @@ -51,7 +50,7 @@ class ClientModelTest extends TestCase $pre_count = $gateways->count(); $gateways->filter(function ($method) use ($amount) { - if ($method->min_limit !== null && $amount < $method->min_limit) { + if ($method->min_limit !== null && $amount < $method->min_limit) { return false; } @@ -71,7 +70,7 @@ class ClientModelTest extends TestCase $payment_methods[] = [$gateway->id => $type]; } } - + $this->assertEquals(8, count($payment_methods)); $payment_methods_collections = collect($payment_methods); @@ -92,15 +91,14 @@ class ClientModelTest extends TestCase $fee_label = $gateway->calcGatewayFeeLabel($amount, $this->client); $payment_urls[] = [ - 'label' => ctrans('texts.' . $gateway->getTypeAlias($gateway_type_id)) . $fee_label, + 'label' => ctrans('texts.'.$gateway->getTypeAlias($gateway_type_id)).$fee_label, 'url' => URL::signedRoute('client.payments.process', [ 'company_gateway_id' => $gateway_id, - 'gateway_type_id' => $gateway_type_id]) + 'gateway_type_id' => $gateway_type_id, ]), ]; } } - $this->assertEquals(4, count($payment_urls)); } } diff --git a/tests/Feature/ClientPresenterTest.php b/tests/Feature/ClientPresenterTest.php index c4a36387f606..1859881e3451 100644 --- a/tests/Feature/ClientPresenterTest.php +++ b/tests/Feature/ClientPresenterTest.php @@ -19,7 +19,7 @@ class ClientPresenterTest extends TestCase public function setUp() :void { parent::setUp(); - + $this->makeTestData(); } @@ -30,7 +30,7 @@ class ClientPresenterTest extends TestCase $settings->name = 'test'; $this->client->company->settings = $settings; $this->client->company->save(); - + $this->client->getSetting('name'); $merged_settings = $this->client->getMergedSettings(); diff --git a/tests/Feature/ClientTest.php b/tests/Feature/ClientTest.php index 04483bcfa817..c43c269ff2d8 100644 --- a/tests/Feature/ClientTest.php +++ b/tests/Feature/ClientTest.php @@ -55,7 +55,6 @@ class ClientTest extends TestCase ); $this->makeTestData(); - } public function testStoreClientUsingCountryCode() @@ -71,7 +70,6 @@ class ClientTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/', $data); - $arr = $response->json(); $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); @@ -89,14 +87,12 @@ class ClientTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/', $data); - $arr = $response->json(); $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); $this->assertEquals(840, $client->country_id); $this->assertEquals(1, $client->settings->currency_id); - $data = [ 'name' => 'Country Code Name', 'country_code' => 'AU', @@ -108,7 +104,6 @@ class ClientTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/', $data); - $arr = $response->json(); $client = Client::find($this->decodePrimaryKey($arr['data']['id'])); @@ -118,7 +113,6 @@ class ClientTest extends TestCase public function testClientList() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -132,20 +126,18 @@ class ClientTest extends TestCase */ public function testClientRestEndPoints() { - - - factory(\App\Models\Client::class, 3)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c){ + factory(\App\Models\Client::class, 3)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 2)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, - 'company_id' => $this->company->id + 'company_id' => $this->company->id, ]); }); @@ -164,7 +156,7 @@ class ClientTest extends TestCase $response->assertStatus(200); $client_update = [ - 'name' => 'A Funky Name' + 'name' => 'A Funky Name', ]; $response = $this->withHeaders([ @@ -180,22 +172,19 @@ class ClientTest extends TestCase $response->assertStatus(200); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/', ['name' => 'New Client']) ->assertStatus(200); - $response->assertStatus(200); $this->client->is_deleted = true; $this->client->save(); - $client_update = [ - 'name' => 'Double Funk' + 'name' => 'Double Funk', ]; $response = $this->withHeaders([ @@ -218,17 +207,16 @@ class ClientTest extends TestCase $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'confirmation_code' => $this->createDbHash(config('database.default')), - 'email' => 'whiz@gmail.com' + 'email' => 'whiz@gmail.com', ]); - $userPermissions = collect([ 'view_invoice', 'view_client', 'edit_client', 'edit_invoice', 'create_invoice', - 'create_client' + 'create_client', ]); $userSettings = DefaultSettings::userSettings(); @@ -254,7 +242,7 @@ class ClientTest extends TestCase factory(\App\Models\ClientContact::class, 2)->create([ 'user_id' => $user->id, 'client_id' => $c->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); }); @@ -272,7 +260,6 @@ class ClientTest extends TestCase $this->assertEquals($this->client->contacts->count(), 3); } - public function testCreatingClientAndContacts() { $account = factory(\App\Models\Account::class)->create(); @@ -286,7 +273,7 @@ class ClientTest extends TestCase $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, 'confirmation_code' => $this->createDbHash(config('database.default')), - 'email' => 'whiz@gmail.com' + 'email' => 'whiz@gmail.com', ]); @@ -304,21 +291,19 @@ class ClientTest extends TestCase $company_token->user_id = $user->id; $company_token->company_id = $company->id; $company_token->account_id = $account->id; - $company_token->name = $user->first_name. ' '. $user->last_name; + $company_token->name = $user->first_name.' '.$user->last_name; $company_token->token = Str::random(64); $company_token->save(); - $this->token = $company_token->token; $data = [ 'name' => 'A loyal Client', 'contacts' => [ - ['email' => $this->faker->unique()->safeEmail] - ] + ['email' => $this->faker->unique()->safeEmail], + ], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -333,26 +318,24 @@ class ClientTest extends TestCase [ 'email' => $this->faker->unique()->safeEmail, 'password' => '*****', - ] - ] + ], + ], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/clients/', $data) ->assertStatus(200); - $data = [ 'name' => 'A loyal Client', 'contacts' => [ [ 'email' => $this->faker->unique()->safeEmail, - 'password' => '1' - ] - ] + 'password' => '1', + ], + ], ]; $response = null; @@ -372,9 +355,9 @@ class ClientTest extends TestCase 'contacts' => [ [ 'email' => $this->faker->unique()->safeEmail, - 'password' => '1Qajsj...33' + 'password' => '1Qajsj...33', ], - ] + ], ]; $response = null; @@ -395,13 +378,13 @@ class ClientTest extends TestCase 'contacts' => [ [ 'email' => $this->faker->unique()->safeEmail, - 'password' => '1Qajsj...33' + 'password' => '1Qajsj...33', ], [ 'email' => $this->faker->unique()->safeEmail, - 'password' => '1234AAAAAaaaaa' + 'password' => '1234AAAAAaaaaa', ], - ] + ], ]; $response = null; @@ -418,7 +401,6 @@ class ClientTest extends TestCase $response->assertStatus(200); - $arr = $response->json(); $this->client_id = $arr['data']['id']; @@ -426,7 +408,7 @@ class ClientTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->put('/api/v1/clients/' . $this->client_id, $data)->assertStatus(200); + ])->put('/api/v1/clients/'.$this->client_id, $data)->assertStatus(200); $arr = $response->json(); @@ -437,9 +419,9 @@ class ClientTest extends TestCase 'contacts' => [ [ 'email' => $safe_email, - 'password' => '' + 'password' => '', ], - ] + ], ]; $response = null; @@ -471,9 +453,9 @@ class ClientTest extends TestCase 'contacts' => [ [ 'email' => $safe_email, - 'password' => 'AFancyDancy191$Password' + 'password' => 'AFancyDancy191$Password', ], - ] + ], ]; $response = null; @@ -506,9 +488,9 @@ class ClientTest extends TestCase [ 'id' => $contact->hashed_id, 'email' => $safe_email, - 'password' => '*****' + 'password' => '*****', ], - ] + ], ]; $response = null; @@ -517,7 +499,7 @@ class ClientTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->put('/api/v1/clients/' . $this->client->hashed_id, $data); + ])->put('/api/v1/clients/'.$this->client->hashed_id, $data); } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); @@ -534,6 +516,4 @@ class ClientTest extends TestCase $this->assertEquals($password, $contact->password); } - - } diff --git a/tests/Feature/CompanyGatewayApiTest.php b/tests/Feature/CompanyGatewayApiTest.php index aa0ab792d2c5..ecfaa40557c9 100644 --- a/tests/Feature/CompanyGatewayApiTest.php +++ b/tests/Feature/CompanyGatewayApiTest.php @@ -48,10 +48,8 @@ class CompanyGatewayApiTest extends TestCase Model::reguard(); } - public function testCompanyGatewayEndPoints() { - $data = [ 'config' => 'random config', 'gateway_key' => '3b6621f970ab18887c4f6dca78d3f8bb', @@ -60,7 +58,7 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); $cg = $response->json(); @@ -78,27 +76,24 @@ class CompanyGatewayApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->put("/api/v1/company_gateways/".$cg_id, $data); + 'X-API-TOKEN' => $this->token, + ])->put('/api/v1/company_gateways/'.$cg_id, $data); $response->assertStatus(200); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->delete("/api/v1/company_gateways/{$cg_id}", $data); $response->assertStatus(200); - } - public function testCompanyGatewayFeesAndLimitsSuccess() { - $fee = new FeesAndLimits; - $fee = (array)$fee; + $fee = (array) $fee; $fee_and_limit['1'] = ['min_limit' => 1]; $fee_and_limit['2'] = ['min_limit' => 1]; @@ -115,7 +110,7 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); $cg = $response->json(); @@ -130,10 +125,9 @@ class CompanyGatewayApiTest extends TestCase $response->assertStatus(200); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/company_gateways/'.$this->encodePrimaryKey($cg['data']['id'])); $cg = $response->json(); @@ -141,10 +135,8 @@ class CompanyGatewayApiTest extends TestCase $response->assertStatus(200); } - public function testCompanyGatewayFeesAndLimitsFails() { - $fee_and_limit['bank_transfer'] = new FeesAndLimits; $fee_and_limit['bank_transfer']->adjust_fee_percent = 10; @@ -158,22 +150,20 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); } public function testCompanyGatewayArrayBuilder() { - $arr = [ 'min_limit' => 1, - 'max_limit' => 2 + 'max_limit' => 2, ]; - $fal = (array)new FeesAndLimits; + $fal = (array) new FeesAndLimits; $new_arr = array_replace($fal, $arr); @@ -190,7 +180,7 @@ class CompanyGatewayApiTest extends TestCase // $fee->fee_tax_name1 = 'GST'; // $fee->fee_tax_rate1 = '10.0'; - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -201,10 +191,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -220,11 +209,11 @@ class CompanyGatewayApiTest extends TestCase //{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}} $fee = new FeesAndLimits; //$fee->fee_amount = 10; - $fee->fee_percent = 2; + $fee->fee_percent = 2; // $fee->fee_tax_name1 = 'GST'; // $fee->fee_tax_rate1 = '10.0'; - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -235,10 +224,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -254,11 +242,11 @@ class CompanyGatewayApiTest extends TestCase //{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}} $fee = new FeesAndLimits; $fee->fee_amount = 10; - $fee->fee_percent = 2; + $fee->fee_percent = 2; // $fee->fee_tax_name1 = 'GST'; // $fee->fee_tax_rate1 = '10.0'; - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -269,10 +257,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -292,7 +279,7 @@ class CompanyGatewayApiTest extends TestCase $fee->fee_tax_name1 = 'GST'; $fee->fee_tax_rate1 = '10.0'; - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -303,10 +290,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -326,7 +312,7 @@ class CompanyGatewayApiTest extends TestCase $fee->fee_tax_name1 = 'GST'; $fee->fee_tax_rate1 = '10.0'; - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -337,10 +323,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -362,8 +347,7 @@ class CompanyGatewayApiTest extends TestCase $fee->fee_tax_name2 = 'GST'; $fee->fee_tax_rate2 = '10.0'; - - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -374,10 +358,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -385,10 +368,9 @@ class CompanyGatewayApiTest extends TestCase $company_gateway = CompanyGateway::find($id); - $this->assertEquals(12, $company_gateway->calcGatewayFee(10,true)); + $this->assertEquals(12, $company_gateway->calcGatewayFee(10, true)); } - public function testFeesAndLimitsFeePercentAndAmountAndDoubleTaxCalcuationWithFeeCap() { //{"1":{"min_limit":1,"max_limit":1000000,"fee_amount":10,"fee_percent":2,"fee_tax_name1":"","fee_tax_name2":"","fee_tax_name3":"","fee_tax_rate1":0,"fee_tax_rate2":0,"fee_tax_rate3":0,"fee_cap":10,"adjust_fee_percent":true}} @@ -401,7 +383,7 @@ class CompanyGatewayApiTest extends TestCase $fee->fee_tax_rate2 = '10.0'; $fee->fee_cap = 1; - $fee_arr[1] = (array)$fee; + $fee_arr[1] = (array) $fee; $data = [ 'config' => 'random config', @@ -412,10 +394,9 @@ class CompanyGatewayApiTest extends TestCase /* POST */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/company_gateways', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -423,6 +404,6 @@ class CompanyGatewayApiTest extends TestCase $company_gateway = CompanyGateway::find($id); - $this->assertEquals(1.2, $company_gateway->calcGatewayFee(10,true)); + $this->assertEquals(1.2, $company_gateway->calcGatewayFee(10, true)); } } diff --git a/tests/Feature/CompanyGatewayTest.php b/tests/Feature/CompanyGatewayTest.php index fa4bdfa7af1b..83631de6728a 100644 --- a/tests/Feature/CompanyGatewayTest.php +++ b/tests/Feature/CompanyGatewayTest.php @@ -20,20 +20,18 @@ class CompanyGatewayTest extends TestCase public function setUp() :void { parent::setUp(); - + $this->makeTestData(); - if (!config('ninja.testvars.stripe')) { + if (! config('ninja.testvars.stripe')) { $this->markTestSkipped('Skip test no company gateways installed'); } } public function testGatewayExists() { - $company_gateway = CompanyGateway::first(); $this->assertNotNull($company_gateway); - } public function testFeesAndLimitsExists() @@ -70,48 +68,44 @@ class CompanyGatewayTest extends TestCase $this->assertNotNull($fees_and_limits); - //confirm amount filtering works - $amount = 100; + $amount = 100; - $this->assertFalse($this->checkSieve($cg, $amount)); + $this->assertFalse($this->checkSieve($cg, $amount)); - $amount = 235; + $amount = 235; - $this->assertTrue($this->checkSieve($cg, $amount)); + $this->assertTrue($this->checkSieve($cg, $amount)); - $amount = 70000; - - $this->assertFalse($this->checkSieve($cg, $amount)); + $amount = 70000; + $this->assertFalse($this->checkSieve($cg, $amount)); } public function checkSieve($cg, $amount) { - if(isset($cg->fees_and_limits)){ + if (isset($cg->fees_and_limits)) { $properties = array_keys(get_object_vars($cg->fees_and_limits)); $fees_and_limits = $cg->fees_and_limits->{$properties[0]}; - } - else + } else { $passes = true; + } - if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) { - info("amount {$amount} less than ". $fees_and_limits->min_limit); - $passes = false; - } - else if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit){ - info("amount {$amount} greater than ". $fees_and_limits->max_limit); + if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) { + info("amount {$amount} less than ".$fees_and_limits->min_limit); $passes = false; - } - else + } elseif ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit) { + info("amount {$amount} greater than ".$fees_and_limits->max_limit); + $passes = false; + } else { $passes = true; + } return $passes; } public function testFeesAreAppendedToInvoice() //after refactor this may be redundant { - $data = []; $data[1]['min_limit'] = -1; $data[1]['max_limit'] = -1; @@ -144,12 +138,11 @@ class CompanyGatewayTest extends TestCase $items = $this->invoice->line_items; - $this->assertEquals(($balance+1), $this->invoice->balance); + $this->assertEquals(($balance + 1), $this->invoice->balance); } public function testProRataGatewayFees() { - $data = []; $data[1]['min_limit'] = -1; $data[1]['max_limit'] = -1; @@ -175,17 +168,15 @@ class CompanyGatewayTest extends TestCase $cg->fees_and_limits = $data; $cg->save(); - $total = 10.93; $total_invoice_count = 5; - $total_gateway_fee = round($cg->calcGatewayFee($total,true),2); + $total_gateway_fee = round($cg->calcGatewayFee($total, true), 2); $this->assertEquals(1.58, $total_gateway_fee); /*simple pro rata*/ $fees_and_limits = $cg->getFeesAndLimits(); - /*Calculate all subcomponents of the fee*/ // $fee_component_amount = $fees_and_limits->fee_amount ?: 0; @@ -202,20 +193,15 @@ class CompanyGatewayTest extends TestCase // $fee_component_tax_name3 = $fees_and_limits->fee_tax_name3 ?: ''; // $fee_component_tax_rate3 = $fees_and_limits->fee_tax_rate3 ? ($combined_fee_component * $fees_and_limits->fee_tax_rate3 / 100) : 0; - - - - // $pro_rata_fee = round($total_gateway_fee / $total_invoice_count,2); - // while($pro_rata_fee * $total_invoice_count != $total_gateway_fee) { // //nudge one pro rata fee until we get the desired amount // $sub_total_fees = ($pro_rata_fee*($total_invoice_count--)); // //work out if we have to nudge up or down - + // if($pro_rata_fee*$total_invoice_count > $total_gateway_fee) { // //nudge DOWN // $pro_rata_fee - 0.01; //this will break if the currency doesn't have decimals @@ -223,10 +209,9 @@ class CompanyGatewayTest extends TestCase // else { // //nudge UP // } - + // } // $this->assertEquals(1.56, $pro_rata_fee*$total_invoice_count); - } -} \ No newline at end of file +} diff --git a/tests/Feature/CompanySettingsTest.php b/tests/Feature/CompanySettingsTest.php index e85e263b5098..b95e2937fe7c 100644 --- a/tests/Feature/CompanySettingsTest.php +++ b/tests/Feature/CompanySettingsTest.php @@ -31,7 +31,6 @@ class CompanySettingsTest extends TestCase use DatabaseTransactions; use MockAccountData; - public function setUp() :void { parent::setUp(); @@ -56,7 +55,7 @@ class CompanySettingsTest extends TestCase //$this->withoutExceptionHandling(); $response = false; - + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), @@ -88,11 +87,10 @@ class CompanySettingsTest extends TestCase 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); - $response->assertStatus(200); $arr = $response->json(); - + $this->assertEquals($arr['data']['settings']['reset_counter_date'], ''); } @@ -100,7 +98,7 @@ class CompanySettingsTest extends TestCase { $settings = $this->company->settings; - $settings->client_number_counter = "a"; + $settings->client_number_counter = 'a'; $settings->invoice_number_counter = 1000; $settings->quote_number_counter = 1.2; $settings->credit_number_counter = 10.1; @@ -126,10 +124,10 @@ class CompanySettingsTest extends TestCase { $settings = $this->company->settings; - $settings->default_task_rate = "a"; + $settings->default_task_rate = 'a'; $settings->tax_rate1 = 10.0; - $settings->tax_rate2 = "10.0"; - $settings->tax_rate3 = "10.5"; + $settings->tax_rate2 = '10.0'; + $settings->tax_rate3 = '10.5'; $this->company->saveSettings($settings, $this->company); @@ -155,8 +153,8 @@ class CompanySettingsTest extends TestCase $settings->require_invoice_signature = true; $settings->require_quote_signature = true; $settings->show_accept_quote_terms = false; - $settings->show_accept_invoice_terms = "TRUE"; - $settings->enable_client_portal_tasks = "FALSE"; + $settings->show_accept_invoice_terms = 'TRUE'; + $settings->enable_client_portal_tasks = 'FALSE'; $this->company->saveSettings($settings, $this->company); @@ -175,14 +173,12 @@ class CompanySettingsTest extends TestCase $this->assertTrue($arr['data']['settings']['show_accept_invoice_terms']); $this->assertFalse($arr['data']['settings']['enable_client_portal_tasks']); } - public function testCompanyNullValueMatrixPOST() { $settings = CompanySettings::defaults(); $settings->reset_counter_date = null; - $this->company->saveSettings($settings, $this->company); $response = $this->withHeaders([ @@ -214,7 +210,6 @@ class CompanySettingsTest extends TestCase $this->assertEquals($arr['data'][0]['company']['settings']['reset_counter_date'], ''); } - public function testCompanyWrong2ValueMatrixPOST() { $settings = CompanySettings::defaults(); diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php index b1e114bc7883..c29965dc2859 100644 --- a/tests/Feature/CompanyTest.php +++ b/tests/Feature/CompanyTest.php @@ -30,7 +30,6 @@ class CompanyTest extends TestCase { use MakesHash; use MockAccountData; - use DatabaseTransactions; public function setUp() :void @@ -44,12 +43,10 @@ class CompanyTest extends TestCase Model::reguard(); $this->makeTestData(); - } public function testCompanyList() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -57,7 +54,6 @@ class CompanyTest extends TestCase $response->assertStatus(200); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -65,7 +61,7 @@ class CompanyTest extends TestCase '/api/v1/companies?include=company', [ 'name' => 'A New Company', - 'logo' => UploadedFile::fake()->image('avatar.jpg') + 'logo' => UploadedFile::fake()->image('avatar.jpg'), ] ) ->assertStatus(200)->decodeResponseJson(); @@ -79,7 +75,7 @@ class CompanyTest extends TestCase '/api/v1/companies/', [ 'name' => 'A New Company', - 'company_logo' => UploadedFile::fake()->create('avatar.pdf', 100) + 'company_logo' => UploadedFile::fake()->create('avatar.pdf', 100), ] ) ->assertStatus(302); @@ -99,7 +95,6 @@ class CompanyTest extends TestCase ])->put('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company_update) ->assertStatus(200); - $settings = CompanySettings::defaults(); $settings->custom_value1 = 'test'; $settings->invoice_design_id = '2'; diff --git a/tests/Feature/CompanyTokenApiTest.php b/tests/Feature/CompanyTokenApiTest.php index b2ce142b1239..90dbd1ea3518 100644 --- a/tests/Feature/CompanyTokenApiTest.php +++ b/tests/Feature/CompanyTokenApiTest.php @@ -58,7 +58,6 @@ class CompanyTokenApiTest extends TestCase 'X-API-PASSWORD' => 'ALongAndBriliantPassword', ])->get('/api/v1/tokens'); - $response->assertStatus(200); } @@ -73,10 +72,9 @@ class CompanyTokenApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-PASSWORD' => 'ALongAndBriliantPassword', - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/tokens', $data); - $response->assertStatus(200); } @@ -87,17 +85,15 @@ class CompanyTokenApiTest extends TestCase $company_token = CompanyToken::whereCompanyId($this->company->id)->first(); $data = [ - 'name' => "newname", + 'name' => 'newname', ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-PASSWORD' => 'ALongAndBriliantPassword', - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->put('/api/v1/tokens/'.$this->encodePrimaryKey($company_token->id), $data); - $response->assertStatus(200); $arr = $response->json(); @@ -110,14 +106,12 @@ class CompanyTokenApiTest extends TestCase $company_token = CompanyToken::whereCompanyId($this->company->id)->first(); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-PASSWORD' => 'ALongAndBriliantPassword', - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/tokens/'.$this->encodePrimaryKey($company_token->id)); - $response->assertStatus(200); } @@ -130,7 +124,7 @@ class CompanyTokenApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-PASSWORD' => 'ALongAndBriliantPassword', - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/tokens/'.$this->encodePrimaryKey($company_token->id)); $arr = $response->json(); diff --git a/tests/Feature/CreditTest.php b/tests/Feature/CreditTest.php index 75987b666139..beb80868e631 100644 --- a/tests/Feature/CreditTest.php +++ b/tests/Feature/CreditTest.php @@ -6,11 +6,11 @@ use App\Models\Account; use App\Models\Client; use App\Models\Credit; use App\Utils\Traits\MakesHash; +use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\DatabaseTransactions; +use Illuminate\Support\Facades\Session; use Tests\MockAccountData; use Tests\TestCase; -use Illuminate\Support\Facades\Session; -use Illuminate\Database\Eloquent\Model; class CreditTest extends TestCase { @@ -33,19 +33,18 @@ class CreditTest extends TestCase public function testCreditsList() { - factory(Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, - 'company_id' => $this->company->id + 'company_id' => $this->company->id, ]); }); @@ -53,7 +52,6 @@ class CreditTest extends TestCase factory(Credit::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -67,14 +65,14 @@ class CreditTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->get('/api/v1/credits/' . $this->encodePrimaryKey($this->credit->id)); + ])->get('/api/v1/credits/'.$this->encodePrimaryKey($this->credit->id)); $response->assertStatus(200); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->get('/api/v1/credits/' . $this->encodePrimaryKey($this->credit->id) . '/edit'); + ])->get('/api/v1/credits/'.$this->encodePrimaryKey($this->credit->id).'/edit'); $response->assertStatus(200); @@ -87,7 +85,7 @@ class CreditTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->put('/api/v1/credits/' . $this->encodePrimaryKey($this->credit->id), $credit_update) + ])->put('/api/v1/credits/'.$this->encodePrimaryKey($this->credit->id), $credit_update) ->assertStatus(200); } diff --git a/tests/Feature/DesignApiTest.php b/tests/Feature/DesignApiTest.php index d1701e6152be..9a2812db0662 100644 --- a/tests/Feature/DesignApiTest.php +++ b/tests/Feature/DesignApiTest.php @@ -46,7 +46,6 @@ class DesignApiTest extends TestCase Model::reguard(); } - public function testDesignPost() { $design = [ @@ -55,21 +54,19 @@ class DesignApiTest extends TestCase 'product' => 'product', 'task' => 'task', 'footer' => 'footer', - 'header' => 'header' + 'header' => 'header', ]; $data = [ 'name' => $this->faker->firstName, - 'design' => $design + 'design' => $design, ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/designs', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -80,7 +77,7 @@ class DesignApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/designs'); $response->assertStatus(200); @@ -89,7 +86,7 @@ class DesignApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/designs/'.$this->id); $response->assertStatus(200); @@ -100,13 +97,12 @@ class DesignApiTest extends TestCase $data = [ 'name' => $this->faker->firstName, - 'design' => $design + 'design' => $design, ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->put('/api/v1/designs/'.$this->id, $data); $response->assertStatus(200); @@ -116,24 +112,21 @@ class DesignApiTest extends TestCase $this->assertEquals($data['name'], $arr['data']['name']); $this->assertEquals($data['design'], $arr['data']['design']); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->delete('/api/v1/designs/'.$this->id, $data); - $response->assertStatus(200); $arr = $response->json(); $design = Design::whereId($this->decodePrimaryKey($this->id))->withTrashed()->first(); - $this->assertTrue((bool)$design->is_deleted); + $this->assertTrue((bool) $design->is_deleted); $this->assertGreaterThan(0, $design->deleted_at); } - public function testDesignArchive() { $design = [ @@ -142,17 +135,17 @@ class DesignApiTest extends TestCase 'product' => 'product', 'task' => 'task', 'footer' => 'footer', - 'header' => 'header' + 'header' => 'header', ]; $data = [ 'name' => $this->faker->firstName, - 'design' => $design + 'design' => $design, ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/designs', $data); $response->assertStatus(200); @@ -165,7 +158,7 @@ class DesignApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/designs/bulk?action=archive', $data); $response->assertStatus(200); @@ -176,7 +169,7 @@ class DesignApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/designs/bulk?action=restore', $data); $response->assertStatus(200); @@ -187,25 +180,25 @@ class DesignApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/designs/bulk?action=delete', $data); $response->assertStatus(200); $design = Design::where('id', $this->decodePrimaryKey($arr['data']['id']))->withTrashed()->first(); - $this->assertTrue((bool)$design->is_deleted); + $this->assertTrue((bool) $design->is_deleted); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/designs/bulk?action=restore', $data); $response->assertStatus(200); $design = Design::where('id', $this->decodePrimaryKey($arr['data']['id']))->withTrashed()->first(); - $this->assertFalse((bool)$design->is_deleted); + $this->assertFalse((bool) $design->is_deleted); $this->assertNull($design->deleted_at); } } diff --git a/tests/Feature/GroupSettingTest.php b/tests/Feature/GroupSettingTest.php index 6221ce8e6783..c86390c0f520 100644 --- a/tests/Feature/GroupSettingTest.php +++ b/tests/Feature/GroupSettingTest.php @@ -6,11 +6,11 @@ use App\Models\Account; use App\Models\Client; use App\Models\Credit; use App\Utils\Traits\MakesHash; +use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\DatabaseTransactions; +use Illuminate\Support\Facades\Session; use Tests\MockAccountData; use Tests\TestCase; -use Illuminate\Support\Facades\Session; -use Illuminate\Database\Eloquent\Model; class GroupSettingTest extends TestCase { @@ -38,7 +38,7 @@ class GroupSettingTest extends TestCase $data = [ 'name' => 'test', - 'settings' => $settings + 'settings' => $settings, ]; $response = $this->withHeaders([ @@ -47,15 +47,13 @@ class GroupSettingTest extends TestCase ])->post('/api/v1/group_settings', $data); $response->assertStatus(200); - + $arr = $response->json(); $this->assertEquals('test', $arr['data']['name']); $this->assertEquals(0, $arr['data']['archived_at']); - } - public function testArchiveGroupSettings() { $settings = new \stdClass; @@ -63,7 +61,7 @@ class GroupSettingTest extends TestCase $data = [ 'name' => 'test', - 'settings' => $settings + 'settings' => $settings, ]; $response = $this->withHeaders([ @@ -72,14 +70,14 @@ class GroupSettingTest extends TestCase ])->post('/api/v1/group_settings', $data); $response->assertStatus(200); - + $arr = $response->json(); $data = [ 'action' => 'archive', - 'ids' => [$arr['data']['id']] + 'ids' => [$arr['data']['id']], ]; - + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -88,8 +86,7 @@ class GroupSettingTest extends TestCase $response->assertStatus(200); $arr = $response->json(); - + $this->assertNotNull($arr['data'][0]['archived_at']); } - } diff --git a/tests/Feature/InvitationTest.php b/tests/Feature/InvitationTest.php index 6a59ff4d7d4d..832b5944ae66 100644 --- a/tests/Feature/InvitationTest.php +++ b/tests/Feature/InvitationTest.php @@ -29,7 +29,6 @@ use Tests\TestCase; * @test * @covers App\Models\InvoiceInvitation */ - class InvitationTest extends TestCase { use MakesHash; @@ -59,11 +58,10 @@ class InvitationTest extends TestCase $user = User::where('email', 'user@example.com')->first(); - if(!$user) - { + if (! $user) { $user = factory(\App\Models\User::class)->create([ 'account_id' => $account->id, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } @@ -73,7 +71,7 @@ class InvitationTest extends TestCase 'edit_client', 'edit_invoice', 'create_invoice', - 'create_client' + 'create_client', ]); $userSettings = DefaultSettings::userSettings(); @@ -93,13 +91,13 @@ class InvitationTest extends TestCase 'user_id' => $user->id, 'client_id' => $c->id, 'company_id' => $company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 2)->create([ 'user_id' => $user->id, 'client_id' => $c->id, - 'company_id' => $company->id + 'company_id' => $company->id, ]); }); @@ -113,7 +111,6 @@ class InvitationTest extends TestCase $this->assertNotNull($invoice->client); $this->assertNotNull($invoice->client->primary_contact); - $i = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id); $i->client_contact_id = $client->primary_contact->first()->id; $i->invoice_id = $invoice->id; diff --git a/tests/Feature/InvoiceEmailTest.php b/tests/Feature/InvoiceEmailTest.php index 421dffd45492..1f7ec0b67702 100644 --- a/tests/Feature/InvoiceEmailTest.php +++ b/tests/Feature/InvoiceEmailTest.php @@ -20,9 +20,9 @@ use Tests\MockAccountData; use Tests\TestCase; /** -* @test -* @covers App\Jobs\Invoice\EmailInvoice -*/ + * @test + * @covers App\Jobs\Invoice\EmailInvoice + */ class InvoiceEmailTest extends TestCase { use MockAccountData; @@ -54,7 +54,7 @@ class InvoiceEmailTest extends TestCase $client_settings->email_style = 'dark'; $this->client->settings = $client_settings; $this->client->save(); - + $this->invoice->setRelation('client', $this->client); $this->invoice->save(); @@ -104,7 +104,7 @@ class InvoiceEmailTest extends TestCase $this->company->settings = $settings; $this->company->save(); - + $this->invoice->date = now(); $this->invoice->due_date = now()->addDays(7); $this->invoice->number = $this->getNextInvoiceNumber($this->client); @@ -134,7 +134,7 @@ class InvoiceEmailTest extends TestCase $this->company->settings = $settings; $this->company->save(); - + $this->invoice->date = now(); $this->invoice->due_date = now()->addDays(7); $this->invoice->number = $this->getNextInvoiceNumber($this->client); @@ -154,7 +154,6 @@ class InvoiceEmailTest extends TestCase } }); - $this->assertTrue(true); } } diff --git a/tests/Feature/InvoiceTest.php b/tests/Feature/InvoiceTest.php index 0271636e360e..ff6cfa5afae4 100644 --- a/tests/Feature/InvoiceTest.php +++ b/tests/Feature/InvoiceTest.php @@ -22,7 +22,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\InvoiceController */ - class InvoiceTest extends TestCase { use MakesHash; @@ -44,27 +43,25 @@ class InvoiceTest extends TestCase public function testInvoiceList() { - - factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c){ + factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, - 'company_id' => $this->company->id + 'company_id' => $this->company->id, ]); }); - + $client = Client::all()->first(); factory(\App\Models\Invoice::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -126,8 +123,7 @@ class InvoiceTest extends TestCase ])->post('/api/v1/invoices/', $invoice) ->assertStatus(200); - - //test that the same request should produce a validation error due + //test that the same request should produce a validation error due //to duplicate number being used. $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), @@ -159,7 +155,7 @@ class InvoiceTest extends TestCase /* Test fire new invoice */ $data = [ 'client_id' => $this->client->hashed_id, - 'number' => 'dude' + 'number' => 'dude', ]; $response = $this->withHeaders([ @@ -175,46 +171,44 @@ class InvoiceTest extends TestCase /*test validation fires*/ $data = [ 'client_id' => $this->client->hashed_id, - 'number' => 'test' + 'number' => 'test', ]; - try{ + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->put('/api/v1/invoices/' . $arr['data']['id'], $data) + ])->put('/api/v1/invoices/'.$arr['data']['id'], $data) ->assertStatus(302); - } catch (ValidationException $e) { - $message = json_decode($e->validator->getMessageBag(), 1); - info("inside update invoice validator"); + info('inside update invoice validator'); info($message); $this->assertNotNull($message); } - $data = [ + $data = [ 'client_id' => $this->client->hashed_id, - 'number' => 'style' + 'number' => 'style', ]; - /* test number passed validation*/ - $response = $this->withHeaders([ + /* test number passed validation*/ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->put('/api/v1/invoices/' . $arr['data']['id'], $data) + ])->put('/api/v1/invoices/'.$arr['data']['id'], $data) ->assertStatus(200); - $data = [ + $data = [ 'client_id' => $this->client->hashed_id, - 'number' => 'style' + 'number' => 'style', ]; - /* Make sure we can UPDATE using the same number*/ - $response = $this->withHeaders([ + /* Make sure we can UPDATE using the same number*/ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->put('/api/v1/invoices/' . $arr['data']['id'], $data) + ])->put('/api/v1/invoices/'.$arr['data']['id'], $data) ->assertStatus(200); } } diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php index c0a87b99d9ef..c5142b4f0969 100644 --- a/tests/Feature/LoginTest.php +++ b/tests/Feature/LoginTest.php @@ -33,11 +33,12 @@ class LoginTest extends TestCase public function testLoginFormDisplayed() { $response = $this->get('/login', [ - '_token' => csrf_token() + '_token' => csrf_token(), ]); $response->assertStatus(404); } + /** * A valid user can be logged in. * @@ -125,7 +126,7 @@ class LoginTest extends TestCase // '_token' => csrf_token() // ]); // $response->assertStatus(302); - + // // $this->assertGuest(); // } @@ -135,7 +136,7 @@ class LoginTest extends TestCase $user = factory(User::class)->create([ 'account_id' => $account->id, 'email' => 'test@example.com', - 'password' => \Hash::make('123456') + 'password' => \Hash::make('123456'), ]); $company = factory(\App\Models\Company::class)->create([ @@ -149,11 +150,10 @@ class LoginTest extends TestCase $company_token->user_id = $user->id; $company_token->company_id = $company->id; $company_token->account_id = $account->id; - $company_token->name = $user->first_name. ' '. $user->last_name; + $company_token->name = $user->first_name.' '.$user->last_name; $company_token->token = \Illuminate\Support\Str::random(64); $company_token->save(); - $user->companies()->attach($company->id, [ 'account_id' => $account->id, 'is_owner' => 1, @@ -170,14 +170,13 @@ class LoginTest extends TestCase $data = [ 'email' => 'test@example.com', - 'password' => '123456' + 'password' => '123456', ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), ])->post('/api/v1/login', $data); - $response->assertStatus(200); } } diff --git a/tests/Feature/MigrationTest.php b/tests/Feature/MigrationTest.php index 1dab58dd97f2..730ce57f09de 100644 --- a/tests/Feature/MigrationTest.php +++ b/tests/Feature/MigrationTest.php @@ -25,7 +25,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\MigrationController */ - class MigrationTest extends TestCase { use DatabaseTransactions; @@ -44,7 +43,6 @@ class MigrationTest extends TestCase $this->makeTestData(); } - public function testCompanyExists() { $co = Company::find($this->company->id); diff --git a/tests/Feature/PaymentTermsApiTest.php b/tests/Feature/PaymentTermsApiTest.php index de49b4339bf2..8a97bad722fe 100644 --- a/tests/Feature/PaymentTermsApiTest.php +++ b/tests/Feature/PaymentTermsApiTest.php @@ -32,7 +32,6 @@ class PaymentTermsApiTest extends TestCase use DatabaseTransactions; use MockAccountData; - public function setUp() :void { parent::setUp(); @@ -46,26 +45,22 @@ class PaymentTermsApiTest extends TestCase Model::reguard(); } - public function testPaymentTermsGet() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/payment_terms'); - $response->assertStatus(200); } public function testPostPaymentTerm() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->post('/api/v1/payment_terms', ['num_days' => 50 ]); + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/payment_terms', ['num_days' => 50]); $response->assertStatus(200); @@ -76,38 +71,33 @@ class PaymentTermsApiTest extends TestCase public function testPutPaymentTerms() { - - $payment_term = PaymentTermFactory::create($this->company->id, $this->user->id); + $payment_term = PaymentTermFactory::create($this->company->id, $this->user->id); $payment_term->num_days = 500; $payment_term->save(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->put('/api/v1/payment_terms/' . $this->encodePrimaryKey($payment_term->id), ['num_days' => 5000 ]); + 'X-API-TOKEN' => $this->token, + ])->put('/api/v1/payment_terms/'.$this->encodePrimaryKey($payment_term->id), ['num_days' => 5000]); $response->assertStatus(200); - } public function testDeletePaymentTerm() { - - $payment_term = PaymentTermFactory::create($this->company->id, $this->user->id); + $payment_term = PaymentTermFactory::create($this->company->id, $this->user->id); $payment_term->num_days = 500; $payment_term->save(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->delete('/api/v1/payment_terms/' . $this->encodePrimaryKey($payment_term->id)); + 'X-API-TOKEN' => $this->token, + ])->delete('/api/v1/payment_terms/'.$this->encodePrimaryKey($payment_term->id)); - $response->assertStatus(200); + $response->assertStatus(200); - $payment_term = PaymentTerm::find($payment_term->id); - - $this->assertNull($payment_term); + $payment_term = PaymentTerm::find($payment_term->id); + $this->assertNull($payment_term); } - } diff --git a/tests/Feature/PaymentTest.php b/tests/Feature/PaymentTest.php index fcb1a505b5ce..439a7202ca36 100644 --- a/tests/Feature/PaymentTest.php +++ b/tests/Feature/PaymentTest.php @@ -32,7 +32,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\PaymentController */ - class PaymentTest extends TestCase { use MakesHash; @@ -65,13 +64,13 @@ class PaymentTest extends TestCase 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, - 'company_id' => $this->company->id + 'company_id' => $this->company->id, ]); }); @@ -115,7 +114,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -133,7 +132,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/11', @@ -157,7 +156,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -178,7 +177,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -196,7 +195,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + if ($response) { $arr = $response->json(); $response->assertStatus(200); @@ -217,7 +216,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -240,7 +239,6 @@ class PaymentTest extends TestCase ]; - $response = false; try { @@ -252,7 +250,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + if ($response) { $response->assertStatus(200); } @@ -271,9 +269,8 @@ class PaymentTest extends TestCase 'company_id' =>$this->company->id, 'is_primary' => true, ]); - - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 2.0; @@ -289,21 +286,20 @@ class PaymentTest extends TestCase $this->invoice->save(); $this->invoice->service()->markSent()->save(); - $data = [ 'amount' => 2.0, 'client_id' => $client->hashed_id, 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 2.0 + 'amount' => 2.0, ], ], 'date' => '2019/12/12', ]; $response = false; - + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), @@ -313,7 +309,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + if ($response) { $response->assertStatus(200); @@ -347,12 +343,12 @@ class PaymentTest extends TestCase 'user_id' => $this->user->id, 'client_id' => $client->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); $client->setRelation('contacts', $client_contact); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 5.0; @@ -378,7 +374,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 6.0 + 'amount' => 6.0, ], ], 'date' => '2019/12/12', @@ -397,7 +393,7 @@ class PaymentTest extends TestCase $arr = $response->json(); $response->assertStatus(200); - + $payment_id = $arr['data']['id']; $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); @@ -431,11 +427,10 @@ class PaymentTest extends TestCase 'user_id' => $this->user->id, 'client_id' => $client->id, 'company_id' => $this->company->id, - 'send_email' => true + 'send_email' => true, ]); - - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 5.0; @@ -451,14 +446,13 @@ class PaymentTest extends TestCase $this->invoice->save(); $this->invoice->service()->markSent()->save(); - $data = [ 'amount' => 2.0, 'client_id' => $client->hashed_id, 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 2.0 + 'amount' => 2.0, ], ], 'date' => '2019/12/12', @@ -505,12 +499,12 @@ class PaymentTest extends TestCase 'user_id' => $this->user->id, 'client_id' => $this->client->id, 'company_id' => $this->company->id, - 'send_email' => true + 'send_email' => true, ]); $client->setRelation('contact', $contact); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->partial = 5.0; @@ -534,7 +528,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 2.0 + 'amount' => 2.0, ], ], 'date' => '2019/12/12', @@ -552,7 +546,6 @@ class PaymentTest extends TestCase } } - public function testPaymentChangesBalancesCorrectly() { $this->invoice = null; @@ -560,7 +553,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -575,14 +568,13 @@ class PaymentTest extends TestCase $this->invoice->save(); $this->invoice->service()->markSent()->save(); - $data = [ 'amount' => 2.0, 'client_id' => $client->hashed_id, 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 2.0 + 'amount' => 2.0, ], ], 'date' => '2019/12/12', @@ -621,7 +613,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -642,7 +634,6 @@ class PaymentTest extends TestCase $payment->date = now(); $payment->save(); - $data = [ 'amount' => 2.0, 'client_id' => $client->hashed_id, @@ -668,7 +659,6 @@ class PaymentTest extends TestCase } } - public function testUpdatePaymentValidationPasses() { $this->invoice = null; @@ -676,7 +666,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -698,7 +688,6 @@ class PaymentTest extends TestCase $payment->number = $client->getNextPaymentNumber($client); $payment->save(); - $data = [ 'amount' => 10.0, 'client_id' => $this->encodePrimaryKey($client->id), @@ -706,7 +695,7 @@ class PaymentTest extends TestCase [ 'invoice_id' => $this->encodePrimaryKey($this->invoice->id), 'amount' => 10, - ] + ], ], 'date' => '2019/12/12', ]; @@ -730,7 +719,6 @@ class PaymentTest extends TestCase } } - public function testDoublePaymentTestWithInvalidAmounts() { $this->invoice = null; @@ -738,7 +726,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -760,7 +748,7 @@ class PaymentTest extends TestCase [ 'invoice_id' => $this->encodePrimaryKey($this->invoice->id), 'amount' => 10, - ] + ], ], 'date' => '2019/12/12', ]; @@ -778,9 +766,9 @@ class PaymentTest extends TestCase } $response->assertStatus(200); - + $arr = $response->json(); - + $payment_id = $arr['data']['id']; $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); @@ -789,7 +777,7 @@ class PaymentTest extends TestCase $this->assertEquals($payment->applied, 10); $this->invoice = null; - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -804,7 +792,6 @@ class PaymentTest extends TestCase $this->invoice->save(); $this->invoice->service()->markSent()->save(); - $data = [ 'amount' => 15.0, 'client_id' => $this->encodePrimaryKey($client->id), @@ -812,12 +799,11 @@ class PaymentTest extends TestCase [ 'invoice_id' => $this->encodePrimaryKey($this->invoice->id), 'amount' => 10, - ] + ], ], 'date' => '2019/12/12', ]; - $response = false; try { @@ -832,7 +818,6 @@ class PaymentTest extends TestCase } } - public function testDoublePaymentTestWithValidAmounts() { $this->invoice = null; @@ -840,7 +825,7 @@ class PaymentTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->line_items = $this->buildLineItems(); @@ -862,7 +847,7 @@ class PaymentTest extends TestCase [ 'invoice_id' => $this->encodePrimaryKey($this->invoice->id), 'amount' => 10, - ] + ], ], 'date' => '2019/12/12', ]; @@ -871,11 +856,11 @@ class PaymentTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/', $data); - + $response->assertStatus(200); - + $arr = $response->json(); - + $payment_id = $arr['data']['id']; $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); @@ -899,7 +884,6 @@ class PaymentTest extends TestCase // $this->invoice->save(); // $this->invoice->service()->markSent()->save(); - // $data = [ // 'amount' => 20.0, // 'client_id' => $this->encodePrimaryKey($client->id), @@ -912,7 +896,6 @@ class PaymentTest extends TestCase // 'date' => '2019/12/12', // ]; - // $response = false; // try { @@ -928,19 +911,18 @@ class PaymentTest extends TestCase // } // $response->assertStatus(200); - + // $arr = $response->json(); // $this->assertEquals(20, $arr['data']['applied']); } - public function testStorePaymentWithNoAmountField() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -960,7 +942,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -978,7 +960,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + if ($response) { $arr = $response->json(); $response->assertStatus(200); @@ -995,13 +977,12 @@ class PaymentTest extends TestCase } } - public function testStorePaymentWithZeroAmountField() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -1022,7 +1003,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -1038,7 +1019,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + $response->assertStatus(200); $arr = $response->json(); @@ -1046,7 +1027,7 @@ class PaymentTest extends TestCase $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); $this->assertEquals(round($payment->amount, 2), $this->invoice->amount); - + $this->assertEquals(round($payment->applied, 2), $this->invoice->amount); } @@ -1058,8 +1039,7 @@ class PaymentTest extends TestCase $client2 = ClientFactory::create($this->company->id, $this->user->id); $client2->save(); - - $invoice1 = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $invoice1 = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $invoice1->client_id = $client1->id; $invoice1->status_id = Invoice::STATUS_SENT; @@ -1074,7 +1054,7 @@ class PaymentTest extends TestCase $invoice1 = $invoice_calc->getInvoice(); $invoice1->save(); - $invoice2 = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $invoice2 = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $invoice2->client_id = $client2->id; $invoice2->status_id = Invoice::STATUS_SENT; @@ -1095,12 +1075,12 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $invoice1->hashed_id, - 'amount' => $invoice1->amount + 'amount' => $invoice1->amount, ], [ 'invoice_id' => $invoice2->hashed_id, - 'amount' => $invoice2->amount - ] + 'amount' => $invoice2->amount, + ], ], 'date' => '2020/12/12', @@ -1117,13 +1097,12 @@ class PaymentTest extends TestCase } } - public function testPaymentWithSameInvoiceMultipleTimes() { $client1 = ClientFactory::create($this->company->id, $this->user->id); $client1->save(); - $invoice1 = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $invoice1 = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $invoice1->client_id = $client1->id; $invoice1->status_id = Invoice::STATUS_SENT; @@ -1138,19 +1117,18 @@ class PaymentTest extends TestCase $invoice1 = $invoice_calc->getInvoice(); $invoice1->save(); - $data = [ 'amount' => $invoice1->amount, 'client_id' => $client1->hashed_id, 'invoices' => [ [ 'invoice_id' => $invoice1->hashed_id, - 'amount' => 1 + 'amount' => 1, ], [ 'invoice_id' => $invoice1->hashed_id, - 'amount' => 1 - ] + 'amount' => 1, + ], ], 'date' => '2020/12/12', @@ -1171,13 +1149,12 @@ class PaymentTest extends TestCase $this->assertNull($response); } - public function testStorePaymentWithCredits() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -1207,20 +1184,19 @@ class PaymentTest extends TestCase $credit = $this->credit_calc->getCredit(); $credit->save(); //$10 credit - $data = [ 'amount' => $this->invoice->amount, 'client_id' => $client->hashed_id, 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 5 + 'amount' => 5, ], ], 'credits' => [ [ 'credit_id' => $credit->id, - 'amount' => 5 + 'amount' => 5, ], ], 'date' => '2020/12/12', @@ -1238,7 +1214,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + if ($response) { $arr = $response->json(); $response->assertStatus(200); @@ -1253,17 +1229,16 @@ class PaymentTest extends TestCase } } - public function testStorePaymentExchangeRate() { $settings = ClientSettings::defaults(); - $settings->currency_id = "2"; + $settings->currency_id = '2'; $client = ClientFactory::create($this->company->id, $this->user->id); $client->settings = $settings; $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -1284,7 +1259,7 @@ class PaymentTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -1302,7 +1277,7 @@ class PaymentTest extends TestCase $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); } - + if ($response) { $arr = $response->json(); $response->assertStatus(200); @@ -1311,14 +1286,11 @@ class PaymentTest extends TestCase $payment = Payment::find($this->decodePrimaryKey($payment_id))->first(); -info($payment); + info($payment); $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - - } } - } diff --git a/tests/Feature/PdfMaker/ExampleDesign.php b/tests/Feature/PdfMaker/ExampleDesign.php index df493b96b624..5859549f09a6 100644 --- a/tests/Feature/PdfMaker/ExampleDesign.php +++ b/tests/Feature/PdfMaker/ExampleDesign.php @@ -20,4 +20,4 @@ class ExampleDesign base_path('tests/Feature/PdfMaker/example-design.html') ); } -} \ No newline at end of file +} diff --git a/tests/Feature/PdfMaker/ExampleIntegrationTest.php b/tests/Feature/PdfMaker/ExampleIntegrationTest.php index e7e88144eb7e..f8a8299375be 100644 --- a/tests/Feature/PdfMaker/ExampleIntegrationTest.php +++ b/tests/Feature/PdfMaker/ExampleIntegrationTest.php @@ -39,7 +39,7 @@ class ExampleIntegrationTest extends TestCase 'template' => $design->elements([ 'client' => $invoice->client, 'entity' => $invoice, - 'pdf_variables' => (array)$invoice->company->settings->pdf_variables, + 'pdf_variables' => (array) $invoice->company->settings->pdf_variables, ]), 'variables' => $engine->generateLabelsAndValues(), ]; @@ -50,7 +50,7 @@ class ExampleIntegrationTest extends TestCase ->design($design) ->build(); - // exec('echo "" > storage/logs/laravel.log'); + // exec('echo "" > storage/logs/laravel.log'); // info($maker->getCompiledHTML(true)); diff --git a/tests/Feature/PdfMaker/PdfMakerTest.php b/tests/Feature/PdfMaker/PdfMakerTest.php index bbc40124df5b..7325f3521d0c 100644 --- a/tests/Feature/PdfMaker/PdfMakerTest.php +++ b/tests/Feature/PdfMaker/PdfMakerTest.php @@ -119,7 +119,7 @@ class PdfMakerTest extends TestCase 'properties' => [], 'elements' => [ ['element' => 'thead', 'content' => '', 'elements' => [ - ['element' => 'th', 'content' => 'Company',], + ['element' => 'th', 'content' => 'Company'], ['element' => 'th', 'content' => 'Contact'], ['element' => 'th', 'content' => 'Country', 'properties' => [ 'colspan' => 3, @@ -185,7 +185,7 @@ class PdfMakerTest extends TestCase 'template' => [ 'header' => [ 'id' => 'header', - 'properties' => ['hidden' => "true"], + 'properties' => ['hidden' => 'true'], ], ], ]); @@ -213,7 +213,7 @@ class PdfMakerTest extends TestCase 'elements' => [ ['element' => 'h1', 'content' => 'h1-element'], ['element' => 'span', 'content' => 'span-element'], - ] + ], ], ], ]); @@ -240,7 +240,7 @@ class PdfMakerTest extends TestCase 'elements' => [ ['element' => 'h1', 'content' => 'h1-element', 'order' => 1], ['element' => 'span', 'content' => 'span-element', 'order' => 0], - ] + ], ], ], ]); @@ -277,7 +277,7 @@ class PdfMakerTest extends TestCase ['element' => 'th', 'content' => 'Title', 'properties' => ['class' => 'px-4 py-2']], ['element' => 'th', 'content' => 'Author', 'properties' => ['class' => 'px-4 py-2']], ['element' => 'th', 'content' => 'Views', 'properties' => ['class' => 'px-4 py-2']], - ]] + ]], ]], ['element' => 'tbody', 'content' => '', 'elements' => [ ['element' => 'tr', 'content' => '', 'elements' => [ @@ -300,14 +300,14 @@ class PdfMakerTest extends TestCase ]], ]], ], - ] + ], ], 'variables' => [ 'labels' => [], 'values' => [ '$title' => 'Invoice Ninja', ], - ] + ], ]; $design = new Design('example', ['custom_path' => base_path('tests/Feature/PdfMaker/')]); diff --git a/tests/Feature/ProductTest.php b/tests/Feature/ProductTest.php index d2d973211a12..1ebcca44de32 100644 --- a/tests/Feature/ProductTest.php +++ b/tests/Feature/ProductTest.php @@ -44,13 +44,10 @@ class ProductTest extends TestCase ); $this->makeTestData(); - } public function testProductList() { - - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -58,7 +55,6 @@ class ProductTest extends TestCase $response->assertStatus(200); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -77,7 +73,7 @@ class ProductTest extends TestCase 'custom_value2' => 'custom', 'custom_value3' => 'custom', 'custom_value4' => 'custom', - 'is_deleted' => 0 + 'is_deleted' => 0, ] ) ->assertStatus(200); @@ -85,7 +81,7 @@ class ProductTest extends TestCase $product = Product::all()->first(); $product_update = [ - 'notes' => 'CHANGE' + 'notes' => 'CHANGE', ]; $response = $this->withHeaders([ @@ -94,7 +90,6 @@ class ProductTest extends TestCase ])->put('/api/v1/products/'.$this->encodePrimaryKey($product->id), $product_update) ->assertStatus(200); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/QuoteTest.php b/tests/Feature/QuoteTest.php index d241dee8e4d1..ef41a34532ce 100644 --- a/tests/Feature/QuoteTest.php +++ b/tests/Feature/QuoteTest.php @@ -23,7 +23,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\QuoteController */ - class QuoteTest extends TestCase { use MakesHash; @@ -69,7 +68,7 @@ class QuoteTest extends TestCase } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); } - + if ($response) { $response->assertStatus(200); } @@ -108,14 +107,13 @@ class QuoteTest extends TestCase $data = [ 'client_id' => $this->encodePrimaryKey($this->client->id), - 'date' => "2019-12-14", + 'date' => '2019-12-14', 'line_items' => [], 'invitations' => [ - ['client_contact_id' => $this->encodePrimaryKey($client_contact->id)] + ['client_contact_id' => $this->encodePrimaryKey($client_contact->id)], ], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/RecurringInvoiceTest.php b/tests/Feature/RecurringInvoiceTest.php index 42b2a462577e..60b0133e4284 100644 --- a/tests/Feature/RecurringInvoiceTest.php +++ b/tests/Feature/RecurringInvoiceTest.php @@ -22,7 +22,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\RecurringInvoiceController */ - class RecurringInvoiceTest extends TestCase { use MakesHash; @@ -43,26 +42,23 @@ class RecurringInvoiceTest extends TestCase ThrottleRequests::class ); - $this->makeTestData(); - + $this->makeTestData(); } public function testRecurringInvoiceList() { - - factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, - 'company_id' => $this->company->id + 'company_id' => $this->company->id, ]); }); @@ -70,7 +66,6 @@ class RecurringInvoiceTest extends TestCase factory(\App\Models\RecurringInvoice::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -81,19 +76,18 @@ class RecurringInvoiceTest extends TestCase public function testRecurringInvoiceRESTEndPoints() { - factory(\App\Models\Client::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id])->each(function ($c) { factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, 'company_id' => $this->company->id, - 'is_primary' => 1 + 'is_primary' => 1, ]); factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $c->id, - 'company_id' => $this->company->id + 'company_id' => $this->company->id, ]); }); $client = Client::all()->first(); @@ -103,7 +97,6 @@ class RecurringInvoiceTest extends TestCase $RecurringInvoice = RecurringInvoice::where('user_id', $this->user->id)->first(); $RecurringInvoice->save(); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/RecurringInvoicesCronTest.php b/tests/Feature/RecurringInvoicesCronTest.php index b3c8335ac8c7..d61aca3818e8 100644 --- a/tests/Feature/RecurringInvoicesCronTest.php +++ b/tests/Feature/RecurringInvoicesCronTest.php @@ -22,7 +22,6 @@ use Tests\TestCase; * @test * @covers App\Jobs\Cron\RecurringInvoicesCron */ - class RecurringInvoicesCronTest extends TestCase { use DatabaseTransactions; @@ -38,7 +37,7 @@ class RecurringInvoicesCronTest extends TestCase } public function testCountCorrectNumberOfRecurringInvoicesDue() - { + { //spin up 5 valid and 1 invalid recurring invoices $recurring_invoices = RecurringInvoice::where('next_send_date', '<=', Carbon::now()->addMinutes(30))->get(); diff --git a/tests/Feature/RecurringQuoteTest.php b/tests/Feature/RecurringQuoteTest.php index db4e0cf2a291..8b0b8dfe5c47 100644 --- a/tests/Feature/RecurringQuoteTest.php +++ b/tests/Feature/RecurringQuoteTest.php @@ -22,7 +22,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\RecurringQuoteController */ - class RecurringQuoteTest extends TestCase { use MakesHash; @@ -43,16 +42,13 @@ class RecurringQuoteTest extends TestCase ThrottleRequests::class ); - $this->makeTestData(); - + $this->makeTestData(); } public function testRecurringQuoteList() { - factory(\App\Models\RecurringQuote::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -63,14 +59,11 @@ class RecurringQuoteTest extends TestCase public function testRecurringQuoteRESTEndPoints() { - - factory(\App\Models\RecurringQuote::class, 1)->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]); $RecurringQuote = RecurringQuote::where('user_id', $this->user->id)->first(); $RecurringQuote->save(); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -92,7 +85,6 @@ class RecurringQuoteTest extends TestCase $this->assertNotNull($RecurringQuote); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/RefundTest.php b/tests/Feature/RefundTest.php index 64688ec0b36e..5a0ff7ac53a5 100644 --- a/tests/Feature/RefundTest.php +++ b/tests/Feature/RefundTest.php @@ -30,7 +30,6 @@ use Tests\TestCase; * @test * @covers App\Utils\Traits\Payment\Refundable */ - class RefundTest extends TestCase { use MakesHash; @@ -65,7 +64,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -92,12 +91,11 @@ class RefundTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments', $data); - $arr = $response->json(); $response->assertStatus(200); $payment_id = $arr['data']['id']; - + $this->assertEquals(50, $arr['data']['amount']); $payment = Payment::whereId($this->decodePrimaryKey($payment_id))->first(); @@ -141,7 +139,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -155,23 +153,23 @@ class RefundTest extends TestCase $this->invoice = $this->invoice_calc->getInvoice(); $this->invoice->save(); - + $this->invoice->setRelation('client', $this->client); $this->invoice->setRelation('company', $this->company); $this->invoice->service()->createInvitations()->markSent()->save(); $this->assertNotNull($this->invoice->invitations); - + $this->assertNotNull($this->invoice->invitations->first()->contact); - + $data = [ 'amount' => 50, 'client_id' => $client->hashed_id, 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -183,7 +181,6 @@ class RefundTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments', $data); - $arr = $response->json(); $response->assertStatus(200); @@ -196,7 +193,6 @@ class RefundTest extends TestCase $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - $data = [ 'id' => $this->encodePrimaryKey($payment->id), @@ -232,7 +228,7 @@ class RefundTest extends TestCase $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -253,7 +249,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -265,7 +261,6 @@ class RefundTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments', $data); - $arr = $response->json(); $response->assertStatus(200); @@ -278,7 +273,6 @@ class RefundTest extends TestCase $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - $data = [ 'id' => $this->encodePrimaryKey($payment->id), @@ -286,7 +280,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -298,19 +292,19 @@ class RefundTest extends TestCase 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - + $response->assertStatus(200); } /** - * Test Validation with incorrect invoice refund amounts + * Test Validation with incorrect invoice refund amounts. */ public function testRefundValidationWithInValidInvoiceRefundedAmount() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -331,7 +325,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -343,7 +337,6 @@ class RefundTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments', $data); - $arr = $response->json(); $response->assertStatus(200); @@ -356,7 +349,6 @@ class RefundTest extends TestCase $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - $data = [ 'id' => $this->encodePrimaryKey($payment->id), @@ -364,7 +356,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => 100 + 'amount' => 100, ], ], 'date' => '2020/12/12', @@ -387,17 +379,17 @@ class RefundTest extends TestCase $response->assertStatus(302); } } - + /** * Tests refund when providing an invoice - * not related to the payment + * not related to the payment. */ public function testRefundValidationWithInValidInvoiceProvided() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -418,7 +410,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -430,7 +422,6 @@ class RefundTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments', $data); - $arr = $response->json(); $response->assertStatus(200); @@ -443,8 +434,8 @@ class RefundTest extends TestCase $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -465,7 +456,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -490,7 +481,7 @@ class RefundTest extends TestCase } /** - * Test refunds where payments include credits + * Test refunds where payments include credits. * * $10 invoice * $10 credit @@ -501,14 +492,13 @@ class RefundTest extends TestCase * * payment.applied = 10 * credit.balance = 0 - * */ public function testRefundWhereCreditsArePresent() { $client = ClientFactory::create($this->company->id, $this->user->id); $client->save(); - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $client->id; $this->invoice->status_id = Invoice::STATUS_SENT; @@ -525,7 +515,7 @@ class RefundTest extends TestCase $this->credit = CreditFactory::create($this->company->id, $this->user->id); $this->credit->client_id = $client->id; - $this->credit->status_id=2; + $this->credit->status_id = 2; $this->credit->line_items = $this->buildLineItems(); $this->credit->amount = 10; @@ -540,13 +530,13 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'credits' => [ [ 'credit_id' => $this->credit->hashed_id, - 'amount' => $this->credit->amount + 'amount' => $this->credit->amount, ], ], 'date' => '2020/12/12', @@ -562,11 +552,10 @@ class RefundTest extends TestCase ])->post('/api/v1/payments', $data); } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); - \Log::error("this should not hit"); + \Log::error('this should not hit'); \Log::error($message); } - $arr = $response->json(); $response->assertStatus(200); @@ -579,7 +568,6 @@ class RefundTest extends TestCase $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); $this->assertEquals(1, $payment->invoices()->count()); - $data = [ 'id' => $this->encodePrimaryKey($payment->id), @@ -587,7 +575,7 @@ class RefundTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->invoice->hashed_id, - 'amount' => $this->invoice->amount + 'amount' => $this->invoice->amount, ], ], 'date' => '2020/12/12', @@ -602,11 +590,10 @@ class RefundTest extends TestCase ])->post('/api/v1/payments/refund', $data); } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); - \Log::error("refund message error"); + \Log::error('refund message error'); \Log::error($message); } - $response->assertStatus(200); $arr = $response->json(); diff --git a/tests/Feature/ReminderTest.php b/tests/Feature/ReminderTest.php index 645b49958597..397b14f747a3 100644 --- a/tests/Feature/ReminderTest.php +++ b/tests/Feature/ReminderTest.php @@ -26,7 +26,6 @@ use Tests\TestCase; * @test * @covers App\Jobs\Util\ReminderJob */ - class ReminderTest extends TestCase { use MakesHash; @@ -84,6 +83,4 @@ class ReminderTest extends TestCase ReminderJob::dispatchNow(); } - - } diff --git a/tests/Feature/ReverseInvoiceTest.php b/tests/Feature/ReverseInvoiceTest.php index c2b0cde3d2b1..9306bdc8e8ee 100644 --- a/tests/Feature/ReverseInvoiceTest.php +++ b/tests/Feature/ReverseInvoiceTest.php @@ -26,7 +26,6 @@ use Tests\TestCase; * @test * @covers App\Services\Invoice\HandleReversal */ - class ReverseInvoiceTest extends TestCase { use MakesHash; @@ -59,8 +58,8 @@ class ReverseInvoiceTest extends TestCase $first_payment = $this->invoice->payments->first(); - $this->assertEquals((float)$first_payment->amount, (float)$this->invoice->amount); - $this->assertEquals((float)$first_payment->applied, (float)$this->invoice->amount); + $this->assertEquals((float) $first_payment->amount, (float) $this->invoice->amount); + $this->assertEquals((float) $first_payment->applied, (float) $this->invoice->amount); $this->assertTrue($this->invoice->invoiceReversable($this->invoice)); @@ -88,8 +87,8 @@ class ReverseInvoiceTest extends TestCase $item = InvoiceItemFactory::create(); $item->quantity = 1; - $item->cost = (float)$total_paid; - $item->notes = "Credit for reversal of ".$this->invoice->number; + $item->cost = (float) $total_paid; + $item->notes = 'Credit for reversal of '.$this->invoice->number; $line_items[] = $item; @@ -107,7 +106,7 @@ class ReverseInvoiceTest extends TestCase ->markSent()->save(); /* Set invoice balance to 0 */ - $this->invoice->ledger()->updateInvoiceBalance($balance_remaining*-1, $item->notes)->save(); + $this->invoice->ledger()->updateInvoiceBalance($balance_remaining * -1, $item->notes)->save(); /* Set invoice status to reversed... somehow*/ $this->invoice->service()->setStatus(Invoice::STATUS_REVERSED)->save(); @@ -123,7 +122,6 @@ class ReverseInvoiceTest extends TestCase //create a ledger row for this with the resulting Credit ( also include an explanation in the notes section ) } - public function testReversalViaAPI() { $this->assertEquals($this->client->balance, $this->invoice->balance); @@ -136,8 +134,8 @@ class ReverseInvoiceTest extends TestCase $this->invoice = $this->invoice->service()->markPaid()->save(); - $this->assertEquals($this->client->balance, ($this->invoice->balance*-1)); - $this->assertEquals($this->client->paid_to_date, ($client_paid_to_date+$invoice_balance)); + $this->assertEquals($this->client->balance, ($this->invoice->balance * -1)); + $this->assertEquals($this->client->paid_to_date, ($client_paid_to_date + $invoice_balance)); $this->assertEquals(0, $this->invoice->balance); $this->assertEquals(Invoice::STATUS_PAID, $this->invoice->status_id); @@ -163,6 +161,6 @@ class ReverseInvoiceTest extends TestCase $this->assertEquals(Invoice::STATUS_REVERSED, $this->invoice->status_id); $this->assertEquals(0, $this->invoice->balance); $this->assertEquals($this->client->paid_to_date, ($client_paid_to_date)); - $this->assertEquals($this->client->balance, ($client_balance-$invoice_balance)); + $this->assertEquals($this->client->balance, ($client_balance - $invoice_balance)); } } diff --git a/tests/Feature/Shop/ShopInvoiceTest.php b/tests/Feature/Shop/ShopInvoiceTest.php index e661c9e35872..72725050b111 100644 --- a/tests/Feature/Shop/ShopInvoiceTest.php +++ b/tests/Feature/Shop/ShopInvoiceTest.php @@ -15,7 +15,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\Shop\InvoiceController */ - class ShopInvoiceTest extends TestCase { use MakesHash; @@ -46,14 +45,11 @@ class ShopInvoiceTest extends TestCase $response = null; try { - - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->get('api/v1/shop/products'); - } - - catch (ValidationException $e) { + } catch (ValidationException $e) { $this->assertNotNull($message); } @@ -62,16 +58,14 @@ class ShopInvoiceTest extends TestCase public function testTokenFailure() { - $this->company->enable_shop_api = true; $this->company->save(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->get('/api/v1/products'); - $response->assertStatus(403); $arr = $response->json(); @@ -80,14 +74,11 @@ class ShopInvoiceTest extends TestCase public function testCompanyEnableShopApiBooleanWorks() { try { - - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->get('api/v1/shop/products'); - } - - catch (ValidationException $e) { + } catch (ValidationException $e) { $this->assertNotNull($message); } @@ -96,7 +87,6 @@ class ShopInvoiceTest extends TestCase public function testGetByProductKey() { - $this->company->enable_shop_api = true; $this->company->save(); @@ -107,10 +97,9 @@ class ShopInvoiceTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->get('/api/v1/shop/product/'.$product->product_key); - $response->assertStatus(200); $arr = $response->json(); @@ -120,50 +109,42 @@ class ShopInvoiceTest extends TestCase public function testGetByClientByContactKey() { - $this->company->enable_shop_api = true; $this->company->save(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->get('/api/v1/shop/client/'.$this->client->contacts->first()->contact_key); - $response->assertStatus(200); $arr = $response->json(); $this->assertEquals($this->client->hashed_id, $arr['data']['id']); - } public function testCreateClientOnShopRoute() { - $this->company->enable_shop_api = true; $this->company->save(); - $data = [ 'name' => 'ShopClient', ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->post('/api/v1/shop/clients/', $data); - $response->assertStatus(200); $arr = $response->json(); $this->assertEquals('ShopClient', $arr['data']['name']); - } public function testCreateInvoiceOnShopRoute() { - $this->company->enable_shop_api = true; $this->company->save(); @@ -173,10 +154,9 @@ class ShopInvoiceTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->post('/api/v1/shop/clients/', $data); - $response->assertStatus(200); $arr = $response->json(); @@ -184,21 +164,17 @@ class ShopInvoiceTest extends TestCase $invoice_data = [ 'client_id' => $client_hashed_id, - 'po_number' => 'shop_order' + 'po_number' => 'shop_order', ]; - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-COMPANY-KEY' => $this->company->company_key + 'X-API-COMPANY-KEY' => $this->company->company_key, ])->post('/api/v1/shop/invoices/', $invoice_data); + $response->assertStatus(200); + $arr = $response->json(); - $response->assertStatus(200); - $arr = $response->json(); - - $this->assertEquals('shop_order', $arr['data']['po_number']); - - + $this->assertEquals('shop_order', $arr['data']['po_number']); } - } diff --git a/tests/Feature/SystemLogApiTest.php b/tests/Feature/SystemLogApiTest.php index 4eeada3ed084..2cae10055d95 100644 --- a/tests/Feature/SystemLogApiTest.php +++ b/tests/Feature/SystemLogApiTest.php @@ -36,13 +36,10 @@ class SystemLogApiTest extends TestCase parent::setUp(); $this->makeTestData(); - } - public function testSystemLogRoutes() { - $sl = [ 'client_id' => $this->client->id, 'company_id' => $this->company->id, @@ -57,46 +54,41 @@ class SystemLogApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/system_logs'); - $response->assertStatus(200); $arr = $response->json(); - $this->assertTrue(count($arr['data']) >=1); + $this->assertTrue(count($arr['data']) >= 1); $hashed_id = $arr['data'][0]['id']; - - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->get('/api/v1/system_logs/' . $hashed_id); + 'X-API-TOKEN' => $this->token, + ])->get('/api/v1/system_logs/'.$hashed_id); - $response->assertStatus(200); + $response->assertStatus(200); - $arr = $response->json(); + $arr = $response->json(); - $this->assertEquals($hashed_id, $arr['data']['id']); + $this->assertEquals($hashed_id, $arr['data']['id']); - - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->put('/api/v1/system_logs/' . $hashed_id, $sl)->assertStatus(400); + 'X-API-TOKEN' => $this->token, + ])->put('/api/v1/system_logs/'.$hashed_id, $sl)->assertStatus(400); - - $response = $this->withHeaders([ + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token - ])->delete('/api/v1/system_logs/' . $hashed_id)->assertStatus(400); + 'X-API-TOKEN' => $this->token, + ])->delete('/api/v1/system_logs/'.$hashed_id)->assertStatus(400); } public function testStoreRouteFails() { - $sl = [ 'client_id' => $this->client->id, 'company_id' => $this->company->id, @@ -109,19 +101,15 @@ class SystemLogApiTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/system_logs', $sl)->assertStatus(400); - } public function testCreateRouteFails() { - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/system_logs/create')->assertStatus(400); - } - } diff --git a/tests/Feature/UpdateExchangeRatesTest.php b/tests/Feature/UpdateExchangeRatesTest.php index 51ee61f5ff57..e65f45c4e77e 100644 --- a/tests/Feature/UpdateExchangeRatesTest.php +++ b/tests/Feature/UpdateExchangeRatesTest.php @@ -48,12 +48,9 @@ class UpdateExchangeRatesTest extends TestCase Model::reguard(); } - public function testExchangeRate() { - - if(!empty(config('ninja.currency_converter_api_key'))) - { + if (! empty(config('ninja.currency_converter_api_key'))) { $cc_endpoint = sprintf('https://openexchangerates.org/api/latest.json?app_id=%s', config('ninja.currency_converter_api_key')); $client = new \GuzzleHttp\Client(); @@ -64,16 +61,15 @@ class UpdateExchangeRatesTest extends TestCase UpdateExchangeRates::dispatchNow(); $currencies = Cache::get('currencies'); - + $gbp_currency = $currencies->filter(function ($item) { return $item->id == 2; })->first(); $this->assertEquals($currency_api->rates->GBP, $gbp_currency->exchange_rate); - } - else + } else { $this->markTestSkipped('No API Key set'); - + } } public function testExchangeRateConversion() @@ -81,7 +77,6 @@ class UpdateExchangeRatesTest extends TestCase $usd = Currency::find(1); $gbp = Currency::find(2); - $usd->exchange_rate = 1; $usd->save(); @@ -119,8 +114,5 @@ class UpdateExchangeRatesTest extends TestCase $synthetic_exchange = $currency_api->exchangeRate($gbp->id, $aud->id); $this->assertEquals($synthetic_exchange, 3); - - } - } diff --git a/tests/Feature/UserTest.php b/tests/Feature/UserTest.php index 2fde162e44c7..1c1463f3201b 100644 --- a/tests/Feature/UserTest.php +++ b/tests/Feature/UserTest.php @@ -24,9 +24,9 @@ use Tests\MockAccountData; use Tests\TestCase; /** -* @test + * @test * @covers App\Http\Controllers\UserController -*/ + */ class UserTest extends TestCase { use MockAccountData; @@ -48,7 +48,6 @@ class UserTest extends TestCase ThrottleRequests::class, PasswordProtection::class ); - } public function testUserList() @@ -65,7 +64,7 @@ class UserTest extends TestCase public function testUserStore() { $this->withoutMiddleware(PasswordProtection::class); - + $data = [ 'first_name' => 'hey', 'last_name' => 'you', @@ -73,7 +72,7 @@ class UserTest extends TestCase 'company_user' => [ 'is_admin' => false, 'is_owner' => false, - 'permissions' => 'create_client,create_invoice' + 'permissions' => 'create_client,create_invoice', ], ]; @@ -110,7 +109,6 @@ class UserTest extends TestCase $this->assertNotNull($user->company_user); $this->assertEquals($user->company_user->company_id, $this->company->id); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -119,7 +117,6 @@ class UserTest extends TestCase $response->assertStatus(200); - $cu = CompanyUser::whereUserId($user->id)->whereCompanyId($this->company->id)->first(); $ct = CompanyToken::whereUserId($user->id)->whereCompanyId($this->company->id)->first(); @@ -136,7 +133,7 @@ class UserTest extends TestCase $company2 = factory(\App\Models\Company::class)->create([ 'account_id' => $this->account->id, ]); - + $company_token = new CompanyToken; $company_token->user_id = $this->user->id; $company_token->company_id = $company2->id; @@ -145,7 +142,6 @@ class UserTest extends TestCase $company_token->token = \Illuminate\Support\Str::random(64); $company_token->save(); - /*Manually link this user to the company*/ $cu = CompanyUserFactory::create($this->user->id, $company2->id, $this->account->id); $cu->is_owner = true; @@ -168,7 +164,6 @@ class UserTest extends TestCase $this->assertNotNull($new_user->company_user); $this->assertEquals($new_user->company_user->company_id, $company2->id); - /*Create brand new user manually with company_user object and attach to a different company*/ $data = [ 'first_name' => 'hey', @@ -177,7 +172,7 @@ class UserTest extends TestCase 'company_user' => [ 'is_admin' => false, 'is_owner' => false, - 'permissions' => 'create_client,create_invoice' + 'permissions' => 'create_client,create_invoice', ], ]; @@ -203,8 +198,6 @@ class UserTest extends TestCase $this->assertNotNull($cu); - - /*Update the user permissions of this user*/ $data = [ 'first_name' => 'Captain', @@ -213,7 +206,7 @@ class UserTest extends TestCase 'company_user' => [ 'is_admin' => true, 'is_owner' => false, - 'permissions' => 'create_invoice,create_invoice' + 'permissions' => 'create_invoice,create_invoice', ], ]; diff --git a/tests/Feature/WebhookAPITest.php b/tests/Feature/WebhookAPITest.php index 128f4752bfa1..b428764ae3c7 100644 --- a/tests/Feature/WebhookAPITest.php +++ b/tests/Feature/WebhookAPITest.php @@ -17,7 +17,6 @@ use Tests\TestCase; * @test * @covers App\Http\Controllers\WebhookController */ - class WebhookAPITest extends TestCase { use MakesHash; @@ -56,7 +55,7 @@ class WebhookAPITest extends TestCase $data = [ 'target_url' => 'http://hook.com', 'event_id' => 1, - 'format' => 'JSON' + 'format' => 'JSON', ]; $response = $this->withHeaders([ @@ -73,7 +72,7 @@ class WebhookAPITest extends TestCase $data = [ 'event_id' => 2, ]; - + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, @@ -94,25 +93,22 @@ class WebhookAPITest extends TestCase $this->assertNotNull($arr['data']['archived_at']); - $data = [ 'ids' => [$arr['data']['id']], ]; - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/webhooks/bulk?action=restore', $data); $arr = $response->json(); $this->assertEquals(0, $arr['data'][0]['archived_at']); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->post('/api/v1/webhooks/bulk?action=delete', $data); $arr = $response->json(); diff --git a/tests/Integration/CheckLockedInvoiceValidationTest.php b/tests/Integration/CheckLockedInvoiceValidationTest.php index 6ac2583711ca..891e7dcc0093 100644 --- a/tests/Integration/CheckLockedInvoiceValidationTest.php +++ b/tests/Integration/CheckLockedInvoiceValidationTest.php @@ -10,10 +10,9 @@ use Tests\MockAccountData; use Tests\TestCase; /** - * @test + * @test * @covers App\Http\ValidationRules\Invoice\LockedInvoiceRule */ - class CheckLockedInvoiceValidationTest extends TestCase { use MockAccountData; @@ -32,14 +31,12 @@ class CheckLockedInvoiceValidationTest extends TestCase 'po_number' => 'test', ]; - try { - + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id), $invoice_update) ->assertStatus(200); - } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); @@ -66,13 +63,11 @@ class CheckLockedInvoiceValidationTest extends TestCase $this->assertEquals($this->invoice->status_id, \App\Models\Invoice::STATUS_SENT); - try { - + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id), $invoice_update); - } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); @@ -83,15 +78,13 @@ class CheckLockedInvoiceValidationTest extends TestCase if ($response) { $response->assertStatus(302); } - } - public function testValidationFailsForLockedInvoiceWhenPaid() { $this->company->settings->lock_invoices = 'when_paid'; $this->company->save(); - + $settings = $this->client->settings; $settings->lock_invoices = 'when_paid'; $this->client->settings = $settings; @@ -105,13 +98,11 @@ class CheckLockedInvoiceValidationTest extends TestCase $this->assertEquals($this->invoice->status_id, \App\Models\Invoice::STATUS_PAID); - try { - + try { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/invoices/'.$this->encodePrimaryKey($this->invoice->id), $invoice_update); - } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); @@ -122,6 +113,5 @@ class CheckLockedInvoiceValidationTest extends TestCase if ($response) { $response->assertStatus(302); } - } } diff --git a/tests/Integration/CompanyLedgerTest.php b/tests/Integration/CompanyLedgerTest.php index aa0703a709ef..8e88d26e0136 100644 --- a/tests/Integration/CompanyLedgerTest.php +++ b/tests/Integration/CompanyLedgerTest.php @@ -28,7 +28,6 @@ use Tests\MockAccountData; use Tests\TestCase; /** @test*/ - class CompanyLedgerTest extends TestCase { use DatabaseTransactions; @@ -50,9 +49,9 @@ class CompanyLedgerTest extends TestCase /* Warm up the cache !*/ $cached_tables = config('ninja.cached_tables'); - + foreach ($cached_tables as $name => $class) { - + // check that the table exists in case the migration is pending if (! Schema::hasTable((new $class())->getTable())) { continue; @@ -80,17 +79,17 @@ class CompanyLedgerTest extends TestCase $settings = CompanySettings::defaults(); $settings->company_logo = 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'; - $settings->website = 'www.invoiceninja.com'; - $settings->address1 = 'Address 1'; - $settings->address2 = 'Address 2'; - $settings->city = 'City'; - $settings->state = 'State'; - $settings->postal_code = 'Postal Code'; - $settings->phone = '555-343-2323'; - $settings->email = 'user@example.com'; - $settings->country_id = '840'; + $settings->website = 'www.invoiceninja.com'; + $settings->address1 = 'Address 1'; + $settings->address2 = 'Address 2'; + $settings->city = 'City'; + $settings->state = 'State'; + $settings->postal_code = 'Postal Code'; + $settings->phone = '555-343-2323'; + $settings->email = 'user@example.com'; + $settings->country_id = '840'; $settings->vat_number = 'vat number'; - $settings->id_number = 'id number'; + $settings->id_number = 'id number'; $this->company->settings = $settings; $this->company->save(); @@ -100,14 +99,14 @@ class CompanyLedgerTest extends TestCase $this->user = User::whereEmail('user@example.com')->first(); - if (!$this->user) { + if (! $this->user) { $this->user = factory(\App\Models\User::class)->create([ 'account_id' => $this->account->id, 'password' => Hash::make('ALongAndBriliantPassword'), - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } - + $cu = CompanyUserFactory::create($this->user->id, $this->company->id, $this->account->id); $cu->is_owner = true; $cu->is_admin = true; @@ -128,7 +127,6 @@ class CompanyLedgerTest extends TestCase 'company_id' => $this->company->id, ]); - factory(\App\Models\ClientContact::class, 1)->create([ 'user_id' => $this->user->id, 'client_id' => $this->client->id, @@ -157,7 +155,7 @@ class CompanyLedgerTest extends TestCase $data = [ 'client_id' => $this->encodePrimaryKey($this->client->id), - 'line_items' => $line_items + 'line_items' => $line_items, ]; /* Test adding one invoice */ @@ -181,7 +179,6 @@ class CompanyLedgerTest extends TestCase $this->assertEquals($invoice_ledger->balance, $invoice->client->balance); $this->assertEquals($invoice->client->paid_to_date, 0); - /* Test adding another invoice */ $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), @@ -209,7 +206,7 @@ class CompanyLedgerTest extends TestCase 'invoices' => [ [ 'invoice_id' => $this->encodePrimaryKey($invoice->id), - 'amount' => $invoice->balance + 'amount' => $invoice->balance, ], ], 'date' => '2020/12/11', @@ -230,7 +227,7 @@ class CompanyLedgerTest extends TestCase $this->assertEquals($payment->client->balance, $payment_ledger->balance); $this->assertEquals($payment->client->paid_to_date, 10); - + $invoice = Invoice::find($invoice->id); $this->assertEquals(Invoice::STATUS_PAID, $invoice->status_id); @@ -257,7 +254,6 @@ class CompanyLedgerTest extends TestCase 'X-API-TOKEN' => $this->token, ])->post('/api/v1/payments/refund', $data); - $acc = $response->json(); $invoice = Invoice::find($invoice->id); diff --git a/tests/Integration/ContainerTest.php b/tests/Integration/ContainerTest.php index cedc212c96ec..63e92dfb6362 100644 --- a/tests/Integration/ContainerTest.php +++ b/tests/Integration/ContainerTest.php @@ -14,32 +14,23 @@ use Tests\TestCase; */ class ContainerTest extends TestCase { - use MockAccountData; public function setUp() :void { - parent::setUp(); $this->makeTestData(); app()->instance(Company::class, $this->company); - - } public function testBindingWorks() { - - $resolved_company = resolve(Company::class); $this->assertNotNull($resolved_company); $this->assertEquals($this->account->id, $resolved_company->account_id); - - } - } diff --git a/tests/Integration/DownloadHistoricalInvoiceTest.php b/tests/Integration/DownloadHistoricalInvoiceTest.php index dde9f0d98f08..67e0a36cba76 100644 --- a/tests/Integration/DownloadHistoricalInvoiceTest.php +++ b/tests/Integration/DownloadHistoricalInvoiceTest.php @@ -40,8 +40,8 @@ class DownloadHistoricalInvoiceTest extends TestCase $obj->company_id = $this->company->id; $activity_repo->save($obj, $this->invoice, Ninja::eventVars()); - } + public function testActivityAccessible() { $this->mockActivity(); @@ -62,7 +62,7 @@ class DownloadHistoricalInvoiceTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/activities/download_entity/'.$this->encodePrimaryKey($this->invoice->activities->first()->id)); $response->assertStatus(200); @@ -77,7 +77,7 @@ class DownloadHistoricalInvoiceTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/activities/download_entity/'.$this->encodePrimaryKey($this->invoice->activities->first()->id)); $response->assertStatus(404); diff --git a/tests/Integration/MultiDBUserTest.php b/tests/Integration/MultiDBUserTest.php index 29220cdd5c30..7938a5171f3e 100644 --- a/tests/Integration/MultiDBUserTest.php +++ b/tests/Integration/MultiDBUserTest.php @@ -19,9 +19,7 @@ use Tests\TestCase; * @covers App\Libraries\MultiDB * * Proves that we can reliably switch database connections at runtime - * */ - class MultiDBUserTest extends TestCase { public function setUp() :void @@ -49,10 +47,9 @@ class MultiDBUserTest extends TestCase 'account_id' => $account2->id, ]); - $company->setHidden(['settings', 'settings_object', 'hashed_id']); $company2->setHidden(['settings', 'settings_object', 'hashed_id']); - + $coco = Company::on('db-ninja-01')->create($company->toArray()); Company::on('db-ninja-02')->create($company2->toArray()); @@ -70,7 +67,6 @@ class MultiDBUserTest extends TestCase // 'account_id' => $account->id, ]; - $user2 = [ 'account_id' => $account2->id, 'first_name' => 'user_db_2', @@ -166,7 +162,7 @@ class MultiDBUserTest extends TestCase 'company_user' => [ 'is_admin' => true, 'is_owner' => false, - 'permissions' => 'create_client,create_invoice' + 'permissions' => 'create_client,create_invoice', ], ]; @@ -186,7 +182,6 @@ class MultiDBUserTest extends TestCase } } - public function test_cross_db_user_linking_succeeds_appropriately() { $data = [ @@ -196,7 +191,7 @@ class MultiDBUserTest extends TestCase 'company_user' => [ 'is_admin' => false, 'is_owner' => false, - 'permissions' => 'create_client,create_invoice' + 'permissions' => 'create_client,create_invoice', ], ]; diff --git a/tests/Integration/PaymentDrivers/AuthorizeTest.php b/tests/Integration/PaymentDrivers/AuthorizeTest.php index 2dd85be48551..48e1eec15325 100644 --- a/tests/Integration/PaymentDrivers/AuthorizeTest.php +++ b/tests/Integration/PaymentDrivers/AuthorizeTest.php @@ -5,8 +5,6 @@ namespace Tests\Integration\PaymentDrivers; use App\Factory\PaymentFactory; use App\Models\CompanyGateway; use App\PaymentDrivers\AuthorizePaymentDriver; -use Tests\MockAccountData; -use Tests\TestCase; use net\authorize\api\constants\ANetEnvironment; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest; @@ -29,6 +27,8 @@ use net\authorize\api\controller\CreateTransactionController; use net\authorize\api\controller\GetCustomerProfileController; use net\authorize\api\controller\GetCustomerProfileIdsController; use net\authorize\api\controller\GetMerchantDetailsController; +use Tests\MockAccountData; +use Tests\TestCase; /** * @test @@ -48,8 +48,8 @@ class AuthorizeTest extends TestCase if (! config('ninja.testvars.authorize')) { $this->markTestSkipped('authorize.net not configured'); } - - $this->makeTestData(); + + $this->makeTestData(); } public function testUnpackingVars() @@ -61,7 +61,7 @@ class AuthorizeTest extends TestCase public function testCreatePublicClientKey() { - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $vars = json_decode(config('ninja.testvars.authorize')); @@ -74,15 +74,14 @@ class AuthorizeTest extends TestCase $controller = new GetMerchantDetailsController($request); - $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); + $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); $this->assertNotNull($response->getPublicClientKey()); } public function testProfileIdList() { - - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $vars = json_decode(config('ninja.testvars.authorize')); @@ -91,33 +90,28 @@ class AuthorizeTest extends TestCase $merchantAuthentication->setTransactionKey($vars->transactionKey); // Set the transaction's refId - $refId = 'ref' . time(); + $refId = 'ref'.time(); // Get all existing customer profile ID's $request = new GetCustomerProfileIdsRequest(); $request->setMerchantAuthentication($merchantAuthentication); $controller = new GetCustomerProfileIdsController($request); - $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) - { - info("GetCustomerProfileId's SUCCESS: " . "\n"); - info(print_r($response->getIds(),1)); - } - else - { + $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { + info("GetCustomerProfileId's SUCCESS: "."\n"); + info(print_r($response->getIds(), 1)); + } else { info("GetCustomerProfileId's ERROR : Invalid response\n"); $errorMessages = $response->getMessages()->getMessage(); - info("Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"); + info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()."\n"); } - + $this->assertNotNull($response); - } public function testCreateProfile() { - - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $vars = json_decode(config('ninja.testvars.authorize')); @@ -127,44 +121,43 @@ class AuthorizeTest extends TestCase // Create the Bill To info for new payment type $billTo = new CustomerAddressType(); - $billTo->setFirstName("Ellen"); - $billTo->setLastName("Johnson"); - $billTo->setCompany("Souveniropolis"); - $billTo->setAddress("14 Main Street"); - $billTo->setCity("Pecan Springs"); - $billTo->setState("TX"); - $billTo->setZip("44628"); - $billTo->setCountry("USA"); - $billTo->setPhoneNumber("888-888-8888"); - $billTo->setfaxNumber("999-999-9999"); + $billTo->setFirstName('Ellen'); + $billTo->setLastName('Johnson'); + $billTo->setCompany('Souveniropolis'); + $billTo->setAddress('14 Main Street'); + $billTo->setCity('Pecan Springs'); + $billTo->setState('TX'); + $billTo->setZip('44628'); + $billTo->setCountry('USA'); + $billTo->setPhoneNumber('888-888-8888'); + $billTo->setfaxNumber('999-999-9999'); // Create a customer shipping address $customerShippingAddress = new CustomerAddressType(); - $customerShippingAddress->setFirstName("James"); - $customerShippingAddress->setLastName("White"); - $customerShippingAddress->setCompany("Addresses R Us"); - $customerShippingAddress->setAddress(rand() . " North Spring Street"); - $customerShippingAddress->setCity("Toms River"); - $customerShippingAddress->setState("NJ"); - $customerShippingAddress->setZip("08753"); - $customerShippingAddress->setCountry("USA"); - $customerShippingAddress->setPhoneNumber("888-888-8888"); - $customerShippingAddress->setFaxNumber("999-999-9999"); + $customerShippingAddress->setFirstName('James'); + $customerShippingAddress->setLastName('White'); + $customerShippingAddress->setCompany('Addresses R Us'); + $customerShippingAddress->setAddress(rand().' North Spring Street'); + $customerShippingAddress->setCity('Toms River'); + $customerShippingAddress->setState('NJ'); + $customerShippingAddress->setZip('08753'); + $customerShippingAddress->setCountry('USA'); + $customerShippingAddress->setPhoneNumber('888-888-8888'); + $customerShippingAddress->setFaxNumber('999-999-9999'); // Create an array of any shipping addresses $shippingProfiles[] = $customerShippingAddress; - $refId = 'ref' . time(); - $email = "test12@gmail.com"; + $refId = 'ref'.time(); + $email = 'test12@gmail.com'; // Create a new CustomerProfileType and add the payment profile object $customerProfile = new CustomerProfileType(); - $customerProfile->setDescription("Customer 2 Test PHP"); - $customerProfile->setMerchantCustomerId("M_" . time()); + $customerProfile->setDescription('Customer 2 Test PHP'); + $customerProfile->setMerchantCustomerId('M_'.time()); $customerProfile->setEmail($email); //$customerProfile->setpaymentProfiles($paymentProfiles); $customerProfile->setShipToList($shippingProfiles); - // Assemble the complete transaction request $request = new AnetAPI\CreateCustomerProfileRequest(); $request->setMerchantAuthentication($merchantAuthentication); @@ -174,29 +167,25 @@ class AuthorizeTest extends TestCase // Create the controller and get the response $controller = new CreateCustomerProfileController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); - - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { - info("Succesfully created customer profile : " . $response->getCustomerProfileId() . "\n"); - $paymentProfiles = $response->getCustomerPaymentProfileIdList(); - info(print_r($paymentProfiles,1)); - + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { + info('Succesfully created customer profile : '.$response->getCustomerProfileId()."\n"); + $paymentProfiles = $response->getCustomerPaymentProfileIdList(); + info(print_r($paymentProfiles, 1)); } else { info("ERROR : Invalid response\n"); $errorMessages = $response->getMessages()->getMessage(); - info("Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"); + info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()."\n"); } - info("the new customer profile id = ". $response->getCustomerProfileId()); - - $this->assertNotNull($response); + info('the new customer profile id = '.$response->getCustomerProfileId()); + $this->assertNotNull($response); } public function testGetCustomerProfileId() { - - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $vars = json_decode(config('ninja.testvars.authorize')); @@ -204,61 +193,57 @@ class AuthorizeTest extends TestCase $merchantAuthentication->setName($vars->apiLoginId); $merchantAuthentication->setTransactionKey($vars->transactionKey); - $request = new GetCustomerProfileRequest(); - $request->setMerchantAuthentication($merchantAuthentication); - $request->setCustomerProfileId($this->customer_profile_id); - $controller = new GetCustomerProfileController($request); - $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); - - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { - - info("got profile"); - info(print_r($response->getProfile(),1)); - + $request = new GetCustomerProfileRequest(); + $request->setMerchantAuthentication($merchantAuthentication); + $request->setCustomerProfileId($this->customer_profile_id); + $controller = new GetCustomerProfileController($request); + $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { + info('got profile'); + info(print_r($response->getProfile(), 1)); } else { info("ERROR : Invalid response\n"); } - + $this->assertNotNull($response); } - public function testCreateCustomerPaymentProfile() { - info("test create customer payment profile"); + info('test create customer payment profile'); - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $vars = json_decode(config('ninja.testvars.authorize')); $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($vars->apiLoginId); $merchantAuthentication->setTransactionKey($vars->transactionKey); - + // Set the transaction's refId - $refId = 'ref' . time(); + $refId = 'ref'.time(); // Set credit card information for payment profile $creditCard = new CreditCardType(); - $creditCard->setCardNumber("4111111111111111"); - $creditCard->setExpirationDate("2024-01"); - $creditCard->setCardCode("100"); + $creditCard->setCardNumber('4111111111111111'); + $creditCard->setExpirationDate('2024-01'); + $creditCard->setCardCode('100'); $paymentCreditCard = new PaymentType(); $paymentCreditCard->setCreditCard($creditCard); // Create the Bill To info for new payment type $billto = new CustomerAddressType(); - $billto->setFirstName("Elas"); - $billto->setLastName("Joson"); - $billto->setCompany("Souveniropolis"); - $billto->setAddress("14 Main Street"); - $billto->setCity("Pecan Springs"); - $billto->setState("TX"); - $billto->setZip("44628"); - $billto->setCountry("USA"); - $billto->setPhoneNumber("999-999-9999"); - $billto->setfaxNumber("999-999-9999"); + $billto->setFirstName('Elas'); + $billto->setLastName('Joson'); + $billto->setCompany('Souveniropolis'); + $billto->setAddress('14 Main Street'); + $billto->setCity('Pecan Springs'); + $billto->setState('TX'); + $billto->setZip('44628'); + $billto->setCountry('USA'); + $billto->setPhoneNumber('999-999-9999'); + $billto->setfaxNumber('999-999-9999'); // Create a new Customer Payment Profile object $paymentprofile = new CustomerPaymentProfileType(); @@ -276,36 +261,35 @@ class AuthorizeTest extends TestCase // Add an existing profile id to the request $paymentprofilerequest->setCustomerProfileId($this->customer_profile_id); $paymentprofilerequest->setPaymentProfile($paymentprofile); - $paymentprofilerequest->setValidationMode("liveMode"); + $paymentprofilerequest->setValidationMode('liveMode'); // Create the controller and get the response $controller = new CreateCustomerPaymentProfileController($paymentprofilerequest); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) { - info("Create Customer Payment Profile SUCCESS: " . $response->getCustomerPaymentProfileId() . "\n"); + if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) { + info('Create Customer Payment Profile SUCCESS: '.$response->getCustomerPaymentProfileId()."\n"); } else { info("Create Customer Payment Profile: ERROR Invalid response\n"); $errorMessages = $response->getMessages()->getMessage(); - info("Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"); - + info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()."\n"); } $this->assertNotNull($response); } - function testChargeCustomerProfile() + public function testChargeCustomerProfile() { - error_reporting (E_ALL & ~E_DEPRECATED); + error_reporting(E_ALL & ~E_DEPRECATED); $vars = json_decode(config('ninja.testvars.authorize')); $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName($vars->apiLoginId); $merchantAuthentication->setTransactionKey($vars->transactionKey); - + // Set the transaction's refId - $refId = 'ref' . time(); + $refId = 'ref'.time(); $profileToCharge = new CustomerProfilePaymentType(); $profileToCharge->setCustomerProfileId($this->customer_profile_id); @@ -314,61 +298,48 @@ class AuthorizeTest extends TestCase $profileToCharge->setPaymentProfile($paymentProfile); $transactionRequestType = new TransactionRequestType(); - $transactionRequestType->setTransactionType( "authCaptureTransaction"); + $transactionRequestType->setTransactionType('authCaptureTransaction'); $transactionRequestType->setAmount(350); $transactionRequestType->setProfile($profileToCharge); $request = new CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); - $request->setRefId( $refId); - $request->setTransactionRequest( $transactionRequestType); + $request->setRefId($refId); + $request->setTransactionRequest($transactionRequestType); $controller = new CreateTransactionController($request); - $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); + $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); - if ($response != null) - { - if($response->getMessages()->getResultCode() == "Ok") - { - $tresponse = $response->getTransactionResponse(); - - if ($tresponse != null && $tresponse->getMessages() != null) - { - info( " Transaction Response code : " . $tresponse->getResponseCode() . "\n"); - info( "Charge Customer Profile APPROVED :" . "\n"); - info( " Charge Customer Profile AUTH CODE : " . $tresponse->getAuthCode() . "\n"); - info( " Charge Customer Profile TRANS ID : " . $tresponse->getTransId() . "\n"); - info( " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"); - info( " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n"); + if ($response != null) { + if ($response->getMessages()->getResultCode() == 'Ok') { + $tresponse = $response->getTransactionResponse(); + + if ($tresponse != null && $tresponse->getMessages() != null) { + info(' Transaction Response code : '.$tresponse->getResponseCode()."\n"); + info('Charge Customer Profile APPROVED :'."\n"); + info(' Charge Customer Profile AUTH CODE : '.$tresponse->getAuthCode()."\n"); + info(' Charge Customer Profile TRANS ID : '.$tresponse->getTransId()."\n"); + info(' Code : '.$tresponse->getMessages()[0]->getCode()."\n"); + info(' Description : '.$tresponse->getMessages()[0]->getDescription()."\n"); + } else { + info("Transaction Failed \n"); + if ($tresponse->getErrors() != null) { + info(' Error code : '.$tresponse->getErrors()[0]->getErrorCode()."\n"); + info(' Error message : '.$tresponse->getErrors()[0]->getErrorText()."\n"); + } + } + } else { + info("Transaction Failed \n"); + $tresponse = $response->getTransactionResponse(); + if ($tresponse != null && $tresponse->getErrors() != null) { + info(' Error code : '.$tresponse->getErrors()[0]->getErrorCode()."\n"); + info(' Error message : '.$tresponse->getErrors()[0]->getErrorText()."\n"); + } else { + info(' Error code : '.$response->getMessages()->getMessage()[0]->getCode()."\n"); + info(' Error message : '.$response->getMessages()->getMessage()[0]->getText()."\n"); + } } - else - { - info( "Transaction Failed \n"); - if($tresponse->getErrors() != null) - { - info( " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n"); - info( " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n"); - } - } - } - else - { - info( "Transaction Failed \n"); - $tresponse = $response->getTransactionResponse(); - if($tresponse != null && $tresponse->getErrors() != null) - { - info( " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n"); - info( " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n"); - } - else - { - info( " Error code : " . $response->getMessages()->getMessage()[0]->getCode() . "\n"); - info( " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n"); - } - } - } - else - { - info( "No response returned \n"); + } else { + info("No response returned \n"); } $this->assertNotNull($response); @@ -378,7 +349,7 @@ class AuthorizeTest extends TestCase /* Testing refunds - need to research more as payments are in a pending state so cannot be 'refunded'*/ // info("transaction reference = " . $tresponse->getTransId()); - + // $payment = PaymentFactory::create($this->company->id, $this->user->id); // $payment->amount = 400; // $payment->client_id = $this->client->id; @@ -396,7 +367,5 @@ class AuthorizeTest extends TestCase // info(print_r($response,1)); // $this->assertTrue(is_array($response)); - - } - + } } diff --git a/tests/Integration/SendFailedEmailsTest.php b/tests/Integration/SendFailedEmailsTest.php index 917fc0a443e3..346814c5da09 100644 --- a/tests/Integration/SendFailedEmailsTest.php +++ b/tests/Integration/SendFailedEmailsTest.php @@ -20,7 +20,7 @@ use Tests\TestCase; class SendFailedEmailsTest extends TestCase { use MockAccountData; - use DatabaseTransactions; + use DatabaseTransactions; public function setUp() :void { @@ -29,14 +29,13 @@ class SendFailedEmailsTest extends TestCase $this->makeTestData(); } - public function testReminderFires() { - $invitation = $this->invoice->invitations->first(); + $invitation = $this->invoice->invitations->first(); $reminder_template = $this->invoice->calculateTemplate(); $sl = [ - 'entity_name' => 'App\Models\InvoiceInvitation', + 'entity_name' => \App\Models\InvoiceInvitation::class, 'invitation_key' => $invitation->key, 'reminder_template' => $reminder_template, 'subject' => '', @@ -56,13 +55,11 @@ class SendFailedEmailsTest extends TestCase $this->assertNotNull($sys_log); - // Queue::fake(); - SendFailedEmails::dispatch(); - - //Queue::assertPushed(SendFailedEmails::class); - //Queue::assertPushed(EmailInvoice::class); - //$this->expectsJobs(EmailInvoice::class); + // Queue::fake(); + SendFailedEmails::dispatch(); + //Queue::assertPushed(SendFailedEmails::class); + //Queue::assertPushed(EmailInvoice::class); + //$this->expectsJobs(EmailInvoice::class); } - } diff --git a/tests/Integration/SystemHealthTest.php b/tests/Integration/SystemHealthTest.php index 64b4e4822f10..8fe6f2fb952d 100644 --- a/tests/Integration/SystemHealthTest.php +++ b/tests/Integration/SystemHealthTest.php @@ -27,12 +27,9 @@ class SystemHealthTest extends TestCase { $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), - 'X-API-TOKEN' => $this->token + 'X-API-TOKEN' => $this->token, ])->get('/api/v1/health_check'); - $response->assertStatus(200); } - - } diff --git a/tests/Integration/UniqueEmailTest.php b/tests/Integration/UniqueEmailTest.php index 90ee01f475e5..453f9f04cb06 100644 --- a/tests/Integration/UniqueEmailTest.php +++ b/tests/Integration/UniqueEmailTest.php @@ -44,9 +44,8 @@ class UniqueEmailTest extends TestCase ]); $company->setHidden(['settings', 'settings_object', 'hashed_id']); - - Company::on('db-ninja-01')->create($company->toArray()); + Company::on('db-ninja-01')->create($company->toArray()); $ac2 = factory(\App\Models\Account::class)->make(); $ac2->setHidden(['hashed_id']); @@ -60,7 +59,6 @@ class UniqueEmailTest extends TestCase Company::on('db-ninja-02')->create($company2->toArray()); - $user = [ 'first_name' => 'user_db_1', 'email' => 'user@example.com', @@ -77,13 +75,15 @@ class UniqueEmailTest extends TestCase $user_find = User::on('db-ninja-01')->where('email', 'user@example.com')->first(); - if(!$user_find) + if (! $user_find) { User::on('db-ninja-01')->create($user); - + } + $user_find = User::on('db-ninja-02')->where('email', 'user@example.com')->first(); - if(!$user_find) + if (! $user_find) { User::on('db-ninja-02')->create($user2); + } } public function test_unique_emails_detected_on_database() diff --git a/tests/Integration/UpdateCompanyLedgerTest.php b/tests/Integration/UpdateCompanyLedgerTest.php index 8468b6dd38b6..fa0e2ff97795 100644 --- a/tests/Integration/UpdateCompanyLedgerTest.php +++ b/tests/Integration/UpdateCompanyLedgerTest.php @@ -19,7 +19,6 @@ use Tests\MockAccountData; use Tests\TestCase; /** @test*/ - class UpdateCompanyLedgerTest extends TestCase { use MockAccountData; @@ -44,7 +43,7 @@ class UpdateCompanyLedgerTest extends TestCase ->orderBy('id', 'DESC') ->first(); - $payment = $ledger->adjustment * - 1; + $payment = $ledger->adjustment * -1; $this->assertEquals($invoice->amount, $payment); } @@ -53,13 +52,9 @@ class UpdateCompanyLedgerTest extends TestCase */ public function testInvoiceIsPresentInLedger() { - //$this->invoice->save(); - $ledger = CompanyLedger::whereCompanyLedgerableId($this->invoice->id) - ->whereCompanyLedgerableType(Invoice::class) - ->whereCompanyId($this->invoice->company_id) - ->get(); + $invoice = $this->invoice->service()->markPaid()->save(); - $this->assertGreaterThan(1, count($ledger)); + $this->assertGreaterThan(0, $invoice->company_ledger()->count()); } } diff --git a/tests/Integration/UploadFileTest.php b/tests/Integration/UploadFileTest.php index fcc121fb25d3..1dc74393a21b 100644 --- a/tests/Integration/UploadFileTest.php +++ b/tests/Integration/UploadFileTest.php @@ -43,7 +43,6 @@ class UploadFileTest extends TestCase ); } - public function testFileUploadWorks() { $image = UploadedFile::fake()->image('avatar.jpg'); @@ -55,7 +54,7 @@ class UploadFileTest extends TestCase $this->invoice->company, $this->invoice ); - + $this->assertNotNull($document); } } diff --git a/tests/Integration/UploadLogoTest.php b/tests/Integration/UploadLogoTest.php index 6cf2ce3b5854..bb4802282b48 100644 --- a/tests/Integration/UploadLogoTest.php +++ b/tests/Integration/UploadLogoTest.php @@ -42,23 +42,22 @@ class UploadLogoTest extends TestCase Company::reguard(); } - public function testLogoUploadWorks() { Storage::fake('avatars'); $data = [ 'company_logo' => UploadedFile::fake()->image('avatar.jpg'), - 'name' => 'TestCompany' + 'name' => 'TestCompany', ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $data); - + $response->assertStatus(200); - + $acc = $response->json(); $logo = $acc['data']['settings']['company_logo']; @@ -68,41 +67,38 @@ class UploadLogoTest extends TestCase $this->assertNotNull($logo_file); } - - public function testLogoUploadfailure() { Storage::fake('avatars'); $data = [ - 'company_logo' => "", - 'name' => 'TestCompany' + 'company_logo' => '', + 'name' => 'TestCompany', ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $data); - + //$acc = $response->json(); $response->assertStatus(302); } - public function testLogoUploadNoAttribute() { Storage::fake('avatars'); $data = [ - 'name' => 'TestCompany' + 'name' => 'TestCompany', ]; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $data); - + $response->assertStatus(200); } } diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index d2a9df121935..12a65cc8e094 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -1,6 +1,6 @@ $class) { - + // check that the table exists in case the migration is pending if (! Schema::hasTable((new $class())->getTable())) { continue; @@ -101,17 +100,17 @@ trait MockAccountData $settings = CompanySettings::defaults(); $settings->company_logo = 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'; - $settings->website = 'www.invoiceninja.com'; - $settings->address1 = 'Address 1'; - $settings->address2 = 'Address 2'; - $settings->city = 'City'; - $settings->state = 'State'; - $settings->postal_code = 'Postal Code'; - $settings->phone = '555-343-2323'; - $settings->email = 'user@example.com'; - $settings->country_id = '840'; + $settings->website = 'www.invoiceninja.com'; + $settings->address1 = 'Address 1'; + $settings->address2 = 'Address 2'; + $settings->city = 'City'; + $settings->state = 'State'; + $settings->postal_code = 'Postal Code'; + $settings->phone = '555-343-2323'; + $settings->email = 'user@example.com'; + $settings->country_id = '840'; $settings->vat_number = 'vat number'; - $settings->id_number = 'id number'; + $settings->id_number = 'id number'; $this->company->settings = $settings; $this->company->save(); @@ -121,13 +120,13 @@ trait MockAccountData $this->user = User::whereEmail('user@example.com')->first(); - if (!$this->user) { + if (! $this->user) { $this->user = factory(\App\Models\User::class)->create([ 'account_id' => $this->account->id, - 'confirmation_code' => $this->createDbHash(config('database.default')) + 'confirmation_code' => $this->createDbHash(config('database.default')), ]); } - + $this->user->password = Hash::make('ALongAndBriliantPassword'); $cu = CompanyUserFactory::create($this->user->id, $this->company->id, $this->account->id); @@ -147,13 +146,11 @@ trait MockAccountData $company_token->save(); - $this->client = factory(\App\Models\Client::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, ]); - $contact = factory(\App\Models\ClientContact::class)->create([ 'user_id' => $this->user->id, 'client_id' => $this->client->id, @@ -166,13 +163,12 @@ trait MockAccountData 'user_id' => $this->user->id, 'client_id' => $this->client->id, 'company_id' => $this->company->id, - 'send_email' => true + 'send_email' => true, ]); - - // $rels = collect($contact, $contact2); - // $this->client->setRelation('contacts', $rels); - // $this->client->save(); + // $rels = collect($contact, $contact2); + // $this->client->setRelation('contacts', $rels); + // $this->client->save(); $gs = new GroupSetting; $gs->name = 'Test'; @@ -186,8 +182,8 @@ trait MockAccountData $this->client->group_settings_id = $gs->id; $this->client->save(); - - $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id);//stub the company and user_id + + $this->invoice = InvoiceFactory::create($this->company->id, $this->user->id); //stub the company and user_id $this->invoice->client_id = $this->client->id; // $this->invoice = factory(\App\Models\Invoice::class)->create([ @@ -196,7 +192,6 @@ trait MockAccountData // 'company_id' => $this->company->id, // ]); - $this->invoice->line_items = $this->buildLineItems(); $this->invoice->uses_inclusive_taxes = false; @@ -215,14 +210,14 @@ trait MockAccountData //$this->invoice->service()->createInvitations()->markSent(); //$this->invoice->service()->createInvitations(); - factory(\App\Models\InvoiceInvitation::class)->create([ + factory(\App\Models\InvoiceInvitation::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_contact_id' => $contact->id, 'invoice_id' => $this->invoice->id, ]); - factory(\App\Models\InvoiceInvitation::class)->create([ + factory(\App\Models\InvoiceInvitation::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_contact_id' => $contact2->id, @@ -246,20 +241,20 @@ trait MockAccountData $this->quote_calc->build(); $this->quote = $this->quote_calc->getQuote(); - + $this->quote->status_id = Quote::STATUS_SENT; $this->quote->number = $this->getNextQuoteNumber($this->client); //$this->quote->service()->createInvitations()->markSent(); - factory(\App\Models\QuoteInvitation::class)->create([ + factory(\App\Models\QuoteInvitation::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_contact_id' => $contact->id, 'quote_id' => $this->quote->id, ]); - factory(\App\Models\QuoteInvitation::class)->create([ + factory(\App\Models\QuoteInvitation::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_contact_id' => $contact2->id, @@ -281,7 +276,7 @@ trait MockAccountData $this->credit->uses_inclusive_taxes = false; $this->credit->save(); - + $this->credit->service()->createInvitations()->markSent(); $this->credit_calc = new InvoiceSum($this->credit); @@ -298,12 +293,12 @@ trait MockAccountData ->whereInvoiceId($this->invoice->id) ->first(); - if (!$invitation && $contact->send_email) { + if (! $invitation && $contact->send_email) { $ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id); $ii->invoice_id = $this->invoice->id; $ii->client_contact_id = $contact->id; $ii->save(); - } elseif ($invitation && !$contact->send_email) { + } elseif ($invitation && ! $contact->send_email) { $invitation->delete(); } }); @@ -324,7 +319,7 @@ trait MockAccountData $recurring_invoice->remaining_cycles = 2; $recurring_invoice->start_date = Carbon::now(); $recurring_invoice->save(); - + $recurring_invoice->number = $this->getNextInvoiceNumber($this->invoice->client); $recurring_invoice->save(); @@ -334,7 +329,7 @@ trait MockAccountData $recurring_invoice->remaining_cycles = 2; $recurring_invoice->start_date = Carbon::now(); $recurring_invoice->save(); - + $recurring_invoice->number = $this->getNextInvoiceNumber($this->invoice->client); $recurring_invoice->save(); @@ -344,7 +339,7 @@ trait MockAccountData $recurring_invoice->remaining_cycles = 2; $recurring_invoice->start_date = Carbon::now(); $recurring_invoice->save(); - + $recurring_invoice->number = $this->getNextInvoiceNumber($this->invoice->client); $recurring_invoice->save(); @@ -354,18 +349,17 @@ trait MockAccountData $recurring_invoice->remaining_cycles = 2; $recurring_invoice->start_date = Carbon::now(); $recurring_invoice->save(); - + $recurring_invoice->number = $this->getNextInvoiceNumber($this->invoice->client); $recurring_invoice->save(); - $recurring_invoice = InvoiceToRecurringInvoiceFactory::create($this->invoice); $recurring_invoice->next_send_date = Carbon::now()->addMinutes(20); $recurring_invoice->status_id = RecurringInvoice::STATUS_ACTIVE; $recurring_invoice->remaining_cycles = 2; $recurring_invoice->start_date = Carbon::now(); $recurring_invoice->save(); - + $recurring_invoice->number = $this->getNextInvoiceNumber($this->invoice->client); $recurring_invoice->save(); @@ -375,7 +369,7 @@ trait MockAccountData $recurring_invoice->remaining_cycles = 2; $recurring_invoice->start_date = Carbon::now(); $recurring_invoice->save(); - + $recurring_invoice->number = $this->getNextInvoiceNumber($this->invoice->client); $recurring_invoice->save(); @@ -387,7 +381,6 @@ trait MockAccountData $gs->save(); if (config('ninja.testvars.stripe')) { - $data = []; $data[1]['min_limit'] = 234; $data[1]['max_limit'] = 65317; @@ -423,19 +416,16 @@ trait MockAccountData $cg->fees_and_limits = $data; $cg->config = encrypt(config('ninja.testvars.stripe')); $cg->save(); - } } - - private function buildLineItems() { $line_items = []; $item = InvoiceItemFactory::create(); $item->quantity = 1; - $item->cost =10; + $item->cost = 10; $line_items[] = $item; diff --git a/tests/Pdf/PdfGenerationTest.php b/tests/Pdf/PdfGenerationTest.php index b57d1f47ca7f..8fa6b21a83c4 100644 --- a/tests/Pdf/PdfGenerationTest.php +++ b/tests/Pdf/PdfGenerationTest.php @@ -33,7 +33,6 @@ class PdfGenerationTest extends TestCase $html = file_get_contents(base_path().'/tests/Pdf/invoice.html'); $pdf = base_path().'/tests/Pdf/invoice.pdf'; - $header = '
'; $footer = '