diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 4d9451dcf83a..110567910cda 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -187,7 +187,7 @@ class BaseRepository if(!$model->id){ $this->new_model = true; - if(is_array($model->line_items)) + if(is_array($model->line_items) && !($model instanceof RecurringInvoice)) { $model->line_items = (collect($model->line_items))->map(function ($item) use($model,$client) { diff --git a/tests/Feature/RecurringInvoiceTest.php b/tests/Feature/RecurringInvoiceTest.php index 2c076d214d2e..61f99b0cd9f3 100644 --- a/tests/Feature/RecurringInvoiceTest.php +++ b/tests/Feature/RecurringInvoiceTest.php @@ -61,7 +61,7 @@ class RecurringInvoiceTest extends TestCase $item->cost = 10; $item->task_id = $this->encodePrimaryKey($this->task->id); $item->expense_id = $this->encodePrimaryKey($this->expense->id); - $item->description = "Hello this is the month of :MONTH"; + $item->notes = "Hello this is the month of :MONTH"; $line_items[] = $item; @@ -93,7 +93,9 @@ class RecurringInvoiceTest extends TestCase $arr = $response->json(); $this->assertEquals(RecurringInvoice::STATUS_DRAFT, $arr['data']['status_id']); - $this->assertIsArray($arr['data']['line_items']); + $notes = end($arr['data']['line_items'])['notes']; + + $this->assertTrue(str_contains($notes, ':MONTH')); }