mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 05:26:17 +00:00
Add timezone fields.
This commit is contained in:
@@ -101,7 +101,7 @@ class JournalUpdateService
|
|||||||
'external_url',
|
'external_url',
|
||||||
];
|
];
|
||||||
$this->metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
|
$this->metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
|
||||||
'invoice_date', ];
|
'invoice_date',];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setData(array $data): void
|
public function setData(array $data): void
|
||||||
@@ -490,6 +490,7 @@ class JournalUpdateService
|
|||||||
}
|
}
|
||||||
// do some parsing.
|
// do some parsing.
|
||||||
app('log')->debug(sprintf('Create date value from string "%s".', $value));
|
app('log')->debug(sprintf('Create date value from string "%s".', $value));
|
||||||
|
$this->transactionJournal->date_tz = $value->format('e');
|
||||||
}
|
}
|
||||||
event(
|
event(
|
||||||
new TriggeredAuditLog(
|
new TriggeredAuditLog(
|
||||||
@@ -598,7 +599,7 @@ class JournalUpdateService
|
|||||||
if ($this->hasFields([$field])) {
|
if ($this->hasFields([$field])) {
|
||||||
try {
|
try {
|
||||||
$value = '' === (string) $this->data[$field] ? null : new Carbon($this->data[$field]);
|
$value = '' === (string) $this->data[$field] ? null : new Carbon($this->data[$field]);
|
||||||
} catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line
|
} catch (InvalidDateException | InvalidFormatException $e) { // @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
app('log')->debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -610,6 +611,13 @@ class JournalUpdateService
|
|||||||
'data' => $value,
|
'data' => $value,
|
||||||
];
|
];
|
||||||
$factory->updateOrCreate($set);
|
$factory->updateOrCreate($set);
|
||||||
|
// also set date with timezone.
|
||||||
|
$set = [
|
||||||
|
'journal' => $this->transactionJournal,
|
||||||
|
'name' => sprintf('%s_tz', $field),
|
||||||
|
'data' => $value->format('e'),
|
||||||
|
];
|
||||||
|
$factory->updateOrCreate($set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user