mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 07:53:16 +00:00
Fix #10601
This commit is contained in:
@@ -149,7 +149,9 @@ class TransactionGroupEnrichment implements EnrichmentInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (in_array($name, $this->dateFields, true)) {
|
if (in_array($name, $this->dateFields, true)) {
|
||||||
$this->metaData[$entry['transaction_journal_id']][$name] = Carbon::parse($data);
|
Log::debug(sprintf('Meta data for "%s" is a date : "%s"', $name, $data));
|
||||||
|
$this->metaData[$entry['transaction_journal_id']][$name] = Carbon::parse($data, config('app.timezone'));
|
||||||
|
Log::debug(sprintf('Meta data for "%s" converts to: "%s"', $name, $this->metaData[$entry['transaction_journal_id']][$name]->toW3CString()));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -257,16 +257,16 @@ trait ConvertsDataTypes
|
|||||||
try {
|
try {
|
||||||
$carbon = Carbon::createFromFormat('Y-m-d', $value);
|
$carbon = Carbon::createFromFormat('Y-m-d', $value);
|
||||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||||
app('log')->error(sprintf('[1] "%s" is not a valid date: %s', $value, $e->getMessage()));
|
Log::error(sprintf('[1] "%s" is not a valid date: %s', $value, $e->getMessage()));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
|
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
|
||||||
app('log')->error(sprintf('[2] "%s" is of an invalid format: %s', $value, $e->getMessage()));
|
Log::error(sprintf('[2] "%s" is of an invalid format: %s', $value, $e->getMessage()));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!$carbon instanceof Carbon) {
|
if (!$carbon instanceof Carbon) {
|
||||||
app('log')->error(sprintf('[2] "%s" is of an invalid format.', $value));
|
Log::error(sprintf('[2] "%s" is of an invalid format.', $value));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -278,11 +278,11 @@ trait ConvertsDataTypes
|
|||||||
try {
|
try {
|
||||||
$carbon = Carbon::parse($value);
|
$carbon = Carbon::parse($value);
|
||||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||||
app('log')->error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage()));
|
Log::error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage()));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} catch (InvalidFormatException $e) {
|
} catch (InvalidFormatException $e) {
|
||||||
app('log')->error(sprintf('[4] "%s" is of an invalid format: %s', $value, $e->getMessage()));
|
Log::error(sprintf('[4] "%s" is of an invalid format: %s', $value, $e->getMessage()));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -306,6 +306,7 @@ trait ConvertsDataTypes
|
|||||||
protected function dateFromValue(?string $string): ?Carbon
|
protected function dateFromValue(?string $string): ?Carbon
|
||||||
{
|
{
|
||||||
if (null === $string) {
|
if (null === $string) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ('' === $string) {
|
if ('' === $string) {
|
||||||
@@ -319,11 +320,11 @@ trait ConvertsDataTypes
|
|||||||
// @ignoreException
|
// @ignoreException
|
||||||
}
|
}
|
||||||
if (!$carbon instanceof Carbon) {
|
if (!$carbon instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Invalid date: %s', $string));
|
Log::debug(sprintf('Invalid date: %s', $string));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('Date object: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()));
|
Log::debug(sprintf('Date object: %s (%s) from "%s"', $carbon->toW3cString(), $carbon->getTimezone(), $string));
|
||||||
|
|
||||||
return $carbon;
|
return $carbon;
|
||||||
}
|
}
|
||||||
@@ -383,7 +384,7 @@ trait ConvertsDataTypes
|
|||||||
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
||||||
}
|
}
|
||||||
if (!$result instanceof Carbon) {
|
if (!$result instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@@ -128,7 +128,6 @@ class TransactionGroupTransformer extends AbstractTransformer
|
|||||||
$recurrenceTotal = null !== $recurrenceTotal ? (int) $recurrenceTotal : null;
|
$recurrenceTotal = null !== $recurrenceTotal ? (int) $recurrenceTotal : null;
|
||||||
$recurrenceCount = $transaction['meta']['recurrence_count'] ?? null;
|
$recurrenceCount = $transaction['meta']['recurrence_count'] ?? null;
|
||||||
$recurrenceCount = null !== $recurrenceCount ? (int) $recurrenceCount : null;
|
$recurrenceCount = null !== $recurrenceCount ? (int) $recurrenceCount : null;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'user' => (string) $transaction['user_id'],
|
'user' => (string) $transaction['user_id'],
|
||||||
'transaction_journal_id' => (string) $transaction['transaction_journal_id'],
|
'transaction_journal_id' => (string) $transaction['transaction_journal_id'],
|
||||||
@@ -220,12 +219,12 @@ class TransactionGroupTransformer extends AbstractTransformer
|
|||||||
'sepa_ci' => $transaction['meta']['sepa_ci'] ?? null,
|
'sepa_ci' => $transaction['meta']['sepa_ci'] ?? null,
|
||||||
'sepa_batch_id' => $transaction['meta']['sepa_batch_id'] ?? null,
|
'sepa_batch_id' => $transaction['meta']['sepa_batch_id'] ?? null,
|
||||||
|
|
||||||
'interest_date' => $transaction['meta_date']['interest_date'] ?? null,
|
'interest_date' => array_key_exists('interest_date', $transaction['meta_date']) ? $transaction['meta_date']['interest_date']->toW3CString() : null,
|
||||||
'book_date' => $transaction['meta_date']['book_date'] ?? null,
|
'book_date' => array_key_exists('book_date', $transaction['meta_date']) ? $transaction['meta_date']['book_date']->toW3CString() : null,
|
||||||
'process_date' => $transaction['meta_date']['process_date'] ?? null,
|
'process_date' => array_key_exists('process_date', $transaction['meta_date']) ? $transaction['meta_date']['process_date']->toW3CString() : null,
|
||||||
'due_date' => $transaction['meta_date']['due_date'] ?? null,
|
'due_date' => array_key_exists('due_date', $transaction['meta_date']) ? $transaction['meta_date']['due_date']->toW3CString() : null,
|
||||||
'payment_date' => $transaction['meta_date']['payment_date'] ?? null,
|
'payment_date' => array_key_exists('payment_date', $transaction['meta_date']) ? $transaction['meta_date']['payment_date']->toW3CString() : null,
|
||||||
'invoice_date' => $transaction['meta_date']['invoice_date'] ?? null,
|
'invoice_date' => array_key_exists('invoice_date', $transaction['meta_date']) ? $transaction['meta_date']['invoice_date']->toW3CString() : null,
|
||||||
// location data
|
// location data
|
||||||
'longitude' => $transaction['location']['longitude'],
|
'longitude' => $transaction['location']['longitude'],
|
||||||
'latitude' => $transaction['location']['latitude'],
|
'latitude' => $transaction['location']['latitude'],
|
||||||
|
Reference in New Issue
Block a user