mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:40:09 -05:00 
			
		
		
		
	Centralised variables:
- New Helpers.php with sharedEmailVariables - Merged settings from TemplateEngine - @isset check for $whitelabel in the master.blade
This commit is contained in:
		
							parent
							
								
									7b926980f1
								
							
						
					
					
						commit
						69b24f95c4
					
				
							
								
								
									
										29
									
								
								app/Utils/Helpers.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								app/Utils/Helpers.php
									
									
									
									
									
										Normal 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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -171,9 +171,8 @@ class TemplateEngine
 | 
				
			|||||||
        $data['title'] = '';
 | 
					        $data['title'] = '';
 | 
				
			||||||
        $data['body'] = '$body';
 | 
					        $data['body'] = '$body';
 | 
				
			||||||
        $data['footer'] = '';
 | 
					        $data['footer'] = '';
 | 
				
			||||||
        $data['signature'] = $this->settings_entity->getSetting('email_signature');
 | 
					        
 | 
				
			||||||
        $data['settings'] = $this->settings;
 | 
					        $data = array_merge($data, Helpers::sharedEmailVariables($this->entity_obj->client));
 | 
				
			||||||
        $data['whitelabel'] = $this->entity_obj->client->user->account->isPaid() ? true : false;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($email_style == 'custom') {
 | 
					        if ($email_style == 'custom') {
 | 
				
			||||||
            $wrapper = $this->settings_entity->getSetting('email_style_custom');
 | 
					            $wrapper = $this->settings_entity->getSetting('email_style_custom');
 | 
				
			||||||
 | 
				
			|||||||
@ -59,12 +59,14 @@ if(!isset($design)) $design = 'light';
 | 
				
			|||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- Whitelabel -->
 | 
					  <!-- Whitelabel -->
 | 
				
			||||||
  @if(!$whitelabel)
 | 
					  @isset($whitelabel)
 | 
				
			||||||
    <div style="display: flex; flex-direction: row; justify-content: center; margin-top: 1rem; margin-bottom: 1rem;">
 | 
					    @if(!$whitelabel)
 | 
				
			||||||
      <a href="https://invoiceninja.com" target="_blank">
 | 
					      <div style="display: flex; flex-direction: row; justify-content: center; margin-top: 1rem; margin-bottom: 1rem;">
 | 
				
			||||||
        <img style="height: 4rem;" src="{{ asset('images/created-by-invoiceninja-new.png') }}" alt="Invoice Ninja">
 | 
					          <a href="https://invoiceninja.com" target="_blank">
 | 
				
			||||||
      </a>
 | 
					            <img style="height: 4rem;" src="{{ asset('images/created-by-invoiceninja-new.png') }}" alt="Invoice Ninja">
 | 
				
			||||||
    </div>
 | 
					          </a>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    @endif
 | 
				
			||||||
  @endif
 | 
					  @endif
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user