mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Fix #3145
This commit is contained in:
@@ -114,7 +114,7 @@ class CategoryController extends Controller
|
|||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$cache->addProperty('chart.category.frontpage');
|
$cache->addProperty('chart.category.frontpage');
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
// return response()->json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
// currency repos:
|
// currency repos:
|
||||||
@@ -163,22 +163,24 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
// no category per currency:
|
// no category per currency:
|
||||||
$noCategory = $noCatRepository->sumExpenses($start, $end);
|
$noCategory = $noCatRepository->sumExpenses($start, $end);
|
||||||
|
if (0 !== bccomp($noCategory[0]['sum'] ?? '0', '0')) {
|
||||||
|
|
||||||
foreach ($noCategory as $currency) {
|
foreach ($noCategory as $currency) {
|
||||||
$currencyId = $currency['currency_id'];
|
$currencyId = $currency['currency_id'];
|
||||||
$currencies[$currencyId] = $currencies[$currencyId] ?? [
|
$currencies[$currencyId] = $currencies[$currencyId] ?? [
|
||||||
'currency_id' => $currency['currency_id'],
|
'currency_id' => $currency['currency_id'],
|
||||||
'currency_name' => $currency['currency_name'],
|
'currency_name' => $currency['currency_name'],
|
||||||
'currency_symbol' => $currency['currency_symbol'],
|
'currency_symbol' => $currency['currency_symbol'],
|
||||||
'currency_code' => $currency['currency_code'],
|
'currency_code' => $currency['currency_code'],
|
||||||
'currency_decimal_places' => $currency['currency_decimal_places'],
|
'currency_decimal_places' => $currency['currency_decimal_places'],
|
||||||
|
];
|
||||||
|
$tempData[] = [
|
||||||
|
'name' => trans('firefly.no_category'),
|
||||||
|
'sum' => $currency['sum'],
|
||||||
|
'sum_float' => round($currency['sum'], $currency['currency_decimal_places'] ?? 2),
|
||||||
|
'currency_id' => $currency['currency_id'],
|
||||||
];
|
];
|
||||||
$tempData[] = [
|
}
|
||||||
'name' => trans('firefly.no_category'),
|
|
||||||
'sum' => $currency['sum'],
|
|
||||||
'sum_float' => round($currency['sum'], $currency['currency_decimal_places']),
|
|
||||||
'currency_id' => $currency['currency_id'],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort temp array by amount.
|
// sort temp array by amount.
|
||||||
@@ -203,6 +205,7 @@ class CategoryController extends Controller
|
|||||||
$name = $entry['name'];
|
$name = $entry['name'];
|
||||||
$chartData[$currencyId]['entries'][$name] = bcmul($entry['sum'], '-1');
|
$chartData[$currencyId]['entries'][$name] = bcmul($entry['sum'], '-1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->generator->multiSet($chartData);
|
$data = $this->generator->multiSet($chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
|
@@ -198,7 +198,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
|
|||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
|
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'] ?? '0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
|
@@ -97,7 +97,7 @@ trait UserNavigation
|
|||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
$type = $transaction->account->accountType->type;
|
$type = $transaction->account->accountType->type;
|
||||||
if (!in_array($type, $ignore)) {
|
if (!in_array($type, $ignore, true)) {
|
||||||
return redirect(route('accounts.edit', [$transaction->account_id]));
|
return redirect(route('accounts.edit', [$transaction->account_id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
public/v1/js/ff/charts.js
vendored
4
public/v1/js/ff/charts.js
vendored
@@ -374,7 +374,9 @@ function drawAChart(URI, container, chartType, options, colorData) {
|
|||||||
|
|
||||||
$.getJSON(URI).done(function (data) {
|
$.getJSON(URI).done(function (data) {
|
||||||
containerObj.removeClass('general-chart-error');
|
containerObj.removeClass('general-chart-error');
|
||||||
if (data.labels.length === 0) {
|
console.log(data);
|
||||||
|
if (!(Array.isArray(data) && data.length) ||
|
||||||
|
(typeof data.labels != 'undefined' && data.labels.length === 0)) {
|
||||||
// remove the chart container + parent
|
// remove the chart container + parent
|
||||||
var holder = $('#' + container).parent().parent();
|
var holder = $('#' + container).parent().parent();
|
||||||
if (holder.hasClass('box') || holder.hasClass('box-body')) {
|
if (holder.hasClass('box') || holder.hasClass('box-body')) {
|
||||||
|
Reference in New Issue
Block a user