mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-24 22:48:18 +00:00
Various nestor-related fixes.
This commit is contained in:
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Json;
|
||||
|
||||
use FireflyIII\Models\AvailableBudget;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
@@ -72,7 +73,7 @@ class BudgetController extends Controller
|
||||
$available = '0';
|
||||
$percentage = '0';
|
||||
|
||||
if (null !== $availableBudget) {
|
||||
if ($availableBudget instanceof AvailableBudget) {
|
||||
$available = $availableBudget->amount;
|
||||
if (0 !== bccomp($available, '0')) {
|
||||
$percentage = bcmul(bcdiv($budgeted, $available), '100');
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Json;
|
||||
|
||||
use Throwable;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
@@ -89,7 +90,7 @@ class FrontpageController extends Controller
|
||||
if (0 !== count($info)) {
|
||||
try {
|
||||
$html = view('json.piggy-banks', compact('info', 'convertToNative', 'native'))->render();
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$html = 'Could not render view.';
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Json;
|
||||
|
||||
use Throwable;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
@@ -77,7 +78,7 @@ class ReconcileController extends Controller
|
||||
$amount = '0';
|
||||
$clearedAmount = '0';
|
||||
|
||||
if (null === $start && null === $end) {
|
||||
if (!$start instanceof Carbon && !$end instanceof Carbon) {
|
||||
throw new FireflyException('Invalid dates submitted.');
|
||||
}
|
||||
if ($end->lt($start)) {
|
||||
@@ -130,7 +131,7 @@ class ReconcileController extends Controller
|
||||
|
||||
try {
|
||||
$view = view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared', 'reconSum', 'selectedIds'))->render();
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
app('log')->debug(sprintf('View error: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
|
||||
@@ -183,7 +184,7 @@ class ReconcileController extends Controller
|
||||
*/
|
||||
public function transactions(Account $account, ?Carbon $start = null, ?Carbon $end = null)
|
||||
{
|
||||
if (null === $start || null === $end) {
|
||||
if (!$start instanceof Carbon || !$end instanceof Carbon) {
|
||||
throw new FireflyException('Invalid dates submitted.');
|
||||
}
|
||||
if ($end->lt($start)) {
|
||||
@@ -228,7 +229,7 @@ class ReconcileController extends Controller
|
||||
'accounts.reconcile.transactions',
|
||||
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||
)->render();
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
app('log')->debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
|
||||
|
@@ -82,12 +82,12 @@ class RecurrenceController extends Controller
|
||||
$skip = $skip < 0 || $skip > 31 ? 0 : $skip;
|
||||
$weekend = $weekend < 1 || $weekend > 4 ? 1 : $weekend;
|
||||
|
||||
if (null === $endDate) {
|
||||
if (!$endDate instanceof Carbon) {
|
||||
// safety catch:
|
||||
$endDate = now()->addYear();
|
||||
}
|
||||
|
||||
if (null === $start || null === $end || null === $firstDate) {
|
||||
if (!$start instanceof Carbon || !$end instanceof Carbon || !$firstDate instanceof Carbon) {
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class RecurrenceController extends Controller
|
||||
} catch (InvalidFormatException) {
|
||||
$date = Carbon::today(config('app.timezone'));
|
||||
}
|
||||
if (null === $date) {
|
||||
if (!$date instanceof Carbon) {
|
||||
return response()->json();
|
||||
}
|
||||
$date->startOfDay();
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Json;
|
||||
|
||||
use Throwable;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -50,7 +51,7 @@ class RuleController extends Controller
|
||||
|
||||
try {
|
||||
$view = view('rules.partials.action', compact('actions', 'count'))->render();
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$view = 'Could not render view.';
|
||||
@@ -80,7 +81,7 @@ class RuleController extends Controller
|
||||
|
||||
try {
|
||||
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
app('log')->error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
$view = 'Could not render view.';
|
||||
|
Reference in New Issue
Block a user