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