mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests
This commit is contained in:
parent
22793dbe52
commit
e2287c6d57
@ -68,17 +68,17 @@ class AutoBillInvoice extends AbstractService
|
|||||||
$this->applyCreditPayment();
|
$this->applyCreditPayment();
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog($this->client->getSetting('use_unapplied_payment'));
|
|
||||||
if($this->client->getSetting('use_unapplied_payment') != 'off') {
|
if($this->client->getSetting('use_unapplied_payment') != 'off') {
|
||||||
nlog("meeeeeeerp");
|
|
||||||
$this->applyUnappliedPayment();
|
$this->applyUnappliedPayment();
|
||||||
}
|
}
|
||||||
|
|
||||||
//If this returns true, it means a partial invoice amount was paid as a credit and there is no further balance payable
|
//If this returns true, it means a partial invoice amount was paid as a credit and there is no further balance payable
|
||||||
if ($this->is_partial_amount && $this->invoice->partial == 0) {
|
if (($this->is_partial_amount && $this->invoice->partial == 0) || (int)$this->invoice->balance == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nlog($this->invoice->toArray());
|
||||||
|
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
$invoice_total = 0;
|
$invoice_total = 0;
|
||||||
|
|
||||||
@ -262,11 +262,13 @@ class AutoBillInvoice extends AbstractService
|
|||||||
->where('client_id', $this->client->id)
|
->where('client_id', $this->client->id)
|
||||||
->where('status_id', Payment::STATUS_COMPLETED)
|
->where('status_id', Payment::STATUS_COMPLETED)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
->where('amount', '>', 'applied')
|
->whereColumn('amount', '>', 'applied')
|
||||||
->where('amount', '>', 0)
|
->where('amount', '>', 0)
|
||||||
->orderBy('created_at')
|
->orderBy('created_at')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
nlog($unapplied_payments->pluck("id"));
|
||||||
|
|
||||||
$available_unapplied_balance = $unapplied_payments->sum('amount') - $unapplied_payments->sum('applied');
|
$available_unapplied_balance = $unapplied_payments->sum('amount') - $unapplied_payments->sum('applied');
|
||||||
|
|
||||||
nlog("available unapplied balance = {$available_unapplied_balance}");
|
nlog("available unapplied balance = {$available_unapplied_balance}");
|
||||||
|
@ -2,9 +2,19 @@
|
|||||||
|
|
||||||
namespace Tests;
|
namespace Tests;
|
||||||
|
|
||||||
|
use App\Utils\Traits\AppSetup;
|
||||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||||
|
|
||||||
abstract class TestCase extends BaseTestCase
|
abstract class TestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
use CreatesApplication;
|
use CreatesApplication;
|
||||||
|
use AppSetup;
|
||||||
|
|
||||||
|
protected function setUp() :void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->buildCache(true);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user