mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix null pointer
This commit is contained in:
parent
25a23801be
commit
f9463e02a2
@ -45,6 +45,7 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Destroy\AccountDestroyService;
|
||||
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class DestroyController
|
||||
@ -175,12 +176,14 @@ class DestroyController extends Controller
|
||||
$count = $account->transactions()->count();
|
||||
if (true === $this->unused && 0 === $count) {
|
||||
app('log')->info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
|
||||
Log::channel('audit')->info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
|
||||
$service->destroy($account, null);
|
||||
|
||||
continue;
|
||||
}
|
||||
if (false === $this->unused) {
|
||||
app('log')->info(sprintf('Deleting account #%d "%s"', $account->id, $account->name));
|
||||
Log::channel('audit')->info(sprintf('Deleted account #%d "%s"', $account->id, $account->name));
|
||||
$service->destroy($account, null);
|
||||
}
|
||||
}
|
||||
|
@ -280,12 +280,12 @@ class RecurrenceFormRequest extends FormRequest
|
||||
if ('deposit' === $type) {
|
||||
$throwError = false;
|
||||
$sourceId = (int) $data['deposit_source_id'];
|
||||
$destinationId = (int) $data['destination_id'];
|
||||
$destinationId = (int) ($data['destination_id'] ?? 0);
|
||||
}
|
||||
if ('transfer' === $type) {
|
||||
$throwError = false;
|
||||
$sourceId = (int) $data['source_id'];
|
||||
$destinationId = (int) $data['destination_id'];
|
||||
$destinationId = (int) ($data['destination_id'] ?? 0);
|
||||
}
|
||||
if (true === $throwError) {
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
||||
|
@ -42,6 +42,7 @@ use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class BillRepository.
|
||||
@ -105,6 +106,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
|
||||
public function destroyAll(): void
|
||||
{
|
||||
Log::channel('audit')->info('Delete all bills through destroyAll');
|
||||
$this->user->bills()->delete();
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class AvailableBudgetRepository
|
||||
@ -79,6 +80,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
||||
*/
|
||||
public function destroyAll(): void
|
||||
{
|
||||
Log::channel('audit')->info('Delete all available budgets through destroyAll');
|
||||
$this->user->availableBudgets()->delete();
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class BudgetLimitRepository
|
||||
@ -108,6 +109,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
|
||||
/** @var Budget $budget */
|
||||
foreach ($budgets as $budget) {
|
||||
Log::channel('audit')->info(sprintf('Delete all budget limits of budget #%d ("%s") through destroyAll', $budget->id, $budget->name));
|
||||
$budget->budgetlimits()->delete();
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class BudgetRepository.
|
||||
@ -329,6 +330,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
RuleAction::where('action_type', 'set_budget')->where('action_value', (string) $budget->id)->delete();
|
||||
$budget->delete();
|
||||
}
|
||||
Log::channel('audit')->info('Delete all budgets through destroyAll');
|
||||
}
|
||||
|
||||
public function getBudgets(): Collection
|
||||
|
@ -36,6 +36,7 @@ use FireflyIII\Services\Internal\Update\CategoryUpdateService;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class CategoryRepository.
|
||||
@ -88,6 +89,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
RuleAction::where('action_type', 'set_category')->where('action_value', $category->name)->delete();
|
||||
$category->delete();
|
||||
}
|
||||
Log::channel('audit')->info('Delete all categories through destroyAll');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class PiggyBankRepository.
|
||||
@ -48,6 +49,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
|
||||
public function destroyAll(): void
|
||||
{
|
||||
Log::channel('audit')->info('Delete all piggy banks through destroyAll');
|
||||
$this->user->piggyBanks()->delete();
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class RecurringRepository
|
||||
@ -116,6 +117,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
|
||||
public function destroyAll(): void
|
||||
{
|
||||
Log::channel('audit')->info('Delete all recurring transactions through destroyAll');
|
||||
$this->user->recurrences()->delete();
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class RuleGroupRepository.
|
||||
@ -152,7 +153,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
|
||||
public function destroyAll(): void
|
||||
{
|
||||
$groups = $this->get();
|
||||
Log::channel('audit')->info('Delete all rule groups through destroyAll'); $groups = $this->get();
|
||||
|
||||
/** @var RuleGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
|
@ -34,6 +34,7 @@ use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class TagRepository.
|
||||
@ -64,6 +65,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
*/
|
||||
public function destroyAll(): void
|
||||
{
|
||||
Log::channel('audit')->info('Delete all tags through destroyAll');
|
||||
$tags = $this->get();
|
||||
|
||||
/** @var Tag $tag */
|
||||
|
Loading…
Reference in New Issue
Block a user