mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Remove static references
This commit is contained in:
parent
075d459b7c
commit
4f2159b54d
@ -73,7 +73,7 @@ class UpdateController extends Controller
|
||||
*/
|
||||
public function update(UpdateRequest $request, Account $account): JsonResponse
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$data = $request->getUpdateData();
|
||||
$data['type'] = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$account = $this->repository->update($account, $data);
|
||||
|
@ -78,7 +78,7 @@ class StoreController extends Controller
|
||||
*/
|
||||
public function store(StoreRequest $request): JsonResponse
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$data = $request->getAll();
|
||||
$attachment = $this->repository->store($data);
|
||||
$manager = $this->getManager();
|
||||
|
@ -79,7 +79,7 @@ class DestroyController extends Controller
|
||||
*/
|
||||
public function destroy(TransactionGroup $transactionGroup): JsonResponse
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
// grab asset account(s) from group:
|
||||
$accounts = [];
|
||||
/** @var TransactionJournal $journal */
|
||||
@ -100,7 +100,7 @@ class DestroyController extends Controller
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
Log::debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
|
||||
app('log')->debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
|
||||
event(new UpdatedAccount($account));
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ class StoreController extends Controller
|
||||
*/
|
||||
public function store(StoreRequest $request): JsonResponse
|
||||
{
|
||||
Log::debug('Now in API StoreController::store()');
|
||||
app('log')->debug('Now in API StoreController::store()');
|
||||
$data = $request->getAll();
|
||||
$data['user'] = auth()->user()->id;
|
||||
|
||||
|
@ -77,7 +77,7 @@ class UpdateController extends Controller
|
||||
*/
|
||||
public function update(UpdateRequest $request, TransactionGroup $transactionGroup): JsonResponse
|
||||
{
|
||||
Log::debug('Now in update routine for transaction group!');
|
||||
app('log')->debug('Now in update routine for transaction group!');
|
||||
$data = $request->getAll();
|
||||
|
||||
$transactionGroup = $this->groupRepository->update($transactionGroup, $data);
|
||||
|
@ -67,7 +67,7 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function search(Request $request): JsonResponse | Response
|
||||
{
|
||||
Log::debug('Now in account search()');
|
||||
app('log')->debug('Now in account search()');
|
||||
$manager = $this->getManager();
|
||||
$query = trim((string)$request->get('query'));
|
||||
$field = trim((string)$request->get('field'));
|
||||
|
@ -53,8 +53,8 @@ class CronController extends Controller
|
||||
{
|
||||
$config = $request->getAll();
|
||||
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
Log::debug(sprintf('Date is %s', $config['date']->toIsoString()));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Date is %s', $config['date']->toIsoString()));
|
||||
$return = [];
|
||||
$return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']);
|
||||
$return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']);
|
||||
|
@ -192,7 +192,7 @@ class UserController extends Controller
|
||||
|
||||
// can only update 'blocked' when user is admin.
|
||||
if (!$this->repository->hasRole(auth()->user(), 'owner')) {
|
||||
Log::debug('Quietly drop fields "blocked" and "blocked_code" from request.');
|
||||
app('log')->debug('Quietly drop fields "blocked" and "blocked_code" from request.');
|
||||
unset($data['blocked'], $data['blocked_code']);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class StoreRequest extends FormRequest
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
Log::debug('Raw fields in Bill StoreRequest', $this->all());
|
||||
app('log')->debug('Raw fields in Bill StoreRequest', $this->all());
|
||||
$fields = [
|
||||
'name' => ['name', 'convertString'],
|
||||
'amount_min' => ['amount_min', 'convertString'],
|
||||
|
@ -57,7 +57,7 @@ class StoreRequest extends FormRequest
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
Log::debug('get all data in TransactionStoreRequest');
|
||||
app('log')->debug('get all data in TransactionStoreRequest');
|
||||
|
||||
return [
|
||||
'group_title' => $this->convertString('group_title'),
|
||||
@ -173,7 +173,7 @@ class StoreRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
Log::debug('Collect rules of TransactionStoreRequest');
|
||||
app('log')->debug('Collect rules of TransactionStoreRequest');
|
||||
$validProtocols = config('firefly.valid_url_protocols');
|
||||
return [
|
||||
// basic fields for group:
|
||||
@ -270,9 +270,9 @@ class StoreRequest extends FormRequest
|
||||
$this->validateTransactionArray($validator);
|
||||
|
||||
// must submit at least one transaction.
|
||||
Log::debug('Now going to validateOneTransaction');
|
||||
app('log')->debug('Now going to validateOneTransaction');
|
||||
$this->validateOneTransaction($validator);
|
||||
Log::debug('Now done with validateOneTransaction');
|
||||
app('log')->debug('Now done with validateOneTransaction');
|
||||
|
||||
// all journals must have a description
|
||||
$this->validateDescriptions($validator);
|
||||
|
@ -63,7 +63,7 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$this->integerFields = [
|
||||
'order',
|
||||
'currency_id',
|
||||
@ -157,7 +157,7 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
private function getTransactionData(): array
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$return = [];
|
||||
|
||||
if (!is_countable($this->get('transactions'))) {
|
||||
@ -246,9 +246,9 @@ class UpdateRequest extends FormRequest
|
||||
private function getDateData(array $current, array $transaction): array
|
||||
{
|
||||
foreach ($this->dateFields as $fieldName) {
|
||||
Log::debug(sprintf('Now at date field %s', $fieldName));
|
||||
app('log')->debug(sprintf('Now at date field %s', $fieldName));
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
Log::debug(sprintf('New value: "%s"', (string)$transaction[$fieldName]));
|
||||
app('log')->debug(sprintf('New value: "%s"', (string)$transaction[$fieldName]));
|
||||
$current[$fieldName] = $this->dateFromValue((string)$transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$validProtocols = config('firefly.valid_url_protocols');
|
||||
return [
|
||||
// basic fields for group:
|
||||
@ -406,7 +406,7 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
Log::debug('Now in withValidator');
|
||||
app('log')->debug('Now in withValidator');
|
||||
/** @var TransactionGroup $transactionGroup */
|
||||
$transactionGroup = $this->route()->parameter('transactionGroup');
|
||||
$validator->after(
|
||||
|
@ -56,7 +56,7 @@ class TransferBudgets extends Command
|
||||
foreach ($set as $entry) {
|
||||
$message = sprintf('Transaction journal #%d is a %s, so has no longer a budget.', $entry->id, $entry->transactionType->type);
|
||||
$this->friendlyInfo($message);
|
||||
Log::debug($message);
|
||||
app('log')->debug($message);
|
||||
$entry->budgets()->sync([]);
|
||||
$count++;
|
||||
}
|
||||
@ -66,7 +66,7 @@ class TransferBudgets extends Command
|
||||
}
|
||||
if (0 !== $count) {
|
||||
$message = sprintf('Corrected %d invalid budget/journal entries (entry).', $count);
|
||||
Log::debug($message);
|
||||
app('log')->debug($message);
|
||||
$this->friendlyInfo($message);
|
||||
}
|
||||
return 0;
|
||||
|
@ -95,7 +95,7 @@ class ForceDecimalSize extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
Log::debug('Now in ForceDecimalSize::handle()');
|
||||
app('log')->debug('Now in ForceDecimalSize::handle()');
|
||||
$this->determineDatabaseType();
|
||||
|
||||
$this->friendlyError('Running this command is dangerous and can cause data loss.');
|
||||
|
@ -66,7 +66,7 @@ class VerifySecurityAlerts extends Command
|
||||
$disk = Storage::disk('resources');
|
||||
// Next line is ignored because it's a Laravel Facade.
|
||||
if (!$disk->has('alerts.json')) {
|
||||
Log::debug('No alerts.json file present.');
|
||||
app('log')->debug('No alerts.json file present.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -76,19 +76,19 @@ class VerifySecurityAlerts extends Command
|
||||
/** @var array $array */
|
||||
foreach ($json as $array) {
|
||||
if ($version === $array['version'] && true === $array['advisory']) {
|
||||
Log::debug(sprintf('Version %s has an alert!', $array['version']));
|
||||
app('log')->debug(sprintf('Version %s has an alert!', $array['version']));
|
||||
// add advisory to configuration.
|
||||
$this->saveSecurityAdvisory($array);
|
||||
|
||||
// depends on level
|
||||
if ('info' === $array['level']) {
|
||||
Log::debug('INFO level alert');
|
||||
app('log')->debug('INFO level alert');
|
||||
$this->friendlyInfo($array['message']);
|
||||
|
||||
return 0;
|
||||
}
|
||||
if ('warning' === $array['level']) {
|
||||
Log::debug('WARNING level alert');
|
||||
app('log')->debug('WARNING level alert');
|
||||
$this->friendlyWarning('------------------------ :o');
|
||||
$this->friendlyWarning($array['message']);
|
||||
$this->friendlyWarning('------------------------ :o');
|
||||
@ -96,7 +96,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
if ('danger' === $array['level']) {
|
||||
Log::debug('DANGER level alert');
|
||||
app('log')->debug('DANGER level alert');
|
||||
$this->friendlyError('------------------------ :-(');
|
||||
$this->friendlyError($array['message']);
|
||||
$this->friendlyError('------------------------ :-(');
|
||||
@ -107,7 +107,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Log::debug(sprintf('No security alerts for version %s', $version));
|
||||
app('log')->debug(sprintf('No security alerts for version %s', $version));
|
||||
$this->friendlyPositive(sprintf('No security alerts for version %s', $version));
|
||||
return 0;
|
||||
}
|
||||
@ -121,7 +121,7 @@ class VerifySecurityAlerts extends Command
|
||||
app('fireflyconfig')->delete('upgrade_security_message');
|
||||
app('fireflyconfig')->delete('upgrade_security_level');
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ class VerifySecurityAlerts extends Command
|
||||
app('fireflyconfig')->set('upgrade_security_message', $array['message']);
|
||||
app('fireflyconfig')->set('upgrade_security_level', $array['level']);
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ class ApplyRules extends Command
|
||||
// if in rule selection, or group in selection or all rules, it's included.
|
||||
$test = $this->includeRule($rule, $group);
|
||||
if (true === $test) {
|
||||
Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
app('log')->debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
$rulesToApply->push($rule);
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class AppendBudgetLimitPeriods extends Command
|
||||
$limit->end_date->format('Y-m-d'),
|
||||
$period
|
||||
);
|
||||
Log::debug($msg);
|
||||
app('log')->debug($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ class MigrateAttachments extends Command
|
||||
$att->description = '';
|
||||
$att->save();
|
||||
|
||||
Log::debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
|
||||
app('log')->debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class MigrateJournalNotes extends Command
|
||||
|
||||
$note->text = $meta->data;
|
||||
$note->save();
|
||||
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
app('log')->debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
$meta->delete();
|
||||
|
||||
$count++;
|
||||
|
@ -151,11 +151,11 @@ class MigrateToGroups extends Command
|
||||
{
|
||||
// double check transaction count.
|
||||
if ($journal->transactions->count() <= 2) {
|
||||
Log::debug(sprintf('Will not try to convert journal #%d because it has 2 or less transactions.', $journal->id));
|
||||
app('log')->debug(sprintf('Will not try to convert journal #%d because it has 2 or less transactions.', $journal->id));
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Will now try to convert journal #%d', $journal->id));
|
||||
app('log')->debug(sprintf('Will now try to convert journal #%d', $journal->id));
|
||||
|
||||
$this->journalRepository->setUser($journal->user);
|
||||
$this->groupFactory->setUser($journal->user);
|
||||
@ -193,11 +193,11 @@ class MigrateToGroups extends Command
|
||||
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
|
||||
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
|
||||
|
||||
Log::debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
app('log')->debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($destTransactions as $transaction) {
|
||||
Log::debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
app('log')->debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
$opposingTr = $this->findOpposingTransaction($journal, $transaction);
|
||||
|
||||
if (null === $opposingTr) {
|
||||
@ -256,9 +256,9 @@ class MigrateToGroups extends Command
|
||||
|
||||
$data['transactions'][] = $tArray;
|
||||
}
|
||||
Log::debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
|
||||
app('log')->debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
|
||||
$group = $this->groupFactory->create($data);
|
||||
Log::debug('Done calling transaction journal factory');
|
||||
app('log')->debug('Done calling transaction journal factory');
|
||||
|
||||
// delete the old transaction journal.
|
||||
$this->service->destroy($journal);
|
||||
@ -266,7 +266,7 @@ class MigrateToGroups extends Command
|
||||
$this->count++;
|
||||
|
||||
// report on result:
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Migrated journal #%d into group #%d with these journals: #%s',
|
||||
$journal->id,
|
||||
@ -310,8 +310,8 @@ class MigrateToGroups extends Command
|
||||
static function (Transaction $subject) use ($transaction) {
|
||||
$amount = (float)$transaction->amount * -1 === (float)$subject->amount; // intentional float
|
||||
$identifier = $transaction->identifier === $subject->identifier;
|
||||
Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
Log::debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
app('log')->debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
app('log')->debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
|
||||
return $amount && $identifier;
|
||||
}
|
||||
@ -328,13 +328,13 @@ class MigrateToGroups extends Command
|
||||
*/
|
||||
private function getTransactionBudget(Transaction $left, Transaction $right): ?int
|
||||
{
|
||||
Log::debug('Now in getTransactionBudget()');
|
||||
app('log')->debug('Now in getTransactionBudget()');
|
||||
|
||||
// try to get a budget ID from the left transaction:
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $left->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
|
||||
return (int)$budget->id;
|
||||
}
|
||||
@ -343,11 +343,11 @@ class MigrateToGroups extends Command
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $right->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
|
||||
return (int)$budget->id;
|
||||
}
|
||||
Log::debug('Neither left or right have a budget, return NULL');
|
||||
app('log')->debug('Neither left or right have a budget, return NULL');
|
||||
|
||||
// if all fails, return NULL.
|
||||
return null;
|
||||
@ -361,13 +361,13 @@ class MigrateToGroups extends Command
|
||||
*/
|
||||
private function getTransactionCategory(Transaction $left, Transaction $right): ?int
|
||||
{
|
||||
Log::debug('Now in getTransactionCategory()');
|
||||
app('log')->debug('Now in getTransactionCategory()');
|
||||
|
||||
// try to get a category ID from the left transaction:
|
||||
/** @var Category|null $category */
|
||||
$category = $left->categories()->first();
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
|
||||
return (int)$category->id;
|
||||
}
|
||||
@ -376,11 +376,11 @@ class MigrateToGroups extends Command
|
||||
/** @var Category|null $category */
|
||||
$category = $right->categories()->first();
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
|
||||
return (int)$category->id;
|
||||
}
|
||||
Log::debug('Neither left or right have a category, return NULL');
|
||||
app('log')->debug('Neither left or right have a category, return NULL');
|
||||
|
||||
// if all fails, return NULL.
|
||||
return null;
|
||||
@ -394,7 +394,7 @@ class MigrateToGroups extends Command
|
||||
$orphanedJournals = $this->cliRepository->getJournalsWithoutGroup();
|
||||
$total = count($orphanedJournals);
|
||||
if ($total > 0) {
|
||||
Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
app('log')->debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
$this->friendlyInfo(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
/** @var array $array */
|
||||
foreach ($orphanedJournals as $array) {
|
||||
|
@ -46,7 +46,7 @@ class AdminRequestedTestMessage extends Event
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
Log::debug(sprintf('Triggered AdminRequestedTestMessage for user #%d (%s)', $user->id, $user->email));
|
||||
app('log')->debug(sprintf('Triggered AdminRequestedTestMessage for user #%d (%s)', $user->id, $user->email));
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class DestroyedTransactionGroup extends Event
|
||||
*/
|
||||
public function __construct(TransactionGroup $transactionGroup)
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$this->transactionGroup = $transactionGroup;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class ChangedAmount extends Event
|
||||
*/
|
||||
public function __construct(PiggyBank $piggyBank, string $amount, ?TransactionJournal $transactionJournal, ?TransactionGroup $transactionGroup)
|
||||
{
|
||||
Log::debug(sprintf('Created piggy bank event for piggy bank #%d with amount %s', $piggyBank->id, $amount));
|
||||
app('log')->debug(sprintf('Created piggy bank event for piggy bank #%d with amount %s', $piggyBank->id, $amount));
|
||||
$this->piggyBank = $piggyBank;
|
||||
$this->transactionJournal = $transactionJournal;
|
||||
$this->transactionGroup = $transactionGroup;
|
||||
|
@ -53,7 +53,7 @@ class RequestedReportOnJournals
|
||||
*/
|
||||
public function __construct(int $userId, Collection $groups)
|
||||
{
|
||||
Log::debug('In event RequestedReportOnJournals.');
|
||||
app('log')->debug('In event RequestedReportOnJournals.');
|
||||
$this->userId = $userId;
|
||||
$this->groups = $groups;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
*/
|
||||
private function handleAccount(Request $request, Throwable $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted account. Redirect to overview of account types.');
|
||||
app('log')->debug('404 page is probably a deleted account. Redirect to overview of account types.');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
@ -177,7 +177,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
*/
|
||||
private function handleGroup(Request $request, Throwable $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted group. Redirect to overview of group types.');
|
||||
app('log')->debug('404 page is probably a deleted group. Redirect to overview of group types.');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
@ -216,7 +216,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
*/
|
||||
private function handleAttachment(Request $request, Throwable $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted attachment. Redirect to parent object.');
|
||||
app('log')->debug('404 page is probably a deleted attachment. Redirect to parent object.');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
|
@ -83,41 +83,41 @@ class Handler extends ExceptionHandler
|
||||
$expectsJson = $request->expectsJson();
|
||||
// if the user requests anything /api/, assume the user wants to see JSON.
|
||||
if (str_starts_with($request->getRequestUri(), '/api/')) {
|
||||
Log::debug('API endpoint, always assume user wants JSON.');
|
||||
app('log')->debug('API endpoint, always assume user wants JSON.');
|
||||
$expectsJson = true;
|
||||
}
|
||||
|
||||
Log::debug('Now in Handler::render()');
|
||||
app('log')->debug('Now in Handler::render()');
|
||||
if ($e instanceof LaravelValidationException && $expectsJson) {
|
||||
// ignore it: controller will handle it.
|
||||
Log::debug(sprintf('Return to parent to handle LaravelValidationException(%d)', $e->status));
|
||||
app('log')->debug(sprintf('Return to parent to handle LaravelValidationException(%d)', $e->status));
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
if ($e instanceof NotFoundHttpException && $expectsJson) {
|
||||
// JSON error:
|
||||
Log::debug('Return JSON not found error.');
|
||||
app('log')->debug('Return JSON not found error.');
|
||||
return response()->json(['message' => 'Resource not found', 'exception' => 'NotFoundHttpException'], 404);
|
||||
}
|
||||
|
||||
if ($e instanceof AuthenticationException && $expectsJson) {
|
||||
// somehow Laravel handler does not catch this:
|
||||
Log::debug('Return JSON unauthenticated error.');
|
||||
app('log')->debug('Return JSON unauthenticated error.');
|
||||
return response()->json(['message' => 'Unauthenticated', 'exception' => 'AuthenticationException'], 401);
|
||||
}
|
||||
|
||||
if ($e instanceof OAuthServerException && $expectsJson) {
|
||||
Log::debug('Return JSON OAuthServerException.');
|
||||
app('log')->debug('Return JSON OAuthServerException.');
|
||||
// somehow Laravel handler does not catch this:
|
||||
return response()->json(['message' => $e->getMessage(), 'exception' => 'OAuthServerException'], 401);
|
||||
}
|
||||
if ($e instanceof BadRequestHttpException) {
|
||||
Log::debug('Return JSON BadRequestHttpException.');
|
||||
app('log')->debug('Return JSON BadRequestHttpException.');
|
||||
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadRequestHttpException'], 400);
|
||||
}
|
||||
|
||||
if ($e instanceof BadHttpHeaderException) {
|
||||
// is always API exception.
|
||||
Log::debug('Return JSON BadHttpHeaderException.');
|
||||
app('log')->debug('Return JSON BadHttpHeaderException.');
|
||||
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadHttpHeaderException'], $e->statusCode);
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class Handler extends ExceptionHandler
|
||||
|
||||
$isDebug = config('app.debug', false);
|
||||
if ($isDebug) {
|
||||
Log::debug(sprintf('Return JSON %s with debug.', get_class($e)));
|
||||
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
|
||||
return response()->json(
|
||||
[
|
||||
'message' => $e->getMessage(),
|
||||
@ -139,7 +139,7 @@ class Handler extends ExceptionHandler
|
||||
$errorCode
|
||||
);
|
||||
}
|
||||
Log::debug(sprintf('Return JSON %s.', get_class($e)));
|
||||
app('log')->debug(sprintf('Return JSON %s.', get_class($e)));
|
||||
return response()->json(
|
||||
['message' => sprintf('Internal Firefly III Exception: %s', $e->getMessage()), 'exception' => get_class($e)],
|
||||
$errorCode
|
||||
@ -147,7 +147,7 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
|
||||
if ($e instanceof NotFoundHttpException) {
|
||||
Log::debug('Refer to GracefulNotFoundHandler');
|
||||
app('log')->debug('Refer to GracefulNotFoundHandler');
|
||||
$handler = app(GracefulNotFoundHandler::class);
|
||||
|
||||
return $handler->render($request, $e);
|
||||
@ -155,20 +155,20 @@ class Handler extends ExceptionHandler
|
||||
|
||||
// special view for database errors with extra instructions
|
||||
if ($e instanceof QueryException) {
|
||||
Log::debug('Return Firefly III database exception view.');
|
||||
app('log')->debug('Return Firefly III database exception view.');
|
||||
$isDebug = config('app.debug');
|
||||
|
||||
return response()->view('errors.DatabaseException', ['exception' => $e, 'debug' => $isDebug], 500);
|
||||
}
|
||||
|
||||
if ($e instanceof FireflyException || $e instanceof ErrorException || $e instanceof OAuthServerException) {
|
||||
Log::debug('Return Firefly III error view.');
|
||||
app('log')->debug('Return Firefly III error view.');
|
||||
$isDebug = config('app.debug');
|
||||
|
||||
return response()->view('errors.FireflyException', ['exception' => $e, 'debug' => $isDebug], 500);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', get_class($e)));
|
||||
app('log')->debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', get_class($e)));
|
||||
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class AccountFactory
|
||||
*/
|
||||
public function findOrCreate(string $accountName, string $accountType): Account
|
||||
{
|
||||
Log::debug(sprintf('findOrCreate("%s", "%s")', $accountName, $accountType));
|
||||
app('log')->debug(sprintf('findOrCreate("%s", "%s")', $accountName, $accountType));
|
||||
|
||||
$type = $this->accountRepository->getAccountTypeByType($accountType);
|
||||
if (null === $type) {
|
||||
@ -88,7 +88,7 @@ class AccountFactory
|
||||
$return = $this->user->accounts->where('account_type_id', $type->id)->where('name', $accountName)->first();
|
||||
|
||||
if (null === $return) {
|
||||
Log::debug('Found nothing. Will create a new one.');
|
||||
app('log')->debug('Found nothing. Will create a new one.');
|
||||
$return = $this->create(
|
||||
[
|
||||
'user_id' => $this->user->id,
|
||||
@ -115,7 +115,7 @@ class AccountFactory
|
||||
*/
|
||||
public function create(array $data): Account
|
||||
{
|
||||
Log::debug('Now in AccountFactory::create()');
|
||||
app('log')->debug('Now in AccountFactory::create()');
|
||||
$type = $this->getAccountType($data);
|
||||
$data['iban'] = $this->filterIban($data['iban'] ?? null);
|
||||
|
||||
@ -163,7 +163,7 @@ class AccountFactory
|
||||
app('log')->warning(sprintf('Found NO account type based on %d and "%s"', $accountTypeId, $accountTypeName));
|
||||
throw new FireflyException(sprintf('AccountFactory::create() was unable to find account type #%d ("%s").', $accountTypeId, $accountTypeName));
|
||||
}
|
||||
Log::debug(sprintf('Found account type based on %d and "%s": "%s"', $accountTypeId, $accountTypeName, $result->type));
|
||||
app('log')->debug(sprintf('Found account type based on %d and "%s": "%s"', $accountTypeId, $accountTypeName, $result->type));
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -176,7 +176,7 @@ class AccountFactory
|
||||
*/
|
||||
public function find(string $accountName, string $accountType): ?Account
|
||||
{
|
||||
Log::debug(sprintf('Now in AccountFactory::find("%s", "%s")', $accountName, $accountType));
|
||||
app('log')->debug(sprintf('Now in AccountFactory::find("%s", "%s")', $accountName, $accountType));
|
||||
$type = AccountType::whereType($accountType)->first();
|
||||
|
||||
/** @var Account|null */
|
||||
@ -358,22 +358,22 @@ class AccountFactory
|
||||
*/
|
||||
private function storeCreditLiability(Account $account, array $data): void
|
||||
{
|
||||
Log::debug('storeCreditLiability');
|
||||
app('log')->debug('storeCreditLiability');
|
||||
$account->refresh();
|
||||
$accountType = $account->accountType->type;
|
||||
$direction = $this->accountRepository->getMetaValue($account, 'liability_direction');
|
||||
$valid = config('firefly.valid_liabilities');
|
||||
if (in_array($accountType, $valid, true)) {
|
||||
Log::debug('Is a liability with credit ("i am owed") direction.');
|
||||
app('log')->debug('Is a liability with credit ("i am owed") direction.');
|
||||
if ($this->validOBData($data)) {
|
||||
Log::debug('Has valid CL data.');
|
||||
app('log')->debug('Has valid CL data.');
|
||||
$openingBalance = $data['opening_balance'];
|
||||
$openingBalanceDate = $data['opening_balance_date'];
|
||||
// store credit transaction.
|
||||
$this->updateCreditTransaction($account, $direction, $openingBalance, $openingBalanceDate);
|
||||
}
|
||||
if (!$this->validOBData($data)) {
|
||||
Log::debug('Does NOT have valid CL data, deletr any CL transaction.');
|
||||
app('log')->debug('Does NOT have valid CL data, deletr any CL transaction.');
|
||||
$this->deleteCreditTransaction($account);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class BillFactory
|
||||
*/
|
||||
public function create(array $data): ?Bill
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__), $data);
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__), $data);
|
||||
$factory = app(TransactionCurrencyFactory::class);
|
||||
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
|
||||
app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
|
||||
|
@ -48,7 +48,7 @@ class CategoryFactory
|
||||
$categoryId = (int)$categoryId;
|
||||
$categoryName = (string)$categoryName;
|
||||
|
||||
Log::debug(sprintf('Going to find category with ID %d and name "%s"', $categoryId, $categoryName));
|
||||
app('log')->debug(sprintf('Going to find category with ID %d and name "%s"', $categoryId, $categoryName));
|
||||
|
||||
if ('' === $categoryName && 0 === $categoryId) {
|
||||
return null;
|
||||
|
@ -41,9 +41,9 @@ class PiggyBankEventFactory
|
||||
*/
|
||||
public function create(TransactionJournal $journal, ?PiggyBank $piggyBank): void
|
||||
{
|
||||
Log::debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
|
||||
app('log')->debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
|
||||
if (null === $piggyBank) {
|
||||
Log::debug('Piggy bank is null');
|
||||
app('log')->debug('Piggy bank is null');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -58,10 +58,10 @@ class PiggyBankEventFactory
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug('Found repetition');
|
||||
app('log')->debug('Found repetition');
|
||||
$amount = $piggyRepos->getExactAmount($piggyBank, $repetition, $journal);
|
||||
if (0 === bccomp($amount, '0')) {
|
||||
Log::debug('Amount is zero, will not create event.');
|
||||
app('log')->debug('Amount is zero, will not create event.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ class TagFactory
|
||||
public function findOrCreate(string $tag): ?Tag
|
||||
{
|
||||
$tag = trim($tag);
|
||||
Log::debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));
|
||||
app('log')->debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));
|
||||
|
||||
/** @var Tag|null $dbTag */
|
||||
$dbTag = $this->user->tags()->where('tag', $tag)->first();
|
||||
if (null !== $dbTag) {
|
||||
Log::debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));
|
||||
app('log')->debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));
|
||||
|
||||
return $dbTag;
|
||||
}
|
||||
@ -67,7 +67,7 @@ class TagFactory
|
||||
|
||||
return null;
|
||||
}
|
||||
Log::debug(sprintf('Created new tag #%d ("%s")', $newTag->id, $newTag->tag));
|
||||
app('log')->debug(sprintf('Created new tag #%d ("%s")', $newTag->id, $newTag->tag));
|
||||
|
||||
return $newTag;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class TransactionCurrencyFactory
|
||||
$currencyId = (int)$currencyId;
|
||||
|
||||
if ('' === $currencyCode && 0 === $currencyId) {
|
||||
Log::debug('Cannot find anything on empty currency code and empty currency ID!');
|
||||
app('log')->debug('Cannot find anything on empty currency code and empty currency ID!');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ class TransactionFactory
|
||||
throw new FireflyException('Transaction is NULL.');
|
||||
}
|
||||
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Created transaction #%d (%s %s, account %s), part of journal #%d',
|
||||
$result->id,
|
||||
@ -147,15 +147,15 @@ class TransactionFactory
|
||||
private function updateAccountInformation(): void
|
||||
{
|
||||
if (!array_key_exists('iban', $this->accountInformation)) {
|
||||
Log::debug('No IBAN information in array, will not update.');
|
||||
app('log')->debug('No IBAN information in array, will not update.');
|
||||
return;
|
||||
}
|
||||
if ('' !== (string)$this->account->iban) {
|
||||
Log::debug('Account already has IBAN information, will not update.');
|
||||
app('log')->debug('Account already has IBAN information, will not update.');
|
||||
return;
|
||||
}
|
||||
if ($this->account->iban === $this->accountInformation['iban']) {
|
||||
Log::debug('Account already has this IBAN, will not update.');
|
||||
app('log')->debug('Account already has this IBAN, will not update.');
|
||||
return;
|
||||
}
|
||||
// validate info:
|
||||
@ -163,11 +163,11 @@ class TransactionFactory
|
||||
'iban' => ['required', new UniqueIban($this->account, $this->account->accountType->type)],
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
Log::debug('Invalid or non-unique IBAN, will not update.');
|
||||
app('log')->debug('Invalid or non-unique IBAN, will not update.');
|
||||
return;
|
||||
}
|
||||
|
||||
Log::debug('Will update account with IBAN information.');
|
||||
app('log')->debug('Will update account with IBAN information.');
|
||||
$service = app(AccountUpdateService::class);
|
||||
$service->update($this->account, ['iban' => $this->accountInformation['iban']]);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class TransactionGroupFactory
|
||||
*/
|
||||
public function create(array $data): TransactionGroup
|
||||
{
|
||||
Log::debug('Now in TransactionGroupFactory::create()');
|
||||
app('log')->debug('Now in TransactionGroupFactory::create()');
|
||||
$this->journalFactory->setUser($this->user);
|
||||
$this->journalFactory->setErrorOnHash($data['error_if_duplicate_hash'] ?? false);
|
||||
try {
|
||||
|
@ -102,11 +102,11 @@ class TransactionJournalFactory
|
||||
*/
|
||||
public function create(array $data): Collection
|
||||
{
|
||||
Log::debug('Now in TransactionJournalFactory::create()');
|
||||
app('log')->debug('Now in TransactionJournalFactory::create()');
|
||||
// convert to special object.
|
||||
$dataObject = new NullArrayObject($data);
|
||||
|
||||
Log::debug('Start of TransactionJournalFactory::create()');
|
||||
app('log')->debug('Start of TransactionJournalFactory::create()');
|
||||
$collection = new Collection();
|
||||
$transactions = $dataObject['transactions'] ?? [];
|
||||
if (0 === count($transactions)) {
|
||||
@ -117,7 +117,7 @@ class TransactionJournalFactory
|
||||
try {
|
||||
/** @var array $row */
|
||||
foreach ($transactions as $index => $row) {
|
||||
Log::debug(sprintf('Now creating journal %d/%d', $index + 1, count($transactions)));
|
||||
app('log')->debug(sprintf('Now creating journal %d/%d', $index + 1, count($transactions)));
|
||||
$journal = $this->createJournal(new NullArrayObject($row));
|
||||
if (null !== $journal) {
|
||||
$collection->push($journal);
|
||||
@ -201,13 +201,13 @@ class TransactionJournalFactory
|
||||
'bic' => $row['destination_bic'],
|
||||
'currency_id' => $currency->id,
|
||||
];
|
||||
Log::debug('Source info:', $sourceInfo);
|
||||
Log::debug('Destination info:', $destInfo);
|
||||
Log::debug('Now calling getAccount for the source.');
|
||||
app('log')->debug('Source info:', $sourceInfo);
|
||||
app('log')->debug('Destination info:', $destInfo);
|
||||
app('log')->debug('Now calling getAccount for the source.');
|
||||
$sourceAccount = $this->getAccount($type->type, 'source', $sourceInfo);
|
||||
Log::debug('Now calling getAccount for the destination.');
|
||||
app('log')->debug('Now calling getAccount for the destination.');
|
||||
$destinationAccount = $this->getAccount($type->type, 'destination', $destInfo);
|
||||
Log::debug('Done with getAccount(2x)');
|
||||
app('log')->debug('Done with getAccount(2x)');
|
||||
|
||||
// this is the moment for a reconciliation sanity check (again).
|
||||
if (TransactionType::RECONCILIATION === $type->type) {
|
||||
@ -219,7 +219,7 @@ class TransactionJournalFactory
|
||||
$foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount);
|
||||
$description = $this->getDescription($description);
|
||||
|
||||
Log::debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName()));
|
||||
app('log')->debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName()));
|
||||
|
||||
/** Create a basic journal. */
|
||||
$journal = TransactionJournal::create(
|
||||
@ -236,7 +236,7 @@ class TransactionJournalFactory
|
||||
'completed' => 0,
|
||||
]
|
||||
);
|
||||
Log::debug(sprintf('Created new journal #%d: "%s"', $journal->id, $journal->description));
|
||||
app('log')->debug(sprintf('Created new journal #%d: "%s"', $journal->id, $journal->description));
|
||||
|
||||
/** Create two transactions. */
|
||||
$transactionFactory = app(TransactionFactory::class);
|
||||
@ -318,7 +318,7 @@ class TransactionJournalFactory
|
||||
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
|
||||
$json = json_encode($dataRow, JSON_THROW_ON_ERROR);
|
||||
$hash = hash('sha256', $json);
|
||||
Log::debug(sprintf('The hash is: %s', $hash), $dataRow);
|
||||
app('log')->debug(sprintf('The hash is: %s', $hash), $dataRow);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
@ -333,11 +333,11 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function errorIfDuplicate(string $hash): void
|
||||
{
|
||||
Log::debug(sprintf('In errorIfDuplicate(%s)', $hash));
|
||||
app('log')->debug(sprintf('In errorIfDuplicate(%s)', $hash));
|
||||
if (false === $this->errorOnHash) {
|
||||
return;
|
||||
}
|
||||
Log::debug('Will verify duplicate!');
|
||||
app('log')->debug('Will verify duplicate!');
|
||||
/** @var TransactionJournalMeta|null $result */
|
||||
$result = TransactionJournalMeta::withTrashed()
|
||||
->where('data', json_encode($hash, JSON_THROW_ON_ERROR))
|
||||
@ -362,7 +362,7 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function validateAccounts(NullArrayObject $data): void
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$transactionType = $data['type'] ?? 'invalid';
|
||||
$this->accountValidator->setUser($this->user);
|
||||
$this->accountValidator->setTransactionType($transactionType);
|
||||
@ -380,7 +380,7 @@ class TransactionJournalFactory
|
||||
if (false === $validSource) {
|
||||
throw new FireflyException(sprintf('Source: %s', $this->accountValidator->sourceError));
|
||||
}
|
||||
Log::debug('Source seems valid.');
|
||||
app('log')->debug('Source seems valid.');
|
||||
|
||||
// validate destination account
|
||||
$array = [
|
||||
@ -422,25 +422,25 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function reconciliationSanityCheck(?Account $sourceAccount, ?Account $destinationAccount): array
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
if (null !== $sourceAccount && null !== $destinationAccount) {
|
||||
Log::debug('Both accounts exist, simply return them.');
|
||||
app('log')->debug('Both accounts exist, simply return them.');
|
||||
return [$sourceAccount, $destinationAccount];
|
||||
}
|
||||
if (null !== $sourceAccount && null === $destinationAccount) {
|
||||
Log::debug('Destination account is NULL, source account is not.');
|
||||
app('log')->debug('Destination account is NULL, source account is not.');
|
||||
$account = $this->accountRepository->getReconciliation($sourceAccount);
|
||||
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
|
||||
app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
|
||||
return [$sourceAccount, $account];
|
||||
}
|
||||
|
||||
if (null === $sourceAccount && null !== $destinationAccount) {
|
||||
Log::debug('Source account is NULL, destination account is not.');
|
||||
app('log')->debug('Source account is NULL, destination account is not.');
|
||||
$account = $this->accountRepository->getReconciliation($destinationAccount);
|
||||
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
|
||||
app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
|
||||
return [$account, $destinationAccount];
|
||||
}
|
||||
Log::debug('Unused fallback');
|
||||
app('log')->debug('Unused fallback');
|
||||
return [$sourceAccount, $destinationAccount];
|
||||
}
|
||||
|
||||
@ -456,7 +456,7 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency
|
||||
{
|
||||
Log::debug('Now in getCurrencyByAccount()');
|
||||
app('log')->debug('Now in getCurrencyByAccount()');
|
||||
|
||||
return match ($type) {
|
||||
default => $this->getCurrency($currency, $source),
|
||||
@ -474,7 +474,7 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency
|
||||
{
|
||||
Log::debug('Now in getCurrency()');
|
||||
app('log')->debug('Now in getCurrency()');
|
||||
/** @var Preference|null $preference */
|
||||
$preference = $this->accountRepository->getAccountCurrency($account);
|
||||
if (null === $preference && null === $currency) {
|
||||
@ -482,7 +482,7 @@ class TransactionJournalFactory
|
||||
return app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
|
||||
}
|
||||
$result = ($preference ?? $currency) ?? app('amount')->getSystemCurrency();
|
||||
Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
|
||||
app('log')->debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -545,11 +545,11 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function forceDeleteOnError(Collection $collection): void
|
||||
{
|
||||
Log::debug(sprintf('forceDeleteOnError on collection size %d item(s)', $collection->count()));
|
||||
app('log')->debug(sprintf('forceDeleteOnError on collection size %d item(s)', $collection->count()));
|
||||
$service = app(JournalDestroyService::class);
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($collection as $journal) {
|
||||
Log::debug(sprintf('forceDeleteOnError on journal #%d', $journal->id));
|
||||
app('log')->debug(sprintf('forceDeleteOnError on journal #%d', $journal->id));
|
||||
$service->destroy($journal);
|
||||
}
|
||||
}
|
||||
@ -570,17 +570,17 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function storePiggyEvent(TransactionJournal $journal, NullArrayObject $data): void
|
||||
{
|
||||
Log::debug('Will now store piggy event.');
|
||||
app('log')->debug('Will now store piggy event.');
|
||||
|
||||
$piggyBank = $this->piggyRepository->findPiggyBank((int)$data['piggy_bank_id'], $data['piggy_bank_name']);
|
||||
|
||||
if (null !== $piggyBank) {
|
||||
$this->piggyEventFactory->create($journal, $piggyBank);
|
||||
Log::debug('Create piggy event.');
|
||||
app('log')->debug('Create piggy event.');
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug('Create no piggy event');
|
||||
app('log')->debug('Create no piggy event');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -608,11 +608,11 @@ class TransactionJournalFactory
|
||||
];
|
||||
if ($data[$field] instanceof Carbon) {
|
||||
$data[$field]->setTimezone(config('app.timezone'));
|
||||
Log::debug(sprintf('%s Date: %s (%s)', $field, $data[$field], $data[$field]->timezone->getName()));
|
||||
app('log')->debug(sprintf('%s Date: %s (%s)', $field, $data[$field], $data[$field]->timezone->getName()));
|
||||
$set['data'] = $data[$field]->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Going to store meta-field "%s", with value "%s".', $set['name'], $set['data']));
|
||||
app('log')->debug(sprintf('Going to store meta-field "%s", with value "%s".', $set['name'], $set['data']));
|
||||
|
||||
/** @var TransactionJournalMetaFactory $factory */
|
||||
$factory = app(TransactionJournalMetaFactory::class);
|
||||
|
@ -39,26 +39,26 @@ class TransactionJournalMetaFactory
|
||||
*/
|
||||
public function updateOrCreate(array $data): ?TransactionJournalMeta
|
||||
{
|
||||
//Log::debug('In updateOrCreate()');
|
||||
//app('log')->debug('In updateOrCreate()');
|
||||
$value = $data['data'];
|
||||
/** @var TransactionJournalMeta|null $entry */
|
||||
$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
|
||||
if (null === $value && null !== $entry) {
|
||||
//Log::debug('Value is empty, delete meta value.');
|
||||
//app('log')->debug('Value is empty, delete meta value.');
|
||||
$entry->delete();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($data['data'] instanceof Carbon) {
|
||||
Log::debug('Is a carbon object.');
|
||||
app('log')->debug('Is a carbon object.');
|
||||
$value = $data['data']->toW3cString();
|
||||
}
|
||||
if ('' === (string)$value) {
|
||||
// Log::debug('Is an empty string.');
|
||||
// app('log')->debug('Is an empty string.');
|
||||
// don't store blank strings.
|
||||
if (null !== $entry) {
|
||||
Log::debug('Will not store empty strings, delete meta value');
|
||||
app('log')->debug('Will not store empty strings, delete meta value');
|
||||
$entry->delete();
|
||||
}
|
||||
|
||||
@ -66,13 +66,13 @@ class TransactionJournalMetaFactory
|
||||
}
|
||||
|
||||
if (null === $entry) {
|
||||
//Log::debug('Will create new object.');
|
||||
Log::debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
|
||||
//app('log')->debug('Will create new object.');
|
||||
app('log')->debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
|
||||
$entry = new TransactionJournalMeta();
|
||||
$entry->transactionJournal()->associate($data['journal']);
|
||||
$entry->name = $data['name'];
|
||||
}
|
||||
Log::debug('Will update value and return.');
|
||||
app('log')->debug('Will update value and return.');
|
||||
$entry->data = $value;
|
||||
$entry->save();
|
||||
|
||||
|
@ -155,7 +155,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
protected function getExpenses(): array
|
||||
{
|
||||
if (0 !== count($this->expenses)) {
|
||||
Log::debug('Return previous set of expenses.');
|
||||
app('log')->debug('Return previous set of expenses.');
|
||||
|
||||
return $this->expenses;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
protected function getExpenses(): array
|
||||
{
|
||||
if (0 !== count($this->expenses)) {
|
||||
Log::debug('Return previous set of expenses.');
|
||||
app('log')->debug('Return previous set of expenses.');
|
||||
|
||||
return $this->expenses;
|
||||
}
|
||||
|
@ -67,14 +67,14 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
*/
|
||||
public function generateMessages(): void
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
app('log')->debug(__METHOD__);
|
||||
// get the webhooks:
|
||||
if (0 === $this->webhooks->count()) {
|
||||
$this->webhooks = $this->getWebhooks();
|
||||
}
|
||||
|
||||
// do some debugging
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf('StandardMessageGenerator will generate messages for %d object(s) and %d webhook(s).', $this->objects->count(), $this->webhooks->count())
|
||||
);
|
||||
$this->run();
|
||||
@ -93,12 +93,12 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
*/
|
||||
private function run(): void
|
||||
{
|
||||
Log::debug('Now in StandardMessageGenerator::run');
|
||||
app('log')->debug('Now in StandardMessageGenerator::run');
|
||||
/** @var Webhook $webhook */
|
||||
foreach ($this->webhooks as $webhook) {
|
||||
$this->runWebhook($webhook);
|
||||
}
|
||||
Log::debug('Done with StandardMessageGenerator::run');
|
||||
app('log')->debug('Done with StandardMessageGenerator::run');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +109,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
*/
|
||||
private function runWebhook(Webhook $webhook): void
|
||||
{
|
||||
Log::debug(sprintf('Now in runWebhook(#%d)', $webhook->id));
|
||||
app('log')->debug(sprintf('Now in runWebhook(#%d)', $webhook->id));
|
||||
/** @var Model $object */
|
||||
foreach ($this->objects as $object) {
|
||||
$this->generateMessage($webhook, $object);
|
||||
@ -127,7 +127,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
{
|
||||
$class = get_class($model);
|
||||
// Line is ignored because all of Firefly III's Models have an id property.
|
||||
Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
|
||||
app('log')->debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
|
||||
|
||||
$uuid = Uuid::uuid4();
|
||||
$basicMessage = [
|
||||
@ -232,7 +232,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
$webhookMessage->uuid = $message['uuid'];
|
||||
$webhookMessage->message = $message;
|
||||
$webhookMessage->save();
|
||||
Log::debug(sprintf('Stored new webhook message #%d', $webhookMessage->id));
|
||||
app('log')->debug(sprintf('Stored new webhook message #%d', $webhookMessage->id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,7 @@ class APIEventHandler
|
||||
*/
|
||||
public function accessTokenCreated(AccessTokenCreated $event): void
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
app('log')->debug(__METHOD__);
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$user = $repository->find((int)$event->userId);
|
||||
|
@ -47,23 +47,23 @@ class AutomationHandler
|
||||
*/
|
||||
public function reportJournals(RequestedReportOnJournals $event): void
|
||||
{
|
||||
Log::debug('In reportJournals.');
|
||||
app('log')->debug('In reportJournals.');
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$user = $repository->find($event->userId);
|
||||
$sendReport = app('preferences')->getForUser($user, 'notification_transaction_creation', false)->data;
|
||||
|
||||
if (false === $sendReport) {
|
||||
Log::debug('Not sending report, because config says so.');
|
||||
app('log')->debug('Not sending report, because config says so.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (null === $user || 0 === $event->groups->count()) {
|
||||
Log::debug('No transaction groups in event, nothing to email about.');
|
||||
app('log')->debug('No transaction groups in event, nothing to email about.');
|
||||
return;
|
||||
}
|
||||
Log::debug('Continue with message!');
|
||||
app('log')->debug('Continue with message!');
|
||||
|
||||
// transform groups into array:
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
@ -88,6 +88,6 @@ class AutomationHandler
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
}
|
||||
Log::debug('If there is no error above this line, message was sent.');
|
||||
app('log')->debug('If there is no error above this line, message was sent.');
|
||||
}
|
||||
}
|
||||
|
@ -43,14 +43,14 @@ class BillEventHandler
|
||||
*/
|
||||
public function warnAboutBill(WarnUserAboutBill $event): void
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
|
||||
$bill = $event->bill;
|
||||
/** @var bool $preference */
|
||||
$preference = app('preferences')->getForUser($bill->user, 'notification_bill_reminder', true)->data;
|
||||
|
||||
if (true === $preference) {
|
||||
Log::debug('Bill reminder is true!');
|
||||
app('log')->debug('Bill reminder is true!');
|
||||
try {
|
||||
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
|
||||
} catch (Exception $e) {
|
||||
@ -68,7 +68,7 @@ class BillEventHandler
|
||||
}
|
||||
}
|
||||
if (false === $preference) {
|
||||
Log::debug('User has disabled bill reminders.');
|
||||
app('log')->debug('User has disabled bill reminders.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class DestroyedGroupEventHandler
|
||||
*/
|
||||
public function triggerWebhooks(DestroyedTransactionGroup $destroyedGroupEvent): void
|
||||
{
|
||||
Log::debug('DestroyedTransactionGroup:triggerWebhooks');
|
||||
app('log')->debug('DestroyedTransactionGroup:triggerWebhooks');
|
||||
$group = $destroyedGroupEvent->transactionGroup;
|
||||
$user = $group->user;
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
|
@ -51,7 +51,7 @@ class BudgetLimitHandler
|
||||
*/
|
||||
public function created(Created $event): void
|
||||
{
|
||||
Log::debug(sprintf('BudgetLimitHandler::created(#%s)', $event->budgetLimit->id));
|
||||
app('log')->debug(sprintf('BudgetLimitHandler::created(#%s)', $event->budgetLimit->id));
|
||||
$this->updateAvailableBudget($event->budgetLimit);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class BudgetLimitHandler
|
||||
*/
|
||||
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
Log::debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
|
||||
app('log')->debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
|
||||
$budget = Budget::find($budgetLimit->budget_id);
|
||||
if (null === $budget) {
|
||||
app('log')->warning('Budget is null, probably deleted, find deleted version.');
|
||||
@ -113,7 +113,7 @@ class BudgetLimitHandler
|
||||
)->where('transaction_currency_id', $budgetLimit->transaction_currency_id)->first();
|
||||
|
||||
if (null !== $availableBudget) {
|
||||
Log::debug('Found 1 AB, will update.');
|
||||
app('log')->debug('Found 1 AB, will update.');
|
||||
$this->calculateAmount($availableBudget);
|
||||
}
|
||||
if (null === $availableBudget) {
|
||||
@ -127,10 +127,10 @@ class BudgetLimitHandler
|
||||
$amount = 0 === (int)$budgetLimit->id ? '0' : $budgetLimit->amount;
|
||||
}
|
||||
if (0 === bccomp($amount, '0')) {
|
||||
Log::debug('Amount is zero, will not create AB.');
|
||||
app('log')->debug('Amount is zero, will not create AB.');
|
||||
}
|
||||
if (0 !== bccomp($amount, '0')) {
|
||||
Log::debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
|
||||
$availableBudget = new AvailableBudget(
|
||||
[
|
||||
'user_id' => $budgetLimit->budget->user->id,
|
||||
@ -161,7 +161,7 @@ class BudgetLimitHandler
|
||||
$repository->setUser($availableBudget->user);
|
||||
$newAmount = '0';
|
||||
$abPeriod = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Now at AB #%d, ("%s" to "%s")',
|
||||
$availableBudget->id,
|
||||
@ -171,10 +171,10 @@ class BudgetLimitHandler
|
||||
);
|
||||
// have to recalculate everything just in case.
|
||||
$set = $repository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
|
||||
Log::debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
|
||||
app('log')->debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($set as $budgetLimit) {
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Found interesting budget limit #%d ("%s" to "%s")',
|
||||
$budgetLimit->id,
|
||||
@ -210,11 +210,11 @@ class BudgetLimitHandler
|
||||
}
|
||||
}
|
||||
if (0 === bccomp('0', $newAmount)) {
|
||||
Log::debug('New amount is zero, deleting AB.');
|
||||
app('log')->debug('New amount is zero, deleting AB.');
|
||||
$availableBudget->delete();
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
|
||||
app('log')->debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
|
||||
$availableBudget->amount = app('steam')->bcround($newAmount, $availableBudget->transactionCurrency->decimal_places);
|
||||
$availableBudget->save();
|
||||
}
|
||||
@ -237,7 +237,7 @@ class BudgetLimitHandler
|
||||
);
|
||||
$days = $limitPeriod->length();
|
||||
$amount = bcdiv((string)$budgetLimit->amount, (string)$days, 12);
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf('Total amount for budget limit #%d is %s. Nr. of days is %d. Amount per day is %s', $budgetLimit->id, $budgetLimit->amount, $days, $amount)
|
||||
);
|
||||
return $amount;
|
||||
@ -250,7 +250,7 @@ class BudgetLimitHandler
|
||||
*/
|
||||
public function deleted(Deleted $event): void
|
||||
{
|
||||
Log::debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id));
|
||||
app('log')->debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id));
|
||||
$budgetLimit = $event->budgetLimit;
|
||||
$budgetLimit->id = null;
|
||||
$this->updateAvailableBudget($event->budgetLimit);
|
||||
@ -263,7 +263,7 @@ class BudgetLimitHandler
|
||||
*/
|
||||
public function updated(Updated $event): void
|
||||
{
|
||||
Log::debug(sprintf('BudgetLimitHandler::updated(#%s)', $event->budgetLimit->id));
|
||||
app('log')->debug(sprintf('BudgetLimitHandler::updated(#%s)', $event->budgetLimit->id));
|
||||
$this->updateAvailableBudget($event->budgetLimit);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ class StoredGroupEventHandler
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug('Now in StoredGroupEventHandler::processRules()');
|
||||
app('log')->debug('Now in StoredGroupEventHandler::processRules()');
|
||||
|
||||
$journals = $storedGroupEvent->transactionGroup->transactionJournals;
|
||||
$array = [];
|
||||
@ -60,7 +60,7 @@ class StoredGroupEventHandler
|
||||
$array[] = $journal->id;
|
||||
}
|
||||
$journalIds = implode(',', $array);
|
||||
Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds));
|
||||
app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
|
||||
|
||||
// collect rules:
|
||||
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
|
||||
@ -97,7 +97,7 @@ class StoredGroupEventHandler
|
||||
*/
|
||||
public function triggerWebhooks(StoredTransactionGroup $storedGroupEvent): void
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
app('log')->debug(__METHOD__);
|
||||
$group = $storedGroupEvent->transactionGroup;
|
||||
if (false === $storedGroupEvent->fireWebhooks) {
|
||||
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
|
||||
|
@ -62,7 +62,7 @@ class UpdatedGroupEventHandler
|
||||
$array[] = $journal->id;
|
||||
}
|
||||
$journalIds = implode(',', $array);
|
||||
Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds));
|
||||
app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
|
||||
|
||||
// collect rules:
|
||||
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
|
||||
@ -95,7 +95,7 @@ class UpdatedGroupEventHandler
|
||||
*/
|
||||
public function triggerWebhooks(UpdatedTransactionGroup $updatedGroupEvent): void
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
app('log')->debug(__METHOD__);
|
||||
$group = $updatedGroupEvent->transactionGroup;
|
||||
if (false === $updatedGroupEvent->fireWebhooks) {
|
||||
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
|
||||
|
@ -73,7 +73,7 @@ class UserEventHandler
|
||||
|
||||
// first user ever?
|
||||
if (1 === $repository->count()) {
|
||||
Log::debug('User count is one, attach role.');
|
||||
app('log')->debug('User count is one, attach role.');
|
||||
$repository->attachRole($event->user, 'owner');
|
||||
}
|
||||
}
|
||||
@ -386,11 +386,11 @@ class UserEventHandler
|
||||
*/
|
||||
public function storeUserIPAddress(ActuallyLoggedIn $event): void
|
||||
{
|
||||
Log::debug('Now in storeUserIPAddress');
|
||||
app('log')->debug('Now in storeUserIPAddress');
|
||||
$user = $event->user;
|
||||
|
||||
if ($user->hasRole('demo')) {
|
||||
Log::debug('Do not log demo user logins');
|
||||
app('log')->debug('Do not log demo user logins');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -405,19 +405,19 @@ class UserEventHandler
|
||||
}
|
||||
$inArray = false;
|
||||
$ip = request()->ip();
|
||||
Log::debug(sprintf('User logging in from IP address %s', $ip));
|
||||
app('log')->debug(sprintf('User logging in from IP address %s', $ip));
|
||||
|
||||
// update array if in array
|
||||
foreach ($preference as $index => $row) {
|
||||
if ($row['ip'] === $ip) {
|
||||
Log::debug('Found IP in array, refresh time.');
|
||||
app('log')->debug('Found IP in array, refresh time.');
|
||||
$preference[$index]['time'] = now(config('app.timezone'))->format('Y-m-d H:i:s');
|
||||
$inArray = true;
|
||||
}
|
||||
// clean up old entries (6 months)
|
||||
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $preference[$index]['time']);
|
||||
if ($carbon->diffInMonths(today()) > 6) {
|
||||
Log::debug(sprintf('Entry for %s is very old, remove it.', $row['ip']));
|
||||
app('log')->debug(sprintf('Entry for %s is very old, remove it.', $row['ip']));
|
||||
unset($preference[$index]);
|
||||
}
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ class VersionCheckEventHandler
|
||||
*/
|
||||
public function checkForUpdates(RequestedVersionCheckStatus $event): void
|
||||
{
|
||||
Log::debug('Now in checkForUpdates()');
|
||||
app('log')->debug('Now in checkForUpdates()');
|
||||
|
||||
// should not check for updates:
|
||||
$permission = app('fireflyconfig')->get('permission_update_check', -1);
|
||||
$value = (int)$permission->data;
|
||||
if (1 !== $value) {
|
||||
Log::debug('Update check is not enabled.');
|
||||
app('log')->debug('Update check is not enabled.');
|
||||
$this->warnToCheckForUpdates($event);
|
||||
|
||||
return;
|
||||
@ -67,7 +67,7 @@ class VersionCheckEventHandler
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$user = $event->user;
|
||||
if (!$repository->hasRole($user, 'owner')) {
|
||||
Log::debug('User is not admin, done.');
|
||||
app('log')->debug('User is not admin, done.');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -76,14 +76,14 @@ class VersionCheckEventHandler
|
||||
$lastCheckTime = app('fireflyconfig')->get('last_update_check', time());
|
||||
$now = time();
|
||||
$diff = $now - $lastCheckTime->data;
|
||||
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
app('log')->debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
if ($diff < 604800) {
|
||||
Log::debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
|
||||
app('log')->debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
|
||||
|
||||
return;
|
||||
}
|
||||
// last check time was more than a week ago.
|
||||
Log::debug('Have not checked for a new version in a week!');
|
||||
app('log')->debug('Have not checked for a new version in a week!');
|
||||
$release = $this->getLatestRelease();
|
||||
|
||||
session()->flash($release['level'], $release['message']);
|
||||
@ -103,7 +103,7 @@ class VersionCheckEventHandler
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$user = $event->user;
|
||||
if (!$repository->hasRole($user, 'owner')) {
|
||||
Log::debug('User is not admin, done.');
|
||||
app('log')->debug('User is not admin, done.');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -112,14 +112,14 @@ class VersionCheckEventHandler
|
||||
$lastCheckTime = app('fireflyconfig')->get('last_update_warning', time());
|
||||
$now = time();
|
||||
$diff = $now - $lastCheckTime->data;
|
||||
Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
app('log')->debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
|
||||
if ($diff < 604800 * 4) {
|
||||
Log::debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
|
||||
app('log')->debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
|
||||
|
||||
return;
|
||||
}
|
||||
// last check time was more than a week ago.
|
||||
Log::debug('Have warned about a new version in four weeks!');
|
||||
app('log')->debug('Have warned about a new version in four weeks!');
|
||||
|
||||
session()->flash('info', (string)trans('firefly.disabled_but_check'));
|
||||
app('fireflyconfig')->set('last_update_warning', time());
|
||||
|
@ -37,7 +37,7 @@ class WebhookEventHandler
|
||||
*/
|
||||
public function sendWebhookMessages(): void
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
// kick off the job!
|
||||
$messages = WebhookMessage::where('webhook_messages.sent', false)
|
||||
->get(['webhook_messages.*'])
|
||||
@ -46,14 +46,14 @@ class WebhookEventHandler
|
||||
return $message->webhookAttempts()->count() <= 2;
|
||||
}
|
||||
)->splice(0, 5);
|
||||
Log::debug(sprintf('Found %d webhook message(s) ready to be send.', $messages->count()));
|
||||
app('log')->debug(sprintf('Found %d webhook message(s) ready to be send.', $messages->count()));
|
||||
foreach ($messages as $message) {
|
||||
if (false === $message->sent) {
|
||||
Log::debug(sprintf('Send message #%d', $message->id));
|
||||
app('log')->debug(sprintf('Send message #%d', $message->id));
|
||||
SendWebhookMessage::dispatch($message)->afterResponse();
|
||||
}
|
||||
if (false !== $message->sent) {
|
||||
Log::debug(sprintf('Skip message #%d', $message->id));
|
||||
app('log')->debug(sprintf('Skip message #%d', $message->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,19 +193,19 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
|
||||
app('log')->debug(sprintf('Now in saveAttachmentsForModel for model %s', get_class($model)));
|
||||
if (is_array($files)) {
|
||||
Log::debug('$files is an array.');
|
||||
app('log')->debug('$files is an array.');
|
||||
/** @var UploadedFile $entry */
|
||||
foreach ($files as $entry) {
|
||||
if (null !== $entry) {
|
||||
$this->processFile($entry, $model);
|
||||
}
|
||||
}
|
||||
Log::debug('Done processing uploads.');
|
||||
app('log')->debug('Done processing uploads.');
|
||||
}
|
||||
if (!is_array($files)) {
|
||||
Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
|
||||
app('log')->debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -223,7 +223,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*/
|
||||
protected function processFile(UploadedFile $file, Model $model): ?Attachment
|
||||
{
|
||||
Log::debug('Now in processFile()');
|
||||
app('log')->debug('Now in processFile()');
|
||||
$validation = $this->validateUpload($file, $model);
|
||||
$attachment = null;
|
||||
if (false !== $validation) {
|
||||
@ -242,7 +242,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
$attachment->size = $file->getSize();
|
||||
$attachment->uploaded = false;
|
||||
$attachment->save();
|
||||
Log::debug('Created attachment:', $attachment->toArray());
|
||||
app('log')->debug('Created attachment:', $attachment->toArray());
|
||||
|
||||
$fileObject = $file->openFile();
|
||||
$fileObject->rewind();
|
||||
@ -252,7 +252,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
}
|
||||
|
||||
$content = $fileObject->fread($file->getSize());
|
||||
Log::debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
|
||||
app('log')->debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
|
||||
|
||||
// store it without encryption.
|
||||
$this->uploadDisk->put($attachment->fileName(), $content);
|
||||
@ -278,7 +278,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*/
|
||||
protected function validateUpload(UploadedFile $file, Model $model): bool
|
||||
{
|
||||
Log::debug('Now in validateUpload()');
|
||||
app('log')->debug('Now in validateUpload()');
|
||||
$result = true;
|
||||
if (!$this->validMime($file)) {
|
||||
$result = false;
|
||||
@ -310,11 +310,11 @@ class AttachmentHelper implements AttachmentHelperInterface
|
||||
*/
|
||||
protected function validMime(UploadedFile $file): bool
|
||||
{
|
||||
Log::debug('Now in validMime()');
|
||||
app('log')->debug('Now in validMime()');
|
||||
$mime = e($file->getMimeType());
|
||||
$name = e($file->getClientOriginalName());
|
||||
Log::debug(sprintf('Name is %s, and mime is %s', $name, $mime));
|
||||
Log::debug('Valid mimes are', $this->allowedMimes);
|
||||
app('log')->debug(sprintf('Name is %s, and mime is %s', $name, $mime));
|
||||
app('log')->debug('Valid mimes are', $this->allowedMimes);
|
||||
$result = true;
|
||||
|
||||
if (!in_array($mime, $this->allowedMimes, true)) {
|
||||
|
@ -73,7 +73,7 @@ trait AttachmentCollection
|
||||
*/
|
||||
public function hasAttachments(): GroupCollectorInterface
|
||||
{
|
||||
Log::debug('Add filter on attachment ID.');
|
||||
app('log')->debug('Add filter on attachment ID.');
|
||||
$this->joinAttachmentTables();
|
||||
$this->query->whereNotNull('attachments.attachable_id');
|
||||
$this->query->whereNull('attachments.deleted_at');
|
||||
@ -542,7 +542,7 @@ trait AttachmentCollection
|
||||
*/
|
||||
public function hasNoAttachments(): GroupCollectorInterface
|
||||
{
|
||||
Log::debug('Add filter on no attachments.');
|
||||
app('log')->debug('Add filter on no attachments.');
|
||||
$this->joinAttachmentTables();
|
||||
|
||||
$this->query->where(function (Builder $q1) {
|
||||
|
@ -328,8 +328,8 @@ class GroupCollector implements GroupCollectorInterface
|
||||
*/
|
||||
public function dumpQueryInLogs(): void
|
||||
{
|
||||
Log::debug($this->query->select($this->fields)->toSql());
|
||||
Log::debug('Bindings', $this->query->getBindings());
|
||||
app('log')->debug($this->query->select($this->fields)->toSql());
|
||||
app('log')->debug('Bindings', $this->query->getBindings());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -653,7 +653,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
try {
|
||||
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
$result['tags'][$tagId] = [
|
||||
@ -734,7 +734,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
try {
|
||||
$tagDate = Carbon::parse($newArray['tag_date']);
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
$existingJournal['tags'][$tagId] = [
|
||||
|
@ -52,7 +52,7 @@ class FiscalHelper implements FiscalHelperInterface
|
||||
*/
|
||||
public function endOfFiscalYear(Carbon $date): Carbon
|
||||
{
|
||||
// Log::debug(sprintf('Now in endOfFiscalYear(%s).', $date->format('Y-m-d')));
|
||||
// app('log')->debug(sprintf('Now in endOfFiscalYear(%s).', $date->format('Y-m-d')));
|
||||
$endDate = $this->startOfFiscalYear($date);
|
||||
if (true === $this->useCustomFiscalYear) {
|
||||
// add 1 year and sub 1 day
|
||||
@ -62,7 +62,7 @@ class FiscalHelper implements FiscalHelperInterface
|
||||
if (false === $this->useCustomFiscalYear) {
|
||||
$endDate->endOfYear();
|
||||
}
|
||||
// Log::debug(sprintf('Result of endOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $endDate->format('Y-m-d')));
|
||||
// app('log')->debug(sprintf('Result of endOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $endDate->format('Y-m-d')));
|
||||
|
||||
return $endDate;
|
||||
}
|
||||
@ -92,7 +92,7 @@ class FiscalHelper implements FiscalHelperInterface
|
||||
$startDate->startOfYear();
|
||||
}
|
||||
|
||||
// Log::debug(sprintf('Result of startOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $startDate->format('Y-m-d')));
|
||||
// app('log')->debug(sprintf('Result of startOfFiscalYear(%s) = %s', $date->format('Y-m-d'), $startDate->format('Y-m-d')));
|
||||
|
||||
return $startDate;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ trait UpdateTrait
|
||||
*/
|
||||
public function getLatestRelease(): array
|
||||
{
|
||||
Log::debug('Now in getLatestRelease()');
|
||||
app('log')->debug('Now in getLatestRelease()');
|
||||
/** @var UpdateRequestInterface $checker */
|
||||
$checker = app(UpdateRequestInterface::class);
|
||||
$channelConfig = app('fireflyconfig')->get('update_channel', 'stable');
|
||||
|
@ -138,7 +138,7 @@ class IndexController extends Controller
|
||||
*/
|
||||
public function index(Request $request, string $objectType)
|
||||
{
|
||||
Log::debug(sprintf('Now at %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
||||
$subTitle = (string)trans(sprintf('firefly.%s_accounts', $objectType));
|
||||
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
|
||||
$types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));
|
||||
@ -152,7 +152,7 @@ class IndexController extends Controller
|
||||
$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||
$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();
|
||||
|
||||
Log::debug(sprintf('Count of collection: %d, count of accounts: %d', $total, $accounts->count()));
|
||||
app('log')->debug(sprintf('Count of collection: %d, count of accounts: %d', $total, $accounts->count()));
|
||||
|
||||
unset($collection);
|
||||
/** @var Carbon $start */
|
||||
@ -189,13 +189,13 @@ class IndexController extends Controller
|
||||
}
|
||||
);
|
||||
// make paginator:
|
||||
Log::debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
|
||||
app('log')->debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
|
||||
/** @var LengthAwarePaginator $accounts */
|
||||
$accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
|
||||
$accounts->setPath(route('accounts.index', [$objectType]));
|
||||
|
||||
Log::debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
|
||||
Log::debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
|
||||
app('log')->debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
|
||||
app('log')->debug(sprintf('Count of accounts after LAP (2): %d', $accounts->getCollection()->count()));
|
||||
|
||||
return view('accounts.index', compact('objectType', 'inactiveCount', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
|
||||
}
|
||||
|
@ -169,14 +169,14 @@ class ReconcileController extends Controller
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
Log::debug('In ReconcileController::submit()');
|
||||
app('log')->debug('In ReconcileController::submit()');
|
||||
$data = $request->getAll();
|
||||
|
||||
/** @var string $journalId */
|
||||
foreach ($data['journals'] as $journalId) {
|
||||
$this->repository->reconcileById((int)$journalId);
|
||||
}
|
||||
Log::debug('Reconciled all transactions.');
|
||||
app('log')->debug('Reconciled all transactions.');
|
||||
|
||||
// switch dates if necessary
|
||||
if ($end->lt($start)) {
|
||||
@ -188,7 +188,7 @@ class ReconcileController extends Controller
|
||||
if ('create' === $data['reconcile']) {
|
||||
$result = $this->createReconciliation($account, $start, $end, $data['difference']);
|
||||
}
|
||||
Log::debug('End of routine.');
|
||||
app('log')->debug('End of routine.');
|
||||
app('preferences')->mark();
|
||||
if ('' === $result) {
|
||||
session()->flash('success', (string)trans('firefly.reconciliation_stored'));
|
||||
|
@ -120,7 +120,7 @@ class HomeController extends Controller
|
||||
Log::channel('audit')->info('User sends test message.');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
Log::debug('Now in testMessage() controller.');
|
||||
app('log')->debug('Now in testMessage() controller.');
|
||||
event(new AdminRequestedTestMessage($user));
|
||||
session()->flash('info', (string)trans('firefly.send_test_triggered'));
|
||||
|
||||
|
@ -94,13 +94,13 @@ class UserController extends Controller
|
||||
*/
|
||||
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
|
||||
{
|
||||
Log::debug('Will now delete invitation');
|
||||
app('log')->debug('Will now delete invitation');
|
||||
if ($invitedUser->redeemed) {
|
||||
Log::debug('Is already redeemed.');
|
||||
app('log')->debug('Is already redeemed.');
|
||||
session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email]));
|
||||
return response()->json(['success' => false]);
|
||||
}
|
||||
Log::debug('Delete!');
|
||||
app('log')->debug('Delete!');
|
||||
session()->flash('success', trans('firefly.invite_is_deleted', ['address' => $invitedUser->email]));
|
||||
$this->repository->deleteInvite($invitedUser);
|
||||
return response()->json(['success' => true]);
|
||||
@ -246,7 +246,7 @@ class UserController extends Controller
|
||||
*/
|
||||
public function update(UserFormRequest $request, User $user)
|
||||
{
|
||||
Log::debug('Actually here');
|
||||
app('log')->debug('Actually here');
|
||||
$data = $request->getUserData();
|
||||
|
||||
//var_dump($data);
|
||||
|
@ -90,7 +90,7 @@ class LoginController extends Controller
|
||||
app('log')->info('User is trying to login.');
|
||||
|
||||
$this->validateLogin($request);
|
||||
Log::debug('Login data is present.');
|
||||
app('log')->debug('Login data is present.');
|
||||
|
||||
/** Copied directly from AuthenticatesUsers, but with logging added: */
|
||||
// If the class is using the ThrottlesLogins trait, we can automatically throttle
|
||||
@ -106,7 +106,7 @@ class LoginController extends Controller
|
||||
/** Copied directly from AuthenticatesUsers, but with logging added: */
|
||||
if ($this->attemptLogin($request)) {
|
||||
Log::channel('audit')->info(sprintf('User "%s" has been logged in.', $request->get($this->username())));
|
||||
Log::debug(sprintf('Redirect after login is %s.', $this->redirectPath()));
|
||||
app('log')->debug(sprintf('Redirect after login is %s.', $this->redirectPath()));
|
||||
|
||||
// if you just logged in, it can't be that you have a valid 2FA cookie.
|
||||
|
||||
|
@ -190,8 +190,8 @@ class IndexController extends Controller
|
||||
{
|
||||
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
|
||||
|
||||
Log::debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
|
||||
Log::debug(sprintf('Average is %s', $avg));
|
||||
app('log')->debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
|
||||
app('log')->debug(sprintf('Average is %s', $avg));
|
||||
// calculate amount per year:
|
||||
$multiplies = [
|
||||
'yearly' => '1',
|
||||
@ -202,7 +202,7 @@ class IndexController extends Controller
|
||||
'daily' => '365.24',
|
||||
];
|
||||
$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
|
||||
Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
|
||||
app('log')->debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
|
||||
|
||||
// per period:
|
||||
$division = [
|
||||
@ -222,7 +222,7 @@ class IndexController extends Controller
|
||||
];
|
||||
$perPeriod = bcdiv($yearAmount, $division[$range]);
|
||||
|
||||
Log::debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
|
||||
app('log')->debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
|
||||
|
||||
return $perPeriod;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class BudgetLimitController extends Controller
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse | JsonResponse
|
||||
{
|
||||
Log::debug('Going to store new budget-limit.', $request->all());
|
||||
app('log')->debug('Going to store new budget-limit.', $request->all());
|
||||
// first search for existing one and update it if necessary.
|
||||
$currency = $this->currencyRepos->find((int)$request->get('transaction_currency_id'));
|
||||
$budget = $this->repository->find((int)$request->get('budget_id'));
|
||||
@ -147,7 +147,7 @@ class BudgetLimitController extends Controller
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
|
||||
$limit = $this->blRepository->find($budget, $currency, $start, $end);
|
||||
|
||||
|
@ -102,7 +102,7 @@ class IndexController extends Controller
|
||||
public function index(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
$this->abRepository->cleanup();
|
||||
Log::debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d')));
|
||||
|
||||
// collect some basic vars:
|
||||
$range = app('navigation')->getViewRange(true);
|
||||
@ -219,12 +219,12 @@ class IndexController extends Controller
|
||||
// get all budgets, and paginate them into $budgets.
|
||||
$collection = $this->repository->getActiveBudgets();
|
||||
$budgets = [];
|
||||
Log::debug(sprintf('7) Start is "%s", end is "%s"', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
|
||||
app('log')->debug(sprintf('7) Start is "%s", end is "%s"', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
|
||||
|
||||
// complement budget with budget limits in range, and expenses in currency X in range.
|
||||
/** @var Budget $current */
|
||||
foreach ($collection as $current) {
|
||||
Log::debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
|
||||
app('log')->debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
|
||||
$array = $current->toArray();
|
||||
$array['spent'] = [];
|
||||
$array['spent_total'] = [];
|
||||
@ -234,7 +234,7 @@ class IndexController extends Controller
|
||||
$budgetLimits = $this->blRepository->getBudgetLimits($current, $start, $end);
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($budgetLimits as $limit) {
|
||||
Log::debug(sprintf('Working on budget limit #%d', $limit->id));
|
||||
app('log')->debug(sprintf('Working on budget limit #%d', $limit->id));
|
||||
$currency = $limit->transactionCurrency ?? $defaultCurrency;
|
||||
$amount = app('steam')->bcround($limit->amount, $currency->decimal_places);
|
||||
$array['budgeted'][] = [
|
||||
@ -248,7 +248,7 @@ class IndexController extends Controller
|
||||
'currency_name' => $currency->name,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
];
|
||||
Log::debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount));
|
||||
app('log')->debug(sprintf('The amount budgeted for budget limit #%d is %s %s', $limit->id, $currency->code, $amount));
|
||||
}
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
@ -348,7 +348,7 @@ class IndexController extends Controller
|
||||
$budgetId = (int)$budgetId;
|
||||
$budget = $repository->find($budgetId);
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));
|
||||
app('log')->debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));
|
||||
$repository->setBudgetOrder($budget, $index + 1);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class NoCategoryController extends Controller
|
||||
*/
|
||||
public function show(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
Log::debug('Start of noCategory()');
|
||||
app('log')->debug('Start of noCategory()');
|
||||
/** @var Carbon $start */
|
||||
$start = $start ?? session('start');
|
||||
/** @var Carbon $end */
|
||||
@ -96,8 +96,8 @@ class NoCategoryController extends Controller
|
||||
);
|
||||
$periods = $this->getNoCategoryPeriodOverview($start);
|
||||
|
||||
Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
|
||||
Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@ -128,13 +128,13 @@ class NoCategoryController extends Controller
|
||||
$periods = new Collection();
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
Log::debug('Start of noCategory()');
|
||||
app('log')->debug('Start of noCategory()');
|
||||
$subTitle = (string)trans('firefly.all_journals_without_category');
|
||||
$first = $this->journalRepos->firstNull();
|
||||
$start = null === $first ? new Carbon() : $first->date;
|
||||
$end = today(config('app.timezone'));
|
||||
Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
|
||||
Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
|
@ -335,12 +335,12 @@ class AccountController extends Controller
|
||||
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
|
||||
Log::debug('Default set is ', $defaultSet);
|
||||
app('log')->debug('Default set is ', $defaultSet);
|
||||
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
||||
Log::debug('Frontpage preference set is ', $frontPage->data);
|
||||
app('log')->debug('Frontpage preference set is ', $frontPage->data);
|
||||
if (0 === count($frontPage->data)) {
|
||||
app('preferences')->set('frontPageAccounts', $defaultSet);
|
||||
Log::debug('frontpage set is empty!');
|
||||
app('log')->debug('frontpage set is empty!');
|
||||
}
|
||||
$accounts = $repository->getAccountsById($frontPage->data);
|
||||
|
||||
|
@ -98,7 +98,7 @@ class ReportController extends Controller
|
||||
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
|
||||
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
|
||||
if (false === $result) {
|
||||
Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
|
||||
app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -160,7 +160,7 @@ class ReportController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());
|
||||
}
|
||||
Log::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
|
||||
app('log')->debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
|
||||
$format = app('navigation')->preferredCarbonFormat($start, $end);
|
||||
$titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
$preferredRange = app('navigation')->preferredRangeFormat($start, $end);
|
||||
|
@ -69,7 +69,7 @@ class DebugController extends Controller
|
||||
*/
|
||||
public function displayError(): void
|
||||
{
|
||||
Log::debug('This is a test message at the DEBUG level.');
|
||||
app('log')->debug('This is a test message at the DEBUG level.');
|
||||
app('log')->info('This is a test message at the INFO level.');
|
||||
Log::notice('This is a test message at the NOTICE level.');
|
||||
app('log')->warning('This is a test message at the WARNING level.');
|
||||
@ -92,21 +92,21 @@ class DebugController extends Controller
|
||||
{
|
||||
app('preferences')->mark();
|
||||
$request->session()->forget(['start', 'end', '_previous', 'viewRange', 'range', 'is_custom_range', 'temp-mfa-secret', 'temp-mfa-codes']);
|
||||
Log::debug('Call cache:clear...');
|
||||
app('log')->debug('Call cache:clear...');
|
||||
|
||||
Artisan::call('cache:clear');
|
||||
Log::debug('Call config:clear...');
|
||||
app('log')->debug('Call config:clear...');
|
||||
Artisan::call('config:clear');
|
||||
Log::debug('Call route:clear...');
|
||||
app('log')->debug('Call route:clear...');
|
||||
Artisan::call('route:clear');
|
||||
Log::debug('Call twig:clean...');
|
||||
app('log')->debug('Call twig:clean...');
|
||||
try {
|
||||
Artisan::call('twig:clean');
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
Log::debug('Call view:clear...');
|
||||
app('log')->debug('Call view:clear...');
|
||||
Artisan::call('view:clear');
|
||||
|
||||
return redirect(route('index'));
|
||||
@ -202,7 +202,7 @@ class DebugController extends Controller
|
||||
$return['build'] = trim(file_get_contents('/var/www/counter-main.txt'));
|
||||
}
|
||||
} catch (Exception $e) { // generic catch for open basedir.
|
||||
Log::debug('Could not check build counter, but thats ok.');
|
||||
app('log')->debug('Could not check build counter, but thats ok.');
|
||||
app('log')->warning($e->getMessage());
|
||||
}
|
||||
try {
|
||||
@ -210,7 +210,7 @@ class DebugController extends Controller
|
||||
$return['build_date'] = trim(file_get_contents('/var/www/build-date-main.txt'));
|
||||
}
|
||||
} catch (Exception $e) { // generic catch for open basedir.
|
||||
Log::debug('Could not check build date, but thats ok.');
|
||||
app('log')->debug('Could not check build date, but thats ok.');
|
||||
app('log')->warning($e->getMessage());
|
||||
}
|
||||
if ('' !== (string)env('BASE_IMAGE_BUILD')) {
|
||||
@ -275,7 +275,7 @@ class DebugController extends Controller
|
||||
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
|
||||
foreach ($parts as $code) {
|
||||
$code = trim($code);
|
||||
Log::debug(sprintf('Trying to set %s', $code));
|
||||
app('log')->debug(sprintf('Trying to set %s', $code));
|
||||
$result = setlocale(LC_ALL, $code);
|
||||
$localeAttempts[$code] = $result === $code;
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ class HomeController extends Controller
|
||||
$label = $request->get('label');
|
||||
$isCustomRange = false;
|
||||
|
||||
Log::debug('Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
|
||||
app('log')->debug('Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
|
||||
// check if the label is "everything" or "Custom range" which will betray
|
||||
// a possible problem with the budgets.
|
||||
if ($label === (string)trans('firefly.everything') || $label === (string)trans('firefly.customRange')) {
|
||||
$isCustomRange = true;
|
||||
Log::debug('Range is now marked as "custom".');
|
||||
app('log')->debug('Range is now marked as "custom".');
|
||||
}
|
||||
|
||||
$diff = $start->diffInDays($end) + 1;
|
||||
@ -99,11 +99,11 @@ class HomeController extends Controller
|
||||
}
|
||||
|
||||
$request->session()->put('is_custom_range', $isCustomRange);
|
||||
Log::debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
|
||||
app('log')->debug(sprintf('Set is_custom_range to %s', var_export($isCustomRange, true)));
|
||||
$request->session()->put('start', $start);
|
||||
Log::debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
|
||||
app('log')->debug(sprintf('Set start to %s', $start->format('Y-m-d H:i:s')));
|
||||
$request->session()->put('end', $end);
|
||||
Log::debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
|
||||
app('log')->debug(sprintf('Set end to %s', $end->format('Y-m-d H:i:s')));
|
||||
|
||||
return response()->json(['ok' => 'ok']);
|
||||
}
|
||||
@ -138,7 +138,7 @@ class HomeController extends Controller
|
||||
// sort frontpage accounts by order
|
||||
$accounts = $accounts->sortBy('order');
|
||||
|
||||
Log::debug('Frontpage accounts are ', $frontPage->data);
|
||||
app('log')->debug('Frontpage accounts are ', $frontPage->data);
|
||||
|
||||
/** @var BillRepositoryInterface $billRepository */
|
||||
$billRepository = app(BillRepositoryInterface::class);
|
||||
|
@ -253,7 +253,7 @@ class BoxController extends Controller
|
||||
$allAccounts = $accountRepository->getActiveAccountsByType(
|
||||
[AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
|
||||
);
|
||||
Log::debug(sprintf('Found %d accounts.', $allAccounts->count()));
|
||||
app('log')->debug(sprintf('Found %d accounts.', $allAccounts->count()));
|
||||
|
||||
// filter list on preference of being included.
|
||||
$filtered = $allAccounts->filter(
|
||||
@ -261,7 +261,7 @@ class BoxController extends Controller
|
||||
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
|
||||
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
|
||||
if (false === $result) {
|
||||
Log::debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
|
||||
app('log')->debug(sprintf('Will not include "%s" in net worth charts.', $account->name));
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -46,12 +46,12 @@ class IntroController extends Controller
|
||||
*/
|
||||
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
|
||||
{
|
||||
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
|
||||
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
|
||||
$specificPage = $specificPage ?? '';
|
||||
$steps = $this->getBasicSteps($route);
|
||||
$specificSteps = $this->getSpecificSteps($route, $specificPage);
|
||||
if (0 === count($specificSteps)) {
|
||||
Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
|
||||
app('log')->debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
|
||||
|
||||
return response()->json($steps);
|
||||
}
|
||||
@ -81,7 +81,7 @@ class IntroController extends Controller
|
||||
public function hasOutroStep(string $route): bool
|
||||
{
|
||||
$routeKey = str_replace('.', '_', $route);
|
||||
Log::debug(sprintf('Has outro step for route %s', $routeKey));
|
||||
app('log')->debug(sprintf('Has outro step for route %s', $routeKey));
|
||||
$elements = config(sprintf('intro.%s', $routeKey));
|
||||
if (!is_array($elements)) {
|
||||
return false;
|
||||
@ -89,9 +89,9 @@ class IntroController extends Controller
|
||||
|
||||
$hasStep = array_key_exists('outro', $elements);
|
||||
|
||||
Log::debug('Elements is array', $elements);
|
||||
Log::debug('Keys is', array_keys($elements));
|
||||
Log::debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
|
||||
app('log')->debug('Elements is array', $elements);
|
||||
app('log')->debug('Keys is', array_keys($elements));
|
||||
app('log')->debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
|
||||
|
||||
return $hasStep;
|
||||
}
|
||||
@ -113,7 +113,7 @@ class IntroController extends Controller
|
||||
if ('' !== $specialPage) {
|
||||
$key .= '_' . $specialPage;
|
||||
}
|
||||
Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
||||
app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
||||
app('preferences')->set($key, false);
|
||||
app('preferences')->mark();
|
||||
|
||||
@ -136,7 +136,7 @@ class IntroController extends Controller
|
||||
if ('' !== $specialPage) {
|
||||
$key .= '_' . $specialPage;
|
||||
}
|
||||
Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
||||
app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
||||
app('preferences')->set($key, true);
|
||||
|
||||
return response()->json(['result' => sprintf('Reported demo watched for route "%s" (%s): %s.', $route, $specialPage, $key)]);
|
||||
|
@ -116,13 +116,13 @@ class ReconcileController extends Controller
|
||||
$clearedJournals = $collector->getExtractedJournals();
|
||||
}
|
||||
|
||||
Log::debug('Start transaction loop');
|
||||
app('log')->debug('Start transaction loop');
|
||||
/** @var array $journal */
|
||||
foreach ($journals as $journal) {
|
||||
$amount = $this->processJournal($account, $accountCurrency, $journal, $amount);
|
||||
}
|
||||
Log::debug(sprintf('Final amount is %s', $amount));
|
||||
Log::debug('End transaction loop');
|
||||
app('log')->debug(sprintf('Final amount is %s', $amount));
|
||||
app('log')->debug('End transaction loop');
|
||||
|
||||
/** @var array $journal */
|
||||
foreach ($clearedJournals as $journal) {
|
||||
@ -156,7 +156,7 @@ class ReconcileController extends Controller
|
||||
)
|
||||
)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('View error: %s', $e->getMessage()));
|
||||
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());
|
||||
throw new FireflyException($view, 0, $e);
|
||||
@ -181,7 +181,7 @@ class ReconcileController extends Controller
|
||||
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
|
||||
{
|
||||
$toAdd = '0';
|
||||
Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
|
||||
app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
|
||||
|
||||
// not much magic below we need to cover using tests.
|
||||
|
||||
@ -203,9 +203,9 @@ class ReconcileController extends Controller
|
||||
}
|
||||
|
||||
|
||||
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
|
||||
app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
|
||||
$amount = bcadd($amount, $toAdd);
|
||||
Log::debug(sprintf('Result is %s', $amount));
|
||||
app('log')->debug(sprintf('Result is %s', $amount));
|
||||
|
||||
return $amount;
|
||||
}
|
||||
@ -258,7 +258,7 @@ class ReconcileController extends Controller
|
||||
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||
)->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||
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());
|
||||
throw new FireflyException($html, 0, $e);
|
||||
|
@ -156,12 +156,12 @@ class RecurrenceController extends Controller
|
||||
$preSelected = (string)$request->get('pre_select');
|
||||
$locale = app('steam')->getLocale();
|
||||
|
||||
Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
|
||||
Log::debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
|
||||
app('log')->debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
|
||||
app('log')->debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));
|
||||
|
||||
$result = [];
|
||||
if ($date > $today || 'true' === (string)$request->get('past')) {
|
||||
Log::debug('Will fill dropdown.');
|
||||
app('log')->debug('Will fill dropdown.');
|
||||
$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);
|
||||
$monthly = sprintf('monthly,%s', $date->day);
|
||||
$dayOfWeek = (string)trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
|
||||
@ -188,7 +188,7 @@ class RecurrenceController extends Controller
|
||||
],
|
||||
];
|
||||
}
|
||||
Log::debug('Dropdown is', $result);
|
||||
app('log')->debug('Dropdown is', $result);
|
||||
|
||||
return response()->json($result);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ class IndexController extends Controller
|
||||
*/
|
||||
public function setOrder(Request $request, ObjectGroup $objectGroup)
|
||||
{
|
||||
Log::debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));
|
||||
app('log')->debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));
|
||||
$newOrder = (int)$request->get('order');
|
||||
$this->repository->setOrder($objectGroup, $newOrder);
|
||||
|
||||
|
@ -90,7 +90,7 @@ class ProfileController extends Controller
|
||||
);
|
||||
$authGuard = config('firefly.authentication_guard');
|
||||
$this->internalAuth = 'web' === $authGuard;
|
||||
Log::debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
|
||||
app('log')->debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
|
||||
|
||||
$this->middleware(IsDemoUser::class)->except(['index']);
|
||||
}
|
||||
|
@ -62,14 +62,14 @@ class TriggerController extends Controller
|
||||
$job->setDate($date);
|
||||
$job->setForce(false);
|
||||
$job->handle();
|
||||
Log::debug('Done with recurrence.');
|
||||
app('log')->debug('Done with recurrence.');
|
||||
|
||||
$groups = $job->getGroups();
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($group->transactionJournals as $journal) {
|
||||
Log::debug(sprintf('Set date of journal #%d to today!', $journal->id));
|
||||
app('log')->debug(sprintf('Set date of journal #%d to today!', $journal->id));
|
||||
$journal->date = today(config('app.timezone'));
|
||||
$journal->save();
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ class CategoryController extends Controller
|
||||
try {
|
||||
$result = view('reports.category.partials.top-expenses', compact('result'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
@ -780,7 +780,7 @@ class CategoryController extends Controller
|
||||
try {
|
||||
$result = view('reports.category.partials.top-income', compact('result'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ class TagController extends Controller
|
||||
try {
|
||||
$result = view('reports.tag.partials.avg-expenses', compact('result'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
@ -361,7 +361,7 @@ class TagController extends Controller
|
||||
try {
|
||||
$result = view('reports.tag.partials.avg-income', compact('result'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
@ -520,7 +520,7 @@ class TagController extends Controller
|
||||
try {
|
||||
$result = view('reports.tag.partials.top-expenses', compact('result'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
@ -571,7 +571,7 @@ class TagController extends Controller
|
||||
try {
|
||||
$result = view('reports.tag.partials.top-income', compact('result'))->render();
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||
throw new FireflyException($result, 0, $e);
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ class ReportController extends Controller
|
||||
$double = implode(',', $request->getDoubleList()->pluck('id')->toArray());
|
||||
|
||||
if (0 === $request->getAccountList()->count()) {
|
||||
Log::debug('Account count is zero');
|
||||
app('log')->debug('Account count is zero');
|
||||
session()->flash('error', (string)trans('firefly.select_at_least_one_account'));
|
||||
|
||||
return redirect(route('reports.index'));
|
||||
|
@ -173,7 +173,7 @@ class EditController extends Controller
|
||||
)->render();
|
||||
} catch (Throwable $e) {
|
||||
$message = sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage());
|
||||
Log::debug($message);
|
||||
app('log')->debug($message);
|
||||
app('log')->error($e->getTraceAsString());
|
||||
throw new FireflyException($message, 0, $e);
|
||||
}
|
||||
|
@ -107,12 +107,12 @@ class InstallController extends Controller
|
||||
'errorMessage' => null,
|
||||
];
|
||||
|
||||
Log::debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
|
||||
app('log')->debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
|
||||
$indexes = array_values(array_keys($this->upgradeCommands));
|
||||
if (array_key_exists($requestIndex, $indexes)) {
|
||||
$command = $indexes[$requestIndex];
|
||||
$parameters = $this->upgradeCommands[$command];
|
||||
Log::debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
|
||||
app('log')->debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
|
||||
try {
|
||||
$result = $this->executeCommand($command, $parameters);
|
||||
} catch (FireflyException $e) {
|
||||
@ -144,14 +144,14 @@ class InstallController extends Controller
|
||||
*/
|
||||
private function executeCommand(string $command, array $args): bool
|
||||
{
|
||||
Log::debug(sprintf('Will now call command %s with args.', $command), $args);
|
||||
app('log')->debug(sprintf('Will now call command %s with args.', $command), $args);
|
||||
try {
|
||||
if ('generate-keys' === $command) {
|
||||
$this->keys();
|
||||
}
|
||||
if ('generate-keys' !== $command) {
|
||||
Artisan::call($command, $args);
|
||||
Log::debug(Artisan::output());
|
||||
app('log')->debug(Artisan::output());
|
||||
}
|
||||
} catch (Exception $e) { // intentional generic exception
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
|
@ -317,10 +317,10 @@ class TagController extends Controller
|
||||
public function store(TagFormRequest $request): RedirectResponse
|
||||
{
|
||||
$data = $request->collectTagData();
|
||||
Log::debug('Data from request', $data);
|
||||
app('log')->debug('Data from request', $data);
|
||||
|
||||
$result = $this->repository->store($data);
|
||||
Log::debug('Data after storage', $result->toArray());
|
||||
app('log')->debug('Data after storage', $result->toArray());
|
||||
|
||||
session()->flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));
|
||||
app('preferences')->mark();
|
||||
|
@ -146,7 +146,7 @@ class BulkController extends Controller
|
||||
if (true === $ignoreUpdate) {
|
||||
return false;
|
||||
}
|
||||
Log::debug(sprintf('Set budget to %d', $budgetId));
|
||||
app('log')->debug(sprintf('Set budget to %d', $budgetId));
|
||||
$this->repository->updateBudget($journal, $budgetId);
|
||||
|
||||
return true;
|
||||
@ -162,7 +162,7 @@ class BulkController extends Controller
|
||||
private function updateJournalTags(TransactionJournal $journal, string $action, array $tags): bool
|
||||
{
|
||||
if ('do_replace' === $action) {
|
||||
Log::debug(sprintf('Set tags to %s', implode(',', $tags)));
|
||||
app('log')->debug(sprintf('Set tags to %s', implode(',', $tags)));
|
||||
$this->repository->updateTags($journal, $tags);
|
||||
}
|
||||
if ('do_append' === $action) {
|
||||
@ -186,7 +186,7 @@ class BulkController extends Controller
|
||||
if (true === $ignoreUpdate) {
|
||||
return false;
|
||||
}
|
||||
Log::debug(sprintf('Set budget to %s', $category));
|
||||
app('log')->debug(sprintf('Set budget to %s', $category));
|
||||
$this->repository->updateCategory($journal, $category);
|
||||
|
||||
return true;
|
||||
|
@ -119,7 +119,7 @@ class ConvertController extends Controller
|
||||
];
|
||||
|
||||
if ($sourceType->type === $destinationType->type) { // cannot convert to its own type.
|
||||
Log::debug('This is already a transaction of the expected type..');
|
||||
app('log')->debug('This is already a transaction of the expected type..');
|
||||
session()->flash('info', (string)trans('firefly.convert_is_already_type_' . $destinationType->type));
|
||||
|
||||
return redirect(route('transactions.show', [$group->id]));
|
||||
|
@ -79,7 +79,7 @@ class DeleteController extends Controller
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Start of delete view for group #%d', $group->id));
|
||||
app('log')->debug(sprintf('Start of delete view for group #%d', $group->id));
|
||||
|
||||
$journal = $group->transactionJournals->first();
|
||||
if (null === $journal) {
|
||||
@ -89,7 +89,7 @@ class DeleteController extends Controller
|
||||
$subTitle = (string)trans('firefly.delete_' . $objectType, ['description' => $group->title ?? $journal->description]);
|
||||
$previous = app('steam')->getSafePreviousUrl();
|
||||
// put previous url in session
|
||||
Log::debug('Will try to remember previous URL');
|
||||
app('log')->debug('Will try to remember previous URL');
|
||||
$this->rememberPreviousUrl('transactions.delete.url');
|
||||
|
||||
return view('transactions.delete', compact('group', 'journal', 'subTitle', 'objectType', 'previous'));
|
||||
@ -104,7 +104,7 @@ class DeleteController extends Controller
|
||||
*/
|
||||
public function destroy(TransactionGroup $group): RedirectResponse
|
||||
{
|
||||
Log::debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
|
||||
app('log')->debug(sprintf('Now in %s(#%d).', __METHOD__, $group->id));
|
||||
if (!$this->isEditableGroup($group)) {
|
||||
return $this->redirectGroupToAccount($group);
|
||||
}
|
||||
@ -134,7 +134,7 @@ class DeleteController extends Controller
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
Log::debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
|
||||
app('log')->debug(sprintf('Now going to trigger updated account event for account #%d', $account->id));
|
||||
event(new UpdatedAccount($account));
|
||||
}
|
||||
app('preferences')->mark();
|
||||
|
@ -123,7 +123,7 @@ class LinkController extends Controller
|
||||
{
|
||||
$linkInfo = $request->getLinkInfo();
|
||||
|
||||
Log::debug('We are here (store)');
|
||||
app('log')->debug('We are here (store)');
|
||||
$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
|
||||
if (null === $other) {
|
||||
session()->flash('error', (string)trans('firefly.invalid_link_selection'));
|
||||
@ -144,7 +144,7 @@ class LinkController extends Controller
|
||||
|
||||
return redirect(route('transactions.show', [$journal->transaction_group_id]));
|
||||
}
|
||||
Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
|
||||
app('log')->debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));
|
||||
$this->repository->storeLink($linkInfo, $other, $journal);
|
||||
session()->flash('success', (string)trans('firefly.journals_linked'));
|
||||
|
||||
|
@ -98,23 +98,23 @@ class MassController extends Controller
|
||||
*/
|
||||
public function destroy(MassDeleteJournalRequest $request)
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||
$ids = $request->get('confirm_mass_delete');
|
||||
$count = 0;
|
||||
if (is_array($ids)) {
|
||||
Log::debug('Array of IDs', $ids);
|
||||
app('log')->debug('Array of IDs', $ids);
|
||||
/** @var string $journalId */
|
||||
foreach ($ids as $journalId) {
|
||||
Log::debug(sprintf('Searching for ID #%d', $journalId));
|
||||
app('log')->debug(sprintf('Searching for ID #%d', $journalId));
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->repository->find((int)$journalId);
|
||||
if (null !== $journal && (int)$journalId === (int)$journal->id) {
|
||||
$this->repository->destroyJournal($journal);
|
||||
++$count;
|
||||
Log::debug(sprintf('Deleted transaction journal #%d', $journalId));
|
||||
app('log')->debug(sprintf('Deleted transaction journal #%d', $journalId));
|
||||
continue;
|
||||
}
|
||||
Log::debug(sprintf('Could not find transaction journal #%d', $journalId));
|
||||
app('log')->debug(sprintf('Could not find transaction journal #%d', $journalId));
|
||||
}
|
||||
}
|
||||
app('preferences')->mark();
|
||||
@ -224,7 +224,7 @@ class MassController extends Controller
|
||||
'amount' => $this->getStringFromRequest($request, $journal->id, 'amount'),
|
||||
'foreign_amount' => $this->getStringFromRequest($request, $journal->id, 'foreign_amount'),
|
||||
];
|
||||
Log::debug(sprintf('Will update journal #%d with data.', $journal->id), $data);
|
||||
app('log')->debug(sprintf('Will update journal #%d with data.', $journal->id), $data);
|
||||
|
||||
// call service to update.
|
||||
$service->setData($data);
|
||||
|
@ -131,7 +131,7 @@ class Authenticate
|
||||
app('log')->warning('User is null, throw exception?');
|
||||
}
|
||||
if (null !== $user) {
|
||||
// Log::debug(get_class($user));
|
||||
// app('log')->debug(get_class($user));
|
||||
if (1 === (int)$user->blocked) {
|
||||
$message = (string)trans('firefly.block_account_logout');
|
||||
if ('email_changed' === $user->blocked_code) {
|
||||
|
@ -52,7 +52,7 @@ class Installer
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
//Log::debug(sprintf('Installer middleware for URL %s', $request->url()));
|
||||
//app('log')->debug(sprintf('Installer middleware for URL %s', $request->url()));
|
||||
// ignore installer in test environment.
|
||||
if ('testing' === config('app.env')) {
|
||||
return $next($request);
|
||||
@ -61,7 +61,7 @@ class Installer
|
||||
$url = $request->url();
|
||||
$strpos = stripos($url, '/install');
|
||||
if (false !== $strpos) {
|
||||
//Log::debug(sprintf('URL is %s, will NOT run installer middleware', $url));
|
||||
//app('log')->debug(sprintf('URL is %s, will NOT run installer middleware', $url));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
@ -86,7 +86,7 @@ class Installer
|
||||
*/
|
||||
private function hasNoTables(): bool
|
||||
{
|
||||
//Log::debug('Now in routine hasNoTables()');
|
||||
//app('log')->debug('Now in routine hasNoTables()');
|
||||
|
||||
try {
|
||||
DB::table('users')->count();
|
||||
@ -109,7 +109,7 @@ class Installer
|
||||
throw new FireflyException(sprintf('Could not access the database: %s', $message), 0, $e);
|
||||
}
|
||||
|
||||
//Log::debug('Everything seems OK with the tables.');
|
||||
//app('log')->debug('Everything seems OK with the tables.');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class ReconciliationStoreRequest extends FormRequest
|
||||
'journals' => $transactions,
|
||||
'reconcile' => $this->convertString('reconcile'),
|
||||
];
|
||||
Log::debug('In ReconciliationStoreRequest::getAll(). Will now return data.');
|
||||
app('log')->debug('In ReconciliationStoreRequest::getAll(). Will now return data.');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
*/
|
||||
public function validateAccountInformation(Validator $validator): void
|
||||
{
|
||||
Log::debug('Now in validateAccountInformation (RecurrenceFormRequest)()');
|
||||
app('log')->debug('Now in validateAccountInformation (RecurrenceFormRequest)()');
|
||||
/** @var AccountValidator $accountValidator */
|
||||
$accountValidator = app(AccountValidator::class);
|
||||
$data = $validator->getData();
|
||||
|
@ -218,14 +218,14 @@ class ReportFormRequest extends FormRequest
|
||||
$set = $this->get('tag');
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
Log::debug('Set is:', $set);
|
||||
app('log')->debug('Set is:', $set);
|
||||
}
|
||||
if (!is_array($set)) {
|
||||
app('log')->error(sprintf('Set is not an array! "%s"', $set));
|
||||
return $collection;
|
||||
}
|
||||
foreach ($set as $tagTag) {
|
||||
Log::debug(sprintf('Now searching for "%s"', $tagTag));
|
||||
app('log')->debug(sprintf('Now searching for "%s"', $tagTag));
|
||||
$tag = $repository->findByTag($tagTag);
|
||||
if (null !== $tag) {
|
||||
$collection->push($tag);
|
||||
|
@ -62,7 +62,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$newDate = clone $date;
|
||||
$newDate->startOfDay();
|
||||
$this->date = $newDate;
|
||||
Log::debug(sprintf('Created new CreateAutoBudgetLimits("%s")', $this->date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Created new CreateAutoBudgetLimits("%s")', $this->date->format('Y-m-d')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,9 +73,9 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::debug(sprintf('Now at start of CreateAutoBudgetLimits() job for %s.', $this->date->format('D d M Y')));
|
||||
app('log')->debug(sprintf('Now at start of CreateAutoBudgetLimits() job for %s.', $this->date->format('D d M Y')));
|
||||
$autoBudgets = AutoBudget::get();
|
||||
Log::debug(sprintf('Found %d auto budgets.', $autoBudgets->count()));
|
||||
app('log')->debug(sprintf('Found %d auto budgets.', $autoBudgets->count()));
|
||||
foreach ($autoBudgets as $autoBudget) {
|
||||
$this->handleAutoBudget($autoBudget);
|
||||
}
|
||||
@ -110,7 +110,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$autoBudget->budget->name
|
||||
)
|
||||
);
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -136,7 +136,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
// that's easy: create one.
|
||||
// do nothing else.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -144,18 +144,18 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ROLLOVER === (int)$autoBudget->auto_budget_type) {
|
||||
// budget limit exists already,
|
||||
$this->createRollover($autoBudget);
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ADJUSTED === (int)$autoBudget->auto_budget_type) {
|
||||
// budget limit exists already,
|
||||
$this->createAdjustedLimit($autoBudget);
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,7 +207,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
private function findBudgetLimit(Budget $budget, Carbon $start, Carbon $end): ?BudgetLimit
|
||||
{
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Going to find a budget limit for budget #%d ("%s") between %s and %s',
|
||||
$budget->id,
|
||||
@ -230,9 +230,9 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
private function createBudgetLimit(AutoBudget $autoBudget, Carbon $start, Carbon $end, ?string $amount = null)
|
||||
{
|
||||
Log::debug(sprintf('No budget limit exist. Must create one for auto-budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('No budget limit exist. Must create one for auto-budget #%d', $autoBudget->id));
|
||||
if (null !== $amount) {
|
||||
Log::debug(sprintf('Amount is overruled and will be set to %s', $amount));
|
||||
app('log')->debug(sprintf('Amount is overruled and will be set to %s', $amount));
|
||||
}
|
||||
$budgetLimit = new BudgetLimit();
|
||||
$budgetLimit->budget()->associate($autoBudget->budget);
|
||||
@ -244,7 +244,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$budgetLimit->generated = true;
|
||||
$budgetLimit->save();
|
||||
|
||||
Log::debug(sprintf('Created budget limit #%d.', $budgetLimit->id));
|
||||
app('log')->debug(sprintf('Created budget limit #%d.', $budgetLimit->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,7 +254,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
private function createRollover(AutoBudget $autoBudget): void
|
||||
{
|
||||
Log::debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
|
||||
// current period:
|
||||
$start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
|
||||
$end = app('navigation')->endOfPeriod($start, $autoBudget->period);
|
||||
@ -263,7 +263,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
|
||||
$previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);
|
||||
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Current period is %s-%s, so previous period is %s-%s',
|
||||
$start->format('Y-m-d'),
|
||||
@ -277,27 +277,27 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
|
||||
|
||||
if (null === $budgetLimit) {
|
||||
Log::debug('No budget limit exists in previous period, so create one.');
|
||||
app('log')->debug('No budget limit exists in previous period, so create one.');
|
||||
// if not, create it and we're done.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug('Budget limit exists for previous period.');
|
||||
app('log')->debug('Budget limit exists for previous period.');
|
||||
// if has one, calculate expenses and use that as a base.
|
||||
$repository = app(OperationsRepositoryInterface::class);
|
||||
$repository->setUser($autoBudget->budget->user);
|
||||
$spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
|
||||
$currencyId = (int)$autoBudget->transaction_currency_id;
|
||||
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
|
||||
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
|
||||
app('log')->debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
|
||||
|
||||
// if you spent more in previous budget period, than whatever you had previous budget period, the amount resets
|
||||
// previous budget limit + spent
|
||||
$budgetLeft = bcadd($budgetLimit->amount, $spentAmount);
|
||||
$totalAmount = $autoBudget->amount;
|
||||
Log::debug(sprintf('Total amount left for previous budget period is %s', $budgetLeft));
|
||||
app('log')->debug(sprintf('Total amount left for previous budget period is %s', $budgetLeft));
|
||||
|
||||
if (-1 !== bccomp('0', $budgetLeft)) {
|
||||
app('log')->info(sprintf('The amount left is negative, so it will be reset to %s.', $totalAmount));
|
||||
@ -309,7 +309,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
|
||||
// create budget limit:
|
||||
$this->createBudgetLimit($autoBudget, $start, $end, $totalAmount);
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,7 +319,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
private function createAdjustedLimit(AutoBudget $autoBudget): void
|
||||
{
|
||||
Log::debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
|
||||
// current period:
|
||||
$start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
|
||||
$end = app('navigation')->endOfPeriod($start, $autoBudget->period);
|
||||
@ -328,7 +328,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
|
||||
$previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);
|
||||
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Current period is %s-%s, so previous period is %s-%s',
|
||||
$start->format('Y-m-d'),
|
||||
@ -342,12 +342,12 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
|
||||
|
||||
if (null === $budgetLimit) {
|
||||
Log::debug('No budget limit exists in previous period, so create one.');
|
||||
app('log')->debug('No budget limit exists in previous period, so create one.');
|
||||
// if not, create standard amount, and we're done.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
return;
|
||||
}
|
||||
Log::debug('Budget limit exists for previous period.');
|
||||
app('log')->debug('Budget limit exists for previous period.');
|
||||
|
||||
// if has one, calculate expenses and use that as a base.
|
||||
$repository = app(OperationsRepositoryInterface::class);
|
||||
@ -355,14 +355,14 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
$spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
|
||||
$currencyId = (int)$autoBudget->transaction_currency_id;
|
||||
$spentAmount = $spent[$currencyId]['sum'] ?? '0';
|
||||
Log::debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
|
||||
app('log')->debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
|
||||
|
||||
// what you spent in previous period PLUS the amount for the current period,
|
||||
// if that is more than zero, that's the amount that will be set.
|
||||
|
||||
$budgetAvailable = bcadd(bcadd($budgetLimit->amount, $autoBudget->amount), $spentAmount);
|
||||
$totalAmount = $autoBudget->amount;
|
||||
Log::debug(sprintf('Total amount available for current budget period is %s', $budgetAvailable));
|
||||
app('log')->debug(sprintf('Total amount available for current budget period is %s', $budgetAvailable));
|
||||
|
||||
|
||||
if (-1 !== bccomp($budgetAvailable, $totalAmount)) {
|
||||
@ -380,7 +380,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
// create budget limit:
|
||||
$this->createBudgetLimit($autoBudget, $start, $end, '1');
|
||||
}
|
||||
Log::debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,7 +93,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
$this->recurrences = new Collection();
|
||||
$this->groups = new Collection();
|
||||
|
||||
Log::debug(sprintf('Created new CreateRecurringTransactions("%s")', $this->date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Created new CreateRecurringTransactions("%s")', $this->date->format('Y-m-d')));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,25 +109,25 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::debug(sprintf('Now at start of CreateRecurringTransactions() job for %s.', $this->date->format('D d M Y')));
|
||||
app('log')->debug(sprintf('Now at start of CreateRecurringTransactions() job for %s.', $this->date->format('D d M Y')));
|
||||
|
||||
// only use recurrences from database if there is no collection submitted.
|
||||
if (0 !== count($this->recurrences)) {
|
||||
Log::debug('Using predetermined set of recurrences.');
|
||||
app('log')->debug('Using predetermined set of recurrences.');
|
||||
}
|
||||
if (0 === count($this->recurrences)) {
|
||||
Log::debug('Grab all recurrences from the database.');
|
||||
app('log')->debug('Grab all recurrences from the database.');
|
||||
$this->recurrences = $this->repository->getAll();
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$count = $this->recurrences->count();
|
||||
$this->submitted = $count;
|
||||
Log::debug(sprintf('Count of collection is %d', $count));
|
||||
app('log')->debug(sprintf('Count of collection is %d', $count));
|
||||
|
||||
// filter recurrences:
|
||||
$filtered = $this->filterRecurrences($this->recurrences);
|
||||
Log::debug(sprintf('Left after filtering is %d', $filtered->count()));
|
||||
app('log')->debug(sprintf('Left after filtering is %d', $filtered->count()));
|
||||
/** @var Recurrence $recurrence */
|
||||
foreach ($filtered as $recurrence) {
|
||||
if (!array_key_exists($recurrence->user_id, $result)) {
|
||||
@ -140,20 +140,20 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
// clear cache for user
|
||||
app('preferences')->setForUser($recurrence->user, 'lastActivity', microtime());
|
||||
|
||||
Log::debug(sprintf('Now at recurrence #%d of user #%d', $recurrence->id, $recurrence->user_id));
|
||||
app('log')->debug(sprintf('Now at recurrence #%d of user #%d', $recurrence->id, $recurrence->user_id));
|
||||
$createdReps = $this->handleRepetitions($recurrence);
|
||||
Log::debug(sprintf('Done with recurrence #%d', $recurrence->id));
|
||||
app('log')->debug(sprintf('Done with recurrence #%d', $recurrence->id));
|
||||
$result[$recurrence->user_id] = $result[$recurrence->user_id]->merge($createdReps);
|
||||
$this->executed++;
|
||||
}
|
||||
|
||||
Log::debug('Now running report thing.');
|
||||
app('log')->debug('Now running report thing.');
|
||||
// will now send email to users.
|
||||
foreach ($result as $userId => $journals) {
|
||||
event(new RequestedReportOnJournals($userId, $journals));
|
||||
}
|
||||
|
||||
Log::debug('Done with handle()');
|
||||
app('log')->debug('Done with handle()');
|
||||
|
||||
// clear cache:
|
||||
app('preferences')->mark();
|
||||
@ -183,7 +183,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
*/
|
||||
private function validRecurrence(Recurrence $recurrence): bool
|
||||
{
|
||||
Log::debug(sprintf('Now filtering recurrence #%d, owned by user #%d', $recurrence->id, $recurrence->user_id));
|
||||
app('log')->debug(sprintf('Now filtering recurrence #%d, owned by user #%d', $recurrence->id, $recurrence->user_id));
|
||||
// is not active.
|
||||
if (!$this->active($recurrence)) {
|
||||
app('log')->info(sprintf('Recurrence #%d is not active. Skipped.', $recurrence->id));
|
||||
@ -233,7 +233,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
|
||||
return false;
|
||||
}
|
||||
Log::debug('Will be included.');
|
||||
app('log')->debug('Will be included.');
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -273,7 +273,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
private function hasNotStartedYet(Recurrence $recurrence): bool
|
||||
{
|
||||
$startDate = $this->getStartDate($recurrence);
|
||||
Log::debug(sprintf('Start date is %s', $startDate->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Start date is %s', $startDate->format('Y-m-d')));
|
||||
|
||||
return $startDate->gt($this->date);
|
||||
}
|
||||
@ -322,7 +322,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
$collection = new Collection();
|
||||
/** @var RecurrenceRepetition $repetition */
|
||||
foreach ($recurrence->recurrenceRepetitions as $repetition) {
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Now repeating %s with value "%s", skips every %d time(s)',
|
||||
$repetition->repetition_type,
|
||||
@ -386,7 +386,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
if ($date->ne($this->date)) {
|
||||
return null;
|
||||
}
|
||||
Log::debug(sprintf('%s IS today (%s)', $date->format('Y-m-d'), $this->date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('%s IS today (%s)', $date->format('Y-m-d'), $this->date->format('Y-m-d')));
|
||||
|
||||
// count created journals on THIS day.
|
||||
$journalCount = $this->repository->getJournalCount($recurrence, $date, $date);
|
||||
|
@ -74,7 +74,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
$newDate = clone $date;
|
||||
$newDate->startOfDay();
|
||||
$this->date = $newDate;
|
||||
Log::debug(sprintf('Created new DownloadExchangeRates("%s")', $this->date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Created new DownloadExchangeRates("%s")', $this->date->format('Y-m-d')));
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::debug('Now in handle()');
|
||||
app('log')->debug('Now in handle()');
|
||||
$currencies = $this->repository->getCompleteSet();
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
@ -100,7 +100,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
*/
|
||||
private function downloadRates(TransactionCurrency $currency): void
|
||||
{
|
||||
Log::debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
|
||||
app('log')->debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
|
||||
$base = sprintf('%s/%s/%s', (string)config('cer.url'), $this->date->year, $this->date->isoWeek);
|
||||
$client = new Client();
|
||||
$url = sprintf('%s/%s.json', $base, $currency->code);
|
||||
@ -137,10 +137,10 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
foreach ($rates as $code => $rate) {
|
||||
$to = $this->getCurrency($code);
|
||||
if (null === $to) {
|
||||
Log::debug(sprintf('Currency %s is not in use, do not save rate.', $code));
|
||||
app('log')->debug(sprintf('Currency %s is not in use, do not save rate.', $code));
|
||||
continue;
|
||||
}
|
||||
Log::debug(sprintf('Currency %s is in use.', $code));
|
||||
app('log')->debug(sprintf('Currency %s is in use.', $code));
|
||||
$this->saveRate($currency, $to, $date, $rate);
|
||||
}
|
||||
}
|
||||
@ -154,22 +154,22 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
{
|
||||
// if we have it already, don't bother searching for it again.
|
||||
if (array_key_exists($code, $this->active)) {
|
||||
Log::debug(sprintf('Already know what the result is of searching for %s', $code));
|
||||
app('log')->debug(sprintf('Already know what the result is of searching for %s', $code));
|
||||
return $this->active[$code];
|
||||
}
|
||||
// find it in the database.
|
||||
$currency = $this->repository->findByCode($code);
|
||||
if (null === $currency) {
|
||||
Log::debug(sprintf('Did not find currency %s.', $code));
|
||||
app('log')->debug(sprintf('Did not find currency %s.', $code));
|
||||
$this->active[$code] = null;
|
||||
return null;
|
||||
}
|
||||
if (false === $currency->enabled) {
|
||||
Log::debug(sprintf('Currency %s is not enabled.', $code));
|
||||
app('log')->debug(sprintf('Currency %s is not enabled.', $code));
|
||||
$this->active[$code] = null;
|
||||
return null;
|
||||
}
|
||||
Log::debug(sprintf('Currency %s is enabled.', $code));
|
||||
app('log')->debug(sprintf('Currency %s is enabled.', $code));
|
||||
$this->active[$code] = $currency;
|
||||
|
||||
return $currency;
|
||||
@ -189,7 +189,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
$this->repository->setUser($user);
|
||||
$existing = $this->repository->getExchangeRate($from, $to, $date);
|
||||
if (null === $existing) {
|
||||
Log::debug(sprintf('Saved rate from %s to %s for user #%d.', $from->code, $to->code, $user->id));
|
||||
app('log')->debug(sprintf('Saved rate from %s to %s for user #%d.', $from->code, $to->code, $user->id));
|
||||
$this->repository->setExchangeRate($from, $to, $date, $rate);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class SendWebhookMessage implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::debug(sprintf('Now handling webhook message #%d', $this->message->id));
|
||||
app('log')->debug(sprintf('Now handling webhook message #%d', $this->message->id));
|
||||
// send job!
|
||||
$sender = app(WebhookSenderInterface::class);
|
||||
$sender->setMessage($this->message);
|
||||
|
@ -67,7 +67,7 @@ class WarnAboutBills implements ShouldQueue
|
||||
|
||||
$this->force = false;
|
||||
|
||||
Log::debug(sprintf('Created new WarnAboutBills("%s")', $this->date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Created new WarnAboutBills("%s")', $this->date->format('Y-m-d')));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,11 +75,11 @@ class WarnAboutBills implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));
|
||||
app('log')->debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));
|
||||
$bills = Bill::all();
|
||||
/** @var Bill $bill */
|
||||
foreach ($bills as $bill) {
|
||||
Log::debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
|
||||
app('log')->debug(sprintf('Now checking bill #%d ("%s")', $bill->id, $bill->name));
|
||||
if ($this->hasDateFields($bill)) {
|
||||
if ($this->needsWarning($bill, 'end_date')) {
|
||||
$this->sendWarning($bill, 'end_date');
|
||||
@ -89,7 +89,7 @@ class WarnAboutBills implements ShouldQueue
|
||||
}
|
||||
}
|
||||
}
|
||||
Log::debug('Done with handle()');
|
||||
app('log')->debug('Done with handle()');
|
||||
|
||||
// clear cache:
|
||||
app('preferences')->mark();
|
||||
@ -103,11 +103,11 @@ class WarnAboutBills implements ShouldQueue
|
||||
private function hasDateFields(Bill $bill): bool
|
||||
{
|
||||
if (false === $bill->active) {
|
||||
Log::debug('Bill is not active.');
|
||||
app('log')->debug('Bill is not active.');
|
||||
return false;
|
||||
}
|
||||
if (null === $bill->end_date && null === $bill->extension_date) {
|
||||
Log::debug('Bill has no date fields.');
|
||||
app('log')->debug('Bill has no date fields.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -126,7 +126,7 @@ class WarnAboutBills implements ShouldQueue
|
||||
}
|
||||
$diff = $this->getDiff($bill, $field);
|
||||
$list = config('firefly.bill_reminder_periods');
|
||||
Log::debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->$field->format('Y-m-d'), $diff));
|
||||
app('log')->debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->$field->format('Y-m-d'), $diff));
|
||||
if (in_array($diff, $list, true)) {
|
||||
return true;
|
||||
}
|
||||
@ -155,7 +155,7 @@ class WarnAboutBills implements ShouldQueue
|
||||
private function sendWarning(Bill $bill, string $field): void
|
||||
{
|
||||
$diff = $this->getDiff($bill, $field);
|
||||
Log::debug('Will now send warning!');
|
||||
app('log')->debug('Will now send warning!');
|
||||
event(new WarnUserAboutBill($bill, $field, $diff));
|
||||
}
|
||||
|
||||
|
@ -96,22 +96,22 @@ class TransactionGroup extends Model
|
||||
*/
|
||||
public static function routeBinder(string $value): TransactionGroup
|
||||
{
|
||||
Log::debug(sprintf('Now in %s("%s")', __METHOD__, $value));
|
||||
app('log')->debug(sprintf('Now in %s("%s")', __METHOD__, $value));
|
||||
if (auth()->check()) {
|
||||
$groupId = (int)$value;
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
Log::debug(sprintf('User authenticated as %s', $user->email));
|
||||
app('log')->debug(sprintf('User authenticated as %s', $user->email));
|
||||
/** @var TransactionGroup $group */
|
||||
$group = $user->transactionGroups()
|
||||
->with(['transactionJournals', 'transactionJournals.transactions'])
|
||||
->where('transaction_groups.id', $groupId)->first(['transaction_groups.*']);
|
||||
if (null !== $group) {
|
||||
Log::debug(sprintf('Found group #%d.', $group->id));
|
||||
app('log')->debug(sprintf('Found group #%d.', $group->id));
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
Log::debug('Found no group.');
|
||||
app('log')->debug('Found no group.');
|
||||
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
@ -165,17 +165,17 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$query->whereIn('account_types.type', $types);
|
||||
}
|
||||
Log::debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
|
||||
app('log')->debug(sprintf('Searching for account named "%s" (of user #%d) of the following type(s)', $name, $this->user->id), ['types' => $types]);
|
||||
|
||||
$query->where('accounts.name', $name);
|
||||
/** @var Account $account */
|
||||
$account = $query->first(['accounts.*']);
|
||||
if (null === $account) {
|
||||
Log::debug(sprintf('There is no account with name "%s" of types', $name), $types);
|
||||
app('log')->debug(sprintf('There is no account with name "%s" of types', $name), $types);
|
||||
|
||||
return null;
|
||||
}
|
||||
Log::debug(sprintf('Found #%d (%s) with type id %d', $account->id, $account->name, $account->account_type_id));
|
||||
app('log')->debug(sprintf('Found #%d (%s) with type id %d', $account->id, $account->name, $account->account_type_id));
|
||||
|
||||
return $account;
|
||||
}
|
||||
@ -568,14 +568,14 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
];
|
||||
if (array_key_exists(ucfirst($type), $sets)) {
|
||||
$order = (int)$this->getAccountsByType($sets[ucfirst($type)])->max('order');
|
||||
Log::debug(sprintf('Return max order of "%s" set: %d', $type, $order));
|
||||
app('log')->debug(sprintf('Return max order of "%s" set: %d', $type, $order));
|
||||
|
||||
return $order;
|
||||
}
|
||||
$specials = [AccountType::CASH, AccountType::INITIAL_BALANCE, AccountType::IMPORT, AccountType::RECONCILIATION];
|
||||
|
||||
$order = (int)$this->getAccountsByType($specials)->max('order');
|
||||
Log::debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order));
|
||||
app('log')->debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order));
|
||||
|
||||
return $order;
|
||||
}
|
||||
@ -670,7 +670,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
continue;
|
||||
}
|
||||
if ($index !== (int)$account->order) {
|
||||
Log::debug(sprintf('Account #%d ("%s"): order should %d be but is %d.', $account->id, $account->name, $index, $account->order));
|
||||
app('log')->debug(sprintf('Account #%d ("%s"): order should %d be but is %d.', $account->id, $account->name, $index, $account->order));
|
||||
$account->order = $index;
|
||||
$account->save();
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
$yesterday->subDay();
|
||||
$startSet = app('steam')->balancesByAccounts($accounts, $yesterday);
|
||||
$endSet = app('steam')->balancesByAccounts($accounts, $end);
|
||||
Log::debug('Start of accountreport');
|
||||
app('log')->debug('Start of accountreport');
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
@ -99,9 +99,9 @@ class AccountTasker implements AccountTaskerInterface
|
||||
|
||||
// first journal exists, and is on start, then this is the actual opening balance:
|
||||
if (null !== $first && $first->date->isSameDay($start) && TransactionType::OPENING_BALANCE === $first->transactionType->type) {
|
||||
Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
|
||||
$entry['start_balance'] = $first->transactions()->where('account_id', $account->id)->first()->amount;
|
||||
Log::debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));
|
||||
app('log')->debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));
|
||||
}
|
||||
$return['sums'][$currency->id]['start'] = bcadd($return['sums'][$currency->id]['start'], $entry['start_balance']);
|
||||
$return['sums'][$currency->id]['end'] = bcadd($return['sums'][$currency->id]['end'], $entry['end_balance']);
|
||||
@ -190,7 +190,7 @@ class AccountTasker implements AccountTaskerInterface
|
||||
];
|
||||
$report['accounts'][$key]['sum'] = bcadd($report['accounts'][$key]['sum'], $journal['amount']);
|
||||
|
||||
Log::debug(sprintf('Sum for %s is now %s', $journal['destination_account_name'], $report['accounts'][$key]['sum']));
|
||||
app('log')->debug(sprintf('Sum for %s is now %s', $journal['destination_account_name'], $report['accounts'][$key]['sum']));
|
||||
|
||||
++$report['accounts'][$key]['count'];
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
try {
|
||||
$unencryptedContent = Crypt::decrypt($encryptedContent); // verified
|
||||
} catch (DecryptException $e) {
|
||||
Log::debug(sprintf('Could not decrypt attachment #%d but this is fine: %s', $attachment->id, $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not decrypt attachment #%d but this is fine: %s', $attachment->id, $e->getMessage()));
|
||||
$unencryptedContent = $encryptedContent;
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
if (null !== $billId) {
|
||||
$searchResult = $this->find((int)$billId);
|
||||
if (null !== $searchResult) {
|
||||
Log::debug(sprintf('Found bill based on #%d, will return it.', $billId));
|
||||
app('log')->debug(sprintf('Found bill based on #%d, will return it.', $billId));
|
||||
|
||||
return $searchResult;
|
||||
}
|
||||
@ -148,12 +148,12 @@ class BillRepository implements BillRepositoryInterface
|
||||
if (null !== $billName) {
|
||||
$searchResult = $this->findByName((string)$billName);
|
||||
if (null !== $searchResult) {
|
||||
Log::debug(sprintf('Found bill based on "%s", will return it.', $billName));
|
||||
app('log')->debug(sprintf('Found bill based on "%s", will return it.', $billName));
|
||||
|
||||
return $searchResult;
|
||||
}
|
||||
}
|
||||
Log::debug('Found nothing');
|
||||
app('log')->debug('Found nothing');
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -373,7 +373,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
*/
|
||||
public function getPaidDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
//Log::debug('Now in getPaidDatesInRange()');
|
||||
//app('log')->debug('Now in getPaidDatesInRange()');
|
||||
|
||||
return $bill->transactionJournals()
|
||||
->before($end)->after($start)->get(
|
||||
@ -498,7 +498,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$journal = $bill->user->transactionJournals()->find((int)$transaction['transaction_journal_id']);
|
||||
$journal->bill_id = $bill->id;
|
||||
$journal->save();
|
||||
Log::debug(sprintf('Linked journal #%d to bill #%d', $journal->id, $bill->id));
|
||||
app('log')->debug(sprintf('Linked journal #%d to bill #%d', $journal->id, $bill->id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,12 +522,12 @@ class BillRepository implements BillRepositoryInterface
|
||||
}
|
||||
// find the most recent date for this bill NOT in the future. Cache this date:
|
||||
$start = clone $bill->date;
|
||||
Log::debug('nextExpectedMatch: Start is ' . $start->format('Y-m-d'));
|
||||
app('log')->debug('nextExpectedMatch: Start is ' . $start->format('Y-m-d'));
|
||||
|
||||
while ($start < $date) {
|
||||
Log::debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d'), $date->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d'), $date->format('Y-m-d')));
|
||||
$start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
||||
Log::debug('Start is now ' . $start->format('Y-m-d'));
|
||||
app('log')->debug('Start is now ' . $start->format('Y-m-d'));
|
||||
}
|
||||
|
||||
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
||||
@ -537,12 +537,12 @@ class BillRepository implements BillRepositoryInterface
|
||||
|
||||
if ($journalCount > 0) {
|
||||
// this period had in fact a bill. The new start is the current end, and we create a new end.
|
||||
Log::debug(sprintf('Journal count is %d, so start becomes %s', $journalCount, $end->format('Y-m-d')));
|
||||
app('log')->debug(sprintf('Journal count is %d, so start becomes %s', $journalCount, $end->format('Y-m-d')));
|
||||
$start = clone $end;
|
||||
$end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
|
||||
}
|
||||
Log::debug('nextExpectedMatch: Final start is ' . $start->format('Y-m-d'));
|
||||
Log::debug('nextExpectedMatch: Matching end is ' . $end->format('Y-m-d'));
|
||||
app('log')->debug('nextExpectedMatch: Final start is ' . $start->format('Y-m-d'));
|
||||
app('log')->debug('nextExpectedMatch: Matching end is ' . $end->format('Y-m-d'));
|
||||
|
||||
$cache->store($start);
|
||||
|
||||
@ -708,21 +708,21 @@ class BillRepository implements BillRepositoryInterface
|
||||
{
|
||||
$set = new Collection();
|
||||
$currentStart = clone $start;
|
||||
//Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
|
||||
//Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
|
||||
//app('log')->debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
|
||||
//app('log')->debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
|
||||
|
||||
while ($currentStart <= $end) {
|
||||
//Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
|
||||
//app('log')->debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
|
||||
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
|
||||
//Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
|
||||
//app('log')->debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
|
||||
if ($nextExpectedMatch > $end) {// If nextExpectedMatch is after end, we continue
|
||||
break;
|
||||
}
|
||||
$set->push(clone $nextExpectedMatch);
|
||||
//Log::debug(sprintf('Now %d dates in set.', $set->count()));
|
||||
//app('log')->debug(sprintf('Now %d dates in set.', $set->count()));
|
||||
$nextExpectedMatch->addDay();
|
||||
|
||||
//Log::debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
|
||||
//app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
|
||||
|
||||
$currentStart = clone $nextExpectedMatch;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
if (null !== $limit) {
|
||||
throw new FireflyException('200027: Budget limit already exists.');
|
||||
}
|
||||
Log::debug('No existing budget limit, create a new one');
|
||||
app('log')->debug('No existing budget limit, create a new one');
|
||||
|
||||
// or create one and return it.
|
||||
$limit = new BudgetLimit();
|
||||
@ -325,7 +325,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
$limit->amount = $data['amount'];
|
||||
$limit->transaction_currency_id = $currency->id;
|
||||
$limit->save();
|
||||
Log::debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $data['amount']));
|
||||
app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $data['amount']));
|
||||
|
||||
return $limit;
|
||||
}
|
||||
@ -399,7 +399,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
|
||||
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
|
||||
->count(['budget_limits.*']);
|
||||
Log::debug(sprintf('Found %d budget limits.', $limits));
|
||||
app('log')->debug(sprintf('Found %d budget limits.', $limits));
|
||||
|
||||
// there might be a budget limit for these dates:
|
||||
/** @var BudgetLimit $limit */
|
||||
@ -410,7 +410,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
|
||||
// if more than 1 limit found, delete the others:
|
||||
if ($limits > 1 && null !== $limit) {
|
||||
Log::debug(sprintf('Found more than 1, delete all except #%d', $limit->id));
|
||||
app('log')->debug(sprintf('Found more than 1, delete all except #%d', $limit->id));
|
||||
$budget->budgetlimits()
|
||||
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
|
||||
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
|
||||
@ -421,20 +421,20 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
// Returns 0 if the two operands are equal,
|
||||
// 1 if the left_operand is larger than the right_operand, -1 otherwise.
|
||||
if (null !== $limit && bccomp($amount, '0') <= 0) {
|
||||
Log::debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
|
||||
app('log')->debug(sprintf('%s is zero, delete budget limit #%d', $amount, $limit->id));
|
||||
$limit->delete();
|
||||
|
||||
return null;
|
||||
}
|
||||
// update if exists:
|
||||
if (null !== $limit) {
|
||||
Log::debug(sprintf('Existing budget limit is #%d, update this to amount %s', $limit->id, $amount));
|
||||
app('log')->debug(sprintf('Existing budget limit is #%d, update this to amount %s', $limit->id, $amount));
|
||||
$limit->amount = $amount;
|
||||
$limit->save();
|
||||
|
||||
return $limit;
|
||||
}
|
||||
Log::debug('No existing budget limit, create a new one');
|
||||
app('log')->debug('No existing budget limit, create a new one');
|
||||
// or create one and return it.
|
||||
$limit = new BudgetLimit();
|
||||
$limit->budget()->associate($budget);
|
||||
@ -442,7 +442,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
$limit->end_date = $end->startOfDay();
|
||||
$limit->amount = $amount;
|
||||
$limit->save();
|
||||
Log::debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount));
|
||||
app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount));
|
||||
|
||||
return $limit;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user