mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 05:54:38 -04:00
Seed company logo size variables into vendor HTML engine
This commit is contained in:
parent
886ca7f1e0
commit
091b798b5b
@ -23,6 +23,7 @@ use App\Models\RecurringInvoiceInvitation;
|
|||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use App\Utils\Traits\AppSetup;
|
use App\Utils\Traits\AppSetup;
|
||||||
|
use App\Utils\Traits\DesignCalculator;
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -34,7 +35,8 @@ class HtmlEngine
|
|||||||
use MakesDates;
|
use MakesDates;
|
||||||
use AppSetup;
|
use AppSetup;
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use DesignCalculator;
|
||||||
|
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
public $invitation;
|
public $invitation;
|
||||||
@ -100,56 +102,6 @@ class HtmlEngine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function resolveCompanyLogoSize()
|
|
||||||
{
|
|
||||||
$design_map = [
|
|
||||||
"VolejRejNm" => "65%", // "Plain",
|
|
||||||
"Wpmbk5ezJn" => "65%", //"Clean",
|
|
||||||
"Opnel5aKBz" => "65%", //"Bold",
|
|
||||||
"wMvbmOeYAl" => "55%", //Modern",
|
|
||||||
"4openRe7Az" => "65%", //"Business",
|
|
||||||
"WJxbojagwO" => "65%", //"Creative",
|
|
||||||
"k8mep2bMyJ" => "55%", //"Elegant",
|
|
||||||
"l4zbq2dprO" => "65%", //"Hipster",
|
|
||||||
"yMYerEdOBQ" => "65%", //"Playful",
|
|
||||||
"gl9avmeG1v" => "65%", //"Tech",
|
|
||||||
"7LDdwRb1YK" => "65%", //"Calm",
|
|
||||||
"APdRoy0eGy" => "65%", //"Calm-DB2",
|
|
||||||
"y1aK83rbQG" => "65%", //"Calm-DB1",
|
|
||||||
];
|
|
||||||
|
|
||||||
$design_int_map = [
|
|
||||||
"1" => "65%", // "Plain",
|
|
||||||
"2" => "65%", //"Clean",
|
|
||||||
"3" => "65%", //"Bold",
|
|
||||||
"4" => "55%", //Modern",
|
|
||||||
"5" => "65%", //"Business",
|
|
||||||
"6" => "65%", //"Creative",
|
|
||||||
"7" => "55%", //"Elegant",
|
|
||||||
"8" => "65%", //"Hipster",
|
|
||||||
"9" => "65%", //"Playful",
|
|
||||||
"10" => "65%", //"Tech",
|
|
||||||
"11" => "65%", //"Calm",
|
|
||||||
"6972" => "65%", //"C-DB2"
|
|
||||||
"11221" => "65%", //"C-DB1"
|
|
||||||
];
|
|
||||||
|
|
||||||
if(isset($this->settings->company_logo_size) && strlen($this->settings->company_logo_size) > 1)
|
|
||||||
return $this->settings->company_logo_size;
|
|
||||||
|
|
||||||
if($this->entity->design_id && array_key_exists($this->entity->design_id, $design_int_map))
|
|
||||||
return $design_int_map[$this->entity->design_id];
|
|
||||||
|
|
||||||
$default_design_id = $this->entity_string."_design_id";
|
|
||||||
$design_id = $this->settings->{$default_design_id};
|
|
||||||
|
|
||||||
if(array_key_exists($design_id, $design_map))
|
|
||||||
return $design_map[$design_id];
|
|
||||||
|
|
||||||
return '65%';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildEntityDataArray() :array
|
public function buildEntityDataArray() :array
|
||||||
{
|
{
|
||||||
if (! $this->client->currency()) {
|
if (! $this->client->currency()) {
|
||||||
|
66
app/Utils/Traits/DesignCalculator.php
Normal file
66
app/Utils/Traits/DesignCalculator.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Utils\Traits;
|
||||||
|
|
||||||
|
trait DesignCalculator
|
||||||
|
{
|
||||||
|
|
||||||
|
private function resolveCompanyLogoSize()
|
||||||
|
{
|
||||||
|
$design_map = [
|
||||||
|
"VolejRejNm" => "65%", // "Plain",
|
||||||
|
"Wpmbk5ezJn" => "65%", //"Clean",
|
||||||
|
"Opnel5aKBz" => "65%", //"Bold",
|
||||||
|
"wMvbmOeYAl" => "55%", //Modern",
|
||||||
|
"4openRe7Az" => "65%", //"Business",
|
||||||
|
"WJxbojagwO" => "65%", //"Creative",
|
||||||
|
"k8mep2bMyJ" => "55%", //"Elegant",
|
||||||
|
"l4zbq2dprO" => "65%", //"Hipster",
|
||||||
|
"yMYerEdOBQ" => "65%", //"Playful",
|
||||||
|
"gl9avmeG1v" => "65%", //"Tech",
|
||||||
|
"7LDdwRb1YK" => "65%", //"Calm",
|
||||||
|
"APdRoy0eGy" => "65%", //"Calm-DB2",
|
||||||
|
"y1aK83rbQG" => "65%", //"Calm-DB1",
|
||||||
|
];
|
||||||
|
|
||||||
|
$design_int_map = [
|
||||||
|
"1" => "65%", // "Plain",
|
||||||
|
"2" => "65%", //"Clean",
|
||||||
|
"3" => "65%", //"Bold",
|
||||||
|
"4" => "55%", //Modern",
|
||||||
|
"5" => "65%", //"Business",
|
||||||
|
"6" => "65%", //"Creative",
|
||||||
|
"7" => "55%", //"Elegant",
|
||||||
|
"8" => "65%", //"Hipster",
|
||||||
|
"9" => "65%", //"Playful",
|
||||||
|
"10" => "65%", //"Tech",
|
||||||
|
"11" => "65%", //"Calm",
|
||||||
|
"6972" => "65%", //"C-DB2"
|
||||||
|
"11221" => "65%", //"C-DB1"
|
||||||
|
];
|
||||||
|
|
||||||
|
if(isset($this->settings->company_logo_size) && strlen($this->settings->company_logo_size) > 1)
|
||||||
|
return $this->settings->company_logo_size;
|
||||||
|
|
||||||
|
if($this->entity->design_id && array_key_exists($this->entity->design_id, $design_int_map))
|
||||||
|
return $design_int_map[$this->entity->design_id];
|
||||||
|
|
||||||
|
$default_design_id = $this->entity_string."_design_id";
|
||||||
|
$design_id = $this->settings->{$default_design_id};
|
||||||
|
|
||||||
|
if(array_key_exists($design_id, $design_map))
|
||||||
|
return $design_map[$design_id];
|
||||||
|
|
||||||
|
return '65%';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,7 @@ use App\Services\PdfMaker\Designs\Utilities\DesignHelpers;
|
|||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Number;
|
use App\Utils\Number;
|
||||||
use App\Utils\Traits\AppSetup;
|
use App\Utils\Traits\AppSetup;
|
||||||
|
use App\Utils\Traits\DesignCalculator;
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use App\Utils\transformTranslations;
|
use App\Utils\transformTranslations;
|
||||||
use Exception;
|
use Exception;
|
||||||
@ -38,7 +39,8 @@ class VendorHtmlEngine
|
|||||||
{
|
{
|
||||||
use MakesDates;
|
use MakesDates;
|
||||||
use AppSetup;
|
use AppSetup;
|
||||||
|
use DesignCalculator;
|
||||||
|
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
public $invitation;
|
public $invitation;
|
||||||
@ -127,6 +129,7 @@ class VendorHtmlEngine
|
|||||||
$data = [];
|
$data = [];
|
||||||
$data['$global_margin'] = ['value' => '6.35mm', 'label' => ''];
|
$data['$global_margin'] = ['value' => '6.35mm', 'label' => ''];
|
||||||
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
$data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')];
|
||||||
|
$data['$company_logo_size'] = ['value' => $this->resolveCompanyLogoSize(), 'label' => ''];
|
||||||
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
|
$data['$app_url'] = ['value' => $this->generateAppUrl(), 'label' => ''];
|
||||||
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
|
$data['$from'] = ['value' => '', 'label' => ctrans('texts.from')];
|
||||||
$data['$to'] = ['value' => '', 'label' => ctrans('texts.to')];
|
$data['$to'] = ['value' => '', 'label' => ctrans('texts.to')];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user