1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

transition partial_due_dates to casts

This commit is contained in:
David Bomba 2024-01-14 16:17:49 +11:00
parent 4ffdbd7245
commit acefad27b6
3 changed files with 25 additions and 11 deletions

View File

@ -204,6 +204,7 @@ class Invoice extends BaseModel
'is_deleted' => 'bool',
'is_amount_discount' => 'bool',
'tax_data' => 'object',
'partial_due_date' => 'date:Y-m-d'
];
protected $with = [];
@ -244,10 +245,10 @@ class Invoice extends BaseModel
return $value ? $this->dateMutator($value) : null;
}
public function getPartialDueDateAttribute($value)
{
return $value ? $this->dateMutator($value) : null;
}
// public function getPartialDueDateAttribute($value)
// {
// return $value ? $this->dateMutator($value) : null;
// }
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Company>

View File

@ -1,7 +0,0 @@
<?php
$lang = array(
'client_settings' => 'Client Settings',
);
return $lang;

View File

@ -49,7 +49,27 @@ class InvoiceTest extends TestCase
$this->invoice_calc = new InvoiceSum($this->invoice);
}
public function testPartialDueDateCast()
{
$i = Invoice::factory()
->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'client_id' => $this->user->id
]);
$this->assertNull($i->partial_due_date);
$i = Invoice::factory()
->create([
'company_id' => $this->company->id,
'user_id' => $this->user->id,
'client_id' => $this->user->id,
'partial_due_date' => '2023-10-10',
]);
$this->assertEquals('2023-10-10', $i->partial_due_date->format('Y-m-d'));
}
public function testMarkPaidWithPartial()
{