mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Fix #9858
This commit is contained in:
@@ -483,6 +483,11 @@ class BasicController extends Controller
|
|||||||
// either an amount was budgeted or 0 is available.
|
// either an amount was budgeted or 0 is available.
|
||||||
$currencyId = $row['currency_id'];
|
$currencyId = $row['currency_id'];
|
||||||
$amount = (string) ($available[$currencyId] ?? '0');
|
$amount = (string) ($available[$currencyId] ?? '0');
|
||||||
|
if(0 === bccomp($amount,'0')) {
|
||||||
|
// #9858 skip over currencies with no available budget.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
$spentInCurrency = $row['sum'];
|
$spentInCurrency = $row['sum'];
|
||||||
$leftToSpend = bcadd($amount, $spentInCurrency);
|
$leftToSpend = bcadd($amount, $spentInCurrency);
|
||||||
$perDay = '0';
|
$perDay = '0';
|
||||||
@@ -495,6 +500,7 @@ class BasicController extends Controller
|
|||||||
$return[] = [
|
$return[] = [
|
||||||
'key' => sprintf('left-to-spend-in-%s', $row['currency_code']),
|
'key' => sprintf('left-to-spend-in-%s', $row['currency_code']),
|
||||||
'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $row['currency_symbol']]),
|
'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $row['currency_symbol']]),
|
||||||
|
'no_available_budgets' => false,
|
||||||
'monetary_value' => $leftToSpend,
|
'monetary_value' => $leftToSpend,
|
||||||
'currency_id' => (string) $row['currency_id'],
|
'currency_id' => (string) $row['currency_id'],
|
||||||
'currency_code' => $row['currency_code'],
|
'currency_code' => $row['currency_code'],
|
||||||
@@ -516,6 +522,7 @@ class BasicController extends Controller
|
|||||||
'key' => sprintf('left-to-spend-in-%s', $currency->code),
|
'key' => sprintf('left-to-spend-in-%s', $currency->code),
|
||||||
'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]),
|
'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]),
|
||||||
'monetary_value' => '0',
|
'monetary_value' => '0',
|
||||||
|
'no_available_budgets' => true,
|
||||||
'currency_id' => (string) $currency->id,
|
'currency_id' => (string) $currency->id,
|
||||||
'currency_code' => $currency->code,
|
'currency_code' => $currency->code,
|
||||||
'currency_symbol' => $currency->symbol,
|
'currency_symbol' => $currency->symbol,
|
||||||
|
@@ -80,11 +80,18 @@ function drawChart() {
|
|||||||
|
|
||||||
// left to spend
|
// left to spend
|
||||||
if (key.substring(0, 17) === 'left-to-spend-in-') {
|
if (key.substring(0, 17) === 'left-to-spend-in-') {
|
||||||
left_to_spend_top.push(data[key].value_parsed);
|
if(true === data[key].no_available_budgets) {
|
||||||
left_to_spend_bottom.push(data[key].sub_title);
|
left_to_spend_top.push('---');
|
||||||
if (parseFloat(data[key].monetary_value) > 0) {
|
left_to_spend_bottom.push('---');
|
||||||
keepGreen = true;
|
keepGreen = true;
|
||||||
}
|
}
|
||||||
|
if(false === data[key].no_available_budgets) {
|
||||||
|
left_to_spend_top.push(data[key].value_parsed);
|
||||||
|
left_to_spend_bottom.push(data[key].sub_title);
|
||||||
|
if (parseFloat(data[key].monetary_value) > 0) {
|
||||||
|
keepGreen = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// net worth
|
// net worth
|
||||||
|
Reference in New Issue
Block a user