Fix for doubling client balance erroneously on emailing"

This commit is contained in:
David Bomba 2020-12-13 11:04:56 +11:00
parent 666966c8bd
commit d440d4421d
2 changed files with 7 additions and 2 deletions

View File

@ -132,8 +132,6 @@ class EmailController extends BaseController
}
});
$entity_obj = $entity_obj->service()->markSent()->save();
$entity_obj->last_sent_date = now();
$entity_obj->save();

View File

@ -37,6 +37,9 @@ class MarkSent extends AbstractService
return $this->invoice;
}
info("in mark sent");
info($this->invoice->balance);
$this->invoice->markInvitationsSent();
$this->invoice->setReminder();
@ -49,8 +52,12 @@ class MarkSent extends AbstractService
->updateBalance($this->invoice->amount)
->save();
info($this->invoice->balance);
$this->client->service()->updateBalance($this->invoice->balance)->save();
info($this->client->balance);
$this->invoice->ledger()->updateInvoiceBalance($this->invoice->balance);
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars()));