diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index d3c13c599..b4e54a07d 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -133,6 +133,15 @@ class StartMigration implements ShouldQueue Mail::to($this->user->email, $this->user->name())->send(new MigrationFailed($e, $this->company, $e->getMessage())); + if(Ninja::isHosted()){ + + $migration_failed = new MigrationFailed($e, $this->company, $e->getMessage()); + $migration_failed->is_system = true; + + Mail::to('contact@invoiceninja.com', 'Failed Migration')->send($migration_failed); + + } + if (app()->environment() !== 'production') { info($e->getMessage()); } diff --git a/app/Mail/MigrationFailed.php b/app/Mail/MigrationFailed.php index 9c28bd2fb..55d6f0838 100644 --- a/app/Mail/MigrationFailed.php +++ b/app/Mail/MigrationFailed.php @@ -13,6 +13,8 @@ class MigrationFailed extends Mailable public $company; + public $is_system = false; + /** * Create a new message instance. * @@ -38,6 +40,7 @@ class MigrationFailed extends Mailable ->view('email.migration.failed', [ 'logo' => $this->company->present()->logo(), 'settings' => $this->company->settings, + 'is_system' => $this->is_system, ]); } } diff --git a/app/Models/Account.php b/app/Models/Account.php index ae563d050..8b0c07dbf 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -363,6 +363,13 @@ class Account extends BaseModel return min($limit, 5000); } + public function emailsSent() + { + if(is_null(Cache::get($this->key))) + return 0; + + return Cache::get($this->key); + } public function emailQuotaExceeded() :bool { diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php index 57a68d9b1..c26b35d73 100644 --- a/app/Transformers/AccountTransformer.php +++ b/app/Transformers/AccountTransformer.php @@ -80,6 +80,8 @@ class AccountTransformer extends EntityTransformer 'is_scheduler_running' => (bool) $account->is_scheduler_running, 'default_company_id' => (string) $this->encodePrimaryKey($account->default_company_id), 'disable_auto_update' => (bool) config('ninja.disable_auto_update'), + 'emails_sent' => (int) $account->emailsSent(), + 'email_quota' => (int) $account->getDailyEmailLimit(), ]; } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index c9cd5d7ff..091d814af 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -4291,6 +4291,7 @@ $LANG = array( 'stripe_connect_migration_desc' => 'Invoice Ninja v5 uses Stripe Connect to link your Stripe account to Invoice Ninja. This provides an additional layer of security for your account. Now that you data has migrated, you will need to Authorize Stripe to accept payments in v5.

To do this, navigate to Settings > Online Payments > Configure Gateways. Click on Stripe Connect and then under Settings click Setup Gateway. This will take you to Stripe to authorize Invoice Ninja and on your return your account will be successfully linked!', 'email_quota_exceeded_subject' => 'Account email quota exceeded.', 'email_quota_exceeded_body' => 'In a 24 hour period you have sent :quota emails.
We have paused your outbound emails.

Your email quota will reset at 23:00 UTC.', + 'auto_bill_option' => 'Opt in or out of having this invoice automatically charged.' ); return $LANG; diff --git a/resources/views/email/migration/failed.blade.php b/resources/views/email/migration/failed.blade.php index 487b9d066..e13eca301 100644 --- a/resources/views/email/migration/failed.blade.php +++ b/resources/views/email/migration/failed.blade.php @@ -4,7 +4,7 @@

{{ ctrans('texts.migration_failed') }} {{ $company->present()->name() }}

-            @if(\App\Utils\Ninja::isSelfHost())
+            @if(\App\Utils\Ninja::isSelfHost() || $is_system)
                 {!! $exception->getMessage() !!}
                 {!! $content !!}
             @else
diff --git a/resources/views/portal/ninja2020/recurring_invoices/show.blade.php b/resources/views/portal/ninja2020/recurring_invoices/show.blade.php
index 37c12a237..a2debf49c 100644
--- a/resources/views/portal/ninja2020/recurring_invoices/show.blade.php
+++ b/resources/views/portal/ninja2020/recurring_invoices/show.blade.php
@@ -65,9 +65,8 @@
             
-

Auto Bill

-

Change your update bill - preferences.

+

{{ ctrans('texts.auto_bill') }}

+

{{ ctrans('texts.auto_bill_option')}}