mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Fix #10794
This commit is contained in:
@@ -28,6 +28,7 @@ namespace FireflyIII\Casts;
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SeparateTimezoneCaster
|
* Class SeparateTimezoneCaster
|
||||||
@@ -50,7 +51,9 @@ class SeparateTimezoneCaster implements CastsAttributes
|
|||||||
}
|
}
|
||||||
$timeZone = $attributes[sprintf('%s_tz', $key)] ?? config('app.timezone');
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -30,6 +30,7 @@ use FireflyIII\Models\Recurrence;
|
|||||||
use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
|
use FireflyIII\Services\Internal\Support\RecurringTransactionTrait;
|
||||||
use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
|
use FireflyIII\Services\Internal\Support\TransactionTypeTrait;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,8 +63,8 @@ class RecurrenceFactory
|
|||||||
$type = $this->findTransactionType(ucfirst((string) $data['recurrence']['type']));
|
$type = $this->findTransactionType(ucfirst((string) $data['recurrence']['type']));
|
||||||
} catch (FireflyException $e) {
|
} catch (FireflyException $e) {
|
||||||
$message = sprintf('Cannot make a recurring transaction of type "%s"', $data['recurrence']['type']);
|
$message = sprintf('Cannot make a recurring transaction of type "%s"', $data['recurrence']['type']);
|
||||||
app('log')->error($message);
|
Log::error($message);
|
||||||
app('log')->error($e->getTraceAsString());
|
Log::error($e->getTraceAsString());
|
||||||
|
|
||||||
throw new FireflyException($message, 0, $e);
|
throw new FireflyException($message, 0, $e);
|
||||||
}
|
}
|
||||||
@@ -107,6 +108,7 @@ class RecurrenceFactory
|
|||||||
'title' => $title,
|
'title' => $title,
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'first_date' => $firstDate?->format('Y-m-d'),
|
'first_date' => $firstDate?->format('Y-m-d'),
|
||||||
|
'first_date_tz' => $firstDate?->format('e'),
|
||||||
'repeat_until' => $repetitions > 0 ? null : $repeatUntilString,
|
'repeat_until' => $repetitions > 0 ? null : $repeatUntilString,
|
||||||
'latest_date' => null,
|
'latest_date' => null,
|
||||||
'repetitions' => $repetitions,
|
'repetitions' => $repetitions,
|
||||||
@@ -125,8 +127,8 @@ class RecurrenceFactory
|
|||||||
try {
|
try {
|
||||||
$this->createTransactions($recurrence, $data['transactions'] ?? []);
|
$this->createTransactions($recurrence, $data['transactions'] ?? []);
|
||||||
} catch (FireflyException $e) {
|
} catch (FireflyException $e) {
|
||||||
app('log')->error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
app('log')->error($e->getTraceAsString());
|
Log::error($e->getTraceAsString());
|
||||||
$recurrence->forceDelete();
|
$recurrence->forceDelete();
|
||||||
$message = sprintf('Could not create recurring transaction: %s', $e->getMessage());
|
$message = sprintf('Could not create recurring transaction: %s', $e->getMessage());
|
||||||
$this->errors->add('store', $message);
|
$this->errors->add('store', $message);
|
||||||
|
@@ -105,7 +105,6 @@ class EditController extends Controller
|
|||||||
/** @var RecurrenceTransformer $transformer */
|
/** @var RecurrenceTransformer $transformer */
|
||||||
$transformer = app(RecurrenceTransformer::class);
|
$transformer = app(RecurrenceTransformer::class);
|
||||||
$transformer->setParameters(new ParameterBag());
|
$transformer->setParameters(new ParameterBag());
|
||||||
|
|
||||||
$array = $transformer->transform($recurrence);
|
$array = $transformer->transform($recurrence);
|
||||||
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
|
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
|
||||||
$bills = ExpandedForm::makeSelectListWithEmpty($this->billRepository->getActiveBills());
|
$bills = ExpandedForm::makeSelectListWithEmpty($this->billRepository->getActiveBills());
|
||||||
|
@@ -129,7 +129,7 @@ class RecurringEnrichment implements EnrichmentInterface
|
|||||||
$recurrence = $this->collection->filter(function (Recurrence $item) use ($repetition) {
|
$recurrence = $this->collection->filter(function (Recurrence $item) use ($repetition) {
|
||||||
return (int)$item->id === (int)$repetition->recurrence_id;
|
return (int)$item->id === (int)$repetition->recurrence_id;
|
||||||
})->first();
|
})->first();
|
||||||
$fromDate = $recurrence->latest_date ?? $recurrence->first_date;
|
$fromDate = clone ($recurrence->latest_date ?? $recurrence->first_date);
|
||||||
$id = (int)$repetition->recurrence_id;
|
$id = (int)$repetition->recurrence_id;
|
||||||
$repId = (int)$repetition->id;
|
$repId = (int)$repetition->id;
|
||||||
$this->repetitions[$id] ??= [];
|
$this->repetitions[$id] ??= [];
|
||||||
|
@@ -255,7 +255,7 @@ trait ConvertsDataTypes
|
|||||||
if (10 === strlen((string) $value)) {
|
if (10 === strlen((string) $value)) {
|
||||||
// probably a date format.
|
// probably a date format.
|
||||||
try {
|
try {
|
||||||
$carbon = Carbon::createFromFormat('Y-m-d', $value);
|
$carbon = Carbon::createFromFormat('Y-m-d', $value,config('app.timezone'));
|
||||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||||
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()));
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ trait ConvertsDataTypes
|
|||||||
|
|
||||||
// is an atom string, I hope?
|
// is an atom string, I hope?
|
||||||
try {
|
try {
|
||||||
$carbon = Carbon::parse($value);
|
$carbon = Carbon::parse($value, $value,config('app.timezone'));
|
||||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||||
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()));
|
||||||
|
|
||||||
|
@@ -83,15 +83,15 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
source: function () {
|
source: function () {
|
||||||
console.log('ForeignAmountSelect watch source');
|
// console.log('ForeignAmountSelect watch source');
|
||||||
this.changeData();
|
this.changeData();
|
||||||
},
|
},
|
||||||
destination: function () {
|
destination: function () {
|
||||||
console.log('ForeignAmountSelect watch destination');
|
// console.log('ForeignAmountSelect watch destination');
|
||||||
this.changeData();
|
this.changeData();
|
||||||
},
|
},
|
||||||
transactionType: function () {
|
transactionType: function () {
|
||||||
console.log('ForeignAmountSelect watch transaction type (is now ' + this.transactionType + ')');
|
// console.log('ForeignAmountSelect watch transaction type (is now ' + this.transactionType + ')');
|
||||||
this.changeData();
|
this.changeData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user