mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
3b6b6b37ba
@ -1 +1 @@
|
||||
5.3.81
|
||||
5.3.82
|
162
app/Console/Commands/TypeCheck.php
Normal file
162
app/Console/Commands/TypeCheck.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Http\ValidationRules\ValidClientGroupSettingsRule;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Backup;
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use App\Models\Design;
|
||||
use App\Utils\Traits\ClientGroupSettingsSaver;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use stdClass;
|
||||
|
||||
class TypeCheck extends Command
|
||||
{
|
||||
use ClientGroupSettingsSaver;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ninja:type-check {--all=} {--client_id=} {--company_id=}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check Settings Types';
|
||||
|
||||
protected $log = '';
|
||||
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//always return state to first DB
|
||||
|
||||
$current_db = config('database.default');
|
||||
|
||||
if($this->option('all'))
|
||||
{
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
$this->checkAll();
|
||||
} else {
|
||||
|
||||
foreach (MultiDB::$dbs as $db)
|
||||
{
|
||||
MultiDB::setDB($db);
|
||||
|
||||
$this->checkAll();
|
||||
}
|
||||
|
||||
MultiDB::setDB($current_db);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($this->option('client_id'))
|
||||
{
|
||||
$client = MultiDB::findAndSetDbByClientId($this->option('client_id'));
|
||||
|
||||
if($client)
|
||||
$this->checkClient($client);
|
||||
else
|
||||
$this->logMessage(date('Y-m-d h:i:s').' Could not find this client');
|
||||
|
||||
}
|
||||
|
||||
if($this->option('company_id'))
|
||||
{
|
||||
$company = MultiDB::findAndSetDbByCompanyId($this->option('company_id'));
|
||||
|
||||
|
||||
if($company)
|
||||
$this->checkCompany($company);
|
||||
else
|
||||
$this->logMessage(date('Y-m-d h:i:s').' Could not find this company');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function checkClient($client)
|
||||
{
|
||||
$this->logMessage(date('Y-m-d h:i:s').' Checking Client => ' . $client->present()->name(). " " . $client->id);
|
||||
|
||||
|
||||
$entity_settings = $this->checkSettingType($client->settings);
|
||||
$entity_settings->md5 = md5(time());
|
||||
$client->settings = $entity_settings;
|
||||
$client->save();
|
||||
|
||||
}
|
||||
|
||||
private function checkCompany($company)
|
||||
{
|
||||
$this->logMessage(date('Y-m-d h:i:s').' Checking Company => ' . $company->present()->name(). " " . $company->id);
|
||||
|
||||
$company->saveSettings((array)$company->settings, $company);
|
||||
|
||||
}
|
||||
|
||||
private function checkAll()
|
||||
{
|
||||
|
||||
$this->logMessage(date('Y-m-d h:i:s').' Checking all clients and companies.');
|
||||
|
||||
Client::cursor()->each( function ($client) {
|
||||
$this->logMessage("Checking client {$client->id}");
|
||||
$entity_settings = $this->checkSettingType($client->settings);
|
||||
$entity_settings->md5 = md5(time());
|
||||
$client->settings = $entity_settings;
|
||||
$client->save();
|
||||
|
||||
});
|
||||
|
||||
Company::cursor()->each( function ($company) {
|
||||
$this->logMessage("Checking company {$company->id}");
|
||||
$company->saveSettings($company->settings, $company);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function logMessage($str)
|
||||
{
|
||||
$str = date('Y-m-d h:i:s').' '.$str;
|
||||
$this->info($str);
|
||||
$this->log .= $str."\n";
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ use App\Http\Requests\Invoice\StoreInvoiceRequest;
|
||||
use App\Http\Requests\Invoice\UpdateInvoiceRequest;
|
||||
use App\Http\Requests\Invoice\UploadInvoiceRequest;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Jobs\Invoice\BulkInvoiceJob;
|
||||
use App\Jobs\Invoice\StoreInvoice;
|
||||
use App\Jobs\Invoice\ZipInvoices;
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
@ -747,23 +748,14 @@ class InvoiceController extends BaseController
|
||||
case 'email':
|
||||
//check query parameter for email_type and set the template else use calculateTemplate
|
||||
|
||||
|
||||
if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) {
|
||||
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
|
||||
} else {
|
||||
$this->reminder_template = $invoice->calculateTemplate('invoice');
|
||||
}
|
||||
|
||||
//touch reminder1,2,3_sent + last_sent here if the email is a reminder.
|
||||
//$invoice->service()->touchReminder($this->reminder_template)->deletePdf()->save();
|
||||
$invoice->service()->touchReminder($this->reminder_template)->markSent()->save();
|
||||
|
||||
$invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($invoice) {
|
||||
EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template)->delay(now()->addSeconds(30));
|
||||
});
|
||||
|
||||
if ($invoice->invitations->count() >= 1) {
|
||||
$invoice->entityEmailEvent($invoice->invitations->first(), 'invoice', $this->reminder_template);
|
||||
}
|
||||
BulkInvoiceJob::dispatch($invoice, $this->reminder_template);
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message' => 'email sent'], 200);
|
||||
|
@ -36,7 +36,7 @@ class CreateAccountRequest extends Request
|
||||
return [
|
||||
'first_name' => 'string|max:100',
|
||||
'last_name' => 'string:max:100',
|
||||
'password' => 'required|string|min:6',
|
||||
'password' => 'required|string|min:6|max:1000',
|
||||
// 'email' => 'bail|required|email:rfc,dns',
|
||||
// 'email' => new NewUniqueUserRule(),
|
||||
'email' => ['required', 'email:rfc,dns', new NewUniqueUserRule],
|
||||
|
@ -36,7 +36,8 @@ class StoreClientRequest extends Request
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{nlog($this->input);
|
||||
{
|
||||
|
||||
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||
$documents = count($this->input('documents'));
|
||||
|
||||
|
@ -36,7 +36,7 @@ class LoginRequest extends Request
|
||||
{
|
||||
return [
|
||||
'email' => 'required',
|
||||
'password' => 'required',
|
||||
'password' => 'required|max:1000',
|
||||
];
|
||||
}
|
||||
|
||||
|
71
app/Jobs/Invoice/BulkInvoiceJob.php
Normal file
71
app/Jobs/Invoice/BulkInvoiceJob.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Jobs\Invoice;
|
||||
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Models\Invoice;
|
||||
use CleverIt\UBL\Invoice\Address;
|
||||
use CleverIt\UBL\Invoice\Contact;
|
||||
use CleverIt\UBL\Invoice\Country;
|
||||
use CleverIt\UBL\Invoice\Generator;
|
||||
use CleverIt\UBL\Invoice\Invoice as UBLInvoice;
|
||||
use CleverIt\UBL\Invoice\InvoiceLine;
|
||||
use CleverIt\UBL\Invoice\Item;
|
||||
use CleverIt\UBL\Invoice\LegalMonetaryTotal;
|
||||
use CleverIt\UBL\Invoice\Party;
|
||||
use CleverIt\UBL\Invoice\TaxCategory;
|
||||
use CleverIt\UBL\Invoice\TaxScheme;
|
||||
use CleverIt\UBL\Invoice\TaxSubTotal;
|
||||
use CleverIt\UBL\Invoice\TaxTotal;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class BulkInvoiceJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $invoice;
|
||||
|
||||
public $reminder_template;
|
||||
|
||||
public function __construct(Invoice $invoice, string $reminder_template)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
$this->reminder_template = $reminder_template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
$this->invoice->service()->touchReminder($this->reminder_template)->markSent()->save();
|
||||
|
||||
$this->invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) {
|
||||
EmailEntity::dispatch($invitation, $this->invoice->company, $this->reminder_template)->delay(now()->addSeconds(5));
|
||||
});
|
||||
|
||||
if ($this->invoice->invitations->count() >= 1) {
|
||||
$this->invoice->entityEmailEvent($this->invoice->invitations->first(), 'invoice', $this->reminder_template);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -284,6 +284,22 @@ class MultiDB
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByCompanyId($company_id) :?Company
|
||||
{
|
||||
$current_db = config('database.default');
|
||||
|
||||
foreach (self::$dbs as $db) {
|
||||
if ($company = Company::on($db)->where('id', $company_id)->first()) {
|
||||
self::setDb($db);
|
||||
return $company;
|
||||
}
|
||||
}
|
||||
|
||||
self::setDB($current_db);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByAccountKey($account_key) :bool
|
||||
{
|
||||
$current_db = config('database.default');
|
||||
@ -332,6 +348,22 @@ class MultiDB
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByClientId($client_id) :?Client
|
||||
{
|
||||
$current_db = config('database.default');
|
||||
|
||||
foreach (self::$dbs as $db) {
|
||||
if ($client = Client::on($db)->where('id', $client_id)->first()) {
|
||||
self::setDb($db);
|
||||
return $client;
|
||||
}
|
||||
}
|
||||
|
||||
self::setDB($current_db);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByDomain($query_array)
|
||||
{
|
||||
|
||||
|
@ -234,6 +234,9 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
|
||||
$this->init();
|
||||
|
||||
nlog("GoCardless Event");
|
||||
nlog($request->all());
|
||||
|
||||
|
||||
if(!is_array($request->events) || !is_object($request->events)){
|
||||
|
||||
|
@ -105,7 +105,7 @@ class CreditCard implements MethodInterface
|
||||
$amount_money->setAmount($amount);
|
||||
$amount_money->setCurrency($this->square_driver->client->currency()->code);
|
||||
|
||||
$body = new \Square\Models\CreatePaymentRequest($token, Str::random(32), $amount_money);
|
||||
$body = new \Square\Models\CreatePaymentRequest($token, $request->idempotencyKey, $amount_money);
|
||||
|
||||
$body->setAutocomplete(true);
|
||||
$body->setLocationId($this->square_driver->company_gateway->getConfigField('locationId'));
|
||||
|
@ -18,6 +18,7 @@ use App\Jobs\Invoice\InvoiceWorkflowSettings;
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
use App\Jobs\Payment\EmailPayment;
|
||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\TransactionEvent;
|
||||
@ -99,10 +100,15 @@ class MarkPaid extends AbstractService
|
||||
$payment->ledger()
|
||||
->updatePaymentBalance($payment->amount * -1);
|
||||
|
||||
$this->invoice->client->fresh();
|
||||
$this->invoice->client->paid_to_date += $payment->amount;
|
||||
$this->invoice->client->balance += $payment->amount * -1;
|
||||
$this->invoice->client->push();
|
||||
\DB::connection(config('database.default'))->transaction(function () use($payment){
|
||||
|
||||
/* Get the last record for the client and set the current balance*/
|
||||
$client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first();
|
||||
$client->paid_to_date += $payment->amount;
|
||||
$client->balance += $payment->amount * -1;
|
||||
$client->save();
|
||||
|
||||
}, 1);
|
||||
|
||||
$this->invoice = $this->invoice
|
||||
->service()
|
||||
|
@ -57,17 +57,22 @@ class MarkSent extends AbstractService
|
||||
->service()
|
||||
->applyNumber()
|
||||
->setDueDate()
|
||||
// ->deletePdf() //08-01-2022
|
||||
->touchPdf() //08-01-2022
|
||||
->touchPdf()
|
||||
->setReminder()
|
||||
->save();
|
||||
|
||||
/*Adjust client balance*/
|
||||
$this->client->fresh();
|
||||
$this->client->balance += $adjustment;
|
||||
$this->client->save();
|
||||
|
||||
|
||||
\DB::connection(config('database.default'))->transaction(function () use($adjustment){
|
||||
|
||||
/* Get the last record for the client and set the current balance*/
|
||||
$client = Client::where('id', $this->client->id)->lockForUpdate()->first();
|
||||
$client->balance += $adjustment;
|
||||
$client->save();
|
||||
|
||||
}, 1);
|
||||
|
||||
$this->invoice->markInvitationsSent();
|
||||
|
||||
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
@ -225,10 +225,13 @@ class Design extends BaseDesign
|
||||
public function entityDetails(): array
|
||||
{
|
||||
if ($this->type === 'statement') {
|
||||
|
||||
$s_date = $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale());
|
||||
|
||||
return [
|
||||
['element' => 'tr', 'properties' => [], 'elements' => [
|
||||
['element' => 'th', 'properties' => [], 'content' => ctrans('texts.statement_date')],
|
||||
['element' => 'th', 'properties' => [], 'content' => $this->options['end_date'] ?? ''],
|
||||
['element' => 'th', 'properties' => [], 'content' => $s_date ?? ''],
|
||||
]],
|
||||
['element' => 'tr', 'properties' => [], 'elements' => [
|
||||
['element' => 'th', 'properties' => [], 'content' => '$balance_due_label'],
|
||||
|
@ -176,7 +176,9 @@ trait ClientGroupSettingsSaver
|
||||
if (! property_exists($settings, $key)) {
|
||||
continue;
|
||||
} elseif ($this->checkAttribute($value, $settings->{$key})) {
|
||||
if (substr($key, -3) == '_id') {
|
||||
if (substr($key, -3) == '_id'||
|
||||
($key == 'payment_terms' && property_exists($settings, 'payment_terms') && strlen($settings->{$key}) >= 1) ||
|
||||
($key == 'valid_until' && property_exists($settings, 'valid_until') && strlen($settings->{$key}) >= 1)) {
|
||||
settype($settings->{$key}, 'string');
|
||||
} else {
|
||||
settype($settings->{$key}, $value);
|
||||
|
@ -63,8 +63,19 @@ trait CompanySettingsSaver
|
||||
{
|
||||
//this pass will handle any null values that are in the translations
|
||||
foreach ($settings->translations as $key => $value) {
|
||||
if (is_null($settings->translations[$key])) {
|
||||
$settings->translations[$key] = '';
|
||||
|
||||
if(is_array($settings->translations))
|
||||
{
|
||||
if (is_null($settings->translations[$key])) {
|
||||
$settings->translations[$key] = '';
|
||||
}
|
||||
}
|
||||
elseif(is_object($settings->translations)){
|
||||
|
||||
if (is_null($settings->translations->{$key})) {
|
||||
$settings->translations->{$key} = '';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => '5.3.81',
|
||||
'app_tag' => '5.3.81',
|
||||
'app_version' => '5.3.82',
|
||||
'app_tag' => '5.3.82',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\ClientGroupSettingsSaver;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ClientSettingsParseForTypes extends Migration
|
||||
{
|
||||
use ClientGroupSettingsSaver;
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
|
||||
if(Ninja::isSelfHost())
|
||||
{
|
||||
|
||||
Client::cursor()->each( function ($client) {
|
||||
$entity_settings = $this->checkSettingType($client->settings);
|
||||
$entity_settings->md5 = md5(time());
|
||||
$client->settings = $entity_settings;
|
||||
$client->save();
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
4
public/flutter_service_worker.js
vendored
4
public/flutter_service_worker.js
vendored
@ -3,8 +3,8 @@ const MANIFEST = 'flutter-app-manifest';
|
||||
const TEMP = 'flutter-temp-cache';
|
||||
const CACHE_NAME = 'flutter-app-cache';
|
||||
const RESOURCES = {
|
||||
"main.dart.js": "490e9bf677a08a199d133d81b6284ae3",
|
||||
"/": "76a4ee7a4c831007fe570334d3ae66d9",
|
||||
"main.dart.js": "895b4896a670fcbc9996783d79fa4c8b",
|
||||
"/": "c03cfe19a48dcd9ed80698d608a5745a",
|
||||
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
||||
"assets/fonts/MaterialIcons-Regular.otf": "7e7a6cccddf6d7b20012a548461d5d81",
|
||||
"assets/AssetManifest.json": "38d9aea341601f3a5c6fa7b5a1216ea5",
|
||||
|
60009
public/main.dart.js
vendored
60009
public/main.dart.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
239725
public/main.foss.dart.js
vendored
239725
public/main.foss.dart.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
58255
public/main.html.dart.js
vendored
58255
public/main.html.dart.js
vendored
File diff suppressed because one or more lines are too long
237870
public/main.next.dart.js
vendored
237870
public/main.next.dart.js
vendored
File diff suppressed because one or more lines are too long
220
public/main.profile.dart.js
vendored
220
public/main.profile.dart.js
vendored
File diff suppressed because one or more lines are too long
@ -152,7 +152,6 @@
|
||||
|
||||
<script defer src="{{ $path }}?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||
|
||||
|
||||
<center style="padding-top: 150px" id="loader">
|
||||
<div class="loader"></div>
|
||||
</center>
|
||||
|
@ -22,6 +22,7 @@
|
||||
<input type="hidden" name="token">
|
||||
<input type="hidden" name="sourceId" id="sourceId">
|
||||
<input type="hidden" name="verificationToken" id="verificationToken">
|
||||
<input type="hidden" name="idempotencyKey" value="{{ \Illuminate\Support\Str::uuid() }}">
|
||||
</form>
|
||||
|
||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||
|
@ -1426,7 +1426,7 @@ class PaymentTest extends TestCase
|
||||
|
||||
|
||||
$this->assertEquals(10, $this->invoice->balance);
|
||||
$this->assertEquals(10, $this->invoice->client->balance);
|
||||
$this->assertEquals(10, $this->invoice->client->fresh()->balance);
|
||||
|
||||
$this->invoice->service()->markPaid()->save();
|
||||
|
||||
|
@ -187,7 +187,7 @@ class CompanyLedgerTest extends TestCase
|
||||
|
||||
$invoice_ledger = $invoice->company_ledger->sortByDesc('id')->first();
|
||||
|
||||
$this->assertEquals($invoice_ledger->balance, $invoice->client->balance);
|
||||
$this->assertEquals($invoice_ledger->balance, $this->client->balance);
|
||||
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||
|
||||
/* Test adding another invoice */
|
||||
@ -203,10 +203,10 @@ class CompanyLedgerTest extends TestCase
|
||||
$invoice->service()->markSent()->save();
|
||||
|
||||
//client balance should = 20
|
||||
$this->assertEquals($invoice->client->balance, 20);
|
||||
$this->assertEquals($this->client->fresh()->balance, 20);
|
||||
$invoice_ledger = $invoice->company_ledger->sortByDesc('id')->first();
|
||||
|
||||
$this->assertEquals($invoice_ledger->balance, $invoice->client->balance);
|
||||
$this->assertEquals($invoice_ledger->balance, $this->client->fresh()->balance);
|
||||
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||
|
||||
/* Test making a payment */
|
||||
|
Loading…
x
Reference in New Issue
Block a user