mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for schedules
This commit is contained in:
parent
86338ce548
commit
32d435d8d7
@ -57,7 +57,7 @@ class StoreSchedulerRequest extends Request
|
||||
$input = $this->all();
|
||||
|
||||
if (array_key_exists('next_run', $input) && is_string($input['next_run'])) {
|
||||
$this->merge(['next_run_client' => $input['next_run']]);
|
||||
$input['next_run_client'] = $input['next_run'];
|
||||
}
|
||||
|
||||
if($input['template'] == 'email_record'){
|
||||
|
@ -54,7 +54,7 @@ class UpdateSchedulerRequest extends Request
|
||||
$input = $this->all();
|
||||
|
||||
if (array_key_exists('next_run', $input) && is_string($input['next_run'])) {
|
||||
$this->merge(['next_run_client' => $input['next_run']]);
|
||||
$input['next_run_client'] = $input['next_run'];
|
||||
}
|
||||
|
||||
if($input['template'] == 'email_record') {
|
||||
|
@ -202,5 +202,16 @@ class Scheduler extends BaseModel
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function adjustOffset(): void
|
||||
{
|
||||
if (! $this->next_run) {
|
||||
return;
|
||||
}
|
||||
|
||||
$offset = $this->company->timezone_offset();
|
||||
|
||||
$this->next_run = $this->next_run->copy()->addSeconds($offset);
|
||||
$this->save();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class SchedulerRepository extends BaseRepository
|
||||
$scheduler->save();
|
||||
|
||||
/** 18-5-2023 set client specific send times. */
|
||||
$scheduler->calculateNextRun();
|
||||
$scheduler->adjustOffset();
|
||||
|
||||
return $scheduler->fresh();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user