1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4113 from beganovich/v2-centralised-email-variables

E-mail centralised variables
This commit is contained in:
David Bomba 2020-09-29 06:55:23 +10:00 committed by GitHub
commit 0186edaf7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 9 deletions

29
app/Utils/Helpers.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Utils;
use App\Models\Client;
class Helpers
{
public static function sharedEmailVariables(Client $client, array $settings = null): array
{
$_settings = is_null($settings) ? $client->getMergedSettings() : $settings;
$elements['signature'] = $_settings->email_signature;
$elements['settings'] = $_settings;
$elements['whitelabel'] = $client->user->account->isPaid() ? true : false;
return $elements;
}
}

View File

@ -171,9 +171,8 @@ class TemplateEngine
$data['title'] = '';
$data['body'] = '$body';
$data['footer'] = '';
$data['signature'] = $this->settings_entity->getSetting('email_signature');
$data['settings'] = $this->settings;
$data['whitelabel'] = $this->entity_obj->client->user->account->isPaid() ? true : false;
$data = array_merge($data, Helpers::sharedEmailVariables($this->entity_obj->client));
if ($email_style == 'custom') {
$wrapper = $this->settings_entity->getSetting('email_style_custom');

View File

@ -59,12 +59,14 @@ if(!isset($design)) $design = 'light';
</div>
<!-- Whitelabel -->
@if(!$whitelabel)
<div style="display: flex; flex-direction: row; justify-content: center; margin-top: 1rem; margin-bottom: 1rem;">
<a href="https://invoiceninja.com" target="_blank">
<img style="height: 4rem;" src="{{ asset('images/created-by-invoiceninja-new.png') }}" alt="Invoice Ninja">
</a>
</div>
@isset($whitelabel)
@if(!$whitelabel)
<div style="display: flex; flex-direction: row; justify-content: center; margin-top: 1rem; margin-bottom: 1rem;">
<a href="https://invoiceninja.com" target="_blank">
<img style="height: 4rem;" src="{{ asset('images/created-by-invoiceninja-new.png') }}" alt="Invoice Ninja">
</a>
</div>
@endif
@endif
</body>
</html>