Document and Transaction trait getSettingKey function replace get{Document/Transaction}SettingKey
This commit is contained in:
parent
a084f83839
commit
ee5822f062
@ -763,7 +763,7 @@ abstract class Form extends Component
|
|||||||
$issuedAt = Date::now()->toDateString();
|
$issuedAt = Date::now()->toDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
$addDays = setting($this->getSettingKey($type, 'payment_terms'), 0) ?: 0;
|
$addDays = setting($this->getDocumentSettingKey($type, 'payment_terms'), 0) ?: 0;
|
||||||
|
|
||||||
$dueAt = Date::parse($issuedAt)->addDays($addDays)->toDateString();
|
$dueAt = Date::parse($issuedAt)->addDays($addDays)->toDateString();
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ abstract class Form extends Component
|
|||||||
return $hideItemName;
|
return $hideItemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hideItemName = setting($this->getSettingKey($type, 'item_name'), false);
|
$hideItemName = setting($this->getDocumentSettingKey($type, 'item_name'), false);
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideItemName === 'hide') {
|
if ($hideItemName === 'hide') {
|
||||||
@ -898,18 +898,18 @@ abstract class Form extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'item_name'), 'items') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'item_name'), 'items') === 'custom') {
|
||||||
if (empty($textItemName = setting($this->getSettingKey($type, 'item_name_input')))) {
|
if (empty($textItemName = setting($this->getDocumentSettingKey($type, 'item_name_input')))) {
|
||||||
$textItemName = 'general.items';
|
$textItemName = 'general.items';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textItemName;
|
return $textItemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'item_name')) !== null
|
if (setting($this->getDocumentSettingKey($type, 'item_name')) !== null
|
||||||
&& (trans(setting($this->getSettingKey($type, 'item_name'))) != setting($this->getSettingKey($type, 'item_name')))
|
&& (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');
|
$translation = $this->getTextFromConfig($type, 'items');
|
||||||
@ -930,7 +930,7 @@ abstract class Form extends Component
|
|||||||
|
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'hide_item_description'), false)) {
|
if (setting($this->getDocumentSettingKey($type, 'hide_item_description'), false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -964,7 +964,7 @@ abstract class Form extends Component
|
|||||||
return $hideItemQuantity;
|
return $hideItemQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hideItemQuantity = setting($this->getSettingKey($type, 'quantity_name'), false);
|
$hideItemQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name'), false);
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideItemQuantity === 'hide') {
|
if ($hideItemQuantity === 'hide') {
|
||||||
@ -987,18 +987,18 @@ abstract class Form extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
||||||
if (empty($textItemQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
|
if (empty($textItemQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name_input')))) {
|
||||||
$textItemQuantity = 'invoices.quantity';
|
$textItemQuantity = 'invoices.quantity';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textItemQuantity;
|
return $textItemQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'quantity_name')) !== null
|
if (setting($this->getDocumentSettingKey($type, 'quantity_name')) !== null
|
||||||
&& (trans(setting($this->getSettingKey($type, 'quantity_name'))) != setting($this->getSettingKey($type, 'quantity_name')))
|
&& (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');
|
$translation = $this->getTextFromConfig($type, 'quantity');
|
||||||
@ -1016,7 +1016,7 @@ abstract class Form extends Component
|
|||||||
return $hideItemPrice;
|
return $hideItemPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hideItemPrice = setting($this->getSettingKey($type, 'price_name'), false);
|
$hideItemPrice = setting($this->getDocumentSettingKey($type, 'price_name'), false);
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($hideItemPrice === 'hide') {
|
if ($hideItemPrice === 'hide') {
|
||||||
@ -1039,18 +1039,18 @@ abstract class Form extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'price_name'), 'price') === 'custom') {
|
||||||
if (empty($textItemPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
|
if (empty($textItemPrice = setting($this->getDocumentSettingKey($type, 'price_name_input')))) {
|
||||||
$textItemPrice = 'invoices.price';
|
$textItemPrice = 'invoices.price';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textItemPrice;
|
return $textItemPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'price_name')) !== null
|
if (setting($this->getDocumentSettingKey($type, 'price_name')) !== null
|
||||||
&& (trans(setting($this->getSettingKey($type, 'price_name'))) != setting($this->getSettingKey($type, 'price_name')))
|
&& (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');
|
$translation = $this->getTextFromConfig($type, 'price');
|
||||||
@ -1069,7 +1069,7 @@ abstract class Form extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'hide_amount'), false)) {
|
if (setting($this->getDocumentSettingKey($type, 'hide_amount'), false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ abstract class Form extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1125,7 +1125,7 @@ abstract class Form extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if ($settingCharLimit = setting($this->getSettingKey($type, 'item_search_chart_limit'), false)) {
|
if ($settingCharLimit = setting($this->getDocumentSettingKey($type, 'item_search_chart_limit'), false)) {
|
||||||
return $settingCharLimit;
|
return $settingCharLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1149,7 +1149,7 @@ abstract class Form extends Component
|
|||||||
return $this->document->notes;
|
return $this->document->notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting($this->getSettingKey($this->type, 'notes'));
|
return setting($this->getDocumentSettingKey($this->type, 'notes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTextSectionAdvancedTitle($type, $textSectionAdvancedTitle)
|
protected function getTextSectionAdvancedTitle($type, $textSectionAdvancedTitle)
|
||||||
@ -1176,7 +1176,7 @@ abstract class Form extends Component
|
|||||||
return $titleSetting;
|
return $titleSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting($this->getSettingKey($type, 'title'));
|
return setting($this->getDocumentSettingKey($type, 'title'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSubheadingSettingValue($type, $subheadingSetting)
|
protected function getSubheadingSettingValue($type, $subheadingSetting)
|
||||||
@ -1185,7 +1185,7 @@ abstract class Form extends Component
|
|||||||
return $subheadingSetting;
|
return $subheadingSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting($this->getSettingKey($type, 'subheading'));
|
return setting($this->getDocumentSettingKey($type, 'subheading'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFooterValue($footer)
|
protected function getFooterValue($footer)
|
||||||
@ -1198,7 +1198,7 @@ abstract class Form extends Component
|
|||||||
return $this->document->footer;
|
return $this->document->footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setting($this->getSettingKey($this->type, 'footer'));
|
return setting($this->getDocumentSettingKey($this->type, 'footer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTypeCategory($type, $typeCategory)
|
protected function getTypeCategory($type, $typeCategory)
|
||||||
|
@ -909,7 +909,7 @@ abstract class Show extends Component
|
|||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
$documentTemplate = setting($this->getSettingKey($type, 'template'), 'default');
|
$documentTemplate = setting($this->getDocumentSettingKey($type, 'template'), 'default');
|
||||||
|
|
||||||
return $documentTemplate;
|
return $documentTemplate;
|
||||||
}
|
}
|
||||||
@ -975,7 +975,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checking setting color
|
// checking setting color
|
||||||
$key = $this->getSettingKey($type, 'color');
|
$key = $this->getDocumentSettingKey($type, 'color');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
$backgroundColor = setting($key);
|
$backgroundColor = setting($key);
|
||||||
@ -1000,7 +1000,7 @@ abstract class Show extends Component
|
|||||||
return $textDocumentTitle;
|
return $textDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'title');
|
$key = $this->getDocumentSettingKey($type, 'title');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
return setting($key);
|
return setting($key);
|
||||||
@ -1021,7 +1021,7 @@ abstract class Show extends Component
|
|||||||
return $textDocumentSubheading;
|
return $textDocumentSubheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'subheading');
|
$key = $this->getDocumentSettingKey($type, 'subheading');
|
||||||
|
|
||||||
if (!empty(setting($key))) {
|
if (!empty(setting($key))) {
|
||||||
return setting($key);
|
return setting($key);
|
||||||
@ -1151,8 +1151,8 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'item_name'), 'items') == 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'item_name'), 'items') == 'custom') {
|
||||||
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
|
if (empty($textItems = setting($this->getDocumentSettingKey($type, 'item_name_input')))) {
|
||||||
$textItems = 'general.items';
|
$textItems = 'general.items';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1175,8 +1175,8 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
||||||
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
|
if (empty($textQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name_input')))) {
|
||||||
$textQuantity = 'invoices.quantity';
|
$textQuantity = 'invoices.quantity';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,8 +1199,8 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'price_name'), 'price') === 'custom') {
|
||||||
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
|
if (empty($textPrice = setting($this->getDocumentSettingKey($type, 'price_name_input')))) {
|
||||||
$textPrice = 'invoices.price';
|
$textPrice = 'invoices.price';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,7 +1255,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1276,7 +1276,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1297,7 +1297,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,7 +1318,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hidePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1339,7 +1339,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1360,7 +1360,7 @@ abstract class Show extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ abstract class Template extends Component
|
|||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
$documentTemplate = setting($this->getSettingKey($type, 'template'), 'default');
|
$documentTemplate = setting($this->getDocumentSettingKey($type, 'template'), 'default');
|
||||||
|
|
||||||
return $documentTemplate;
|
return $documentTemplate;
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checking setting color
|
// checking setting color
|
||||||
$key = $this->getSettingKey($type, 'color');
|
$key = $this->getDocumentSettingKey($type, 'color');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
$backgroundColor = setting($key);
|
$backgroundColor = setting($key);
|
||||||
@ -300,7 +300,7 @@ abstract class Template extends Component
|
|||||||
return $textDocumentTitle;
|
return $textDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'title');
|
$key = $this->getDocumentSettingKey($type, 'title');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
return setting($key);
|
return setting($key);
|
||||||
@ -321,7 +321,7 @@ abstract class Template extends Component
|
|||||||
return $textDocumentSubheading;
|
return $textDocumentSubheading;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $this->getSettingKey($type, 'subheading');
|
$key = $this->getDocumentSettingKey($type, 'subheading');
|
||||||
|
|
||||||
if (! empty(setting($key))) {
|
if (! empty(setting($key))) {
|
||||||
return setting($key);
|
return setting($key);
|
||||||
@ -451,18 +451,18 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'item_name'), 'items') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'item_name'), 'items') === 'custom') {
|
||||||
if (empty($textItems = setting($this->getSettingKey($type, 'item_name_input')))) {
|
if (empty($textItems = setting($this->getDocumentSettingKey($type, 'item_name_input')))) {
|
||||||
$textItems = 'general.items';
|
$textItems = 'general.items';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textItems;
|
return $textItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'item_name')) !== null
|
if (setting($this->getDocumentSettingKey($type, 'item_name')) !== null
|
||||||
&& (trans(setting($this->getSettingKey($type, 'item_name'))) != setting($this->getSettingKey($type, 'item_name')))
|
&& (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');
|
$translation = $this->getTextFromConfig($type, 'items');
|
||||||
@ -481,18 +481,18 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'quantity_name'), 'quantity') === 'custom') {
|
||||||
if (empty($textQuantity = setting($this->getSettingKey($type, 'quantity_name_input')))) {
|
if (empty($textQuantity = setting($this->getDocumentSettingKey($type, 'quantity_name_input')))) {
|
||||||
$textQuantity = 'invoices.quantity';
|
$textQuantity = 'invoices.quantity';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textQuantity;
|
return $textQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'quantity_name')) !== null
|
if (setting($this->getDocumentSettingKey($type, 'quantity_name')) !== null
|
||||||
&& (trans(setting($this->getSettingKey($type, 'quantity_name'))) != setting($this->getSettingKey($type, 'quantity_name')))
|
&& (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');
|
$translation = $this->getTextFromConfig($type, 'quantity');
|
||||||
@ -511,18 +511,18 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// if you use settting translation
|
||||||
if (setting($this->getSettingKey($type, 'price_name'), 'price') === 'custom') {
|
if (setting($this->getDocumentSettingKey($type, 'price_name'), 'price') === 'custom') {
|
||||||
if (empty($textPrice = setting($this->getSettingKey($type, 'price_name_input')))) {
|
if (empty($textPrice = setting($this->getDocumentSettingKey($type, 'price_name_input')))) {
|
||||||
$textPrice = 'invoices.price';
|
$textPrice = 'invoices.price';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textPrice;
|
return $textPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setting($this->getSettingKey($type, 'price_name')) !== null
|
if (setting($this->getDocumentSettingKey($type, 'price_name')) !== null
|
||||||
&& (trans(setting($this->getSettingKey($type, 'price_name'))) != setting($this->getSettingKey($type, 'price_name')))
|
&& (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');
|
$translation = $this->getTextFromConfig($type, 'price');
|
||||||
@ -590,7 +590,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideQuantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hidePrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,7 +674,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideDiscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +695,7 @@ abstract class Template extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if you use settting translation
|
// 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;
|
return $hideAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ abstract class Show extends Component
|
|||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transactionTemplate = setting($this->getSettingKey($type, 'template')) ?: 'default';
|
$transactionTemplate = setting($this->getTransactionSettingKey($type, 'template')) ?: 'default';
|
||||||
|
|
||||||
return $transactionTemplate;
|
return $transactionTemplate;
|
||||||
}
|
}
|
||||||
|
@ -60,17 +60,17 @@ class DocumentItemColumns extends Controller
|
|||||||
'90' => trans('settings.invoice.due_days', ['days' => 90]),
|
'90' => trans('settings.invoice.due_days', ['days' => 90]),
|
||||||
];
|
];
|
||||||
|
|
||||||
$item_name = setting($this->getSettingKey($type, 'item_name'));
|
$item_name = setting($this->getDocumentSettingKey($type, 'item_name'));
|
||||||
$item_name_input = setting($this->getSettingKey($type, 'item_name_input'));
|
$item_name_input = setting($this->getDocumentSettingKey($type, 'item_name_input'));
|
||||||
$price_name = setting($this->getSettingKey($type, 'price_name'));
|
$price_name = setting($this->getDocumentSettingKey($type, 'price_name'));
|
||||||
$price_name_input = setting($this->getSettingKey($type, 'price_name_input'));
|
$price_name_input = setting($this->getDocumentSettingKey($type, 'price_name_input'));
|
||||||
$quantity_name = setting($this->getSettingKey($type, 'quantity_name'));
|
$quantity_name = setting($this->getDocumentSettingKey($type, 'quantity_name'));
|
||||||
$quantity_name_input = setting($this->getSettingKey($type, 'quantity_name_input'));
|
$quantity_name_input = setting($this->getDocumentSettingKey($type, 'quantity_name_input'));
|
||||||
$hide_item_name = setting($this->getSettingKey($type, 'hide_item_name'));
|
$hide_item_name = setting($this->getDocumentSettingKey($type, 'hide_item_name'));
|
||||||
$hide_item_description = setting($this->getSettingKey($type, 'hide_item_description'));
|
$hide_item_description = setting($this->getDocumentSettingKey($type, 'hide_item_description'));
|
||||||
$hide_quantity = setting($this->getSettingKey($type, 'hide_quantity'));
|
$hide_quantity = setting($this->getDocumentSettingKey($type, 'hide_quantity'));
|
||||||
$hide_price = setting($this->getSettingKey($type, 'hide_price'));
|
$hide_price = setting($this->getDocumentSettingKey($type, 'hide_price'));
|
||||||
$hide_amount = setting($this->getSettingKey($type, 'hide_amount'));
|
$hide_amount = setting($this->getDocumentSettingKey($type, 'hide_amount'));
|
||||||
|
|
||||||
$html = view('modals.documents.item_columns', compact(
|
$html = view('modals.documents.item_columns', compact(
|
||||||
'type',
|
'type',
|
||||||
@ -117,7 +117,7 @@ class DocumentItemColumns extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
$real_key = $this->getSettingKey($type, $key);
|
$real_key = $this->getDocumentSettingKey($type, $key);
|
||||||
|
|
||||||
// Don't process unwanted keys
|
// Don't process unwanted keys
|
||||||
if (in_array($key, $this->skip_keys)) {
|
if (in_array($key, $this->skip_keys)) {
|
||||||
|
@ -47,7 +47,7 @@ class SettingFieldCreated
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_key = $this->getSettingKey($type, $key);
|
$real_key = $this->getDocumentSettingKey($type, $key);
|
||||||
|
|
||||||
setting()->set($real_key, $value);
|
setting()->set($real_key, $value);
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ class SettingFieldCreated
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$real_key = setting($this->getSettingKey($type, $key));
|
$real_key = setting($this->getDocumentSettingKey($type, $key));
|
||||||
|
|
||||||
setting()->set($real_key, $value);
|
setting()->set($real_key, $value);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,21 @@ trait Documents
|
|||||||
return ! $this->isRecurring();
|
return ! $this->isRecurring();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRecurringDocumentTypes() : array
|
||||||
|
{
|
||||||
|
$types = array_keys(config('type.document'));
|
||||||
|
|
||||||
|
$recurring_types = [];
|
||||||
|
|
||||||
|
foreach ($types as $type) {
|
||||||
|
if (Str::endsWith($type, '-recurring')) {
|
||||||
|
$recurring_types[] = $type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $recurring_types;
|
||||||
|
}
|
||||||
|
|
||||||
public function getNextDocumentNumber(string $type): string
|
public function getNextDocumentNumber(string $type): string
|
||||||
{
|
{
|
||||||
if ($alias = config('type.document.' . $type . '.alias')) {
|
if ($alias = config('type.document.' . $type . '.alias')) {
|
||||||
@ -138,7 +153,13 @@ trait Documents
|
|||||||
return 'documents.statuses.';
|
return 'documents.statuses.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function will be remoed in the future
|
||||||
protected function getSettingKey($type, $setting_key)
|
protected function getSettingKey($type, $setting_key)
|
||||||
|
{
|
||||||
|
return $this->getDocumentSettingKey($type, $setting_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getDocumentSettingKey($type, $setting_key)
|
||||||
{
|
{
|
||||||
$key = '';
|
$key = '';
|
||||||
$alias = config('type.document.' . $type . '.alias');
|
$alias = config('type.document.' . $type . '.alias');
|
||||||
|
@ -132,7 +132,7 @@ trait Transactions
|
|||||||
return Str::slug($transaction->id, $separator, language()->getShortCode());
|
return Str::slug($transaction->id, $separator, language()->getShortCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSettingKey(string $type, string $setting_key): string
|
protected function getTransactionSettingKey(string $type, string $setting_key): string
|
||||||
{
|
{
|
||||||
$key = '';
|
$key = '';
|
||||||
$alias = config('type.transaction.' . $type . '.alias');
|
$alias = config('type.transaction.' . $type . '.alias');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user