mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Fixes for tests
This commit is contained in:
parent
22793dbe52
commit
e2287c6d57
@ -68,17 +68,17 @@ class AutoBillInvoice extends AbstractService
|
||||
$this->applyCreditPayment();
|
||||
}
|
||||
|
||||
nlog($this->client->getSetting('use_unapplied_payment'));
|
||||
if($this->client->getSetting('use_unapplied_payment') != 'off') {
|
||||
nlog("meeeeeeerp");
|
||||
$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->is_partial_amount && $this->invoice->partial == 0) {
|
||||
if (($this->is_partial_amount && $this->invoice->partial == 0) || (int)$this->invoice->balance == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
nlog($this->invoice->toArray());
|
||||
|
||||
$amount = 0;
|
||||
$invoice_total = 0;
|
||||
|
||||
@ -262,11 +262,13 @@ class AutoBillInvoice extends AbstractService
|
||||
->where('client_id', $this->client->id)
|
||||
->where('status_id', Payment::STATUS_COMPLETED)
|
||||
->where('is_deleted', false)
|
||||
->where('amount', '>', 'applied')
|
||||
->whereColumn('amount', '>', 'applied')
|
||||
->where('amount', '>', 0)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
|
||||
nlog($unapplied_payments->pluck("id"));
|
||||
|
||||
$available_unapplied_balance = $unapplied_payments->sum('amount') - $unapplied_payments->sum('applied');
|
||||
|
||||
nlog("available unapplied balance = {$available_unapplied_balance}");
|
||||
|
@ -2,9 +2,19 @@
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use App\Utils\Traits\AppSetup;
|
||||
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||
|
||||
abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
use CreatesApplication;
|
||||
use AppSetup;
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->buildCache(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user