diff --git a/app/Jobs/Entity/EmailEntity.php b/app/Jobs/Entity/EmailEntity.php index e2683196f57e..53d4dfbd9e3c 100644 --- a/app/Jobs/Entity/EmailEntity.php +++ b/app/Jobs/Entity/EmailEntity.php @@ -112,6 +112,9 @@ class EmailEntity implements ShouldQueue App::setLocale($this->invitation->contact->preferredLocale()); $t->replace(Ninja::transformTranslations($this->settings)); + /* Mark entity sent */ + $this->entity->service()->markSent()->save(); + $nmo = new NinjaMailerObject; $nmo->mailable = new TemplateEmail($this->email_entity_builder, $this->invitation->contact, $this->invitation); $nmo->company = $this->company; @@ -124,8 +127,7 @@ class EmailEntity implements ShouldQueue NinjaMailerJob::dispatchNow($nmo); - /* Mark entity sent */ - $this->entity->service()->markSent()->save(); + } private function resolveEntityString() :string diff --git a/app/Mail/Engine/QuoteEmailEngine.php b/app/Mail/Engine/QuoteEmailEngine.php index 2d33077210b0..39342f8f60fc 100644 --- a/app/Mail/Engine/QuoteEmailEngine.php +++ b/app/Mail/Engine/QuoteEmailEngine.php @@ -64,7 +64,7 @@ class QuoteEmailEngine extends BaseEmailEngine [ 'quote' => $this->quote->number, 'company' => $this->quote->company->present()->name(), - 'amount' => Number::formatMoney($this->quote->balance, $this->client), + 'amount' => Number::formatMoney($this->quote->amount, $this->client), ], null, $this->client->locale() @@ -99,7 +99,6 @@ class QuoteEmailEngine extends BaseEmailEngine ->setViewText(ctrans('texts.view_quote')) ->setInvitation($this->invitation); - if ($this->client->getSetting('pdf_email_attachment') !== false && $this->quote->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { if(Ninja::isHosted()) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 153e5fd0bf1a..a310c635d31e 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -483,6 +483,10 @@ class InvoiceService if(!isset($this->invoice->exchange_rate) && $this->invoice->client->currency()->id != (int) $this->invoice->company->settings->currency_id) $this->invoice->exchange_rate = $this->invoice->client->currency()->exchange_rate; + if($settings->counter_number_applied == 'when_saved'){ + $this->invoice->service()->applyNumber()->save(); + } + return $this; } diff --git a/app/Services/Quote/TriggeredActions.php b/app/Services/Quote/TriggeredActions.php index e1ec9a37a00f..14d69b63fe8e 100644 --- a/app/Services/Quote/TriggeredActions.php +++ b/app/Services/Quote/TriggeredActions.php @@ -57,7 +57,10 @@ class TriggeredActions extends AbstractService { $reminder_template = $this->quote->calculateTemplate('quote'); - //$reminder_template = 'payment'; + // $reminder_template = 'email_template_quote'; + +// nlog($reminder_template); + $this->quote->invitations->load('contact.client.country', 'quote.client.country', 'quote.company')->each(function ($invitation) use ($reminder_template) { EmailEntity::dispatch($invitation, $this->quote->company, $reminder_template);