mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
7559bf3ab9
2
.env.ci
2
.env.ci
@ -10,8 +10,6 @@ DB_DATABASE1=ninja
|
||||
DB_USERNAME1=root
|
||||
DB_PASSWORD1=ninja
|
||||
DB_HOST1=127.0.0.1
|
||||
DB_PORT1=32768
|
||||
DB_PORT=32768
|
||||
DB_DATABASE=ninja
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=ninja
|
||||
|
2
.github/workflows/phpunit.yml
vendored
2
.github/workflows/phpunit.yml
vendored
@ -67,7 +67,7 @@ jobs:
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: mysql, mysqlnd, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml
|
||||
extensions: mysql, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml
|
||||
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
|
@ -205,6 +205,8 @@ class Import implements ShouldQueue
|
||||
|
||||
$this->setInitialCompanyLedgerBalances();
|
||||
|
||||
$this->fixClientBalances();
|
||||
|
||||
Mail::to($this->user)
|
||||
->send(new MigrationCompleted($this->company));
|
||||
|
||||
@ -789,6 +791,7 @@ class Import implements ShouldQueue
|
||||
/*Improve memory handling by setting everything to null when we have finished*/
|
||||
$data = null;
|
||||
$credit_repository = null;
|
||||
|
||||
}
|
||||
|
||||
private function processQuotes(array $data): void
|
||||
@ -1425,4 +1428,23 @@ class Import implements ShouldQueue
|
||||
return $response->getBody();
|
||||
}
|
||||
|
||||
|
||||
/* In V4 we use negative invoices (credits) and add then into the client balance. In V5, these sit off ledger and are applied later.
|
||||
This next section will check for credit balances and reduce the client balance so that the V5 balances are correct
|
||||
*/
|
||||
private function fixClientBalances()
|
||||
{
|
||||
|
||||
Client::cursor()->each(function ($client) {
|
||||
|
||||
$credit_balance = $client->credits->where('is_deleted', false)->sum('balance');
|
||||
|
||||
if($credit_balance > 0){
|
||||
$client->balance += $credit_balance;
|
||||
$client->save();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ use Tests\TestCase;
|
||||
*/
|
||||
class AutoBillInvoiceTest extends TestCase
|
||||
{
|
||||
use MockAccountData;
|
||||
use DatabaseTransactions;
|
||||
use MockAccountData;
|
||||
|
||||
public function setUp() :void
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user