mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
bf75051ade
@ -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\UpdateInvoiceRequest;
|
||||||
use App\Http\Requests\Invoice\UploadInvoiceRequest;
|
use App\Http\Requests\Invoice\UploadInvoiceRequest;
|
||||||
use App\Jobs\Entity\EmailEntity;
|
use App\Jobs\Entity\EmailEntity;
|
||||||
|
use App\Jobs\Invoice\BulkInvoiceJob;
|
||||||
use App\Jobs\Invoice\StoreInvoice;
|
use App\Jobs\Invoice\StoreInvoice;
|
||||||
use App\Jobs\Invoice\ZipInvoices;
|
use App\Jobs\Invoice\ZipInvoices;
|
||||||
use App\Jobs\Ninja\TransactionLog;
|
use App\Jobs\Ninja\TransactionLog;
|
||||||
@ -747,23 +748,14 @@ class InvoiceController extends BaseController
|
|||||||
case 'email':
|
case 'email':
|
||||||
//check query parameter for email_type and set the template else use calculateTemplate
|
//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'))) {
|
if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) {
|
||||||
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
|
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
|
||||||
} else {
|
} else {
|
||||||
$this->reminder_template = $invoice->calculateTemplate('invoice');
|
$this->reminder_template = $invoice->calculateTemplate('invoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
//touch reminder1,2,3_sent + last_sent here if the email is a reminder.
|
BulkInvoiceJob::dispatch($invoice, $this->reminder_template);
|
||||||
//$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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $bulk) {
|
if (! $bulk) {
|
||||||
return response()->json(['message' => 'email sent'], 200);
|
return response()->json(['message' => 'email sent'], 200);
|
||||||
|
@ -36,7 +36,7 @@ class CreateAccountRequest extends Request
|
|||||||
return [
|
return [
|
||||||
'first_name' => 'string|max:100',
|
'first_name' => 'string|max:100',
|
||||||
'last_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' => 'bail|required|email:rfc,dns',
|
||||||
// 'email' => new NewUniqueUserRule(),
|
// 'email' => new NewUniqueUserRule(),
|
||||||
'email' => ['required', 'email:rfc,dns', new NewUniqueUserRule],
|
'email' => ['required', 'email:rfc,dns', new NewUniqueUserRule],
|
||||||
|
@ -36,7 +36,8 @@ class StoreClientRequest extends Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{nlog($this->input);
|
{
|
||||||
|
|
||||||
if ($this->input('documents') && is_array($this->input('documents'))) {
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
$documents = count($this->input('documents'));
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class LoginRequest extends Request
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required',
|
'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;
|
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
|
public static function findAndSetDbByAccountKey($account_key) :bool
|
||||||
{
|
{
|
||||||
$current_db = config('database.default');
|
$current_db = config('database.default');
|
||||||
@ -332,6 +348,22 @@ class MultiDB
|
|||||||
return false;
|
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)
|
public static function findAndSetDbByDomain($query_array)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -234,6 +234,9 @@ class GoCardlessPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
|
nlog("GoCardless Event");
|
||||||
|
nlog($request->all());
|
||||||
|
|
||||||
|
|
||||||
if(!is_array($request->events) || !is_object($request->events)){
|
if(!is_array($request->events) || !is_object($request->events)){
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ use App\Jobs\Invoice\InvoiceWorkflowSettings;
|
|||||||
use App\Jobs\Ninja\TransactionLog;
|
use App\Jobs\Ninja\TransactionLog;
|
||||||
use App\Jobs\Payment\EmailPayment;
|
use App\Jobs\Payment\EmailPayment;
|
||||||
use App\Libraries\Currency\Conversion\CurrencyApi;
|
use App\Libraries\Currency\Conversion\CurrencyApi;
|
||||||
|
use App\Models\Client;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\TransactionEvent;
|
use App\Models\TransactionEvent;
|
||||||
@ -99,10 +100,15 @@ class MarkPaid extends AbstractService
|
|||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
->updatePaymentBalance($payment->amount * -1);
|
->updatePaymentBalance($payment->amount * -1);
|
||||||
|
|
||||||
$this->invoice->client->fresh();
|
\DB::connection(config('database.default'))->transaction(function () use($payment){
|
||||||
$this->invoice->client->paid_to_date += $payment->amount;
|
|
||||||
$this->invoice->client->balance += $payment->amount * -1;
|
/* Get the last record for the client and set the current balance*/
|
||||||
$this->invoice->client->push();
|
$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
|
$this->invoice = $this->invoice
|
||||||
->service()
|
->service()
|
||||||
|
@ -57,16 +57,21 @@ class MarkSent extends AbstractService
|
|||||||
->service()
|
->service()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->setDueDate()
|
->setDueDate()
|
||||||
// ->deletePdf() //08-01-2022
|
->touchPdf()
|
||||||
->touchPdf() //08-01-2022
|
|
||||||
->setReminder()
|
->setReminder()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
/*Adjust client balance*/
|
/*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();
|
$this->invoice->markInvitationsSent();
|
||||||
|
|
||||||
|
@ -225,10 +225,13 @@ class Design extends BaseDesign
|
|||||||
public function entityDetails(): array
|
public function entityDetails(): array
|
||||||
{
|
{
|
||||||
if ($this->type === 'statement') {
|
if ($this->type === 'statement') {
|
||||||
|
|
||||||
|
$s_date = $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale());
|
||||||
|
|
||||||
return [
|
return [
|
||||||
['element' => 'tr', 'properties' => [], 'elements' => [
|
['element' => 'tr', 'properties' => [], 'elements' => [
|
||||||
['element' => 'th', 'properties' => [], 'content' => ctrans('texts.statement_date')],
|
['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' => 'tr', 'properties' => [], 'elements' => [
|
||||||
['element' => 'th', 'properties' => [], 'content' => '$balance_due_label'],
|
['element' => 'th', 'properties' => [], 'content' => '$balance_due_label'],
|
||||||
|
@ -176,7 +176,9 @@ trait ClientGroupSettingsSaver
|
|||||||
if (! property_exists($settings, $key)) {
|
if (! property_exists($settings, $key)) {
|
||||||
continue;
|
continue;
|
||||||
} elseif ($this->checkAttribute($value, $settings->{$key})) {
|
} 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');
|
settype($settings->{$key}, 'string');
|
||||||
} else {
|
} else {
|
||||||
settype($settings->{$key}, $value);
|
settype($settings->{$key}, $value);
|
||||||
|
@ -63,8 +63,19 @@ trait CompanySettingsSaver
|
|||||||
{
|
{
|
||||||
//this pass will handle any null values that are in the translations
|
//this pass will handle any null values that are in the translations
|
||||||
foreach ($settings->translations as $key => $value) {
|
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),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.3.81',
|
'app_version' => '5.3.82',
|
||||||
'app_tag' => '5.3.81',
|
'app_tag' => '5.3.82',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'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()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
@ -152,7 +152,6 @@
|
|||||||
|
|
||||||
<script defer src="{{ $path }}?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
<script defer src="{{ $path }}?v={{ config('ninja.app_version') }}" type="application/javascript"></script>
|
||||||
|
|
||||||
|
|
||||||
<center style="padding-top: 150px" id="loader">
|
<center style="padding-top: 150px" id="loader">
|
||||||
<div class="loader"></div>
|
<div class="loader"></div>
|
||||||
</center>
|
</center>
|
||||||
|
@ -1426,7 +1426,7 @@ class PaymentTest extends TestCase
|
|||||||
|
|
||||||
|
|
||||||
$this->assertEquals(10, $this->invoice->balance);
|
$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();
|
$this->invoice->service()->markPaid()->save();
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class CompanyLedgerTest extends TestCase
|
|||||||
|
|
||||||
$invoice_ledger = $invoice->company_ledger->sortByDesc('id')->first();
|
$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);
|
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||||
|
|
||||||
/* Test adding another invoice */
|
/* Test adding another invoice */
|
||||||
@ -203,10 +203,10 @@ class CompanyLedgerTest extends TestCase
|
|||||||
$invoice->service()->markSent()->save();
|
$invoice->service()->markSent()->save();
|
||||||
|
|
||||||
//client balance should = 20
|
//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();
|
$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);
|
$this->assertEquals($invoice->client->paid_to_date, 0);
|
||||||
|
|
||||||
/* Test making a payment */
|
/* Test making a payment */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user