mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup
This commit is contained in:
@@ -323,9 +323,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && $notes === $value;
|
||||
}
|
||||
}
|
||||
@@ -349,9 +349,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && $notes !== $value;
|
||||
}
|
||||
}
|
||||
@@ -375,9 +375,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && str_contains(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -401,9 +401,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && !str_contains(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -427,9 +427,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && !str_ends_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -453,9 +453,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && !str_starts_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -479,9 +479,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && str_ends_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
@@ -505,9 +505,9 @@ trait AttachmentCollection
|
||||
foreach ($object['transactions'] as $transaction) {
|
||||
/** @var array $attachment */
|
||||
foreach ($transaction['attachments'] as $attachment) {
|
||||
/** @var Attachment $object */
|
||||
/** @var Attachment|null $object */
|
||||
$object = auth()->user()->attachments()->find($attachment['id']);
|
||||
$notes = (string)$object->notes()?->first()?->text;
|
||||
$notes = (string)$object?->notes()->first()?->text;
|
||||
return $notes !== '' && str_starts_with(strtolower($notes), strtolower($value));
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Helpers\Collector;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidDateException;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
@@ -602,7 +603,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$tagDate = null;
|
||||
try {
|
||||
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
|
||||
} catch (InvalidDateException $e) {
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -682,7 +683,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$tagDate = null;
|
||||
try {
|
||||
$tagDate = Carbon::parse($newArray['tag_date']);
|
||||
} catch (InvalidDateException $e) {
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));
|
||||
}
|
||||
|
||||
@@ -754,10 +755,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['foreign_currency_decimal_places'];
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'] = '0';
|
||||
}
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd(
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'],
|
||||
$transaction['foreign_amount'] ?? '0'
|
||||
);
|
||||
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['foreign_amount']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user