diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php
index 7dba25743d38..01f2cbedc5dd 100644
--- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php
+++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php
@@ -94,4 +94,11 @@ class UpdateInvoiceRequest extends Request
$this->replace($input);
}
+
+ public function messages()
+ {
+ return [
+ 'id' => ctrans('text.locked_invoice'),
+ ];
+ }
}
diff --git a/app/Mail/BouncedEmail.php b/app/Mail/BouncedEmail.php
index 7886967cb61b..68876078cc99 100644
--- a/app/Mail/BouncedEmail.php
+++ b/app/Mail/BouncedEmail.php
@@ -59,7 +59,7 @@ class BouncedEmail extends Mailable implements ShouldQueue
//->bcc('')
->queue(new BouncedEmail($invitation));
- return $this->from('turbo124@gmail.com') //todo
+ return $this->from('x@gmail.com') //todo
->subject(ctrans('texts.confirmation_subject'))
->markdown('email.auth.verify', ['user' => $this->user])
->text('email.auth.verify_text');
diff --git a/app/Mail/VerifyUser.php b/app/Mail/VerifyUser.php
index 13d4587736ef..9ef44712b440 100644
--- a/app/Mail/VerifyUser.php
+++ b/app/Mail/VerifyUser.php
@@ -39,7 +39,7 @@ class VerifyUser extends Mailable implements ShouldQueue
*/
public function build()
{
- return $this->from('turbo124@gmail.com') //todo
+ return $this->from('x@gmail.com') //todo
->subject(ctrans('texts.confirmation_subject'))
->markdown('email.auth.verify', ['user' => $this->user])
->text('email.auth.verify_text');
diff --git a/app/Notifications/BaseNotification.php b/app/Notifications/BaseNotification.php
index 5b9d71b768f8..293cc145c805 100644
--- a/app/Notifications/BaseNotification.php
+++ b/app/Notifications/BaseNotification.php
@@ -103,7 +103,7 @@ class BaseNotification extends Notification implements ShouldQueue
$email_style_custom = $this->settings->email_style_custom;
$body = strtr($email_style_custom, "$body", $body);
}
-
+
$data = [
'body' => $body,
'design' => $design_style,
@@ -120,4 +120,22 @@ class BaseNotification extends Notification implements ShouldQueue
return $data;
}
+
+ public function getTemplateView()
+ {
+
+ switch ($this->settings->email_style) {
+ case 'plain':
+ return 'email.template.plain';
+ break;
+ case 'custom':
+ return 'email.template.custom';
+ break;
+ default:
+ return 'email.admin.generic_email';
+ break;
+ }
+
+ }
+
}
\ No newline at end of file
diff --git a/app/Notifications/SendGenericNotification.php b/app/Notifications/SendGenericNotification.php
index fa1395900dde..0ccbe6996e76 100644
--- a/app/Notifications/SendGenericNotification.php
+++ b/app/Notifications/SendGenericNotification.php
@@ -73,10 +73,11 @@ class SendGenericNotification extends BaseNotification implements ShouldQueue
*/
public function toMail($notifiable)
{
+
$mail_message = (new MailMessage)
->withSwiftMessage(function ($message) {
$message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key);
- })->markdown('email.admin.generic_email', $this->buildMailMessageData());
+ })->markdown($this->getTemplateView(), $this->buildMailMessageData());
$mail_message = $this->buildMailMessageSettings($mail_message);
diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php
index 0ef048db9468..ac67a055e80c 100644
--- a/app/Repositories/ClientContactRepository.php
+++ b/app/Repositories/ClientContactRepository.php
@@ -70,6 +70,9 @@ class ClientContactRepository extends BaseRepository
});
+ //need to reload here to shake off stale contacts
+ $client->load('contacts');
+
//always made sure we have one blank contact to maintain state
if ($client->contacts->count() == 0) {
diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php
index fc922bc5f3cd..8acbce3f896c 100644
--- a/app/Utils/HtmlEngine.php
+++ b/app/Utils/HtmlEngine.php
@@ -84,22 +84,10 @@ class HtmlEngine
-
-
-
-
-
-
-
-
-
-
-
-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- private function buildEntityDataArray() :array
+ public function buildEntityDataArray() :array
{
if (!$this->client->currency()) {
throw new \Exception(debug_backtrace()[1]['function'], 1);
@@ -132,21 +120,24 @@ class HtmlEngine
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
$data['$terms'] = &$data['$entity.terms'];
- }
+ $data['$view_link'] = ['value' => ''. ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')];
+ }
if ($this->entity_string == 'quote') {
$data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.quote')];
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')];
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
$data['$terms'] = &$data['$entity.terms'];
- }
+ $data['$view_link'] = ['value' => ''. ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')];
+ }
if ($this->entity_string == 'credit') {
$data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')];
$data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')];
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
$data['$terms'] = &$data['$entity.terms'];
- }
+ $data['$view_link'] = ['value' => ''. ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')];
+ }
$data['$entity_number'] = &$data['$number'];
diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php
index 626241f57894..e5d573c54491 100644
--- a/app/Utils/Traits/MakesInvoiceValues.php
+++ b/app/Utils/Traits/MakesInvoiceValues.php
@@ -187,6 +187,7 @@ trait MakesInvoiceValues
}
$calc = $this->calc();
+ $invitation = $this->invitations->where('client_contact_id', $contact->id)->first();
$data = [];
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
@@ -214,6 +215,7 @@ trait MakesInvoiceValues
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')];
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
$data['$terms'] = &$data['$entity.terms'];
+ $data['$view_link'] = ['value' => ''. ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')];
}
if ($this instanceof Quote) {
@@ -221,13 +223,15 @@ trait MakesInvoiceValues
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')];
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
$data['$terms'] = &$data['$entity.terms'];
- }
+ $data['$view_link'] = ['value' => ''. ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')];
+ }
if ($this instanceof Credit) {
$data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')];
$data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')];
$data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
$data['$terms'] = &$data['$entity.terms'];
+ $data['$view_link'] = ['value' => ''. ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')];
}
$data['$entity_number'] = &$data['$number'];