1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Exceptions for emailing when company is deactivated

This commit is contained in:
David Bomba 2021-05-12 20:46:59 +10:00
parent 4326e3d1ca
commit da6ccddaaf
3 changed files with 12 additions and 6 deletions

View File

@ -54,7 +54,9 @@ class NinjaMailerJob implements ShouldQueue
public $nmo;
public function __construct(NinjaMailerObject $nmo)
public $override;
public function __construct(NinjaMailerObject $nmo, bool $override = false)
{
$this->nmo = $nmo;
@ -64,7 +66,7 @@ class NinjaMailerJob implements ShouldQueue
public function handle()
{
/*If we are migrating data we don't want to fire any emails*/
if ($this->nmo->company->is_disabled)
if ($this->nmo->company->is_disabled && !$this->override)
return true;
/*Set the correct database*/

View File

@ -55,9 +55,6 @@ class UserEmailChanged implements ShouldQueue
public function handle()
{
nlog("notifying user of email change");
if ($this->company->is_disabled)
return true;
//Set DB
MultiDB::setDb($this->company->db);
@ -78,7 +75,7 @@ class UserEmailChanged implements ShouldQueue
$nmo->company = $this->company;
$nmo->to_user = $this->old_user;
NinjaMailerJob::dispatch($nmo);
NinjaMailerJob::dispatch($nmo, true);
// $nmo->to_user = $this->new_user;
// NinjaMailerJob::dispatch($nmo);

View File

@ -209,6 +209,9 @@ class Import implements ShouldQueue
$this->{$method}($data[$import]);
}
if(Ninja::isHosted())
$this->processNinjaTokens($data['ninja_tokens']);
$this->setInitialCompanyLedgerBalances();
// $this->fixClientBalances();
@ -1636,6 +1639,10 @@ class Import implements ShouldQueue
return $response->getBody();
}
private function processNinjaTokens(array $data)
{
}
/* In V4 we use negative invoices (credits) and add then into the client balance. In V5, these sit off ledger and are applied later.
This next section will check for credit balances and reduce the client balance so that the V5 balances are correct