mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Add flagging abilities to accounts table
This commit is contained in:
parent
aa7c3a0ce0
commit
127e9f723f
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Models\CompanyUser;
|
||||
use App\Models\User;
|
||||
|
||||
class UserFactory
|
||||
|
@ -308,8 +308,9 @@ class NinjaMailerJob implements ShouldQueue
|
||||
|
||||
private function preFlightChecksFail()
|
||||
{
|
||||
|
||||
/* If we are migrating data we don't want to fire any emails */
|
||||
if ($this->nmo->company->is_disabled && !$this->override)
|
||||
if($this->nmo->company->is_disabled && !$this->override)
|
||||
return true;
|
||||
|
||||
/* On the hosted platform we set default contacts a @example.com email address - we shouldn't send emails to these types of addresses */
|
||||
@ -324,6 +325,9 @@ class NinjaMailerJob implements ShouldQueue
|
||||
if(Ninja::isHosted() && $this->company->account && $this->company->account->emailQuotaExceeded())
|
||||
return true;
|
||||
|
||||
if(Ninja::isHosted() && $this->company->account && $this->nmo->company->account->is_flagged)
|
||||
return true;
|
||||
|
||||
/* Ensure the user has a valid email address */
|
||||
if(!str_contains($this->nmo->to_user->email, "@"))
|
||||
return true;
|
||||
|
@ -373,6 +373,8 @@ class Account extends BaseModel
|
||||
|
||||
public function getDailyEmailLimit()
|
||||
{
|
||||
if($this->is_flagged)
|
||||
return 0;
|
||||
|
||||
if(Carbon::createFromTimestamp($this->created_at)->diffInWeeks() == 0)
|
||||
return 20;
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFlagToAccountsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('accounts', function (Blueprint $table) {
|
||||
$table->boolean('is_flagged')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user