Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/Api/V1/Controllers/Chart/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function overview(ChartRequest $request): JsonResponse
// move date to end of day
$queryParameters['start']->startOfDay();
$queryParameters['end']->endOfDay();
// Log::debug(sprintf('dashboard(), convert to primary: %s', var_export($this->convertToPrimary, true)));

// loop each account, and collect info:
/** @var Account $account */
Expand Down
1 change: 0 additions & 1 deletion app/Api/V1/Controllers/Chart/BalanceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class BalanceController extends Controller
private GroupCollectorInterface $collector;
private AccountRepositoryInterface $repository;

// private TransactionCurrency $default;

public function __construct()
{
Expand Down
1 change: 0 additions & 1 deletion app/Api/V1/Controllers/Chart/BudgetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ private function processExpenses(int $budgetId, array $spent, Carbon $start, Car
];
$currentBudgetArray = $block['budgets'][$budgetId];

// var_dump($return);
/** @var array $journal */
foreach ($currentBudgetArray['transaction_journals'] as $journal) {
$return[$currencyId]['spent'] = bcadd($return[$currencyId]['spent'], (string)$journal['amount']);
Expand Down
1 change: 0 additions & 1 deletion app/Api/V1/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ final protected function jsonApiObject(string $key, array|Model $object, Abstrac
$baseUrl = sprintf('%s/api/v1', request()->getSchemeAndHttpHost());
$manager->setSerializer(new JsonApiSerializer($baseUrl));

// $transformer->collectMetaData(new Collection([$object]));

$resource = new Item($object, $transformer, $key);

Expand Down
10 changes: 4 additions & 6 deletions app/Api/V1/Controllers/Summary/BasicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public function basic(DateRequest $request): JsonResponse
$billData = $this->getSubscriptionInformation($start, $end);
$spentData = $this->getLeftToSpendInfo($start, $end);
$netWorthData = $this->getNetWorthInfo($end);
// $balanceData = [];
// $billData = [];
// $spentData = [];
// $netWorthData = [];
Expand Down Expand Up @@ -278,7 +277,7 @@ private function getBalanceInformation(Carbon $start, Carbon $end): array
'sub_title' => '',
];
}
if (0 === count($return)) {
if (empty($return)) {
$currency = $this->primaryCurrency;
// create objects for big array.
$return[] = [
Expand Down Expand Up @@ -386,7 +385,6 @@ private function getSubscriptionInformation(Carbon $start, Carbon $end): array
$unpaidAmount = $newUnpaidAmount;
}

// var_dump($paidAmount);
// var_dump($unpaidAmount);
// exit;

Expand Down Expand Up @@ -431,7 +429,7 @@ private function getSubscriptionInformation(Carbon $start, Carbon $end): array
}
Log::debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));

