1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Fixes for scheduler

This commit is contained in:
David Bomba 2023-05-18 09:26:57 +10:00
parent dd59cb6de6
commit 7099ab1c5d
2 changed files with 8 additions and 0 deletions

View File

@ -153,6 +153,9 @@ class Scheduler extends BaseModel
$offset = $this->company->timezone_offset();
switch ($this->frequency_id) {
case 0: //used only for email entities
$next_run = now()->startOfDay();
break;
case RecurringInvoice::FREQUENCY_DAILY:
$next_run = now()->startOfDay()->addDay();
break;

View File

@ -25,13 +25,18 @@ class SchedulerRepository extends BaseRepository
*/
public function save(array $data, Scheduler $scheduler): Scheduler
{
nlog($data);
$scheduler->fill($data);
$scheduler->save();
nlog($scheduler->withoutRelations()->toArray());
/** 18-5-2023 set client specific send times. */
$scheduler->calculateNextRun();
nlog($scheduler->withoutRelations()->toArray());
return $scheduler->fresh();
}