Document and Transaction trait getSettingKey function replace get{Document/Transaction}SettingKey

This commit is contained in:
Cüneyt Şentürk
2023-04-12 14:58:35 +03:00
parent a084f83839
commit ee5822f062
8 changed files with 105 additions and 84 deletions

View File

@@ -209,7 +209,7 @@ abstract class Template extends Component
return $template;
}
$documentTemplate = setting($this->getSettingKey($type, 'template'), 'default');
$documentTemplate = setting($this->getDocumentSettingKey($type, 'template'), 'default');
return $documentTemplate;
}
@@ -275,7 +275,7 @@ abstract class Template extends Component
}
// checking setting color
$key = $this->getSettingKey($type, 'color');
$key = $this->getDocumentSettingKey($type, 'color');
if (! empty(setting($key))) {
$backgroundColor = setting($key);
@@ -300,7 +300,7 @@ abstract class Template extends Component
return $textDocumentTitle;
}
$key = $this->getSettingKey($type, 'title');
$key = $this->getDocumentSettingKey($type, 'title');
if (! empty(setting($key))) {
return setting($key);
@@ -321,7 +321,7 @@ abstract class Template extends Component
return $textDocumentSubheading;
}
$key = $this->getSettingKey($type, 'subheading');
$key = $this->getDocumentSettingKey($type, 'subheading');
if (! empty(setting($key))) {
return setting($key);
@@ -451,18 +451,18 @@ abstract class Template extends Component
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'item_name'), 'items') === 'custom') {
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
if (setting($this->getDocumentSettingKey($type, 'item_name'), 'items') === 'custom') {
if (empty($textItems = setting($this->getDocumentSettingKey($type, 'item_name_input')))) {
$textItems = 'general.items';
}
return $textItems;
}
if (setting($this->getSettingKey($type, 'item_name')) !== null
&& (trans(setting($this->getSettingKey($type, 'item_name'))) != setting($this->getSettingKey($type, 'item_name')))
if (setting($this->getDocumentSettingKey($type, 'item_name')) !== null
&& (trans(setting($this->getDocumentSettingKey($type, 'item_name'))) != setting($this->getDocumentSettingKey($type, 'item_name')))
) {
return setting($this->getSettingKey($type, 'item_name'));
return setting($this->getDocumentSettingKey($type, 'item_name'));
}
$translation = $this->getTextFromConfig($type, 'items');
@@ -481,18 +481,18 @@ abstract class Template extends Component
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
if (setting($this->getDocumentSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
if (empty($textQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name_input')))) {
$textQuantity = 'invoices.quantity';
}
return $textQuantity;
}
if (setting($this->getSettingKey($type, 'quantity_name')) !== null
&& (trans(setting($this->getSettingKey($type, 'quantity_name'))) != setting($this->getSettingKey($type, 'quantity_name')))
if (setting($this->getDocumentSettingKey($type, 'quantity_name')) !== null
&& (trans(setting($this->getDocumentSettingKey($type, 'quantity_name'))) != setting($this->getDocumentSettingKey($type, 'quantity_name')))
) {
return setting($this->getSettingKey($type, 'quantity_name'));
return setting($this->getDocumentSettingKey($type, 'quantity_name'));
}
$translation = $this->getTextFromConfig($type, 'quantity');
@@ -511,18 +511,18 @@ abstract class Template extends Component
}
// if you use settting translation
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
if (setting($this->getDocumentSettingKey($type, 'price_name'), 'price') === 'custom') {
if (empty($textPrice = setting($this->getDocumentSettingKey($type, 'price_name_input')))) {
$textPrice = 'invoices.price';
}
return $textPrice;
}
if (setting($this->getSettingKey($type, 'price_name')) !== null
&& (trans(setting($this->getSettingKey($type, 'price_name'))) != setting($this->getSettingKey($type, 'price_name')))
if (setting($this->getDocumentSettingKey($type, 'price_name')) !== null
&& (trans(setting($this->getDocumentSettingKey($type, 'price_name'))) != setting($this->getDocumentSettingKey($type, 'price_name')))
) {
return setting($this->getSettingKey($type, 'price_name'));
return setting($this->getDocumentSettingKey($type, 'price_name'));
}
$translation = $this->getTextFromConfig($type, 'price');
@@ -590,7 +590,7 @@ abstract class Template extends Component
}
// if you use settting translation
if ($hideName = setting($this->getSettingKey($type, 'item_name'), false) && $hideName == 'hide') {
if ($hideName = setting($this->getDocumentSettingKey($type, 'item_name'), false) && $hideName == 'hide') {
return $hideName;
}
@@ -611,7 +611,7 @@ abstract class Template extends Component
}
// if you use settting translation
if ($hideDescription = setting($this->getSettingKey($type, 'hide_item_description'), false)) {
if ($hideDescription = setting($this->getDocumentSettingKey($type, 'hide_item_description'), false)) {
return $hideDescription;
}
@@ -632,7 +632,7 @@ abstract class Template extends Component
}
// if you use settting translation
if ($hideQuantity = setting($this->getSettingKey($type, 'hide_quantity'), false) && $hideQuantity == 'hide') {
if ($hideQuantity = setting($this->getDocumentSettingKey($type, 'hide_quantity'), false) && $hideQuantity == 'hide') {
return $hideQuantity;
}
@@ -653,7 +653,7 @@ abstract class Template extends Component
}
// if you use settting translation
if ($hidePrice = setting($this->getSettingKey($type, 'hide_price'), false) && $hidePrice == 'hide') {
if ($hidePrice = setting($this->getDocumentSettingKey($type, 'hide_price'), false) && $hidePrice == 'hide') {
return $hidePrice;
}
@@ -674,7 +674,7 @@ abstract class Template extends Component
}
// if you use settting translation
if ($hideDiscount = setting($this->getSettingKey($type, 'hide_discount'), false)) {
if ($hideDiscount = setting($this->getDocumentSettingKey($type, 'hide_discount'), false)) {
return $hideDiscount;
}
@@ -695,7 +695,7 @@ abstract class Template extends Component
}
// if you use settting translation
if ($hideAmount = setting($this->getSettingKey($type, 'hide_amount'), false)) {
if ($hideAmount = setting($this->getDocumentSettingKey($type, 'hide_amount'), false)) {
return $hideAmount;
}