mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 02:45:58 +00:00
Fix #10794
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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);
|
||||
|
@@ -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());
|
||||
|
@@ -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] ??= [];
|
||||
|
@@ -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()));
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user