Fix all level 2 issues.

This commit is contained in:
James Cole
2023-11-05 09:40:45 +01:00
parent 9002365e6d
commit 1b978d41e0
32 changed files with 53 additions and 56 deletions

View File

@@ -88,15 +88,15 @@ class EditController extends Controller
$roles = $this->getRoles();
$liabilityTypes = $this->getLiabilityTypes();
$location = $repository->getLocation($account);
$latitude = $location ? $location->latitude : config('firefly.default_location.latitude');
$longitude = $location ? $location->longitude : config('firefly.default_location.longitude');
$zoomLevel = $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
$latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
$longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
$zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
$hasLocation = null !== $location;
$locations = [
'location' => [
'latitude' => old('location_latitude') ?? $latitude,
'longitude' => old('location_longitude') ?? $longitude,
'zoom_level' => old('location_zoom_level') ?? $zoomLevel,
'latitude' => null !== old('location_latitude') ? old('location_latitude'): $latitude,
'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
'zoom_level' => null !== old('location_zoom_level') ? old('location_zoom_level') : $zoomLevel,
'has_location' => $hasLocation || 'true' === old('location_has_location'),
],
];

View File

@@ -103,7 +103,7 @@ class EditController extends Controller
'notes' => $this->repository->getNoteText($bill),
'transaction_currency_id' => $bill->transaction_currency_id,
'active' => $hasOldInput ? (bool)$request->old('active') : $bill->active,
'object_group' => $bill->objectGroups->first() ? $bill->objectGroups->first()->title : '',
'object_group' => null !== $bill->objectGroups->first() ? $bill->objectGroups->first()->title : '',
];
$request->session()->flash('preFilled', $preFilled);

View File

@@ -100,7 +100,7 @@ class EditController extends Controller
'active' => $hasOldInput ? (bool)$request->old('active') : $budget->active,
'auto_budget_currency_id' => $hasOldInput ? (int)$request->old('auto_budget_currency_id') : $currency->id,
];
if ($autoBudget) {
if (null !== $autoBudget) {
$amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
$preFilled['auto_budget_amount'] = app('steam')->bcround($amount, $autoBudget->transactionCurrency->decimal_places);
}

View File

@@ -57,7 +57,7 @@ abstract class Controller extends BaseController
{
// is site a demo site?
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false));
$isDemoSite = $isDemoSiteConfig ? $isDemoSiteConfig->data : false;
$isDemoSite = (bool) $isDemoSiteConfig->data;
app('view')->share('IS_DEMO_SITE', $isDemoSite);
app('view')->share('DEMO_USERNAME', config('firefly.demo_username'));
app('view')->share('DEMO_PASSWORD', config('firefly.demo_password'));

View File

@@ -314,7 +314,7 @@ class DebugController extends Controller
// has stored reconciliations
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count()) {
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count() > 0) {
$flags[] = '<span title="Has reconciled">:ledger:</span>';
}

View File

@@ -93,7 +93,7 @@ class EditController extends Controller
'targetamount' => app('steam')->bcround($piggyBank->targetamount, $currency->decimal_places),
'targetdate' => $targetDate,
'startdate' => $startDate,
'object_group' => $piggyBank->objectGroups->first() ? $piggyBank->objectGroups->first()->title : '',
'object_group' => null !== $piggyBank->objectGroups->first() ? $piggyBank->objectGroups->first()->title : '',
'notes' => null === $note ? '' : $note->text,
];
if (0 === bccomp($piggyBank->targetamount, '0')) {

View File

@@ -163,9 +163,9 @@ class CreateController extends Controller
$source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $dest */
$dest = $journal->transactions()->where('amount', '>', 0)->first();
$category = $journal->categories()->first() ? $journal->categories()->first()->name : '';
$budget = $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
$bill = $journal->bill ? $journal->bill->id : 0;
$category = null !== $journal->categories()->first() ? $journal->categories()->first()->name : '';
$budget = null !== $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
$bill = null !== $journal->bill ? $journal->bill->id : 0;
$hasOldInput = null !== $request->old('_token'); // flash some data
$preFilled = [];
if (true === $hasOldInput) {

View File

@@ -106,7 +106,7 @@ class CreateController extends Controller
}
// restore actions and triggers from old input:
if ($request->old()) {
if (null !== $request->old()) {
$oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request);
}
@@ -163,7 +163,7 @@ class CreateController extends Controller
$oldActions = $this->getActionsForBill($bill);
// restore actions and triggers from old input:
if ($request->old()) {
if (null !== $request->old()) {
$oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request);
}
@@ -172,7 +172,7 @@ class CreateController extends Controller
$actionCount = count($oldActions);
$subTitleIcon = 'fa-clone';
// title depends on whether or not there is a rule group:
// title depends on whether there is a rule group:
$subTitle = (string)trans('firefly.make_new_rule_no_group');
// flash old data
@@ -218,7 +218,7 @@ class CreateController extends Controller
];
// restore actions and triggers from old input:
if ($request->old()) {
if (null !== $request->old()) {
$oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request);
}

View File

@@ -129,9 +129,9 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag';
$location = $this->repository->getLocation($tag);
$latitude = $location ? $location->latitude : config('firefly.default_location.latitude');
$longitude = $location ? $location->longitude : config('firefly.default_location.longitude');
$zoomLevel = $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
$latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
$longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
$zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
$hasLocation = null !== $location;
$locations = [
'location' => [

View File

@@ -96,7 +96,7 @@ class IndexController extends Controller
if (null === $end) {
// get last transaction ever?
$last = $this->repository->getLast();
$end = $last ? $last->date : session('end');
$end = null !== $last ? $last->date : session('end');
}
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
@@ -147,7 +147,7 @@ class IndexController extends Controller
$first = $this->repository->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$last = $this->repository->getLast();
$end = $last ? $last->date : today(config('app.timezone'));
$end = null !== $last ? $last->date : today(config('app.timezone'));
$subTitle = (string)trans('firefly.all_' . $objectType);
/** @var GroupCollectorInterface $collector */

View File

@@ -47,7 +47,7 @@ class Range
*/
public function handle(Request $request, Closure $next)
{
if ($request->user()) {
if (null !== $request->user()) {
// set start, end and finish:
$this->setRange();