if (0 === count($return)) {
if (empty($return)) {
$currency = $this->primaryCurrency;
unset($info, $amount);

Expand Down Expand Up @@ -530,7 +528,7 @@ private function getLeftToSpendInfo(Carbon $start, Carbon $end): array
];
}
unset($leftToSpend);
if (0 === count($return)) {
if (empty($return)) {
$days = (int) $start->diffInDays($end, true) + 1;
// a small trick to get every expense in this period, regardless of budget.
$spent = $this->opsRepository->sumExpenses($start, $end, null, new Collection());
Expand Down Expand Up @@ -633,7 +631,7 @@ function (Account $account) {
'sub_title' => '',
];
}
if (0 === count($return)) {
if (empty($return)) {
$return[] = [
'key' => sprintf('net-worth-in-%s', $this->primaryCurrency->code),
'title' => trans('firefly.box_net_worth_in_currency', ['currency' => $this->primaryCurrency->symbol]),
Expand Down
1 change: 0 additions & 1 deletion app/Api/V1/Requests/Chart/ChartRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static function (Validator $validator): void {
// validate transaction query data.
$data = $validator->getData();
if (!array_key_exists('accounts', $data)) {
// $validator->errors()->add('accounts', trans('validation.filled', ['attribute' => 'accounts']));
return;
}
if (!is_array($data['accounts'])) {
Expand Down
3 changes: 1 addition & 2 deletions app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private function getRepetitionData(): ?array
}
$return[] = $current;
}
if (0 === count($return)) {
if (empty($return)) {
return null;
}

Expand Down Expand Up @@ -195,7 +195,6 @@ public function withValidator(Validator $validator): void
{
$validator->after(
function (Validator $validator): void {
// $this->validateOneRecurrenceTransaction($validator);
// $this->validateOneRepetitionUpdate($validator);

/** @var Recurrence $recurrence */
Expand Down
3 changes: 0 additions & 3 deletions app/Console/Commands/Correction/CorrectsUnevenAmount.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ private function isForeignCurrencyTransfer(TransactionJournal $journal): bool
// dest amount = source foreign currency
// dest currency = source foreign currency

// Log::debug(sprintf('[a] %s', bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount))));
// Log::debug(sprintf('[b] %s', bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount))));
// Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true)));
// Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true)));
Expand Down Expand Up @@ -406,7 +405,6 @@ private function convertOldStyleTransactions(): void
$source->foreign_currency_id = $currency;
$source->saveQuietly();
$source->refresh();
// Log::debug(sprintf('source->amount = %s', $source->amount));
// Log::debug(sprintf('source->transaction_currency_id = %s', $source->transaction_currency_id));
// Log::debug(sprintf('source->foreign_amount = %s', $source->foreign_amount));
// Log::debug(sprintf('source->foreign_currency_id = %s', $source->foreign_currency_id));
Expand All @@ -426,7 +424,6 @@ private function convertOldStyleTransactions(): void
$destination->balance_dirty = true;
$destination->saveQuietly();
$destination->refresh();
// Log::debug(sprintf('destination->amount = %s', $destination->amount));
// Log::debug(sprintf('destination->transaction_currency_id = %s', $destination->transaction_currency_id));
// Log::debug(sprintf('destination->foreign_amount = %s', $destination->foreign_amount));
// Log::debug(sprintf('destination->foreign_currency_id = %s', $destination->foreign_currency_id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ private function deleteOrphanedJournals(): void
;
$count = $set->count();
if (0 === $count) {
// $this->friendlyPositive('No orphaned journals.');

return;
}
Expand Down
1 change: 0 additions & 1 deletion app/Entities/AccountBalance.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static function fromArray(): self
{
$balance = new self();
$balance->id = (string) random_int(1, 1000);
// $balance->name = (string) random_int(1, 1000);
$balance->amount = (string) random_int(1, 1000);
$balance->currencyId = '1';

Expand Down
4 changes: 2 additions & 2 deletions app/Factory/PiggyBankFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function linkToAccountIds(PiggyBank $piggyBank, array $accounts): void
}
}
Log::debug(sprintf('Link information: %s', json_encode($toBeLinked)));
if (0 !== count($toBeLinked)) {
if (!empty($toBeLinked)) {
Log::debug('Syncing accounts to piggy bank.');
$piggyBank->accounts()->sync($toBeLinked);
$piggyBank->refresh();
Expand All @@ -302,7 +302,7 @@ public function linkToAccountIds(PiggyBank $piggyBank, array $accounts): void
event(new ChangedAmount($piggyBank, bcsub($newSavedAmount, $oldSavedAmount), null, null));
}
}
if (0 === count($toBeLinked)) {
if (empty($toBeLinked)) {
Log::warning('No accounts to link to piggy bank, will not change whatever is there now.');
}
}
Expand Down
3 changes: 0 additions & 3 deletions app/Factory/TransactionJournalMetaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ class TransactionJournalMetaFactory
{
public function updateOrCreate(array $data): ?TransactionJournalMeta
{
// app('log')->debug('In updateOrCreate()');
$value = $data['data'];

/** @var null|TransactionJournalMeta $entry */
$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
if (null === $value && null !== $entry) {
// app('log')->debug('Value is empty, delete meta value.');
$entry->delete();

return null;
Expand All @@ -62,7 +60,6 @@ public function updateOrCreate(array $data): ?TransactionJournalMeta
}

if (null === $entry) {
// 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']);
Expand Down
2 changes: 1 addition & 1 deletion app/Generator/Report/Audit/MonthReportGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function getAuditReport(Account $account, Carbon $date): array
return [
'journals' => $journals,
'currency' => $currency,
'exists' => 0 !== count($journals),
'exists' => !empty($journals),
'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
'endBalance' => Steam::finalAccountBalance($account, $this->end)['balance'],
'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
Expand Down
2 changes: 1 addition & 1 deletion app/Handlers/Events/BillEventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function warnAboutOverdueSubscriptions(WarnUserAboutOverdueSubscriptions
return;
}
Log::debug(sprintf('Will warn about %d overdue subscription(s).', count($toBeWarned)));
if (0 === count($toBeWarned)) {
if (empty($toBeWarned)) {
Log::debug('No overdue subscriptions to warn about.');

return;
Expand Down
3 changes: 0 additions & 3 deletions app/Handlers/Observer/AccountObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class AccountObserver
{
public function created(Account $account): void
{
// Log::debug('Observe "created" of an account.');
$this->updatePrimaryCurrencyAmount($account);
}

Expand All @@ -67,7 +66,6 @@ private function updatePrimaryCurrencyAmount(Account $account): void
$account->native_virtual_balance = null;
}
$account->saveQuietly();
// Log::debug('Account primary currency virtual balance is updated.');
}

/**
Expand Down Expand Up @@ -107,7 +105,6 @@ public function deleting(Account $account): void

public function updated(Account $account): void
{
// Log::debug('Observe "updated" of an account.');
$this->updatePrimaryCurrencyAmount($account);
}
}
3 changes: 0 additions & 3 deletions app/Handlers/Observer/AvailableBudgetObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ class AvailableBudgetObserver
{
public function created(AvailableBudget $availableBudget): void
{
// Log::debug('Observe "created" of an available budget.');
$this->updatePrimaryCurrencyAmount($availableBudget);
}

private function updatePrimaryCurrencyAmount(AvailableBudget $availableBudget): void
{
if (!Amount::convertToPrimary($availableBudget->user)) {
// Log::debug('Do not update primary currency available amount of the available budget.');

return;
}
Expand All @@ -58,7 +56,6 @@ private function updatePrimaryCurrencyAmount(AvailableBudget $availableBudget):

public function updated(AvailableBudget $availableBudget): void
{
// Log::debug('Observe "updated" of an available budget.');
$this->updatePrimaryCurrencyAmount($availableBudget);
}
}
3 changes: 0 additions & 3 deletions app/Handlers/Observer/BillObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class BillObserver
{
public function created(Bill $bill): void
{
// Log::debug('Observe "created" of a bill.');
$this->updatePrimaryCurrencyAmount($bill);
}

Expand Down Expand Up @@ -65,7 +64,6 @@ public function deleting(Bill $bill): void
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($bill->user);

// app('log')->debug('Observe "deleting" of a bill.');
/** @var Attachment $attachment */
foreach ($bill->attachments()->get() as $attachment) {
$repository->destroy($attachment);
Expand All @@ -75,7 +73,6 @@ public function deleting(Bill $bill): void

public function updated(Bill $bill): void
{
// Log::debug('Observe "updated" of a bill.');
$this->updatePrimaryCurrencyAmount($bill);
}
}
1 change: 0 additions & 1 deletion app/Handlers/Observer/BudgetLimitObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public function created(BudgetLimit $budgetLimit): void
private function updatePrimaryCurrencyAmount(BudgetLimit $budgetLimit): void
{
if (!Amount::convertToPrimary($budgetLimit->budget->user)) {
// Log::debug('Do not update primary currency amount of the budget limit.');

return;
}
Expand Down
1 change: 0 additions & 1 deletion app/Handlers/Observer/TransactionObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public function deleting(?Transaction $transaction): void

public function updated(Transaction $transaction): void
{
// Log::debug('Observe "updated" of a transaction.');
if (true === config('firefly.feature_flags.running_balance_column') && true === self::$recalculate) {
if (1 === bccomp($transaction->amount, '0')) {
Log::debug('Trigger recalculateForJournal');
Expand Down
2 changes: 0 additions & 2 deletions app/Helpers/Collector/Extensions/AccountCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-i
$query->orWhereIn('destination.account_id', $accountIds);
}
);
// app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
}

return $this;
Expand Down Expand Up @@ -232,7 +231,6 @@ static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-i
$query->whereNotIn('destination.account_id', $accountIds);
}
);
// app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
}

return $this;
Expand Down
1 change: 0 additions & 1 deletion app/Helpers/Collector/Extensions/AttachmentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ private function joinAttachmentTables(): void
->where(
static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
$q1->where('attachments.attachable_type', TransactionJournal::class);
// $q1->where('attachments.uploaded', true);
$q1->whereNull('attachments.deleted_at');
$q1->orWhereNull('attachments.attachable_type');
}
Expand Down
3 changes: 0 additions & 3 deletions app/Helpers/Collector/Extensions/MetaCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
$this->joinMetaDataTables();
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
// var_dump($url);

$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereNotLike('journal_meta.data', sprintf('%s%%', $url));
Expand All @@ -352,7 +351,6 @@ public function externalUrlStarts(string $url): GroupCollectorInterface
$this->joinMetaDataTables();
$url = (string) json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
// var_dump($url);

$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->whereLike('journal_meta.data', sprintf('%s%%', $url));
Expand Down Expand Up @@ -403,7 +401,6 @@ public function internalReferenceContains(string $internalReference): GroupColle
{
$internalReference = (string) json_encode($internalReference);
$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));
// var_dump($internalReference);
// exit;

$this->joinMetaDataTables();
Expand Down
Loading
Loading