mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:24:31 -04:00
only show active transactions
This commit is contained in:
parent
305e3daeb4
commit
e08fcbaf07
@ -68,7 +68,7 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
*/
|
*/
|
||||||
public function client_status(string $value = ''): Builder
|
public function client_status(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
if (strlen($value) == 0) {
|
if (strlen($value ?? '') == 0) {
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +115,17 @@ class BankTransactionFilters extends QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function active_banks(string $value = ''): Builder
|
||||||
|
{
|
||||||
|
|
||||||
|
if (strlen($value) == 0 || $value != 'true') {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->whereHas('bank_integration', function ($query){
|
||||||
|
$query->where('is_deleted', 0)->whereNull('deleted_at');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the list based on Bank Accounts.
|
* Filters the list based on Bank Accounts.
|
||||||
|
@ -42,6 +42,10 @@ class BankTransactionTest extends TestCase
|
|||||||
|
|
||||||
public function testBankIntegrationFilters()
|
public function testBankIntegrationFilters()
|
||||||
{
|
{
|
||||||
|
BankTransaction::where('company_id', $this->company->id)
|
||||||
|
->cursor()->each(function($bt){
|
||||||
|
$bt->forceDelete();
|
||||||
|
});
|
||||||
|
|
||||||
$bi = BankIntegrationFactory::create($this->company->id, $this->user->id, $this->account->id);
|
$bi = BankIntegrationFactory::create($this->company->id, $this->user->id, $this->account->id);
|
||||||
$bi->bank_account_name = "Bank1";
|
$bi->bank_account_name = "Bank1";
|
||||||
@ -102,7 +106,6 @@ class BankTransactionTest extends TestCase
|
|||||||
|
|
||||||
$this->assertCount(1, $arr['data']);
|
$this->assertCount(1, $arr['data']);
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
@ -129,6 +132,18 @@ class BankTransactionTest extends TestCase
|
|||||||
|
|
||||||
$this->assertCount(2, $arr['data']);
|
$this->assertCount(2, $arr['data']);
|
||||||
|
|
||||||
|
$bi2->delete();
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->getJson('/api/v1/bank_transactions?active_banks=true');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$this->assertCount(1, $arr['data']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user