mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Fix #10601
This commit is contained in:
@@ -149,7 +149,9 @@ class TransactionGroupEnrichment implements EnrichmentInterface
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@@ -257,16 +257,16 @@ trait ConvertsDataTypes
|
||||
try {
|
||||
$carbon = Carbon::createFromFormat('Y-m-d', $value);
|
||||
} 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;
|
||||
} 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -278,11 +278,11 @@ trait ConvertsDataTypes
|
||||
try {
|
||||
$carbon = Carbon::parse($value);
|
||||
} 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;
|
||||
} 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;
|
||||
}
|
||||
@@ -306,6 +306,7 @@ trait ConvertsDataTypes
|
||||
protected function dateFromValue(?string $string): ?Carbon
|
||||
{
|
||||
if (null === $string) {
|
||||
|
||||
return null;
|
||||
}
|
||||
if ('' === $string) {
|
||||
@@ -319,11 +320,11 @@ trait ConvertsDataTypes
|
||||
// @ignoreException
|
||||
}
|
||||
if (!$carbon instanceof Carbon) {
|
||||
app('log')->debug(sprintf('Invalid date: %s', $string));
|
||||
Log::debug(sprintf('Invalid date: %s', $string));
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -383,7 +384,7 @@ trait ConvertsDataTypes
|
||||
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
|
||||
}
|
||||
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;
|
||||
|
@@ -128,7 +128,6 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
$recurrenceTotal = null !== $recurrenceTotal ? (int) $recurrenceTotal : null;
|
||||
$recurrenceCount = $transaction['meta']['recurrence_count'] ?? null;
|
||||
$recurrenceCount = null !== $recurrenceCount ? (int) $recurrenceCount : null;
|
||||
|
||||
return [
|
||||
'user' => (string) $transaction['user_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_batch_id' => $transaction['meta']['sepa_batch_id'] ?? null,
|
||||
|
||||
'interest_date' => $transaction['meta_date']['interest_date'] ?? null,
|
||||
'book_date' => $transaction['meta_date']['book_date'] ?? null,
|
||||
'process_date' => $transaction['meta_date']['process_date'] ?? null,
|
||||
'due_date' => $transaction['meta_date']['due_date'] ?? null,
|
||||
'payment_date' => $transaction['meta_date']['payment_date'] ?? null,
|
||||
'invoice_date' => $transaction['meta_date']['invoice_date'] ?? null,
|
||||
'interest_date' => array_key_exists('interest_date', $transaction['meta_date']) ? $transaction['meta_date']['interest_date']->toW3CString() : null,
|
||||
'book_date' => array_key_exists('book_date', $transaction['meta_date']) ? $transaction['meta_date']['book_date']->toW3CString() : null,
|
||||
'process_date' => array_key_exists('process_date', $transaction['meta_date']) ? $transaction['meta_date']['process_date']->toW3CString() : null,
|
||||
'due_date' => array_key_exists('due_date', $transaction['meta_date']) ? $transaction['meta_date']['due_date']->toW3CString() : null,
|
||||
'payment_date' => array_key_exists('payment_date', $transaction['meta_date']) ? $transaction['meta_date']['payment_date']->toW3CString() : null,
|
||||
'invoice_date' => array_key_exists('invoice_date', $transaction['meta_date']) ? $transaction['meta_date']['invoice_date']->toW3CString() : null,
|
||||
// location data
|
||||
'longitude' => $transaction['location']['longitude'],
|
||||
'latitude' => $transaction['location']['latitude'],
|
||||
|
Reference in New Issue
Block a user