+
-
+
diff --git a/resources/views/modals/vendors/create.blade.php b/resources/views/modals/vendors/create.blade.php
index 58f52ee21..1eebbb735 100644
--- a/resources/views/modals/vendors/create.blade.php
+++ b/resources/views/modals/vendors/create.blade.php
@@ -4,7 +4,7 @@
{{ trans('general.general') }}
-
+
{{ trans('general.validation_error') }}
@@ -12,7 +12,7 @@
{{ trans('general.address') }}
-
+
{{ trans('general.validation_error') }}
@@ -20,7 +20,7 @@
{{ trans_choice('general.others', 1) }}
-
+
{{ trans('general.validation_error') }}
@@ -32,11 +32,11 @@
-
+
-
+
@@ -44,7 +44,7 @@
-
+
diff --git a/resources/views/modals/vendors/edit.blade.php b/resources/views/modals/vendors/edit.blade.php
index 22645dbeb..d1abda31f 100644
--- a/resources/views/modals/vendors/edit.blade.php
+++ b/resources/views/modals/vendors/edit.blade.php
@@ -4,7 +4,7 @@
{{ trans('general.general') }}
-
+
{{ trans('general.validation_error') }}
@@ -12,7 +12,7 @@
{{ trans('general.address') }}
-
+
{{ trans('general.validation_error') }}
@@ -20,7 +20,7 @@
{{ trans_choice('general.others', 1) }}
-
+
{{ trans('general.validation_error') }}
@@ -32,19 +32,19 @@
-
+
-
+
-
+
-
+
diff --git a/resources/views/settings/currencies/index.blade.php b/resources/views/settings/currencies/index.blade.php
index d284f81f7..92d94b8b4 100644
--- a/resources/views/settings/currencies/index.blade.php
+++ b/resources/views/settings/currencies/index.blade.php
@@ -66,7 +66,7 @@
@endif
- @if ($item->code == setting("default.currency"))
+ @if ($item->code == default_currency())
@endif
From a8bd47ea715ff4e7b9f90a2d65f11d7ce94f4fab Mon Sep 17 00:00:00 2001
From: Burak Civan
Date: Wed, 5 Oct 2022 10:19:47 +0300
Subject: [PATCH 3/6] chevron icon styling controlled
---
public/css/app.css | 8 ++++++++
safelist.txt | 4 +++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/public/css/app.css b/public/css/app.css
index 6d668f246..df6838246 100644
--- a/public/css/app.css
+++ b/public/css/app.css
@@ -48282,6 +48282,10 @@ body{
left: -2rem;
}
+[dir="ltr"] .ltr\:-right-1\.5{
+ right: -0.375rem;
+}
+
[dir="ltr"] .ltr\:m-0{
margin: 0px;
}
@@ -49201,6 +49205,10 @@ body{
right: -2rem;
}
+[dir="rtl"] .rtl\:-left-1\.5{
+ left: -0.375rem;
+}
+
[dir="rtl"] .rtl\:float-left{
float: left;
}
diff --git a/safelist.txt b/safelist.txt
index 334e6622a..e247972a3 100644
--- a/safelist.txt
+++ b/safelist.txt
@@ -3,4 +3,6 @@ lg:mt-2
lg:pl-24
lg:my-12
lg:mt-4
-lg:pl-6
\ No newline at end of file
+lg:pl-6
+ltr:-right-1.5
+rtl:-left-1.5
\ No newline at end of file
From d29859f65b4ad32a7dde4e1587cfd6241b75c81d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?=
Date: Wed, 5 Oct 2022 10:35:19 +0300
Subject: [PATCH 4/6] convert setting('default.currency') to default_currency()
helper function..
---
app/Abstracts/View/Components/Contacts/Index.php | 4 ++--
app/Abstracts/View/Components/Documents/Form.php | 6 +++---
app/Abstracts/View/Components/Documents/Index.php | 4 ++--
app/Http/Controllers/Banking/Accounts.php | 4 ++--
app/Http/Controllers/Banking/Reconciliations.php | 4 ++--
app/Http/Controllers/Banking/Transactions.php | 6 +++---
app/Http/Controllers/Banking/Transfers.php | 4 ++--
app/Http/Controllers/Common/Items.php | 2 +-
app/Http/Controllers/Modals/Accounts.php | 2 +-
app/Http/Controllers/Modals/Items.php | 2 +-
app/Http/Controllers/Settings/Currencies.php | 2 +-
app/Http/Controllers/Wizard/Currencies.php | 2 +-
app/Http/Middleware/Money.php | 2 +-
app/Http/Resources/Banking/Reconciliation.php | 2 +-
app/Http/Resources/Common/Item.php | 4 ++--
app/Jobs/Setting/DeleteCurrency.php | 2 +-
app/Jobs/Setting/UpdateCurrency.php | 2 +-
app/Traits/Charts.php | 12 ++++++------
app/Traits/Currencies.php | 4 ++--
app/Traits/Import.php | 8 ++++----
app/View/Components/Contacts/Script.php | 2 +-
app/View/Components/Contacts/Show/Content.php | 6 +++---
app/View/Components/Documents/Script.php | 2 +-
app/View/Components/Form/Group/Currency.php | 2 +-
app/View/Components/Index/Currency.php | 2 +-
app/View/Components/Layouts/Wizard/Scripts.php | 2 +-
app/Widgets/CashFlow.php | 10 +++++-----
app/Widgets/Payables.php | 8 ++++----
app/Widgets/ProfitLoss.php | 2 +-
app/Widgets/Receivables.php | 8 ++++----
database/factories/Account.php | 2 +-
database/factories/Contact.php | 2 +-
database/factories/Document.php | 4 ++--
database/factories/Reconciliation.php | 2 +-
database/factories/Transaction.php | 2 +-
database/seeds/TestCompany.php | 2 +-
resources/views/banking/transfers/create.blade.php | 4 ++--
resources/views/banking/transfers/edit.blade.php | 8 ++++----
resources/views/common/items/index.blade.php | 4 ++--
.../components/contacts/index/content.blade.php | 4 ++--
.../views/components/layouts/admin/scripts.blade.php | 2 +-
.../components/layouts/portal/scripts.blade.php | 2 +-
.../views/components/layouts/print/scripts.blade.php | 2 +-
.../components/reports/summary/table/row.blade.php | 4 ++--
resources/views/settings/currencies/edit.blade.php | 2 +-
45 files changed, 84 insertions(+), 84 deletions(-)
diff --git a/app/Abstracts/View/Components/Contacts/Index.php b/app/Abstracts/View/Components/Contacts/Index.php
index bc55a201b..9f3b4e9e2 100644
--- a/app/Abstracts/View/Components/Contacts/Index.php
+++ b/app/Abstracts/View/Components/Contacts/Index.php
@@ -283,8 +283,8 @@ abstract class Index extends Component
$items[] = [
'title' => ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key),
//'href' => route($route, ['search' => 'status:' . $key]),
- 'amount' => money($total, setting('default.currency'), true)->formatForHumans(),
- 'tooltip' => money($total, setting('default.currency'), true)->format(),
+ 'amount' => money($total, default_currency(), true)->formatForHumans(),
+ 'tooltip' => money($total, default_currency(), true)->format(),
];
}
diff --git a/app/Abstracts/View/Components/Documents/Form.php b/app/Abstracts/View/Components/Documents/Form.php
index 2ffa97220..6158e12d1 100644
--- a/app/Abstracts/View/Components/Documents/Form.php
+++ b/app/Abstracts/View/Components/Documents/Form.php
@@ -291,7 +291,7 @@ abstract class Form extends Component
$this->document = $this->model;
$this->currencies = $this->getCurrencies($currencies);
$this->currency = $this->getCurrency($document, $currency, $currency_code);
- $this->currency_code = ! empty($this->currency) ? $this->currency->code : setting('default.currency');
+ $this->currency_code = ! empty($this->currency) ? $this->currency->code : default_currency();
$this->taxes = Tax::enabled()->orderBy('name')->get()->pluck('title', 'id');
/* -- Content Start -- */
@@ -438,7 +438,7 @@ abstract class Form extends Component
}
if (empty($currency)) {
- $currency = Currency::where('code', setting('default.currency'))->first();
+ $currency = Currency::where('code', default_currency())->first();
}
return $currency;
@@ -1139,7 +1139,7 @@ abstract class Form extends Component
if (! empty($notes)) {
return $notes;
}
-
+
if (! empty($this->document)) {
return $this->document->notes;
}
diff --git a/app/Abstracts/View/Components/Documents/Index.php b/app/Abstracts/View/Components/Documents/Index.php
index e47840939..4a224c2ef 100644
--- a/app/Abstracts/View/Components/Documents/Index.php
+++ b/app/Abstracts/View/Components/Documents/Index.php
@@ -392,8 +392,8 @@ abstract class Index extends Component
foreach ($totals as $key => $total) {
$title = ($key == 'overdue') ? trans('general.overdue') : trans('documents.statuses.' . $key);
$href = route($route, ['search' => 'status:' . $key]);
- $amount = money($total, setting('default.currency'), true)->formatForHumans();
- $tooltip = money($total, setting('default.currency'), true)->format();
+ $amount = money($total, default_currency(), true)->formatForHumans();
+ $tooltip = money($total, default_currency(), true)->format();
$items[] = [
'title' => $title,
diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php
index 9ae9aa7d6..02b88d8d1 100644
--- a/app/Http/Controllers/Banking/Accounts.php
+++ b/app/Http/Controllers/Banking/Accounts.php
@@ -65,7 +65,7 @@ class Accounts extends Controller
*/
public function create()
{
- $currency = Currency::where('code', '=', setting('default.currency'))->first();
+ $currency = Currency::where('code', '=', default_currency())->first();
return view('banking.accounts.create', compact('currency'));
}
@@ -279,7 +279,7 @@ class Accounts extends Controller
return response()->json([]);
}
- $currency_code = setting('default.currency');
+ $currency_code = default_currency();
if (isset($account->currency_code)) {
$currencies = Currency::enabled()->pluck('name', 'code')->toArray();
diff --git a/app/Http/Controllers/Banking/Reconciliations.php b/app/Http/Controllers/Banking/Reconciliations.php
index 80467a7fc..1bef98173 100644
--- a/app/Http/Controllers/Banking/Reconciliations.php
+++ b/app/Http/Controllers/Banking/Reconciliations.php
@@ -24,8 +24,8 @@ class Reconciliations extends Controller
{
$reconciliations = Reconciliation::with('account')->collect();
- $reconciled_amount = money($reconciliations->where('reconciled', 1)->sum('closing_balance'), setting('default.currency'), true);
- $in_progress_amount = money($reconciliations->where('reconciled', 0)->sum('closing_balance'), setting('default.currency'), true);
+ $reconciled_amount = money($reconciliations->where('reconciled', 1)->sum('closing_balance'), default_currency(), true);
+ $in_progress_amount = money($reconciliations->where('reconciled', 0)->sum('closing_balance'), default_currency(), true);
$summary_amounts = [
'amount_exact' => $reconciled_amount->format(),
diff --git a/app/Http/Controllers/Banking/Transactions.php b/app/Http/Controllers/Banking/Transactions.php
index 56c317bae..b74a2fe8a 100644
--- a/app/Http/Controllers/Banking/Transactions.php
+++ b/app/Http/Controllers/Banking/Transactions.php
@@ -56,9 +56,9 @@ class Transactions extends Controller
$totals['profit'] = $totals['income'] - $totals['expense'];
- $incoming_amount = money($totals['income'], setting('default.currency'), true);
- $expense_amount = money($totals['expense'], setting('default.currency'), true);
- $profit_amount = money($totals['profit'], setting('default.currency'), true);
+ $incoming_amount = money($totals['income'], default_currency(), true);
+ $expense_amount = money($totals['expense'], default_currency(), true);
+ $profit_amount = money($totals['profit'], default_currency(), true);
$summary_amounts = [
'incoming_exact' => $incoming_amount->format(),
diff --git a/app/Http/Controllers/Banking/Transfers.php b/app/Http/Controllers/Banking/Transfers.php
index 897eacdb4..5e2fb2ce2 100644
--- a/app/Http/Controllers/Banking/Transfers.php
+++ b/app/Http/Controllers/Banking/Transfers.php
@@ -50,7 +50,7 @@ class Transfers extends Controller
{
$accounts = Account::enabled()->orderBy('name')->get()->pluck('title', 'id');
- $currency = Currency::where('code', setting('default.currency'))->first();
+ $currency = Currency::where('code', default_currency())->first();
return view('banking.transfers.create', compact('accounts', 'currency'));
}
@@ -136,7 +136,7 @@ class Transfers extends Controller
{
$accounts = Account::enabled()->orderBy('name')->get()->pluck('title', 'id');
- $currency_code = ($transfer->expense_transaction->account) ? $transfer->expense_transaction->account->currency_code : setting('default.currency');
+ $currency_code = ($transfer->expense_transaction->account) ? $transfer->expense_transaction->account->currency_code : default_currency();
$currency = Currency::where('code', $currency_code)->first();
diff --git a/app/Http/Controllers/Common/Items.php b/app/Http/Controllers/Common/Items.php
index 7a6a244d6..189af8093 100644
--- a/app/Http/Controllers/Common/Items.php
+++ b/app/Http/Controllers/Common/Items.php
@@ -242,7 +242,7 @@ class Items extends Controller
$currency_code = request('currency_code');
if (empty($currency_code) || (strtolower($currency_code) == 'null')) {
- $currency_code = setting('default.currency');
+ $currency_code = default_currency();
}
$autocomplete = Item::autocomplete([
diff --git a/app/Http/Controllers/Modals/Accounts.php b/app/Http/Controllers/Modals/Accounts.php
index 8b31fb474..e7e18556d 100644
--- a/app/Http/Controllers/Modals/Accounts.php
+++ b/app/Http/Controllers/Modals/Accounts.php
@@ -28,7 +28,7 @@ class Accounts extends Controller
*/
public function create()
{
- $currency = Currency::where('code', '=', setting('default.currency'))->first();
+ $currency = Currency::where('code', '=', default_currency())->first();
$html = view('modals.accounts.create', compact('currency'))->render();
diff --git a/app/Http/Controllers/Modals/Items.php b/app/Http/Controllers/Modals/Items.php
index 53c6d71f8..31ebac806 100644
--- a/app/Http/Controllers/Modals/Items.php
+++ b/app/Http/Controllers/Modals/Items.php
@@ -31,7 +31,7 @@ class Items extends Controller
{
$taxes = Tax::enabled()->orderBy('name')->get()->pluck('title', 'id');
- $currency = Currency::where('code', setting('default.currency'))->first();
+ $currency = Currency::where('code', default_currency())->first();
$html = view('modals.items.create', compact('taxes', 'currency'))->render();
diff --git a/app/Http/Controllers/Settings/Currencies.php b/app/Http/Controllers/Settings/Currencies.php
index 2ed2bca45..c99c30ba7 100644
--- a/app/Http/Controllers/Settings/Currencies.php
+++ b/app/Http/Controllers/Settings/Currencies.php
@@ -122,7 +122,7 @@ class Currencies extends Controller
}
// Set default currency
- $currency->default_currency = ($currency->code == setting('default.currency')) ? 1 : 0;
+ $currency->default_currency = ($currency->code == default_currency()) ? 1 : 0;
$precisions = (object) [
'0' => '0',
diff --git a/app/Http/Controllers/Wizard/Currencies.php b/app/Http/Controllers/Wizard/Currencies.php
index 2a45f5200..bfc28af1f 100644
--- a/app/Http/Controllers/Wizard/Currencies.php
+++ b/app/Http/Controllers/Wizard/Currencies.php
@@ -91,7 +91,7 @@ class Currencies extends Controller
{
$response = $this->ajaxDispatch(new UpdateCurrency($currency, $request));
- $currency->default = setting('default.currency') == $currency->code;
+ $currency->default = default_currency() == $currency->code;
if ($response['success']) {
$message = trans('messages.success.updated', ['type' => $currency->name]);
diff --git a/app/Http/Middleware/Money.php b/app/Http/Middleware/Money.php
index df912998b..24f54f792 100644
--- a/app/Http/Middleware/Money.php
+++ b/app/Http/Middleware/Money.php
@@ -23,7 +23,7 @@ class Money
return $next($request);
}
- $currency_code = setting('default.currency');
+ $currency_code = default_currency();
if ($request->get('currency_code')) {
$currency_code = $request->get('currency_code');
diff --git a/app/Http/Resources/Banking/Reconciliation.php b/app/Http/Resources/Banking/Reconciliation.php
index fc5825411..7ab6889ba 100644
--- a/app/Http/Resources/Banking/Reconciliation.php
+++ b/app/Http/Resources/Banking/Reconciliation.php
@@ -22,7 +22,7 @@ class Reconciliation extends JsonResource
'started_at' => $this->started_at->toIso8601String(),
'ended_at' => $this->ended_at->toIso8601String(),
'closing_balance' => $this->closing_balance,
- 'closing_balance_formatted' => money($this->closing_balance, setting('default.currency'), true)->format(),
+ 'closing_balance_formatted' => money($this->closing_balance, default_currency(), true)->format(),
'reconciled' => $this->reconciled,
'created_from' => $this->created_from,
'created_by' => $this->created_by,
diff --git a/app/Http/Resources/Common/Item.php b/app/Http/Resources/Common/Item.php
index 123e5a615..badcce3f2 100644
--- a/app/Http/Resources/Common/Item.php
+++ b/app/Http/Resources/Common/Item.php
@@ -23,9 +23,9 @@ class Item extends JsonResource
'name' => $this->name,
'description' => $this->description,
'sale_price' => $this->sale_price,
- 'sale_price_formatted' => money($this->sale_price, setting('default.currency'), true)->format(),
+ 'sale_price_formatted' => money($this->sale_price, default_currency(), true)->format(),
'purchase_price' => $this->purchase_price,
- 'purchase_price_formatted' => money($this->purchase_price, setting('default.currency'), true)->format(),
+ 'purchase_price_formatted' => money($this->purchase_price, default_currency(), true)->format(),
'category_id' => $this->category_id,
'picture' => $this->picture,
'enabled' => $this->enabled,
diff --git a/app/Jobs/Setting/DeleteCurrency.php b/app/Jobs/Setting/DeleteCurrency.php
index c3e542712..6f7410561 100644
--- a/app/Jobs/Setting/DeleteCurrency.php
+++ b/app/Jobs/Setting/DeleteCurrency.php
@@ -42,7 +42,7 @@ class DeleteCurrency extends Job implements ShouldDelete
$relationships = $this->countRelationships($this->model, $rels);
- if ($this->model->code == setting('default.currency')) {
+ if ($this->model->code == default_currency()) {
$relationships[] = strtolower(trans_choice('general.companies', 1));
}
diff --git a/app/Jobs/Setting/UpdateCurrency.php b/app/Jobs/Setting/UpdateCurrency.php
index ae0930844..29ce18d6c 100644
--- a/app/Jobs/Setting/UpdateCurrency.php
+++ b/app/Jobs/Setting/UpdateCurrency.php
@@ -64,7 +64,7 @@ class UpdateCurrency extends Job implements ShouldUpdate
$relationships = $this->countRelationships($this->model, $rels);
- if ($this->model->code == setting('default.currency')) {
+ if ($this->model->code == default_currency()) {
$relationships[] = strtolower(trans_choice('general.companies', 1));
}
diff --git a/app/Traits/Charts.php b/app/Traits/Charts.php
index 78ad75787..31e69e8bd 100644
--- a/app/Traits/Charts.php
+++ b/app/Traits/Charts.php
@@ -28,7 +28,7 @@ trait Charts
public function addMoneyToDonutChart($color, $amount, $description = '')
{
- $label = money($amount, setting('default.currency'), true)->formatForHumans();
+ $label = money($amount, default_currency(), true)->formatForHumans();
if (!empty($description)) {
$label .= ' - ' . $description;
@@ -98,11 +98,11 @@ trait Charts
public function getChartLabelFormatter($type = 'money', $position = null)
{
$label = '';
- $decimal_mark = str_replace("'", "\\'", config('money.' . setting('default.currency') . '.decimal_mark'));
- $thousands_separator = str_replace("'", "\\'", config('money.' . setting('default.currency') . '.thousands_separator'));
- $symbol = str_replace("'", "\\'", config('money.' . setting('default.currency') . '.symbol'));
- $symbol_first = str_replace("'", "\\'", config('money.' . setting('default.currency') . '.symbol_first'));
- $precision = str_replace("'", "\\'", config('money.' . setting('default.currency') . '.precision'));
+ $decimal_mark = str_replace("'", "\\'", config('money.' . default_currency() . '.decimal_mark'));
+ $thousands_separator = str_replace("'", "\\'", config('money.' . default_currency() . '.thousands_separator'));
+ $symbol = str_replace("'", "\\'", config('money.' . default_currency() . '.symbol'));
+ $symbol_first = str_replace("'", "\\'", config('money.' . default_currency() . '.symbol_first'));
+ $precision = str_replace("'", "\\'", config('money.' . default_currency() . '.precision'));
$percent_position = $position ?: setting('localisation.percent_position');
switch ($type) {
diff --git a/app/Traits/Currencies.php b/app/Traits/Currencies.php
index 0f7fd7eb7..3345d55ac 100644
--- a/app/Traits/Currencies.php
+++ b/app/Traits/Currencies.php
@@ -44,7 +44,7 @@ trait Currencies
{
$default_amount = $amount;
- if ($from_code != setting('default.currency')) {
+ if ($from_code != default_currency()) {
$default_amount = $this->convertToDefault($amount, $from_code, $from_rate);
}
@@ -70,7 +70,7 @@ trait Currencies
public function getDefaultCurrency()
{
- return !empty($this->default_currency_code) ? $this->default_currency_code : setting('default.currency');
+ return !empty($this->default_currency_code) ? $this->default_currency_code : default_currency();
}
public function setDefaultCurrency($code)
diff --git a/app/Traits/Import.php b/app/Traits/Import.php
index 2ddd79853..0a5c06167 100644
--- a/app/Traits/Import.php
+++ b/app/Traits/Import.php
@@ -195,7 +195,7 @@ trait Import
'company_id' => company_id(),
'name' => $row['account_name'],
'number' => !empty($row['account_number']) ? $row['account_number'] : (string) rand(1, 10000),
- 'currency_code' => !empty($row['currency_code']) ? $row['currency_code'] : setting('default.currency'),
+ 'currency_code' => !empty($row['currency_code']) ? $row['currency_code'] : default_currency(),
'opening_balance' => !empty($row['opening_balance']) ? $row['opening_balance'] : 0,
'enabled' => 1,
'created_from' => $row['created_from'],
@@ -221,7 +221,7 @@ trait Import
'company_id' => company_id(),
'number' => $row['account_number'],
'name' => !empty($row['account_name']) ? $row['account_name'] : $row['account_number'],
- 'currency_code' => !empty($row['currency_code']) ? $row['currency_code'] : setting('default.currency'),
+ 'currency_code' => !empty($row['currency_code']) ? $row['currency_code'] : default_currency(),
'opening_balance' => !empty($row['opening_balance']) ? $row['opening_balance'] : 0,
'enabled' => 1,
'created_from' => $row['created_from'],
@@ -273,7 +273,7 @@ trait Import
'email' => $row['contact_email'],
'type' => $type,
'name' => !empty($row['contact_name']) ? $row['contact_name'] : $row['contact_email'],
- 'currency_code' => !empty($row['contact_currency']) ? $row['contact_currency'] : setting('default.currency'),
+ 'currency_code' => !empty($row['contact_currency']) ? $row['contact_currency'] : default_currency(),
'enabled' => 1,
'created_from' => $row['created_from'],
'created_by' => $row['created_by'],
@@ -299,7 +299,7 @@ trait Import
'name' => $row['contact_name'],
'type' => $type,
'email' => !empty($row['contact_email']) ? $row['contact_email'] : null,
- 'currency_code' => !empty($row['contact_currency']) ? $row['contact_currency'] : setting('default.currency'),
+ 'currency_code' => !empty($row['contact_currency']) ? $row['contact_currency'] : default_currency(),
'enabled' => 1,
'created_from' => $row['created_from'],
'created_by' => $row['created_by'],
diff --git a/app/View/Components/Contacts/Script.php b/app/View/Components/Contacts/Script.php
index 9de21b96d..f4c1bfb2a 100644
--- a/app/View/Components/Contacts/Script.php
+++ b/app/View/Components/Contacts/Script.php
@@ -44,7 +44,7 @@ class Script extends Component
$this->type = $type;
$this->contact = $contact;
$this->currencies = $this->getCurrencies($currencies);
- $this->currency_code = ($contact) ? $contact->currency_code : setting('default.currency');
+ $this->currency_code = ($contact) ? $contact->currency_code : default_currency();
$this->alias = $this->getAlias($type, $alias);
$this->folder = $this->getScriptFolder($type, $folder);
diff --git a/app/View/Components/Contacts/Show/Content.php b/app/View/Components/Contacts/Show/Content.php
index d5dca21f3..60679d25e 100644
--- a/app/View/Components/Contacts/Show/Content.php
+++ b/app/View/Components/Contacts/Show/Content.php
@@ -72,9 +72,9 @@ class Content extends Component
$totals['paid'] += $item->getAmountConvertedToDefault();
});
- $open_amount = money($totals['open'], setting('default.currency'), true);
- $overdue_amount = money($totals['overdue'], setting('default.currency'), true);
- $paid_amount = money($totals['paid'], setting('default.currency'), true);
+ $open_amount = money($totals['open'], default_currency(), true);
+ $overdue_amount = money($totals['overdue'], default_currency(), true);
+ $paid_amount = money($totals['paid'], default_currency(), true);
$summary_amounts = [
'open_exact' => $open_amount->format(),
diff --git a/app/View/Components/Documents/Script.php b/app/View/Components/Documents/Script.php
index 946c19edb..84839e98f 100644
--- a/app/View/Components/Documents/Script.php
+++ b/app/View/Components/Documents/Script.php
@@ -50,7 +50,7 @@ class Script extends Component
$this->document = $document;
$this->items = $items;
$this->currencies = $this->getCurrencies($currencies);
- $this->currency_code = ($document) ? $document->currency_code : setting('default.currency');
+ $this->currency_code = ($document) ? $document->currency_code : default_currency();
$this->taxes = $this->getTaxes($taxes);
$this->alias = $this->getAlias($type, $alias);
diff --git a/app/View/Components/Form/Group/Currency.php b/app/View/Components/Form/Group/Currency.php
index 2ffc0febd..3b9a58e6c 100644
--- a/app/View/Components/Form/Group/Currency.php
+++ b/app/View/Components/Form/Group/Currency.php
@@ -48,7 +48,7 @@ class Currency extends Form
}
if (empty($this->selected) && empty($this->getParentData('model'))) {
- $this->selected = setting('default.currency');
+ $this->selected = default_currency();
}
return view('components.form.group.currency');
diff --git a/app/View/Components/Index/Currency.php b/app/View/Components/Index/Currency.php
index f77370721..59c436873 100644
--- a/app/View/Components/Index/Currency.php
+++ b/app/View/Components/Index/Currency.php
@@ -36,7 +36,7 @@ class Currency extends Component
*/
public function render()
{
- $code = ($this->code) ? $this->code : setting('default.currency');
+ $code = ($this->code) ? $this->code : default_currency();
$this->currency = config('money.' . $code . '.name');
diff --git a/app/View/Components/Layouts/Wizard/Scripts.php b/app/View/Components/Layouts/Wizard/Scripts.php
index 14304ac4d..a2ec25253 100644
--- a/app/View/Components/Layouts/Wizard/Scripts.php
+++ b/app/View/Components/Layouts/Wizard/Scripts.php
@@ -166,7 +166,7 @@ class Scripts extends Component
$currencies = collect();
Currency::all()->each(function ($currency) use (&$currencies) {
- $currency->default = setting('default.currency') == $currency->code;
+ $currency->default = default_currency() == $currency->code;
$currencies->push($currency);
});
diff --git a/app/Widgets/CashFlow.php b/app/Widgets/CashFlow.php
index 1f882cfce..5b8a37a55 100644
--- a/app/Widgets/CashFlow.php
+++ b/app/Widgets/CashFlow.php
@@ -53,9 +53,9 @@ class CashFlow extends Widget
->setDataset(trans('general.outgoing'), 'column', $expense)
->setDataset(trans_choice('general.profits', 1), 'line', $profit);
- $incoming_amount = money(array_sum($income), setting('default.currency'), true);
- $outgoing_amount = money(abs(array_sum($expense)), setting('default.currency'), true);
- $profit_amount = money(array_sum($profit), setting('default.currency'), true);
+ $incoming_amount = money(array_sum($income), default_currency(), true);
+ $outgoing_amount = money(abs(array_sum($expense)), default_currency(), true);
+ $profit_amount = money(array_sum($profit), default_currency(), true);
$totals = [
'incoming_exact' => $incoming_amount->format(),
@@ -191,7 +191,7 @@ class CashFlow extends Widget
$totals[$i] += $item->getAmountConvertedToDefault();
}
- $precision = config('money.' . setting('default.currency') . '.precision');
+ $precision = config('money.' . default_currency() . '.precision');
foreach ($totals as $key => $value) {
if ($type == 'expense') {
@@ -206,7 +206,7 @@ class CashFlow extends Widget
{
$profit = [];
- $precision = config('money.' . setting('default.currency') . '.precision');
+ $precision = config('money.' . default_currency() . '.precision');
foreach ($incomes as $key => $income) {
$value = $income - abs($expenses[$key]);
diff --git a/app/Widgets/Payables.php b/app/Widgets/Payables.php
index 3b0d86520..9ca30f082 100644
--- a/app/Widgets/Payables.php
+++ b/app/Widgets/Payables.php
@@ -52,7 +52,7 @@ class Payables extends Widget
});
foreach ($periods as $period_name => $period_amount) {
- $periods[$period_name] = money($period_amount, setting('default.currency'), true);
+ $periods[$period_name] = money($period_amount, default_currency(), true);
}
$has_progress = !empty($open) || !empty($overdue);
@@ -61,9 +61,9 @@ class Payables extends Widget
$grand = $open + $overdue;
$totals = [
- 'grand' => money($grand, setting('default.currency'), true),
- 'open' => money($open, setting('default.currency'), true),
- 'overdue' => money($overdue, setting('default.currency'), true),
+ 'grand' => money($grand, default_currency(), true),
+ 'open' => money($open, default_currency(), true),
+ 'overdue' => money($overdue, default_currency(), true),
];
$grand_total_text = trans('widgets.total_unpaid_bills');
diff --git a/app/Widgets/ProfitLoss.php b/app/Widgets/ProfitLoss.php
index 1e65a6f70..1ca1242c3 100644
--- a/app/Widgets/ProfitLoss.php
+++ b/app/Widgets/ProfitLoss.php
@@ -195,7 +195,7 @@ class ProfitLoss extends Widget
$totals[$i] += $item->getAmountConvertedToDefault();
}
- $precision = config('money.' . setting('default.currency') . '.precision');
+ $precision = config('money.' . default_currency() . '.precision');
foreach ($totals as $key => $value) {
$totals[$key] = round($value, $precision);
diff --git a/app/Widgets/Receivables.php b/app/Widgets/Receivables.php
index 6e0cd80ab..532c012e7 100644
--- a/app/Widgets/Receivables.php
+++ b/app/Widgets/Receivables.php
@@ -52,7 +52,7 @@ class Receivables extends Widget
});
foreach ($periods as $period_name => $period_amount) {
- $periods[$period_name] = money($period_amount, setting('default.currency'), true);
+ $periods[$period_name] = money($period_amount, default_currency(), true);
}
$has_progress = !empty($open) || !empty($overdue);
@@ -61,9 +61,9 @@ class Receivables extends Widget
$grand = $open + $overdue;
$totals = [
- 'grand' => money($grand, setting('default.currency'), true),
- 'open' => money($open, setting('default.currency'), true),
- 'overdue' => money($overdue, setting('default.currency'), true),
+ 'grand' => money($grand, default_currency(), true),
+ 'open' => money($open, default_currency(), true),
+ 'overdue' => money($overdue, default_currency(), true),
];
$grand_total_text = trans('widgets.total_unpaid_invoices');
diff --git a/database/factories/Account.php b/database/factories/Account.php
index b7b3c30e6..451079a5c 100644
--- a/database/factories/Account.php
+++ b/database/factories/Account.php
@@ -70,7 +70,7 @@ class Account extends Factory
public function default_currency()
{
return $this->state([
- 'currency_code' => setting('default.currency'),
+ 'currency_code' => default_currency(),
]);
}
}
diff --git a/database/factories/Contact.php b/database/factories/Contact.php
index 0631f1e53..301b57ad5 100644
--- a/database/factories/Contact.php
+++ b/database/factories/Contact.php
@@ -38,7 +38,7 @@ class Contact extends Factory
'address' => $this->faker->address,
'country' => $this->faker->randomElement($countries),
'website' => 'https://akaunting.com',
- 'currency_code' => setting('default.currency'),
+ 'currency_code' => default_currency(),
'reference' => $this->faker->text(5),
'enabled' => $this->faker->boolean ? 1 : 0,
'created_from' => 'core::factory',
diff --git a/database/factories/Document.php b/database/factories/Document.php
index 504754ae3..37a48a5ff 100644
--- a/database/factories/Document.php
+++ b/database/factories/Document.php
@@ -44,7 +44,7 @@ class Document extends AbstractFactory
'company_id' => $this->company->id,
'issued_at' => $issued_at,
'due_at' => $due_at,
- 'currency_code' => setting('default.currency'),
+ 'currency_code' => default_currency(),
'currency_rate' => '1',
'notes' => $this->faker->text(5),
'amount' => '0',
@@ -247,7 +247,7 @@ class Document extends AbstractFactory
'tax_ids' => [$tax->id],
'quantity' => '1',
'price' => $amount,
- 'currency' => setting('default.currency'),
+ 'currency' => default_currency(),
],
];
diff --git a/database/factories/Reconciliation.php b/database/factories/Reconciliation.php
index e021b1d5c..1ba0badee 100644
--- a/database/factories/Reconciliation.php
+++ b/database/factories/Reconciliation.php
@@ -28,7 +28,7 @@ class Reconciliation extends Factory
return [
'company_id' => $this->company->id,
'account_id' => '1',
- 'currency_code' => setting('default.currency'),
+ 'currency_code' => default_currency(),
'opening_balance' => '0',
'closing_balance' => '10',
'started_at' => $started_at,
diff --git a/database/factories/Transaction.php b/database/factories/Transaction.php
index d351708fd..d5ecffb05 100644
--- a/database/factories/Transaction.php
+++ b/database/factories/Transaction.php
@@ -44,7 +44,7 @@ class Transaction extends Factory
'account_id' => setting('default.account'),
'paid_at' => $this->faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d H:i:s'),
'amount' => $this->faker->randomFloat(2, 1, 1000),
- 'currency_code' => setting('default.currency'),
+ 'currency_code' => default_currency(),
'currency_rate' => '1.0',
'description' => $this->faker->text(5),
'category_id' => $this->company->categories()->$category_type()->get()->random(1)->pluck('id')->first(),
diff --git a/database/seeds/TestCompany.php b/database/seeds/TestCompany.php
index 995273a69..dbd4579e1 100644
--- a/database/seeds/TestCompany.php
+++ b/database/seeds/TestCompany.php
@@ -84,7 +84,7 @@ class TestCompany extends Seeder
'type' => 'customer',
'name' => 'Test Customer',
'email' => 'customer@company.com',
- 'currency_code' => setting('default.currency'),
+ 'currency_code' => default_currency(),
'password' => '123456',
'password_confirmation' => '123456',
'company_id' => company_id(),
diff --git a/resources/views/banking/transfers/create.blade.php b/resources/views/banking/transfers/create.blade.php
index 4352cd051..070232586 100644
--- a/resources/views/banking/transfers/create.blade.php
+++ b/resources/views/banking/transfers/create.blade.php
@@ -25,13 +25,13 @@
-
+
-
+
diff --git a/resources/views/banking/transfers/edit.blade.php b/resources/views/banking/transfers/edit.blade.php
index d2e13ffa7..1fc4fb840 100644
--- a/resources/views/banking/transfers/edit.blade.php
+++ b/resources/views/banking/transfers/edit.blade.php
@@ -20,25 +20,25 @@
-
+
-
+
@else
-
+
-
+
@endif
diff --git a/resources/views/common/items/index.blade.php b/resources/views/common/items/index.blade.php
index 52037ca4b..b7fb34935 100644
--- a/resources/views/common/items/index.blade.php
+++ b/resources/views/common/items/index.blade.php
@@ -119,14 +119,14 @@
@if ($item->sale_price)
-
+
@else
@endif
@if ($item->purchase_price)
-
+
@else
@endif
diff --git a/resources/views/components/contacts/index/content.blade.php b/resources/views/components/contacts/index/content.blade.php
index 791660b5f..e1dde557a 100644
--- a/resources/views/components/contacts/index/content.blade.php
+++ b/resources/views/components/contacts/index/content.blade.php
@@ -221,7 +221,7 @@
@if (! $hideOpen)
@if ($item->open)
-
+
@else
@endif
@@ -233,7 +233,7 @@
@if (! $hideOverdue)
@if ($item->overdue)
-
+
@else
@endif
diff --git a/resources/views/components/layouts/admin/scripts.blade.php b/resources/views/components/layouts/admin/scripts.blade.php
index b846eceab..774b86feb 100644
--- a/resources/views/components/layouts/admin/scripts.blade.php
+++ b/resources/views/components/layouts/admin/scripts.blade.php
@@ -2,7 +2,7 @@
@stack('scripts_start')
diff --git a/resources/views/components/layouts/portal/scripts.blade.php b/resources/views/components/layouts/portal/scripts.blade.php
index e5c4b94f8..3c4e9cbed 100644
--- a/resources/views/components/layouts/portal/scripts.blade.php
+++ b/resources/views/components/layouts/portal/scripts.blade.php
@@ -2,7 +2,7 @@
@stack('scripts_start')
diff --git a/resources/views/components/layouts/print/scripts.blade.php b/resources/views/components/layouts/print/scripts.blade.php
index 99442b2f9..f13c9a4ce 100644
--- a/resources/views/components/layouts/print/scripts.blade.php
+++ b/resources/views/components/layouts/print/scripts.blade.php
@@ -2,7 +2,7 @@
@stack('scripts_start')
diff --git a/resources/views/components/reports/summary/table/row.blade.php b/resources/views/components/reports/summary/table/row.blade.php
index eb7e9edd5..1d8ecaa12 100644
--- a/resources/views/components/reports/summary/table/row.blade.php
+++ b/resources/views/components/reports/summary/table/row.blade.php
@@ -73,7 +73,7 @@
@endif
@endif
-
{{ $class->has_money ? money($row_total, setting('default.currency'), true) : $row_total }}
+
{{ $class->has_money ? money($row_total, default_currency(), true) : $row_total }}
@endif
@@ -91,7 +91,7 @@
{{ $class->row_names[$table_key][$id] }}
- {{ $class->has_money ? money($row_total, setting('default.currency'), true) : $row_total }}
+ {{ $class->has_money ? money($row_total, default_currency(), true) : $row_total }}
@endif
diff --git a/resources/views/settings/currencies/edit.blade.php b/resources/views/settings/currencies/edit.blade.php
index f0c6a861a..d58f6b318 100644
--- a/resources/views/settings/currencies/edit.blade.php
+++ b/resources/views/settings/currencies/edit.blade.php
@@ -28,7 +28,7 @@