diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 7ea31ef1915f..81acdcd0d711 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -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 diff --git a/lang/en/t.php b/lang/en/t.php deleted file mode 100644 index e6474222c55e..000000000000 --- a/lang/en/t.php +++ /dev/null @@ -1,7 +0,0 @@ - 'Client Settings', -); - -return $lang; diff --git a/tests/Unit/InvoiceTest.php b/tests/Unit/InvoiceTest.php index 1a60d8f2ec29..10a580200db7 100644 --- a/tests/Unit/InvoiceTest.php +++ b/tests/Unit/InvoiceTest.php @@ -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() {