1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Credits fix

This commit is contained in:
David Bomba 2021-10-05 13:49:15 +11:00
parent 980f538e28
commit 8ce94012fb
2 changed files with 15 additions and 4 deletions

View File

@ -42,7 +42,8 @@ class CreditsTable extends Component
->where('is_deleted', 0)
->where(function ($query){
$query->whereDate('due_date', '>=', now())
->orWhereNull('due_date');
->orWhereNull('due_date')
->orWhere('due_date', '=', '');
})
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->withTrashed()

View File

@ -93,9 +93,9 @@ class CreditsTest extends TestCase
$this->actingAs($client->contacts->first(), 'contact');
Livewire::test(CreditsTable::class, ['company' => $company])
->assertSee('testing-number-01')
->assertDontSee('testing-number-01')
->assertSee('testing-number-02')
->assertDontSee('testing-number-03');
->assertSee('testing-number-03');
}
public function testShowingCreditsWithNullDueDate()
@ -122,6 +122,7 @@ class CreditsTest extends TestCase
'client_id' => $client->id,
'number' => 'testing-number-01',
'status_id' => Credit::STATUS_SENT,
'due_date' => null,
]);
Credit::factory()->create([
@ -142,12 +143,21 @@ class CreditsTest extends TestCase
'status_id' => Credit::STATUS_SENT,
]);
Credit::factory()->create([
'user_id' => $user->id,
'company_id' => $company->id,
'client_id' => $client->id,
'number' => 'testing-number-04',
'due_date' => '',
'status_id' => Credit::STATUS_SENT,
]);
$this->actingAs($client->contacts->first(), 'contact');
Livewire::test(CreditsTable::class, ['company' => $company])
->assertSee('testing-number-01')
->assertSee('testing-number-02')
->assertDontSee('testing-number-03');
->assertSee('testing-number-03');
}
}