mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-15 19:52:15 +01:00
Added timezone to registration
This commit is contained in:
@@ -53,6 +53,7 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
|
||||
'email' => $record['Email'],
|
||||
], [
|
||||
'name' => $record['User'],
|
||||
'timezone' => 'UTC',
|
||||
'is_placeholder' => true,
|
||||
]);
|
||||
$clientId = null;
|
||||
|
||||
@@ -12,6 +12,7 @@ use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use App\Service\ColorService;
|
||||
use App\Service\Import\ImportDatabaseHelper;
|
||||
use App\Service\TimezoneService;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
abstract class DefaultImporter implements ImporterContract
|
||||
@@ -47,6 +48,8 @@ abstract class DefaultImporter implements ImporterContract
|
||||
|
||||
protected ColorService $colorService;
|
||||
|
||||
protected TimezoneService $timezoneService;
|
||||
|
||||
public function init(Organization $organization): void
|
||||
{
|
||||
$this->organization = $organization;
|
||||
@@ -62,6 +65,10 @@ abstract class DefaultImporter implements ImporterContract
|
||||
'required',
|
||||
'max:255',
|
||||
],
|
||||
'timezone' => [
|
||||
'required',
|
||||
'timezone:all',
|
||||
],
|
||||
]);
|
||||
$this->projectImportHelper = new ImportDatabaseHelper(Project::class, ['name', 'organization_id'], true, function (Builder $builder) {
|
||||
return $builder->where('organization_id', $this->organization->id);
|
||||
@@ -97,6 +104,7 @@ abstract class DefaultImporter implements ImporterContract
|
||||
]);
|
||||
$this->timeEntriesCreated = 0;
|
||||
$this->colorService = app(ColorService::class);
|
||||
$this->timezoneService = app(TimezoneService::class);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
|
||||
@@ -83,6 +83,7 @@ class TogglDataImporter extends DefaultImporter
|
||||
'email' => $workspaceUser->email,
|
||||
], [
|
||||
'name' => $workspaceUser->name,
|
||||
'timezone' => $workspaceUser->timezone ?? 'UTC',
|
||||
'is_placeholder' => true,
|
||||
], (string) $workspaceUser->id);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ class TogglTimeEntriesImporter extends DefaultImporter
|
||||
'email' => $record['Email'],
|
||||
], [
|
||||
'name' => $record['User'],
|
||||
'timezone' => 'UTC',
|
||||
'is_placeholder' => true,
|
||||
]);
|
||||
$clientId = null;
|
||||
|
||||
@@ -32,4 +32,9 @@ class TimezoneService
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function isValid(string $timezone): bool
|
||||
{
|
||||
return in_array($timezone, $this->getTimezones(), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user