Fixes for recurring due dates
This commit is contained in:
parent
de65dbd086
commit
50a1a746f3
|
|
@ -380,16 +380,16 @@ class Task extends BaseModel
|
|||
|
||||
if ($this->company->invoice_task_datelog) {
|
||||
$date_time[] = Carbon::createFromTimestamp((int)$log[0])
|
||||
->setTimeZone($this->company->timezone()->name)
|
||||
// ->setTimeZone($this->company->timezone()->name)
|
||||
->format($parent_entity->date_format());
|
||||
}
|
||||
|
||||
if ($this->company->invoice_task_timelog) {
|
||||
$date_time[] = Carbon::createFromTimestamp((int)$log[0])
|
||||
->setTimeZone($this->company->timezone()->name)
|
||||
// ->setTimeZone($this->company->timezone()->name)
|
||||
->format($time_format) . " - " .
|
||||
Carbon::createFromTimestamp((int)$log[1])
|
||||
->setTimeZone($this->company->timezone()->name)
|
||||
// ->setTimeZone($this->company->timezone()->name)
|
||||
->format($time_format);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,17 +114,16 @@ class RecurringDatesTest extends TestCase
|
|||
$recurring_invoice->frequency_id = RecurringInvoice::FREQUENCY_MONTHLY;
|
||||
$recurring_invoice->remaining_cycles = 5;
|
||||
$recurring_invoice->due_date_days = '1';
|
||||
$recurring_invoice->next_send_date = now()->format('Y-m-d');
|
||||
$recurring_invoice->next_send_date = now()->setTimezone($this->client->timezone()->name)->format('Y-m-d');
|
||||
$recurring_invoice->save();
|
||||
$recurring_invoice = $recurring_invoice->calc()->getInvoice();
|
||||
|
||||
$recurring_invoice->service()->sendNow();
|
||||
|
||||
$r = $recurring_invoice->fresh();
|
||||
|
||||
$invoice = $recurring_invoice->invoices()->latest()->first();
|
||||
$this->assertGreaterThan(0, $recurring_invoice->invoices()->count());
|
||||
$expected_due_date = now()->startOfDay()->addMonthWithoutOverflow()->startOfMonth()->format('Y-m-d');
|
||||
$expected_due_date = now()->setTimezone($this->client->timezone()->name)->startOfDay()->addMonthWithoutOverflow()->startOfMonth()->format('Y-m-d');
|
||||
|
||||
$this->assertEquals($expected_due_date, $invoice->due_date);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue