mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-03 20:55:05 +00:00 
			
		
		
		
	Fix #3145
This commit is contained in:
		@@ -114,7 +114,7 @@ class CategoryController extends Controller
 | 
			
		||||
        $cache->addProperty($end);
 | 
			
		||||
        $cache->addProperty('chart.category.frontpage');
 | 
			
		||||
        if ($cache->has()) {
 | 
			
		||||
            return response()->json($cache->get()); // @codeCoverageIgnore
 | 
			
		||||
            // return response()->json($cache->get()); // @codeCoverageIgnore
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // currency repos:
 | 
			
		||||
@@ -163,22 +163,24 @@ class CategoryController extends Controller
 | 
			
		||||
 | 
			
		||||
        // no category per currency:
 | 
			
		||||
        $noCategory = $noCatRepository->sumExpenses($start, $end);
 | 
			
		||||
        if (0 !== bccomp($noCategory[0]['sum'] ?? '0', '0')) {
 | 
			
		||||
 | 
			
		||||
        foreach ($noCategory as $currency) {
 | 
			
		||||
            $currencyId              = $currency['currency_id'];
 | 
			
		||||
            $currencies[$currencyId] = $currencies[$currencyId] ?? [
 | 
			
		||||
                    'currency_id'             => $currency['currency_id'],
 | 
			
		||||
                    'currency_name'           => $currency['currency_name'],
 | 
			
		||||
                    'currency_symbol'         => $currency['currency_symbol'],
 | 
			
		||||
                    'currency_code'           => $currency['currency_code'],
 | 
			
		||||
                    'currency_decimal_places' => $currency['currency_decimal_places'],
 | 
			
		||||
            foreach ($noCategory as $currency) {
 | 
			
		||||
                $currencyId              = $currency['currency_id'];
 | 
			
		||||
                $currencies[$currencyId] = $currencies[$currencyId] ?? [
 | 
			
		||||
                        'currency_id'             => $currency['currency_id'],
 | 
			
		||||
                        'currency_name'           => $currency['currency_name'],
 | 
			
		||||
                        'currency_symbol'         => $currency['currency_symbol'],
 | 
			
		||||
                        'currency_code'           => $currency['currency_code'],
 | 
			
		||||
                        '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.
 | 
			
		||||
@@ -203,6 +205,7 @@ class CategoryController extends Controller
 | 
			
		||||
            $name                                     = $entry['name'];
 | 
			
		||||
            $chartData[$currencyId]['entries'][$name] = bcmul($entry['sum'], '-1');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $data = $this->generator->multiSet($chartData);
 | 
			
		||||
        $cache->store($data);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -198,7 +198,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
 | 
			
		||||
                    'currency_code'           => $journal['currency_code'],
 | 
			
		||||
                    '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;
 | 
			
		||||
 
 | 
			
		||||
@@ -97,7 +97,7 @@ trait UserNavigation
 | 
			
		||||
        /** @var Transaction $transaction */
 | 
			
		||||
        foreach ($transactions as $transaction) {
 | 
			
		||||
            $type = $transaction->account->accountType->type;
 | 
			
		||||
            if (!in_array($type, $ignore)) {
 | 
			
		||||
            if (!in_array($type, $ignore, true)) {
 | 
			
		||||
                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) {
 | 
			
		||||
        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
 | 
			
		||||
            var holder = $('#' + container).parent().parent();
 | 
			
		||||
            if (holder.hasClass('box') || holder.hasClass('box-body')) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user