mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix phpstan messages.
This commit is contained in:
parent
ee0116f112
commit
445804a7f1
@ -10,6 +10,11 @@ parameters:
|
|||||||
- '#is neither abstract nor final#'
|
- '#is neither abstract nor final#'
|
||||||
- '#has a nullable return type declaration#'
|
- '#has a nullable return type declaration#'
|
||||||
- '#with a nullable type declaration#'
|
- '#with a nullable type declaration#'
|
||||||
|
- '#with null as default value#'
|
||||||
|
-
|
||||||
|
message: '#but containers should not be injected#'
|
||||||
|
paths:
|
||||||
|
- ../app/Support/Authentication/RemoteUserGuard.php
|
||||||
-
|
-
|
||||||
message: '#Control structures using switch should not be used.#'
|
message: '#Control structures using switch should not be used.#'
|
||||||
paths:
|
paths:
|
||||||
@ -18,6 +23,17 @@ parameters:
|
|||||||
- ../app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
|
- ../app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
|
||||||
- ../app/Exceptions/GracefulNotFoundHandler.php
|
- ../app/Exceptions/GracefulNotFoundHandler.php
|
||||||
- ../app/Generator/Webhook/StandardMessageGenerator.php
|
- ../app/Generator/Webhook/StandardMessageGenerator.php
|
||||||
|
- ../app/Support/Amount.php
|
||||||
|
- ../app/Support/Navigation.php
|
||||||
|
- ../app/Support/ParseDateString.php
|
||||||
|
- ../app/Support/Search/AccountSearch.php
|
||||||
|
- ../app/Support/Search/OperatorQuerySearch.php
|
||||||
|
- ../app/Support/Twig/General.php
|
||||||
|
- ../app/Transformers/RecurrenceTransformer.php
|
||||||
|
- ../app/Validation/AccountValidator.php
|
||||||
|
- ../app/Validation/RecurrenceValidation.php
|
||||||
|
- ../app/Validation/TransactionValidation.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#Function compact\(\) should not be used#'
|
message: '#Function compact\(\) should not be used#'
|
||||||
paths:
|
paths:
|
||||||
@ -32,12 +48,21 @@ parameters:
|
|||||||
- ../app/Http/Controllers/Account/*.php
|
- ../app/Http/Controllers/Account/*.php
|
||||||
- ../app/Http/Controllers/Admin/*.php
|
- ../app/Http/Controllers/Admin/*.php
|
||||||
- ../app/Http/Controllers/*.php
|
- ../app/Http/Controllers/*.php
|
||||||
|
- ../app/Support/ExpandedForm.php
|
||||||
|
- ../app/Support/Form/AccountForm.php
|
||||||
|
- ../app/Support/Form/CurrencyForm.php
|
||||||
|
- ../app/Support/Form/FormSupport.php
|
||||||
|
-
|
||||||
|
message: '#Either catch a more specific exception#'
|
||||||
|
paths:
|
||||||
|
- ../app/Support/Form/FormSupport.php
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
- ../app
|
- ../app
|
||||||
- ../database
|
- ../database
|
||||||
- ../routes
|
- ../routes
|
||||||
|
- ../config
|
||||||
- ../bootstrap/app.php
|
- ../bootstrap/app.php
|
||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
level: 1
|
level: 2
|
||||||
|
@ -251,7 +251,7 @@ class UserEventHandler
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url));
|
Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ class UserEventHandler
|
|||||||
$url = route('profile.undo-email-change', [$token->data, $hashed]);
|
$url = route('profile.undo-email-change', [$token->data, $hashed]);
|
||||||
try {
|
try {
|
||||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url));
|
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ class UserEventHandler
|
|||||||
$url = route('invite', [$event->invitee->invite_code]);
|
$url = route('invite', [$event->invitee->invite_code]);
|
||||||
try {
|
try {
|
||||||
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
|
Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$result['date']->setTimezone(config('app.timezone'));
|
$result['date']->setTimezone(config('app.timezone'));
|
||||||
$result['created_at']->setTimezone(config('app.timezone'));
|
$result['created_at']->setTimezone(config('app.timezone'));
|
||||||
$result['updated_at']->setTimezone(config('app.timezone'));
|
$result['updated_at']->setTimezone(config('app.timezone'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
@ -98,8 +98,8 @@ class DebugController extends Controller
|
|||||||
Log::debug('Call twig:clean...');
|
Log::debug('Call twig:clean...');
|
||||||
try {
|
try {
|
||||||
Artisan::call('twig:clean');
|
Artisan::call('twig:clean');
|
||||||
} catch (Exception $e) { // @phpstan-ignore-line
|
} catch (Exception $e) { // intentional generic exception
|
||||||
// @ignoreException
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::debug('Call view:clear...');
|
Log::debug('Call view:clear...');
|
||||||
@ -186,11 +186,7 @@ class DebugController extends Controller
|
|||||||
if ($handler instanceof RotatingFileHandler) {
|
if ($handler instanceof RotatingFileHandler) {
|
||||||
$logFile = $handler->getUrl();
|
$logFile = $handler->getUrl();
|
||||||
if (null !== $logFile) {
|
if (null !== $logFile) {
|
||||||
try {
|
$logContent = file_get_contents($logFile);
|
||||||
$logContent = file_get_contents($logFile);
|
|
||||||
} catch (Exception $e) { // @phpstan-ignore-line
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ class InstallController extends Controller
|
|||||||
Artisan::call($command, $args);
|
Artisan::call($command, $args);
|
||||||
Log::debug(Artisan::output());
|
Log::debug(Artisan::output());
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
// clear cache as well.
|
// clear cache as well.
|
||||||
|
@ -155,7 +155,7 @@ class ReportFormRequest extends FormRequest
|
|||||||
if (preg_match($pattern, $string)) {
|
if (preg_match($pattern, $string)) {
|
||||||
try {
|
try {
|
||||||
$date = new Carbon($parts[1]);
|
$date = new Carbon($parts[1]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||||
Log::error($error);
|
Log::error($error);
|
||||||
throw new FireflyException($error, 0, $e);
|
throw new FireflyException($error, 0, $e);
|
||||||
@ -189,7 +189,7 @@ class ReportFormRequest extends FormRequest
|
|||||||
if (preg_match($pattern, $string)) {
|
if (preg_match($pattern, $string)) {
|
||||||
try {
|
try {
|
||||||
$date = new Carbon($parts[0]);
|
$date = new Carbon($parts[0]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||||
Log::error($error);
|
Log::error($error);
|
||||||
throw new FireflyException($error, 0, $e);
|
throw new FireflyException($error, 0, $e);
|
||||||
|
@ -90,7 +90,7 @@ class MailError extends Job implements ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,6 @@ use FireflyIII\Helpers\Attachments\AttachmentHelper;
|
|||||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||||
use FireflyIII\Helpers\Fiscal\FiscalHelper;
|
use FireflyIII\Helpers\Fiscal\FiscalHelper;
|
||||||
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
||||||
use FireflyIII\Helpers\Help\Help;
|
|
||||||
use FireflyIII\Helpers\Help\HelpInterface;
|
|
||||||
use FireflyIII\Helpers\Report\NetWorth;
|
use FireflyIII\Helpers\Report\NetWorth;
|
||||||
use FireflyIII\Helpers\Report\NetWorthInterface;
|
use FireflyIII\Helpers\Report\NetWorthInterface;
|
||||||
use FireflyIII\Helpers\Report\PopupReport;
|
use FireflyIII\Helpers\Report\PopupReport;
|
||||||
@ -217,7 +215,6 @@ class FireflyServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
// more generators:
|
// more generators:
|
||||||
$this->app->bind(PopupReportInterface::class, PopupReport::class);
|
$this->app->bind(PopupReportInterface::class, PopupReport::class);
|
||||||
$this->app->bind(HelpInterface::class, Help::class);
|
|
||||||
$this->app->bind(ReportHelperInterface::class, ReportHelper::class);
|
$this->app->bind(ReportHelperInterface::class, ReportHelper::class);
|
||||||
$this->app->bind(FiscalHelperInterface::class, FiscalHelper::class);
|
$this->app->bind(FiscalHelperInterface::class, FiscalHelper::class);
|
||||||
$this->app->bind(UpdateRequestInterface::class, UpdateRequest::class);
|
$this->app->bind(UpdateRequestInterface::class, UpdateRequest::class);
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Repositories\Budget;
|
namespace FireflyIII\Repositories\Budget;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||||
use FireflyIII\Models\Budget;
|
use FireflyIII\Models\Budget;
|
||||||
@ -124,11 +123,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void
|
public function destroyBudgetLimit(BudgetLimit $budgetLimit): void
|
||||||
{
|
{
|
||||||
try {
|
$budgetLimit->delete();
|
||||||
$budgetLimit->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -424,11 +419,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
|||||||
// 1 if the left_operand is larger than the right_operand, -1 otherwise.
|
// 1 if the left_operand is larger than the right_operand, -1 otherwise.
|
||||||
if (null !== $limit && bccomp($amount, '0') <= 0) {
|
if (null !== $limit && bccomp($amount, '0') <= 0) {
|
||||||
Log::debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
|
Log::debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
|
||||||
try {
|
$limit->delete();
|
||||||
$limit->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -207,11 +207,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
public function cleanupBudgets(): bool
|
public function cleanupBudgets(): bool
|
||||||
{
|
{
|
||||||
// delete limits with amount 0:
|
// delete limits with amount 0:
|
||||||
try {
|
BudgetLimit::where('amount', 0)->delete();
|
||||||
BudgetLimit::where('amount', 0)->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
$budgets = $this->getActiveBudgets();
|
$budgets = $this->getActiveBudgets();
|
||||||
/**
|
/**
|
||||||
* @var int $index
|
* @var int $index
|
||||||
@ -335,11 +331,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
try {
|
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'entries' => [],
|
'entries' => [],
|
||||||
];
|
];
|
||||||
$date = $journal['date']->format($carbonFormat);
|
$date = $journal['date']->format($carbonFormat);
|
||||||
$data[$key]['entries'][$date] = bcadd($data[$budgetId]['entries'][$date] ?? '0', $journal['amount']);
|
$data[$key]['entries'][$date] = bcadd($data[$key]['entries'][$date] ?? '0', $journal['amount']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -25,7 +25,6 @@ namespace FireflyIII\Repositories\Journal;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Support\CacheProperties;
|
use FireflyIII\Support\CacheProperties;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
@ -124,28 +123,15 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
|
|||||||
|
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
$result = null;
|
$result = null;
|
||||||
try {
|
return new Carbon($cache->get());
|
||||||
$result = new Carbon($cache->get());
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry = $journal->transactionJournalMeta()->where('name', $field)->first();
|
$entry = $journal->transactionJournalMeta()->where('name', $field)->first();
|
||||||
if (null === $entry) {
|
if (null === $entry) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$value = null;
|
$value = new Carbon($entry->data);
|
||||||
try {
|
$cache->store($value);
|
||||||
$value = new Carbon($entry->data);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
if (null !== $value) {
|
|
||||||
$cache->store($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
@ -185,11 +171,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
|
|||||||
|
|
||||||
// return when something else:
|
// return when something else:
|
||||||
$return = (string)$value;
|
$return = (string)$value;
|
||||||
try {
|
$cache->store($return);
|
||||||
$cache->store($return);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -331,13 +331,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null !== $dbNote && '' === $text) {
|
$dbNote?->delete();
|
||||||
try {
|
|
||||||
$dbNote->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,13 +339,7 @@ trait ModifiesPiggyBanks
|
|||||||
{
|
{
|
||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $piggyBank->notes()->first();
|
$dbNote = $piggyBank->notes()->first();
|
||||||
if (null !== $dbNote) {
|
$dbNote?->delete();
|
||||||
try {
|
|
||||||
$dbNote->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Services\Internal\Destroy;
|
namespace FireflyIII\Services\Internal\Destroy;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\RecurrenceTransaction;
|
use FireflyIII\Models\RecurrenceTransaction;
|
||||||
@ -68,11 +67,7 @@ class AccountDestroyService
|
|||||||
// delete account meta:
|
// delete account meta:
|
||||||
$account->accountMeta()->delete();
|
$account->accountMeta()->delete();
|
||||||
// delete account.
|
// delete account.
|
||||||
try {
|
$account->delete();
|
||||||
$account->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,10 +37,6 @@ class BillDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Bill $bill): void
|
public function destroy(Bill $bill): void
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$bill->delete();
|
$bill->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,7 @@ class BudgetDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Budget $budget): void
|
public function destroy(Budget $budget): void
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$budget->delete();
|
$budget->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
|
|
||||||
// also delete auto budget:
|
// also delete auto budget:
|
||||||
foreach ($budget->autoBudgets()->get() as $autoBudget) {
|
foreach ($budget->autoBudgets()->get() as $autoBudget) {
|
||||||
|
@ -39,11 +39,7 @@ class CategoryDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Category $category): void
|
public function destroy(Category $category): void
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$category->delete();
|
$category->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
|
|
||||||
// also delete all relations between categories and transaction journals:
|
// also delete all relations between categories and transaction journals:
|
||||||
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
|
DB::table('category_transaction_journal')->where('category_id', (int)$category->id)->delete();
|
||||||
|
@ -38,10 +38,6 @@ class CurrencyDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(TransactionCurrency $currency): void
|
public function destroy(TransactionCurrency $currency): void
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$currency->delete();
|
$currency->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Services\Internal\Destroy;
|
namespace FireflyIII\Services\Internal\Destroy;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Models\Attachment;
|
use FireflyIII\Models\Attachment;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
@ -43,61 +42,57 @@ class JournalDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(TransactionJournal $journal): void
|
public function destroy(TransactionJournal $journal): void
|
||||||
{
|
{
|
||||||
try {
|
/** @var Transaction $transaction */
|
||||||
/** @var Transaction $transaction */
|
foreach ($journal->transactions()->get() as $transaction) {
|
||||||
foreach ($journal->transactions()->get() as $transaction) {
|
Log::debug(sprintf('Will now delete transaction #%d', $transaction->id));
|
||||||
Log::debug(sprintf('Will now delete transaction #%d', $transaction->id));
|
$transaction->delete();
|
||||||
$transaction->delete();
|
}
|
||||||
|
|
||||||
|
// also delete journal_meta entries.
|
||||||
|
/** @var TransactionJournalMeta $meta */
|
||||||
|
foreach ($journal->transactionJournalMeta()->get() as $meta) {
|
||||||
|
Log::debug(sprintf('Will now delete meta-entry #%d', $meta->id));
|
||||||
|
$meta->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// also delete attachments.
|
||||||
|
/** @var Attachment $attachment */
|
||||||
|
foreach ($journal->attachments()->get() as $attachment) {
|
||||||
|
$attachment->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete all from 'budget_transaction_journal'
|
||||||
|
DB::table('budget_transaction_journal')
|
||||||
|
->where('transaction_journal_id', $journal->id)->delete();
|
||||||
|
|
||||||
|
// delete all from 'category_transaction_journal'
|
||||||
|
DB::table('category_transaction_journal')
|
||||||
|
->where('transaction_journal_id', $journal->id)->delete();
|
||||||
|
|
||||||
|
// delete all from 'tag_transaction_journal'
|
||||||
|
DB::table('tag_transaction_journal')
|
||||||
|
->where('transaction_journal_id', $journal->id)->delete();
|
||||||
|
|
||||||
|
// delete all links:
|
||||||
|
TransactionJournalLink::where('source_id', $journal->id)->delete();
|
||||||
|
TransactionJournalLink::where('destination_id', $journal->id)->delete();
|
||||||
|
|
||||||
|
// delete all notes
|
||||||
|
$journal->notes()->delete();
|
||||||
|
|
||||||
|
// update events
|
||||||
|
// TODO move to repository
|
||||||
|
$journal->piggyBankEvents()->update(['transaction_journal_id' => null]);
|
||||||
|
|
||||||
|
$journal->delete();
|
||||||
|
|
||||||
|
// delete group, if group is empty:
|
||||||
|
$group = $journal->transactionGroup;
|
||||||
|
if (null !== $group) {
|
||||||
|
$count = $group->transactionJournals->count();
|
||||||
|
if (0 === $count) {
|
||||||
|
$group->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// also delete journal_meta entries.
|
|
||||||
/** @var TransactionJournalMeta $meta */
|
|
||||||
foreach ($journal->transactionJournalMeta()->get() as $meta) {
|
|
||||||
Log::debug(sprintf('Will now delete meta-entry #%d', $meta->id));
|
|
||||||
$meta->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// also delete attachments.
|
|
||||||
/** @var Attachment $attachment */
|
|
||||||
foreach ($journal->attachments()->get() as $attachment) {
|
|
||||||
$attachment->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete all from 'budget_transaction_journal'
|
|
||||||
DB::table('budget_transaction_journal')
|
|
||||||
->where('transaction_journal_id', $journal->id)->delete();
|
|
||||||
|
|
||||||
// delete all from 'category_transaction_journal'
|
|
||||||
DB::table('category_transaction_journal')
|
|
||||||
->where('transaction_journal_id', $journal->id)->delete();
|
|
||||||
|
|
||||||
// delete all from 'tag_transaction_journal'
|
|
||||||
DB::table('tag_transaction_journal')
|
|
||||||
->where('transaction_journal_id', $journal->id)->delete();
|
|
||||||
|
|
||||||
// delete all links:
|
|
||||||
TransactionJournalLink::where('source_id', $journal->id)->delete();
|
|
||||||
TransactionJournalLink::where('destination_id', $journal->id)->delete();
|
|
||||||
|
|
||||||
// delete all notes
|
|
||||||
$journal->notes()->delete();
|
|
||||||
|
|
||||||
// update events
|
|
||||||
// TODO move to repository
|
|
||||||
$journal->piggyBankEvents()->update(['transaction_journal_id' => null]);
|
|
||||||
|
|
||||||
$journal->delete();
|
|
||||||
|
|
||||||
// delete group, if group is empty:
|
|
||||||
$group = $journal->transactionGroup;
|
|
||||||
if (null !== $group) {
|
|
||||||
$count = $group->transactionJournals->count();
|
|
||||||
if (0 === $count) {
|
|
||||||
$group->delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Services\Internal\Destroy;
|
namespace FireflyIII\Services\Internal\Destroy;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Models\Recurrence;
|
use FireflyIII\Models\Recurrence;
|
||||||
use FireflyIII\Models\RecurrenceTransaction;
|
use FireflyIII\Models\RecurrenceTransaction;
|
||||||
|
|
||||||
@ -55,30 +54,18 @@ class RecurrenceDestroyService
|
|||||||
*/
|
*/
|
||||||
public function destroy(Recurrence $recurrence): void
|
public function destroy(Recurrence $recurrence): void
|
||||||
{
|
{
|
||||||
try {
|
// delete all meta data
|
||||||
// delete all meta data
|
$recurrence->recurrenceMeta()->delete();
|
||||||
$recurrence->recurrenceMeta()->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
// delete all transactions.
|
// delete all transactions.
|
||||||
/** @var RecurrenceTransaction $transaction */
|
/** @var RecurrenceTransaction $transaction */
|
||||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||||
$transaction->recurrenceTransactionMeta()->delete();
|
$transaction->recurrenceTransactionMeta()->delete();
|
||||||
try {
|
$transaction->delete();
|
||||||
$transaction->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// delete all repetitions
|
// delete all repetitions
|
||||||
$recurrence->recurrenceRepetitions()->delete();
|
$recurrence->recurrenceRepetitions()->delete();
|
||||||
|
|
||||||
// delete recurrence
|
// delete recurrence
|
||||||
try {
|
$recurrence->delete();
|
||||||
$recurrence->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Services\Internal\Destroy;
|
namespace FireflyIII\Services\Internal\Destroy;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Events\DestroyedTransactionGroup;
|
use FireflyIII\Events\DestroyedTransactionGroup;
|
||||||
use FireflyIII\Models\TransactionGroup;
|
use FireflyIII\Models\TransactionGroup;
|
||||||
|
|
||||||
@ -44,11 +43,7 @@ class TransactionGroupDestroyService
|
|||||||
foreach ($transactionGroup->transactionJournals as $journal) {
|
foreach ($transactionGroup->transactionJournals as $journal) {
|
||||||
$service->destroy($journal);
|
$service->destroy($journal);
|
||||||
}
|
}
|
||||||
try {
|
$transactionGroup->delete();
|
||||||
$transactionGroup->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
// trigger just after destruction
|
// trigger just after destruction
|
||||||
event(new DestroyedTransactionGroup($transactionGroup));
|
event(new DestroyedTransactionGroup($transactionGroup));
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Services\Internal\Support;
|
namespace FireflyIII\Services\Internal\Support;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Exceptions\DuplicateTransactionException;
|
use FireflyIII\Exceptions\DuplicateTransactionException;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Factory\AccountMetaFactory;
|
use FireflyIII\Factory\AccountMetaFactory;
|
||||||
@ -173,11 +172,7 @@ trait AccountServiceTrait
|
|||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $account->notes()->first();
|
$dbNote = $account->notes()->first();
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
try {
|
$dbNote->delete();
|
||||||
$dbNote->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Services\Internal\Support;
|
namespace FireflyIII\Services\Internal\Support;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\Note;
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\RuleAction;
|
use FireflyIII\Models\RuleAction;
|
||||||
@ -70,11 +69,7 @@ trait BillServiceTrait
|
|||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $bill->notes()->first();
|
$dbNote = $bill->notes()->first();
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
try {
|
$dbNote->delete();
|
||||||
$dbNote->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Services\Internal\Support;
|
namespace FireflyIII\Services\Internal\Support;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Factory\AccountMetaFactory;
|
use FireflyIII\Factory\AccountMetaFactory;
|
||||||
use FireflyIII\Factory\TagFactory;
|
use FireflyIII\Factory\TagFactory;
|
||||||
@ -395,11 +394,7 @@ trait JournalServiceTrait
|
|||||||
}
|
}
|
||||||
if ('' === $notes && null !== $note) {
|
if ('' === $notes && null !== $note) {
|
||||||
// try to delete existing notes.
|
// try to delete existing notes.
|
||||||
try {
|
$note->delete();
|
||||||
$note->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,11 +61,7 @@ trait RecurringTransactionTrait
|
|||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $recurrence->notes()->first();
|
$dbNote = $recurrence->notes()->first();
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
try {
|
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -376,11 +372,9 @@ trait RecurringTransactionTrait
|
|||||||
/** @var RecurrenceTransaction $transaction */
|
/** @var RecurrenceTransaction $transaction */
|
||||||
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
foreach ($recurrence->recurrenceTransactions as $transaction) {
|
||||||
$transaction->recurrenceTransactionMeta()->delete();
|
$transaction->recurrenceTransactionMeta()->delete();
|
||||||
try {
|
|
||||||
$transaction->delete();
|
$transaction->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,11 +153,9 @@ class CategoryUpdateService
|
|||||||
if ('' === $note) {
|
if ('' === $note) {
|
||||||
$dbNote = $category->notes()->first();
|
$dbNote = $category->notes()->first();
|
||||||
if (null !== $dbNote) {
|
if (null !== $dbNote) {
|
||||||
try {
|
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Services\Internal\Update;
|
namespace FireflyIII\Services\Internal\Update;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Carbon\Exceptions\InvalidDateException;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Factory\TagFactory;
|
use FireflyIII\Factory\TagFactory;
|
||||||
@ -652,9 +653,8 @@ class JournalUpdateService
|
|||||||
if ($this->hasFields([$field])) {
|
if ($this->hasFields([$field])) {
|
||||||
try {
|
try {
|
||||||
$value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]);
|
$value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]);
|
||||||
} catch (Exception $e) {
|
} catch (InvalidDateException $e) {
|
||||||
Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
|
Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
|
||||||
|
@ -132,11 +132,7 @@ class RecurrenceUpdateService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null !== $dbNote && '' === $text) {
|
if (null !== $dbNote && '' === $text) {
|
||||||
try {
|
|
||||||
$dbNote->delete();
|
$dbNote->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ use GuzzleHttp\Client;
|
|||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
use GuzzleHttp\Exception\RequestException;
|
use GuzzleHttp\Exception\RequestException;
|
||||||
use Log;
|
use Log;
|
||||||
use RuntimeException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PwndVerifierV2.
|
* Class PwndVerifierV2.
|
||||||
@ -73,12 +72,7 @@ class PwndVerifierV2 implements Verifier
|
|||||||
if (404 === $res->getStatusCode()) {
|
if (404 === $res->getStatusCode()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
$strpos = stripos($res->getBody()->getContents(), $rest);
|
||||||
$strpos = stripos($res->getBody()->getContents(), $rest);
|
|
||||||
} catch (RuntimeException $e) {
|
|
||||||
Log::error(sprintf('Could not get body from Pwnd result: %s', $e->getMessage()));
|
|
||||||
$strpos = false;
|
|
||||||
}
|
|
||||||
if (false === $strpos) {
|
if (false === $strpos) {
|
||||||
Log::debug(sprintf('%s was not found in result body. Return true.', $rest));
|
Log::debug(sprintf('%s was not found in result body. Return true.', $rest));
|
||||||
|
|
||||||
|
@ -124,9 +124,9 @@ class RemoteUserGuard implements Guard
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function hasUser()
|
public function hasUser(): bool
|
||||||
{
|
{
|
||||||
// TODO: Implement hasUser() method.
|
throw new FireflyException(sprintf('%s is not implemented', __METHOD__));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support\Binder;
|
namespace FireflyIII\Support\Binder;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Carbon\Exceptions\InvalidDateException;
|
||||||
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;
|
||||||
use Illuminate\Routing\Route;
|
use Illuminate\Routing\Route;
|
||||||
use Log;
|
use Log;
|
||||||
@ -72,9 +72,10 @@ class Date implements BinderInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = new Carbon($value);
|
$result = new Carbon($value);
|
||||||
} catch (Exception $e) {
|
} catch (InvalidDateException $e) {
|
||||||
Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()));
|
$message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage());
|
||||||
throw new NotFoundHttpException();
|
Log::error($message);
|
||||||
|
throw new NotFoundHttpException($message, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -53,6 +53,7 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
|
|||||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use League\Csv\CannotInsertRecord;
|
use League\Csv\CannotInsertRecord;
|
||||||
use League\Csv\Exception;
|
use League\Csv\Exception;
|
||||||
use League\Csv\Writer;
|
use League\Csv\Writer;
|
||||||
@ -206,7 +207,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +282,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +347,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +396,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,7 +474,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +636,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,7 +765,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,7 +818,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,7 +961,8 @@ class ExportDataGenerator
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$string = $csv->toString();
|
$string = $csv->toString();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
|
Log::error($e->getMessage());
|
||||||
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
throw new FireflyException(sprintf(self::EXPORT_ERR, $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,4 +1082,20 @@ class ExportDataGenerator
|
|||||||
{
|
{
|
||||||
$this->start = $start;
|
$this->start = $start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function get(string $key, mixed $default = null): mixed
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function has(mixed $key): mixed
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ use Exception;
|
|||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Configuration;
|
use FireflyIII\Models\Configuration;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class FireflyConfig.
|
* Class FireflyConfig.
|
||||||
@ -45,11 +46,7 @@ class FireflyConfig
|
|||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
Cache::forget($fullName);
|
Cache::forget($fullName);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
Configuration::where('name', $name)->forceDelete();
|
Configuration::where('name', $name)->forceDelete();
|
||||||
} catch (Exception $e) {
|
|
||||||
// @ignoreException
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +77,7 @@ class FireflyConfig
|
|||||||
/** @var Configuration|null $config */
|
/** @var Configuration|null $config */
|
||||||
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
|
$config = Configuration::where('name', $name)->first(['id', 'name', 'data']);
|
||||||
} catch (QueryException|Exception $e) {
|
} catch (QueryException|Exception $e) {
|
||||||
throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()));
|
throw new FireflyException(sprintf('Could not poll the database: %s', $e->getMessage()), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $config) {
|
if (null !== $config) {
|
||||||
@ -106,7 +103,8 @@ class FireflyConfig
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
|
$config = Configuration::whereName($name)->whereNull('deleted_at')->first();
|
||||||
} catch (QueryException|Exception $e) {
|
} catch (QueryException $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
$item = new Configuration();
|
$item = new Configuration();
|
||||||
$item->name = $name;
|
$item->name = $name;
|
||||||
$item->data = $value;
|
$item->data = $value;
|
||||||
|
@ -24,11 +24,10 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support\Form;
|
namespace FireflyIII\Support\Form;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Exception;
|
use Carbon\Exceptions\InvalidDateException;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Log;
|
use Log;
|
||||||
use RuntimeException;
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,13 +129,8 @@ trait FormSupport
|
|||||||
$value = array_key_exists($name, $preFilled) && null === $value ? $preFilled[$name] : $value;
|
$value = array_key_exists($name, $preFilled) && null === $value ? $preFilled[$name] : $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (null !== request()->old($name)) {
|
||||||
if (null !== request()->old($name)) {
|
$value = request()->old($name);
|
||||||
$value = request()->old($name);
|
|
||||||
}
|
|
||||||
} catch (RuntimeException $e) {
|
|
||||||
// don't care about session errors.
|
|
||||||
Log::debug(sprintf('Run time: %s', $e->getMessage()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value instanceof Carbon) {
|
if ($value instanceof Carbon) {
|
||||||
@ -163,8 +157,8 @@ trait FormSupport
|
|||||||
$date = null;
|
$date = null;
|
||||||
try {
|
try {
|
||||||
$date = today(config('app.timezone'));
|
$date = today(config('app.timezone'));
|
||||||
} catch (Exception $e) {
|
} catch (InvalidDateException $e) {
|
||||||
// @ignoreException
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
|
@ -415,7 +415,7 @@ trait PeriodOverview
|
|||||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||||
$first = $this->journalRepos->firstNull();
|
$first = $this->journalRepos->firstNull();
|
||||||
$start = null === $first ? new Carbon() : $first->date;
|
$start = null === $first ? new Carbon() : $first->date;
|
||||||
$end = $theDate ?? today(config('app.timezone'));
|
$end = clone $theDate;
|
||||||
|
|
||||||
Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
|
Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
|
||||||
Log::debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));
|
Log::debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));
|
||||||
|
@ -654,17 +654,17 @@ class Navigation
|
|||||||
|
|
||||||
return $fiscalHelper->endOfFiscalYear($end);
|
return $fiscalHelper->endOfFiscalYear($end);
|
||||||
}
|
}
|
||||||
switch ($range) {
|
$list = [
|
||||||
default:
|
'last7',
|
||||||
break;
|
'last30',
|
||||||
case 'last7':
|
'last90',
|
||||||
case 'last30':
|
'last365',
|
||||||
case 'last90':
|
'YTD',
|
||||||
case 'last365':
|
'QTD',
|
||||||
case 'YTD':
|
'MTD',
|
||||||
case 'QTD':
|
];
|
||||||
case 'MTD':
|
if (in_array($range, $list, true)) {
|
||||||
return $end;
|
return $end;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FireflyException(sprintf('updateEndDate cannot handle range "%s"', $range));
|
throw new FireflyException(sprintf('updateEndDate cannot handle range "%s"', $range));
|
||||||
|
@ -40,6 +40,7 @@ class NullArrayObject extends ArrayObject
|
|||||||
* @param array $array
|
* @param array $array
|
||||||
* @param null $default
|
* @param null $default
|
||||||
*/
|
*/
|
||||||
|
/* @phpstan-ignore-next-line */
|
||||||
public function __construct(array $array, $default = null)
|
public function __construct(array $array, $default = null)
|
||||||
{
|
{
|
||||||
parent::__construct($array);
|
parent::__construct($array);
|
||||||
@ -49,9 +50,9 @@ class NullArrayObject extends ArrayObject
|
|||||||
/**
|
/**
|
||||||
* @param mixed $key
|
* @param mixed $key
|
||||||
*
|
*
|
||||||
* @return mixed|null
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function offsetGet($key)
|
public function offsetGet($key): mixed
|
||||||
{
|
{
|
||||||
if ($this->offsetExists($key)) {
|
if ($this->offsetExists($key)) {
|
||||||
return parent::offsetGet($key);
|
return parent::offsetGet($key);
|
||||||
|
@ -85,11 +85,7 @@ class Preferences
|
|||||||
{
|
{
|
||||||
$preference = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
|
$preference = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
|
||||||
if (null !== $preference && null === $preference->data) {
|
if (null !== $preference && null === $preference->data) {
|
||||||
try {
|
$preference->delete();
|
||||||
$preference->delete();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
throw new FireflyException(sprintf('Could not delete preference #%d: %s', $preference->id, $e->getMessage()), 0, $e);
|
|
||||||
}
|
|
||||||
$preference = null;
|
$preference = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,11 +113,7 @@ class Preferences
|
|||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
Cache::forget($fullName);
|
Cache::forget($fullName);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();
|
Preference::where('user_id', auth()->user()->id)->where('name', $name)->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -153,11 +145,7 @@ class Preferences
|
|||||||
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
||||||
|
|
||||||
if (null !== $pref && null === $value) {
|
if (null !== $pref && null === $value) {
|
||||||
try {
|
|
||||||
$pref->delete();
|
$pref->delete();
|
||||||
} catch (Exception $e) {
|
|
||||||
throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Preference();
|
return new Preference();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,24 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
trait ConvertsDataTypes
|
trait ConvertsDataTypes
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Abstract method that always exists in the Request classes that use this
|
||||||
|
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed|null $default
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
abstract public function get(string $key, mixed $default = null): mixed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract method that always exists in the Request classes that use this
|
||||||
|
* trait, OR a stub needs to be added by any other class that uses this train.
|
||||||
|
*
|
||||||
|
* @param mixed $key
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
abstract public function has(mixed $key): mixed;
|
||||||
/**
|
/**
|
||||||
* Return integer value.
|
* Return integer value.
|
||||||
*
|
*
|
||||||
|
@ -678,7 +678,7 @@ class Steam
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$hostName = gethostbyaddr($ipAddress);
|
$hostName = gethostbyaddr($ipAddress);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) { // intentional generic exception
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
return $hostName;
|
return $hostName;
|
||||||
|
@ -82,4 +82,20 @@ class AppendNotesToDescription implements ActionInterface
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function get(string $key, mixed $default = null): mixed
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function has(mixed $key): mixed
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,4 +80,20 @@ class MoveNotesToDescription implements ActionInterface
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function get(string $key, mixed $default = null): mixed
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function has(mixed $key): mixed
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,6 @@ trait DepositValidation
|
|||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = $result ?? false;
|
|
||||||
Log::debug(sprintf('validateDepositDestination will return %s', var_export($result, true)));
|
Log::debug(sprintf('validateDepositDestination will return %s', var_export($result, true)));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -74,7 +74,6 @@ trait OBValidation
|
|||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$result = $result ?? false;
|
|
||||||
Log::debug(sprintf('validateOBDestination(%d, "%s") will return %s', $accountId, $accountName, var_export($result, true)));
|
Log::debug(sprintf('validateOBDestination(%d, "%s") will return %s', $accountId, $accountName, var_export($result, true)));
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -62,10 +62,6 @@ return [
|
|||||||
'driver' => 'stack',
|
'driver' => 'stack',
|
||||||
'channels' => ['audit_daily', 'audit_stdout'],
|
'channels' => ['audit_daily', 'audit_stdout'],
|
||||||
],
|
],
|
||||||
'scoped' => [
|
|
||||||
'driver' => 'custom',
|
|
||||||
'via' => FireflyIII\Logging\CreateCustomLogger::class,
|
|
||||||
],
|
|
||||||
'papertrail' => [
|
'papertrail' => [
|
||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
'level' => envNonEmpty('APP_LOG_LEVEL', 'info'),
|
'level' => envNonEmpty('APP_LOG_LEVEL', 'info'),
|
||||||
|
@ -1167,7 +1167,7 @@ try {
|
|||||||
Breadcrumbs::for(
|
Breadcrumbs::for(
|
||||||
'transactions.mass.edit',
|
'transactions.mass.edit',
|
||||||
static function (Generator $breadcrumbs, array $journals): void {
|
static function (Generator $breadcrumbs, array $journals): void {
|
||||||
if (!empty($journals)) {
|
if (0 !== count($journals)) {
|
||||||
$objectType = strtolower(reset($journals)['transaction_type_type']);
|
$objectType = strtolower(reset($journals)['transaction_type_type']);
|
||||||
$breadcrumbs->parent('transactions.index', $objectType);
|
$breadcrumbs->parent('transactions.index', $objectType);
|
||||||
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', ['']));
|
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', ['']));
|
||||||
@ -1191,7 +1191,7 @@ try {
|
|||||||
Breadcrumbs::for(
|
Breadcrumbs::for(
|
||||||
'transactions.bulk.edit',
|
'transactions.bulk.edit',
|
||||||
static function (Generator $breadcrumbs, array $journals): void {
|
static function (Generator $breadcrumbs, array $journals): void {
|
||||||
if (!empty($journals)) {
|
if (0 !== count($journals)) {
|
||||||
$ids = Arr::pluck($journals, 'transaction_journal_id');
|
$ids = Arr::pluck($journals, 'transaction_journal_id');
|
||||||
$first = reset($journals);
|
$first = reset($journals);
|
||||||
$breadcrumbs->parent('transactions.index', strtolower($first['transaction_type_type']));
|
$breadcrumbs->parent('transactions.index', strtolower($first['transaction_type_type']));
|
||||||
|
Loading…
Reference in New Issue
Block a user