1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

More logging for migrations

This commit is contained in:
David Bomba 2021-08-10 11:40:58 +10:00
parent 353fe14b1e
commit 3727bafaa1
7 changed files with 25 additions and 4 deletions

View File

@ -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());
}

View File

@ -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,
]);
}
}

View File

@ -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
{

View File

@ -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(),
];
}

View File

@ -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.<br><br>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. <br> We have paused your outbound emails.<br><br> Your email quota will reset at 23:00 UTC.',
'auto_bill_option' => 'Opt in or out of having this invoice automatically charged.'
);
return $LANG;

View File

@ -4,7 +4,7 @@
<p>{{ ctrans('texts.migration_failed') }} {{ $company->present()->name() }}</p>
<pre>
@if(\App\Utils\Ninja::isSelfHost())
@if(\App\Utils\Ninja::isSelfHost() || $is_system)
{!! $exception->getMessage() !!}
{!! $content !!}
@else

View File

@ -65,9 +65,8 @@
<div class="bg-white shadow overflow-hidden lg:rounded-lg mt-4">
<div class="flex flex-col md:flex-row items-start justify-between px-4 py-5 sm:p-6">
<div>
<h3 class="text-lg leading-6 font-medium text-gray-900">Auto Bill</h3>
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">Change your update bill
preferences.</p>
<h3 class="text-lg leading-6 font-medium text-gray-900">{{ ctrans('texts.auto_bill') }}</h3>
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">{{ ctrans('texts.auto_bill_option')}}</p>
</div>
<div class="flex mt-4 space-x-2">