Skip to content

Firefly III: a personal finances manager

Fix #10794

James Cole6ddda13c3a1b
diff --git a/app/Casts/SeparateTimezoneCaster.php b/app/Casts/SeparateTimezoneCaster.php
index aa1091885f..c318626ba6 100644
--- a/app/Casts/SeparateTimezoneCaster.php
+++ b/app/Casts/SeparateTimezoneCaster.php
@@ -28,6 +28,7 @@ namespace FireflyIII\Casts;
use Carbon\Carbon;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Log;
/**
* Class SeparateTimezoneCaster
@@ -50,7 +51,9 @@ class SeparateTimezoneCaster implements CastsAttributes
}
$timeZone = $attributes[sprintf('%s_tz', $key)] ?? config('app.timezone');
- return Carbon::parse($value, $timeZone)->setTimezone(config('app.timezone'));
+ $result = Carbon::parse($value, $timeZone)->setTimezone(config('app.timezone'));
+ Log::debug(sprintf('SeparateTimezoneCaster: %s.%s = %s', str_replace('FireflyIII\\Models\\','',get_class($model)), $key, $result->toAtomString()));
+ return $result;
}
/**
diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php
index 8254a8a4ec..16cb6cb982 100644
--- a/app/Factory/RecurrenceFactory.php
+++ b/app/Factory/RecurrenceFactory.php
@@ -30,6 +30,7 @@ use FireflyIII\Models\Recurrence;
use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
use FireflyIII\User;
+use Illuminate\Support\Facades\Log;
use Illuminate\Support\MessageBag;
/**
@@ -62,8 +63,8 @@ class RecurrenceFactory
$type = $this->findTransactionType(ucfirst((string) $data['recurrence']['type']));
} catch (FireflyException $e) {
$message = sprintf('Cannot make a recurring transaction of type "%s"', $data['recurrence']['type']);
- app('log')->error($message);
- app('log')->error($e->getTraceAsString());
+ Log::error($message);
+ Log::error($e->getTraceAsString());
throw new FireflyException($message, 0, $e);
}
@@ -107,6 +108,7 @@ class RecurrenceFactory
'title' => $title,
'description' => $description,
'first_date' => $firstDate?->format('Y-m-d'),
+ 'first_date_tz' => $firstDate?->format('e'),
'repeat_until' => $repetitions > 0 ? null : $repeatUntilString,
'latest_date' => null,
'repetitions' => $repetitions,
@@ -125,8 +127,8 @@ class RecurrenceFactory
try {
$this->createTransactions($recurrence, $data['transactions'] ?? []);
} catch (FireflyException $e) {
- app('log')->error($e->getMessage());
- app('log')->error($e->getTraceAsString());
+ Log::error($e->getMessage());
+ Log::error($e->getTraceAsString());
$recurrence->forceDelete();
$message = sprintf('Could not create recurring transaction: %s', $e->getMessage());
$this->errors->add('store', $message);
diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php
index 59772aa1b4..b854ae99b8 100644
--- a/app/Http/Controllers/Recurring/EditController.php
+++ b/app/Http/Controllers/Recurring/EditController.php
@@ -105,7 +105,6 @@ class EditController extends Controller
/** @var RecurrenceTransformer $transformer */
$transformer = app(RecurrenceTransformer::class);
$transformer->setParameters(new ParameterBag());
-
$array = $transformer->transform($recurrence);
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
$bills = ExpandedForm::makeSelectListWithEmpty($this->billRepository->getActiveBills());
diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
index 0f86426117..5e6ca0e734 100644
--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
@@ -129,7 +129,7 @@ class RecurringEnrichment implements EnrichmentInterface
$recurrence = $this->collection->filter(function (Recurrence $item) use ($repetition) {
return (int)$item->id === (int)$repetition->recurrence_id;
})->first();
- $fromDate = $recurrence->latest_date ?? $recurrence->first_date;
+ $fromDate = clone ($recurrence->latest_date ?? $recurrence->first_date);
$id = (int)$repetition->recurrence_id;
$repId = (int)$repetition->id;
$this->repetitions[$id] ??= [];
diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php
index 60e954945a..8162b5256f 100644
--- a/app/Support/Request/ConvertsDataTypes.php
+++ b/app/Support/Request/ConvertsDataTypes.php
@@ -255,7 +255,7 @@ trait ConvertsDataTypes
if (10 === strlen((string) $value)) {
// probably a date format.
try {
- $carbon = Carbon::createFromFormat('Y-m-d', $value);
+ $carbon = Carbon::createFromFormat('Y-m-d', $value,config('app.timezone'));
} catch (InvalidDateException $e) { // @phpstan-ignore-line
Log::error(sprintf('[1] "%s" is not a valid date: %s', $value, $e->getMessage()));
@@ -276,7 +276,7 @@ trait ConvertsDataTypes
// is an atom string, I hope?
try {
- $carbon = Carbon::parse($value);
+ $carbon = Carbon::parse($value, $value,config('app.timezone'));
} catch (InvalidDateException $e) { // @phpstan-ignore-line
Log::error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage()));
diff --git a/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue b/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue
index 2df223b20e..fdcc48f80b 100644
--- a/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue
+++ b/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue
@@ -83,15 +83,15 @@ export default {
},
watch: {
source: function () {
- console.log('ForeignAmountSelect watch source');
+ // console.log('ForeignAmountSelect watch source');
this.changeData();
},
destination: function () {
- console.log('ForeignAmountSelect watch destination');
+ // console.log('ForeignAmountSelect watch destination');
this.changeData();
},
transactionType: function () {
- console.log('ForeignAmountSelect watch transaction type (is now ' + this.transactionType + ')');
+ // console.log('ForeignAmountSelect watch transaction type (is now ' + this.transactionType + ')');
this.changeData();
}
},