Merge branch 'v5-develop' of https://github.com/invoiceninja/invoiceninja into feature-brevo

This commit is contained in:
paulwer 2024-01-20 08:15:40 +01:00
commit 04be097edd
1279 changed files with 302659 additions and 291513 deletions

View File

@ -1 +1 @@
5.8.8 5.8.12

View File

@ -15,6 +15,7 @@ use App;
use App\Factory\ClientContactFactory; use App\Factory\ClientContactFactory;
use App\Factory\VendorContactFactory; use App\Factory\VendorContactFactory;
use App\Jobs\Company\CreateCompanyToken; use App\Jobs\Company\CreateCompanyToken;
use App\Libraries\MultiDB;
use App\Models\Account; use App\Models\Account;
use App\Models\BankTransaction; use App\Models\BankTransaction;
use App\Models\Client; use App\Models\Client;
@ -128,6 +129,7 @@ class CheckData extends Command
$this->checkUserState(); $this->checkUserState();
$this->checkContactEmailAndSendEmailStatus(); $this->checkContactEmailAndSendEmailStatus();
$this->checkPaymentCurrency(); $this->checkPaymentCurrency();
$this->checkSubdomainsSet();
if (Ninja::isHosted()) { if (Ninja::isHosted()) {
$this->checkAccountStatuses(); $this->checkAccountStatuses();
@ -1019,6 +1021,24 @@ class CheckData extends Command
} }
} }
public function checkSubdomainsSet()
{
if(Ninja::isSelfHost()) {
return;
}
Company::query()
->whereNull('subdomain')
->orWhere('subdomain', '')
->cursor()
->each(function ($c) {
$c->subdomain = MultiDB::randomSubdomainGenerator();
$c->save();
});
}
public function checkPaymentCurrency() public function checkPaymentCurrency()
{ {
$p = Payment::with('company', 'client') $p = Payment::with('company', 'client')
@ -1028,8 +1048,9 @@ class CheckData extends Command
$this->logMessage($p->count() . " Payments with No currency set"); $this->logMessage($p->count() . " Payments with No currency set");
if($p->count() != 0) if($p->count() != 0) {
$this->isValid = false; $this->isValid = false;
}
if ($this->option('fix') == 'true') { if ($this->option('fix') == 'true') {

View File

@ -29,7 +29,8 @@ use Illuminate\Support\Str;
class CreateAccount extends Command class CreateAccount extends Command
{ {
use MakesHash, GeneratesCounter; use MakesHash;
use GeneratesCounter;
/** /**
* @var string * @var string
@ -97,7 +98,7 @@ class CreateAccount extends Command
'phone' => '', 'phone' => '',
]); ]);
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $user->id; $company_token->user_id = $user->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;

View File

@ -61,7 +61,8 @@ use stdClass;
class CreateSingleAccount extends Command class CreateSingleAccount extends Command
{ {
use MakesHash, GeneratesCounter; use MakesHash;
use GeneratesCounter;
protected $description = 'Create Single Sample Account'; protected $description = 'Create Single Sample Account';
@ -188,7 +189,7 @@ class CreateSingleAccount extends Command
]); ]);
} }
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $user->id; $company_token->user_id = $user->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;
@ -801,7 +802,7 @@ class CreateSingleAccount extends Command
private function createGateways($company, $user) private function createGateways($company, $user)
{ {
if (config('ninja.testvars.stripe') && ($this->gateway == 'all' || $this->gateway == 'stripe')) { if (config('ninja.testvars.stripe') && ($this->gateway == 'all' || $this->gateway == 'stripe')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23'; $cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
@ -814,15 +815,15 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.paypal') && ($this->gateway == 'all' || $this->gateway == 'paypal')) { if (config('ninja.testvars.paypal') && ($this->gateway == 'all' || $this->gateway == 'paypal')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e'; $cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e';
@ -835,15 +836,15 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.paypal_rest') && ($this->gateway == 'all' || $this->gateway == 'paypal_rest')) { if (config('ninja.testvars.paypal_rest') && ($this->gateway == 'all' || $this->gateway == 'paypal_rest')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '80af24a6a691230bbec33e930ab40665'; $cg->gateway_key = '80af24a6a691230bbec33e930ab40665';
@ -856,8 +857,8 @@ class CreateSingleAccount extends Command
// $gateway_types = $cg->driver()->gatewayTypes(); // $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{3} = new FeesAndLimits; $fees_and_limits->{3} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
@ -866,7 +867,7 @@ class CreateSingleAccount extends Command
if (config('ninja.testvars.checkout') && ($this->gateway == 'all' || $this->gateway == 'checkout')) { if (config('ninja.testvars.checkout') && ($this->gateway == 'all' || $this->gateway == 'checkout')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456'; $cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
@ -877,17 +878,17 @@ class CreateSingleAccount extends Command
$cg->config = encrypt(config('ninja.testvars.checkout')); $cg->config = encrypt(config('ninja.testvars.checkout'));
$cg->save(); $cg->save();
$gateway_types = $cg->driver(new Client)->gatewayTypes(); $gateway_types = $cg->driver(new Client())->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.authorize') && ($this->gateway == 'all' || $this->gateway == 'authorizenet')) { if (config('ninja.testvars.authorize') && ($this->gateway == 'all' || $this->gateway == 'authorizenet')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb'; $cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
@ -898,17 +899,17 @@ class CreateSingleAccount extends Command
$cg->config = encrypt(config('ninja.testvars.authorize')); $cg->config = encrypt(config('ninja.testvars.authorize'));
$cg->save(); $cg->save();
$gateway_types = $cg->driver(new Client)->gatewayTypes(); $gateway_types = $cg->driver(new Client())->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.wepay') && ($this->gateway == 'all' || $this->gateway == 'wepay')) { if (config('ninja.testvars.wepay') && ($this->gateway == 'all' || $this->gateway == 'wepay')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '8fdeed552015b3c7b44ed6c8ebd9e992'; $cg->gateway_key = '8fdeed552015b3c7b44ed6c8ebd9e992';
@ -921,15 +922,15 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.braintree') && ($this->gateway == 'all' || $this->gateway == 'braintree')) { if (config('ninja.testvars.braintree') && ($this->gateway == 'all' || $this->gateway == 'braintree')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = 'f7ec488676d310683fb51802d076d713'; $cg->gateway_key = 'f7ec488676d310683fb51802d076d713';
@ -942,8 +943,8 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
@ -951,7 +952,7 @@ class CreateSingleAccount extends Command
if (config('ninja.testvars.paytrace.decrypted') && ($this->gateway == 'all' || $this->gateway == 'paytrace')) { if (config('ninja.testvars.paytrace.decrypted') && ($this->gateway == 'all' || $this->gateway == 'paytrace')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = 'bbd736b3254b0aabed6ad7fda1298c88'; $cg->gateway_key = 'bbd736b3254b0aabed6ad7fda1298c88';
@ -966,15 +967,15 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.mollie') && ($this->gateway == 'all' || $this->gateway == 'mollie')) { if (config('ninja.testvars.mollie') && ($this->gateway == 'all' || $this->gateway == 'mollie')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '1bd651fb213ca0c9d66ae3c336dc77e8'; $cg->gateway_key = '1bd651fb213ca0c9d66ae3c336dc77e8';
@ -987,15 +988,15 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();
} }
if (config('ninja.testvars.square') && ($this->gateway == 'all' || $this->gateway == 'square')) { if (config('ninja.testvars.square') && ($this->gateway == 'all' || $this->gateway == 'square')) {
$cg = new CompanyGateway; $cg = new CompanyGateway();
$cg->company_id = $company->id; $cg->company_id = $company->id;
$cg->user_id = $user->id; $cg->user_id = $user->id;
$cg->gateway_key = '65faab2ab6e3223dbe848b1686490baz'; $cg->gateway_key = '65faab2ab6e3223dbe848b1686490baz';
@ -1008,8 +1009,8 @@ class CreateSingleAccount extends Command
$gateway_types = $cg->driver()->gatewayTypes(); $gateway_types = $cg->driver()->gatewayTypes();
$fees_and_limits = new stdClass; $fees_and_limits = new stdClass();
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits; $fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
$cg->fees_and_limits = $fees_and_limits; $cg->fees_and_limits = $fees_and_limits;
$cg->save(); $cg->save();

View File

@ -47,7 +47,8 @@ use Illuminate\Support\Str;
class CreateTestData extends Command class CreateTestData extends Command
{ {
use MakesHash, GeneratesCounter; use MakesHash;
use GeneratesCounter;
/** /**
* @var string * @var string
@ -115,7 +116,7 @@ class CreateTestData extends Command
]); ]);
} }
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $user->id; $company_token->user_id = $user->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;
@ -210,7 +211,7 @@ class CreateTestData extends Command
]); ]);
} }
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $user->id; $company_token->user_id = $user->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;
@ -307,7 +308,7 @@ class CreateTestData extends Command
]); ]);
} }
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $user->id; $company_token->user_id = $user->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;

View File

@ -54,7 +54,9 @@ use Illuminate\Support\Str;
class DemoMode extends Command class DemoMode extends Command
{ {
use MakesHash, GeneratesCounter, AppSetup; use MakesHash;
use GeneratesCounter;
use AppSetup;
protected $signature = 'ninja:demo-mode'; protected $signature = 'ninja:demo-mode';
@ -151,7 +153,7 @@ class DemoMode extends Command
(new CreateCompanyPaymentTerms($company, $user))->handle(); (new CreateCompanyPaymentTerms($company, $user))->handle();
(new CreateCompanyTaskStatuses($company, $user))->handle(); (new CreateCompanyTaskStatuses($company, $user))->handle();
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $user->id; $company_token->user_id = $user->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;
@ -182,7 +184,7 @@ class DemoMode extends Command
'email_verified_at' => now(), 'email_verified_at' => now(),
]); ]);
$company_token = new CompanyToken; $company_token = new CompanyToken();
$company_token->user_id = $u2->id; $company_token->user_id = $u2->id;
$company_token->company_id = $company->id; $company_token->company_id = $company->id;
$company_token->account_id = $account->id; $company_token->account_id = $account->id;

View File

@ -73,7 +73,7 @@ class DesignUpdate extends Command
$invoice_design = new \App\Services\PdfMaker\Design(strtolower($design->name)); $invoice_design = new \App\Services\PdfMaker\Design(strtolower($design->name));
$invoice_design->document(); $invoice_design->document();
$design_object = new stdClass; $design_object = new stdClass();
$design_object->includes = $invoice_design->getSectionHTML('style'); $design_object->includes = $invoice_design->getSectionHTML('style');
$design_object->header = $invoice_design->getSectionHTML('header'); $design_object->header = $invoice_design->getSectionHTML('header');
$design_object->body = $invoice_design->getSectionHTML('body'); $design_object->body = $invoice_design->getSectionHTML('body');

View File

@ -28,7 +28,8 @@ use Illuminate\Support\Facades\App;
//@deprecated 27-11-2022 - only ever should be used for testing //@deprecated 27-11-2022 - only ever should be used for testing
class SendRemindersCron extends Command class SendRemindersCron extends Command
{ {
use MakesReminders, MakesDates; use MakesReminders;
use MakesDates;
/** /**
* The name and signature of the console command. * The name and signature of the console command.
@ -158,7 +159,7 @@ class SendRemindersCron extends Command
$fee += round($invoice->balance * $percent / 100, 2); $fee += round($invoice->balance * $percent / 100, 2);
} }
$invoice_item = new InvoiceItem; $invoice_item = new InvoiceItem();
$invoice_item->type_id = '5'; $invoice_item->type_id = '5';
$invoice_item->product_key = ctrans('texts.fee'); $invoice_item->product_key = ctrans('texts.fee');
$invoice_item->notes = ctrans('texts.late_fee_added', ['date' => $this->translateDate(now()->startOfDay(), $invoice->client->date_format(), $invoice->client->locale())]); $invoice_item->notes = ctrans('texts.late_fee_added', ['date' => $this->translateDate(now()->startOfDay(), $invoice->client->date_format(), $invoice->client->locale())]);

View File

@ -53,7 +53,7 @@ class SendTestEmails extends Command
$to_user = User::first(); $to_user = User::first();
$nmo = new NinjaMailerObject; $nmo = new NinjaMailerObject();
$nmo->mailable = new TestMailServer('Email Server Works!', config('mail.from.address')); $nmo->mailable = new TestMailServer('Email Server Works!', config('mail.from.address'));
$nmo->company = $to_user->account->companies()->first(); $nmo->company = $to_user->account->companies()->first();
$nmo->settings = $to_user->account->companies()->first()->settings; $nmo->settings = $to_user->account->companies()->first()->settings;

View File

@ -58,6 +58,7 @@ class TranslationsExport extends Command
'it', 'it',
'ja', 'ja',
'km_KH', 'km_KH',
'lo_LA',
'lt', 'lt',
'lv_LV', 'lv_LV',
'mk_MK', 'mk_MK',
@ -137,6 +138,10 @@ class TranslationsExport extends Command
Storage::disk('local')->makeDirectory("lang/{$lang}"); Storage::disk('local')->makeDirectory("lang/{$lang}");
$translations = Lang::getLoader()->load($lang, 'texts'); $translations = Lang::getLoader()->load($lang, 'texts');
foreach($translations as $key => $value) {
$translations[$key] = html_entity_decode($value);
}
Storage::disk('local')->put("lang/{$lang}/{$lang}.json", json_encode(Arr::dot($translations), JSON_UNESCAPED_UNICODE)); Storage::disk('local')->put("lang/{$lang}/{$lang}.json", json_encode(Arr::dot($translations), JSON_UNESCAPED_UNICODE));
} }
} }

View File

@ -47,58 +47,58 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
/* Check for the latest version of Invoice Ninja */ /* Check for the latest version of Invoice Ninja */
$schedule->job(new VersionCheck)->daily(); $schedule->job(new VersionCheck())->daily();
/* Returns the number of jobs in the queue */ /* Returns the number of jobs in the queue */
$schedule->job(new QueueSize)->everyFiveMinutes()->withoutOverlapping()->name('queue-size-job')->onOneServer(); $schedule->job(new QueueSize())->everyFiveMinutes()->withoutOverlapping()->name('queue-size-job')->onOneServer();
/* Send reminders */ /* Send reminders */
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping()->name('reminder-job')->onOneServer(); $schedule->job(new ReminderJob())->hourly()->withoutOverlapping()->name('reminder-job')->onOneServer();
/* Sends recurring invoices*/ /* Sends recurring invoices*/
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping()->name('recurring-invoice-job')->onOneServer(); $schedule->job(new RecurringInvoicesCron())->hourly()->withoutOverlapping()->name('recurring-invoice-job')->onOneServer();
/* Checks for scheduled tasks */ /* Checks for scheduled tasks */
$schedule->job(new TaskScheduler())->hourlyAt(10)->withoutOverlapping()->name('task-scheduler-job')->onOneServer(); $schedule->job(new TaskScheduler())->hourlyAt(10)->withoutOverlapping()->name('task-scheduler-job')->onOneServer();
/* Stale Invoice Cleanup*/ /* Stale Invoice Cleanup*/
$schedule->job(new CleanStaleInvoiceOrder)->hourlyAt(30)->withoutOverlapping()->name('stale-invoice-job')->onOneServer(); $schedule->job(new CleanStaleInvoiceOrder())->hourlyAt(30)->withoutOverlapping()->name('stale-invoice-job')->onOneServer();
/* Stale Invoice Cleanup*/ /* Stale Invoice Cleanup*/
$schedule->job(new UpdateCalculatedFields)->hourlyAt(40)->withoutOverlapping()->name('update-calculated-fields-job')->onOneServer(); $schedule->job(new UpdateCalculatedFields())->hourlyAt(40)->withoutOverlapping()->name('update-calculated-fields-job')->onOneServer();
/* Checks for large companies and marked them as is_large */ /* Checks for large companies and marked them as is_large */
$schedule->job(new CompanySizeCheck)->dailyAt('23:20')->withoutOverlapping()->name('company-size-job')->onOneServer(); $schedule->job(new CompanySizeCheck())->dailyAt('23:20')->withoutOverlapping()->name('company-size-job')->onOneServer();
/* Pulls in the latest exchange rates */ /* Pulls in the latest exchange rates */
$schedule->job(new UpdateExchangeRates)->dailyAt('23:30')->withoutOverlapping()->name('exchange-rate-job')->onOneServer(); $schedule->job(new UpdateExchangeRates())->dailyAt('23:30')->withoutOverlapping()->name('exchange-rate-job')->onOneServer();
/* Runs cleanup code for subscriptions */ /* Runs cleanup code for subscriptions */
$schedule->job(new SubscriptionCron)->dailyAt('00:01')->withoutOverlapping()->name('subscription-job')->onOneServer(); $schedule->job(new SubscriptionCron())->dailyAt('00:01')->withoutOverlapping()->name('subscription-job')->onOneServer();
/* Sends recurring expenses*/ /* Sends recurring expenses*/
$schedule->job(new RecurringExpensesCron)->dailyAt('00:10')->withoutOverlapping()->name('recurring-expense-job')->onOneServer(); $schedule->job(new RecurringExpensesCron())->dailyAt('00:10')->withoutOverlapping()->name('recurring-expense-job')->onOneServer();
/* Checks the status of the scheduler */ /* Checks the status of the scheduler */
$schedule->job(new SchedulerCheck)->dailyAt('01:10')->withoutOverlapping(); $schedule->job(new SchedulerCheck())->dailyAt('01:10')->withoutOverlapping();
/* Checks and cleans redundant files */ /* Checks and cleans redundant files */
$schedule->job(new DiskCleanup)->dailyAt('02:10')->withoutOverlapping()->name('disk-cleanup-job')->onOneServer(); $schedule->job(new DiskCleanup())->dailyAt('02:10')->withoutOverlapping()->name('disk-cleanup-job')->onOneServer();
/* Performs system maintenance such as pruning the backup table */ /* Performs system maintenance such as pruning the backup table */
$schedule->job(new SystemMaintenance)->sundays()->at('02:30')->withoutOverlapping()->name('system-maintenance-job')->onOneServer(); $schedule->job(new SystemMaintenance())->sundays()->at('02:30')->withoutOverlapping()->name('system-maintenance-job')->onOneServer();
/* Fires notifications for expired Quotes */ /* Fires notifications for expired Quotes */
$schedule->job(new QuoteCheckExpired)->dailyAt('05:10')->withoutOverlapping()->name('quote-expired-job')->onOneServer(); $schedule->job(new QuoteCheckExpired())->dailyAt('05:10')->withoutOverlapping()->name('quote-expired-job')->onOneServer();
/* Performs auto billing */ /* Performs auto billing */
$schedule->job(new AutoBillCron)->dailyAt('06:20')->withoutOverlapping()->name('auto-bill-job')->onOneServer(); $schedule->job(new AutoBillCron())->dailyAt('06:20')->withoutOverlapping()->name('auto-bill-job')->onOneServer();
/* Fires webhooks for overdue Invoice */ /* Fires webhooks for overdue Invoice */
$schedule->job(new InvoiceCheckLateWebhook)->dailyAt('07:00')->withoutOverlapping()->name('invoice-overdue-job')->onOneServer(); $schedule->job(new InvoiceCheckLateWebhook())->dailyAt('07:00')->withoutOverlapping()->name('invoice-overdue-job')->onOneServer();
/* Pulls in bank transactions from third party services */ /* Pulls in bank transactions from third party services */
$schedule->job(new BankTransactionSync)->everyFourHours()->withoutOverlapping()->name('bank-trans-sync-job')->onOneServer(); $schedule->job(new BankTransactionSync())->everyFourHours()->withoutOverlapping()->name('bank-trans-sync-job')->onOneServer();
if (Ninja::isSelfHost()) { if (Ninja::isSelfHost()) {
$schedule->call(function () { $schedule->call(function () {
@ -108,10 +108,10 @@ class Kernel extends ConsoleKernel
/* Run hosted specific jobs */ /* Run hosted specific jobs */
if (Ninja::isHosted()) { if (Ninja::isHosted()) {
$schedule->job(new AdjustEmailQuota)->dailyAt('23:30')->withoutOverlapping(); $schedule->job(new AdjustEmailQuota())->dailyAt('23:30')->withoutOverlapping();
/* Checks ACH verification status and updates state to authorize when verified */ /* Checks ACH verification status and updates state to authorize when verified */
$schedule->job(new CheckACHStatus)->everySixHours()->withoutOverlapping()->name('ach-status-job')->onOneServer(); $schedule->job(new CheckACHStatus())->everySixHours()->withoutOverlapping()->name('ach-status-job')->onOneServer();
$schedule->command('ninja:check-data --database=db-ninja-01')->dailyAt('02:10')->withoutOverlapping()->name('check-data-db-1-job')->onOneServer(); $schedule->command('ninja:check-data --database=db-ninja-01')->dailyAt('02:10')->withoutOverlapping()->name('check-data-db-1-job')->onOneServer();

View File

@ -229,7 +229,7 @@ class CompanySettings extends BaseSettings
public $require_quote_signature = false; //@TODO ben to confirm public $require_quote_signature = false; //@TODO ben to confirm
//email settings //email settings
public $email_sending_method = 'default'; //enum 'default','gmail','office365' 'client_postmark', 'client_mailgun' , 'client_brevo' //@implemented public $email_sending_method = 'default'; //enum 'default','gmail','office365' 'client_postmark', 'client_mailgun', 'mailgun' //@implemented
public $gmail_sending_user_id = '0'; //@implemented public $gmail_sending_user_id = '0'; //@implemented
@ -860,7 +860,7 @@ class CompanySettings extends BaseSettings
*/ */
public static function notificationDefaults(): stdClass public static function notificationDefaults(): stdClass
{ {
$notification = new stdClass; $notification = new stdClass();
$notification->email = []; $notification->email = [];
$notification->email = ['invoice_sent_all']; $notification->email = ['invoice_sent_all'];
@ -876,7 +876,7 @@ class CompanySettings extends BaseSettings
*/ */
public static function notificationAdminDefaults(): stdClass public static function notificationAdminDefaults(): stdClass
{ {
$notification = new stdClass; $notification = new stdClass();
$notification->email = []; $notification->email = [];
$notification->email = ['invoice_sent_all']; $notification->email = ['invoice_sent_all'];

View File

@ -8,11 +8,11 @@
* *
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\DataMapper\Settings; namespace App\DataMapper\Settings;
class SettingsData class SettingsData
{ {
public bool $auto_archive_invoice = false; // @implemented public bool $auto_archive_invoice = false; // @implemented
public string $qr_iban = ''; //@implemented public string $qr_iban = ''; //@implemented

View File

@ -13,7 +13,6 @@ namespace App\DataMapper\Tax;
class TaxModel class TaxModel
{ {
/** @var string $seller_subregion */ /** @var string $seller_subregion */
public string $seller_subregion = 'CA'; public string $seller_subregion = 'CA';

View File

@ -22,7 +22,6 @@ use App\Models\Product;
*/ */
class Rule extends BaseRule implements RuleInterface class Rule extends BaseRule implements RuleInterface
{ {
/** @var string $seller_region */ /** @var string $seller_region */
public string $seller_region = 'US'; public string $seller_region = 'US';

View File

@ -14,7 +14,6 @@ namespace App\DataProviders;
class Domains class Domains
{ {
private static array $verify_domains = [ private static array $verify_domains = [
'0-00.usa.cc', '0-00.usa.cc',
'0-180.com', '0-180.com',

View File

@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class AccountCreated class AccountCreated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $user; public $user;

View File

@ -21,7 +21,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class StripeConnectFailure class StripeConnectFailure
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public Company $company, public string $db) public function __construct(public Company $company, public string $db)
{ {

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class ClientWasArchived class ClientWasArchived
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Client * @var Client

View File

@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
class CompanyDocumentsDeleted class CompanyDocumentsDeleted
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Company * @var Company

View File

@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class ContactLoggedIn class ContactLoggedIn
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $client_contact; public $client_contact;

View File

@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
class CreditWasArchived class CreditWasArchived
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $credit; public $credit;

View File

@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
class CreditWasCreated class CreditWasCreated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $credit; public $credit;

View File

@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
class CreditWasDeleted class CreditWasDeleted
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $credit; public $credit;

View File

@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
class CreditWasEmailed class CreditWasEmailed
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $invitation; public $invitation;

View File

@ -18,7 +18,9 @@ use Illuminate\Queue\SerializesModels;
class CreditWasEmailedAndFailed class CreditWasEmailedAndFailed
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $credit; public $credit;

View File

@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
class CreditWasUpdated class CreditWasUpdated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $credit; public $credit;

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class DesignWasArchived class DesignWasArchived
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public Design $design, public Company $company, public array $event_vars) public function __construct(public Design $design, public Company $company, public array $event_vars)
{ {

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class DocumentWasArchived class DocumentWasArchived
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Document * @var Document

View File

@ -24,7 +24,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class InvoiceWasCreated implements ShouldBroadcast class InvoiceWasCreated implements ShouldBroadcast
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Invoice * @var Invoice

View File

@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class InvoiceWasUpdated class InvoiceWasUpdated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Invoice * @var Invoice

View File

@ -20,7 +20,9 @@ use Illuminate\Queue\SerializesModels;
class MethodDeleted class MethodDeleted
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var ClientGatewayToken * @var ClientGatewayToken

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class PaymentWasEmailed class PaymentWasEmailed
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* Create a new event instance. * Create a new event instance.

View File

@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class PaymentWasEmailedAndFailed class PaymentWasEmailedAndFailed
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Payment * @var Payment

View File

@ -20,7 +20,9 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasApproved class QuoteWasApproved
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $contact; public $contact;

View File

@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class RecurringInvoiceWasUpdated class RecurringInvoiceWasUpdated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public RecurringInvoice $recurring_invoice, public Company $company, public array $event_vars) public function __construct(public RecurringInvoice $recurring_invoice, public Company $company, public array $event_vars)
{ {

View File

@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class RecurringQuoteWasUpdated class RecurringQuoteWasUpdated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public RecurringQuote $recurring_quote, public Company $company, public array $event_vars) public function __construct(public RecurringQuote $recurring_quote, public Company $company, public array $event_vars)

View File

@ -10,7 +10,9 @@ use Illuminate\Queue\SerializesModels;
class SubscriptionWasCreated class SubscriptionWasCreated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* @var Subscription * @var Subscription

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class UserLoggedIn class UserLoggedIn
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public User $user, public Company $company, public array $event_vars) public function __construct(public User $user, public Company $company, public array $event_vars)
{ {

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class UserWasArchived class UserWasArchived
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public User $user, public User $creating_user, public Company $company, public array $event_vars) public function __construct(public User $user, public User $creating_user, public Company $company, public array $event_vars)
{ {

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class UserWasCreated class UserWasCreated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public function __construct(public User $user, public User $creating_user, public Company $company, public array $event_vars, public $is_react = true) public function __construct(public User $user, public User $creating_user, public Company $company, public array $event_vars, public $is_react = true)
{ {

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class UserWasDeleted class UserWasDeleted
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $user; public $user;

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class UserWasRestored class UserWasRestored
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $user; public $user;

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class UserWasUpdated class UserWasUpdated
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
public $user; public $user;

View File

@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
*/ */
class VendorContactLoggedIn class VendorContactLoggedIn
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable;
use InteractsWithSockets;
use SerializesModels;
/** /**
* Create a new event instance. * Create a new event instance.

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -9,7 +9,6 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
namespace App\Exceptions; namespace App\Exceptions;
use Exception; use Exception;

View File

@ -25,7 +25,6 @@ use League\Csv\Writer;
class ActivityExport extends BaseExport class ActivityExport extends BaseExport
{ {
private $entity_transformer; private $entity_transformer;
public string $date_key = 'created_at'; public string $date_key = 'created_at';

View File

@ -25,7 +25,6 @@ use Illuminate\Database\Eloquent\Builder;
class ContactExport extends BaseExport class ContactExport extends BaseExport
{ {
private ClientTransformer $client_transformer; private ClientTransformer $client_transformer;
private ClientContactTransformer $contact_transformer; private ClientContactTransformer $contact_transformer;

View File

@ -24,7 +24,6 @@ use League\Csv\Writer;
class CreditExport extends BaseExport class CreditExport extends BaseExport
{ {
private CreditTransformer $credit_transformer; private CreditTransformer $credit_transformer;
private Decorator $decorator; private Decorator $decorator;

View File

@ -22,7 +22,6 @@ use League\Csv\Writer;
class DocumentExport extends BaseExport class DocumentExport extends BaseExport
{ {
private $entity_transformer; private $entity_transformer;
public string $date_key = 'created_at'; public string $date_key = 'created_at';

View File

@ -23,7 +23,6 @@ use League\Csv\Writer;
class ExpenseExport extends BaseExport class ExpenseExport extends BaseExport
{ {
private $expense_transformer; private $expense_transformer;
private Decorator $decorator; private Decorator $decorator;

View File

@ -23,7 +23,6 @@ use League\Csv\Writer;
class InvoiceItemExport extends BaseExport class InvoiceItemExport extends BaseExport
{ {
private $invoice_transformer; private $invoice_transformer;
public string $date_key = 'date'; public string $date_key = 'date';

View File

@ -37,6 +37,7 @@ class ProductSalesExport extends BaseExport
'product_key' => 'product_key', 'product_key' => 'product_key',
'notes' => 'notes', 'notes' => 'notes',
'quantity' => 'quantity', 'quantity' => 'quantity',
'currency' => 'currency',
'cost' => 'price', 'cost' => 'price',
'price' => 'cost', 'price' => 'cost',
'markup' => 'markup', 'markup' => 'markup',
@ -163,6 +164,7 @@ class ProductSalesExport extends BaseExport
private function buildRow($invoice, $invoice_item): array private function buildRow($invoice, $invoice_item): array
{ {
$transformed_entity = (array)$invoice_item; $transformed_entity = (array)$invoice_item;
$transformed_entity['price'] = ($invoice_item->product_cost ?? 1) * ($invoice->exchange_rate ?? 1) ;
$entity = []; $entity = [];
@ -171,6 +173,8 @@ class ProductSalesExport extends BaseExport
if (array_key_exists($key, $transformed_entity)) { if (array_key_exists($key, $transformed_entity)) {
$entity[$keyval] = $transformed_entity[$key]; $entity[$keyval] = $transformed_entity[$key];
} elseif($key == 'currency') {
$entity['currency'] = $invoice->client->currency()->code;
} else { } else {
$entity[$keyval] = ''; $entity[$keyval] = '';
} }
@ -184,9 +188,9 @@ class ProductSalesExport extends BaseExport
private function decorateAdvancedFields(Invoice $invoice, $entity): array private function decorateAdvancedFields(Invoice $invoice, $entity): array
{ {
$product = $this->getProduct($entity['product_key']);
$entity['cost'] = $product->cost ?? 0; //$product = $this->getProduct($entity['product_key']);
// $entity['cost'] = $product->cost ?? 0;
/** @var float $unit_cost */ /** @var float $unit_cost */
$unit_cost = $entity['cost'] == 0 ? 1 : $entity['cost']; $unit_cost = $entity['cost'] == 0 ? 1 : $entity['cost'];

View File

@ -23,7 +23,6 @@ use App\Transformers\PurchaseOrderTransformer;
class PurchaseOrderExport extends BaseExport class PurchaseOrderExport extends BaseExport
{ {
private $purchase_order_transformer; private $purchase_order_transformer;
public string $date_key = 'date'; public string $date_key = 'date';

View File

@ -23,7 +23,6 @@ use League\Csv\Writer;
class PurchaseOrderItemExport extends BaseExport class PurchaseOrderItemExport extends BaseExport
{ {
private $purchase_order_transformer; private $purchase_order_transformer;
public string $date_key = 'date'; public string $date_key = 'date';

View File

@ -23,7 +23,6 @@ use League\Csv\Writer;
class QuoteExport extends BaseExport class QuoteExport extends BaseExport
{ {
private $quote_transformer; private $quote_transformer;
public string $date_key = 'date'; public string $date_key = 'date';

View File

@ -23,7 +23,6 @@ use League\Csv\Writer;
class QuoteItemExport extends BaseExport class QuoteItemExport extends BaseExport
{ {
private $quote_transformer; private $quote_transformer;
public string $date_key = 'date'; public string $date_key = 'date';
@ -46,7 +45,7 @@ class QuoteItemExport extends BaseExport
$this->company = $company; $this->company = $company;
$this->input = $input; $this->input = $input;
$this->quote_transformer = new QuoteTransformer(); $this->quote_transformer = new QuoteTransformer();
$this->decorator = new Decorator; $this->decorator = new Decorator();
} }
public function init(): Builder public function init(): Builder

View File

@ -23,7 +23,6 @@ use League\Csv\Writer;
class RecurringInvoiceExport extends BaseExport class RecurringInvoiceExport extends BaseExport
{ {
private $invoice_transformer; private $invoice_transformer;
public string $date_key = 'date'; public string $date_key = 'date';
@ -120,8 +119,7 @@ class RecurringInvoiceExport extends BaseExport
$entity[$key] = $transformed_invoice[$parts[1]]; $entity[$key] = $transformed_invoice[$parts[1]];
} elseif($parts[0] == 'item') { } elseif($parts[0] == 'item') {
$entity[$key] = ''; $entity[$key] = '';
} } else {
else {
// nlog($key); // nlog($key);
$entity[$key] = $this->decorator->transform($key, $invoice); $entity[$key] = $this->decorator->transform($key, $invoice);
// $entity[$key] = ''; // $entity[$key] = '';

View File

@ -26,7 +26,6 @@ use League\Csv\Writer;
class TaskExport extends BaseExport class TaskExport extends BaseExport
{ {
private $entity_transformer; private $entity_transformer;
public string $date_key = 'created_at'; public string $date_key = 'created_at';
@ -120,7 +119,7 @@ class TaskExport extends BaseExport
$this->storage_array = []; $this->storage_array = [];
}); });
// nlog($this->storage_item_array);
return array_merge(['columns' => $header], $this->storage_item_array); return array_merge(['columns' => $header], $this->storage_item_array);
} }
@ -140,19 +139,11 @@ class TaskExport extends BaseExport
} elseif (in_array($key, ['task.start_date', 'task.end_date', 'task.duration'])) { } elseif (in_array($key, ['task.start_date', 'task.end_date', 'task.duration'])) {
$entity[$key] = ''; $entity[$key] = '';
} else { } else {
// nlog($key);
$entity[$key] = $this->decorator->transform($key, $task); $entity[$key] = $this->decorator->transform($key, $task);
// $entity[$key] = $this->resolveKey($key, $task, $this->entity_transformer);
} }
// $entity['task.start_date'] = '';
// $entity['task.end_date'] = '';
// $entity['task.duration'] = '';
} }
if (is_null($task->time_log) || (is_array(json_decode($task->time_log, 1)) && count(json_decode($task->time_log, 1)) == 0)) { if (is_null($task->time_log) || (is_array(json_decode($task->time_log, 1)) && count(json_decode($task->time_log, 1)) == 0)) {
$this->storage_array[] = $entity; $this->storage_array[] = $entity;
} else { } else {
@ -201,9 +192,9 @@ class TaskExport extends BaseExport
$this->storage_array[] = $entity; $this->storage_array[] = $entity;
unset($entity['task.start_date']); $entity['task.start_date'] = '';
unset($entity['task.end_date']); $entity['task.end_date'] = '';
unset($entity['task.duration']); $entity['task.duration'] = '';
} }
} }

View File

@ -24,7 +24,6 @@ use League\Csv\Writer;
class VendorExport extends BaseExport class VendorExport extends BaseExport
{ {
private $vendor_transformer; private $vendor_transformer;
private $contact_transformer; private $contact_transformer;

View File

@ -29,8 +29,7 @@ class ClientDecorator extends Decorator implements DecoratorInterface
if($client && method_exists($this, $key)) { if($client && method_exists($this, $key)) {
return $this->{$key}($client); return $this->{$key}($client);
} } elseif($client && $client->{$key}) {
elseif($client && $client->{$key}) {
return $client->{$key}; return $client->{$key};
} }

View File

@ -27,8 +27,7 @@ class ContactDecorator implements DecoratorInterface
if($contact && method_exists($this, $key)) { if($contact && method_exists($this, $key)) {
return $this->{$key}($contact); return $this->{$key}($contact);
} } elseif($contact && $contact->{$key}) {
elseif($contact && $contact->{$key}){
return $contact->{$key}; return $contact->{$key};
} }

View File

@ -13,7 +13,6 @@ namespace App\Export\Decorators;
class Decorator implements DecoratorInterface class Decorator implements DecoratorInterface
{ {
public function __construct() public function __construct()
{ {
} }

View File

@ -15,7 +15,6 @@ use App\Models\Payment;
class PaymentDecorator extends Decorator implements DecoratorInterface class PaymentDecorator extends Decorator implements DecoratorInterface
{ {
private $entity_key = 'payment'; private $entity_key = 'payment';
public function transform(string $key, $entity): mixed public function transform(string $key, $entity): mixed
@ -42,8 +41,7 @@ class PaymentDecorator extends Decorator implements DecoratorInterface
if($payment && method_exists($this, $key)) { if($payment && method_exists($this, $key)) {
return $this->{$key}($payment); return $this->{$key}($payment);
} } elseif($payment && $payment->{$key}) {
elseif($payment && $payment->{$key}){
return $payment->{$key}; return $payment->{$key};
} }

View File

@ -17,7 +17,7 @@ class BankIntegrationFactory
{ {
public static function create(int $company_id, int $user_id, int $account_id): BankIntegration public static function create(int $company_id, int $user_id, int $account_id): BankIntegration
{ {
$bank_integration = new BankIntegration; $bank_integration = new BankIntegration();
$bank_integration->account_id = $account_id; $bank_integration->account_id = $account_id;
$bank_integration->user_id = $user_id; $bank_integration->user_id = $user_id;
$bank_integration->company_id = $company_id; $bank_integration->company_id = $company_id;

View File

@ -17,7 +17,7 @@ class BankTransactionFactory
{ {
public static function create(int $company_id, int $user_id): BankTransaction public static function create(int $company_id, int $user_id): BankTransaction
{ {
$bank_transaction = new BankTransaction; $bank_transaction = new BankTransaction();
$bank_transaction->user_id = $user_id; $bank_transaction->user_id = $user_id;
$bank_transaction->company_id = $company_id; $bank_transaction->company_id = $company_id;

View File

@ -17,7 +17,7 @@ class BankTransactionRuleFactory
{ {
public static function create(int $company_id, int $user_id): BankTransactionRule public static function create(int $company_id, int $user_id): BankTransactionRule
{ {
$bank_transaction_rule = new BankTransactionRule; $bank_transaction_rule = new BankTransactionRule();
$bank_transaction_rule->user_id = $user_id; $bank_transaction_rule->user_id = $user_id;
$bank_transaction_rule->company_id = $company_id; $bank_transaction_rule->company_id = $company_id;

View File

@ -18,7 +18,7 @@ class ClientContactFactory
{ {
public static function create(int $company_id, int $user_id): ClientContact public static function create(int $company_id, int $user_id): ClientContact
{ {
$client_contact = new ClientContact; $client_contact = new ClientContact();
$client_contact->first_name = ''; $client_contact->first_name = '';
$client_contact->user_id = $user_id; $client_contact->user_id = $user_id;
$client_contact->company_id = $company_id; $client_contact->company_id = $company_id;

View File

@ -19,7 +19,7 @@ class ClientFactory
{ {
public static function create(int $company_id, int $user_id): Client public static function create(int $company_id, int $user_id): Client
{ {
$client = new Client; $client = new Client();
$client->company_id = $company_id; $client->company_id = $company_id;
$client->user_id = $user_id; $client->user_id = $user_id;
$client->name = ''; $client->name = '';

View File

@ -17,7 +17,7 @@ class ClientGatewayTokenFactory
{ {
public static function create(int $company_id): ClientGatewayToken public static function create(int $company_id): ClientGatewayToken
{ {
$client_gateway_token = new ClientGatewayToken; $client_gateway_token = new ClientGatewayToken();
$client_gateway_token->company_id = $company_id; $client_gateway_token->company_id = $company_id;
$client_gateway_token->is_default = false; $client_gateway_token->is_default = false;
$client_gateway_token->meta = ''; $client_gateway_token->meta = '';

View File

@ -29,7 +29,7 @@ class CompanyFactory
*/ */
public function create(int $account_id): Company public function create(int $account_id): Company
{ {
$company = new Company; $company = new Company();
$company->account_id = $account_id; $company->account_id = $account_id;
$company->company_key = $this->createHash(); $company->company_key = $this->createHash();
$company->settings = CompanySettings::defaults(); $company->settings = CompanySettings::defaults();

View File

@ -17,12 +17,12 @@ class CompanyGatewayFactory
{ {
public static function create(int $company_id, int $user_id): CompanyGateway public static function create(int $company_id, int $user_id): CompanyGateway
{ {
$company_gateway = new CompanyGateway; $company_gateway = new CompanyGateway();
$company_gateway->company_id = $company_id; $company_gateway->company_id = $company_id;
$company_gateway->user_id = $user_id; $company_gateway->user_id = $user_id;
$company_gateway->require_billing_address = false; $company_gateway->require_billing_address = false;
$company_gateway->require_shipping_address = false; $company_gateway->require_shipping_address = false;
$company_gateway->config = encrypt(json_encode(new \stdClass)); $company_gateway->config = encrypt(json_encode(new \stdClass()));
return $company_gateway; return $company_gateway;
} }

View File

@ -17,7 +17,7 @@ class CompanyLedgerFactory
{ {
public static function create(int $company_id, int $user_id): CompanyLedger public static function create(int $company_id, int $user_id): CompanyLedger
{ {
$company_ledger = new CompanyLedger; $company_ledger = new CompanyLedger();
$company_ledger->company_id = $company_id; $company_ledger->company_id = $company_id;
$company_ledger->user_id = $user_id; $company_ledger->user_id = $user_id;
$company_ledger->adjustment = 0; $company_ledger->adjustment = 0;

View File

@ -18,7 +18,7 @@ class CompanyTokenFactory
{ {
public static function create(int $company_id, int $user_id, int $account_id): CompanyToken public static function create(int $company_id, int $user_id, int $account_id): CompanyToken
{ {
$token = new CompanyToken; $token = new CompanyToken();
$token->user_id = $user_id; $token->user_id = $user_id;
$token->account_id = $account_id; $token->account_id = $account_id;
$token->token = Str::random(64); $token->token = Str::random(64);

View File

@ -18,7 +18,7 @@ class CompanyUserFactory
{ {
public static function create($user_id, $company_id, $account_id): CompanyUser public static function create($user_id, $company_id, $account_id): CompanyUser
{ {
$company_user = new CompanyUser; $company_user = new CompanyUser();
$company_user->user_id = $user_id; $company_user->user_id = $user_id;
$company_user->company_id = $company_id; $company_user->company_id = $company_id;
$company_user->account_id = $account_id; $company_user->account_id = $account_id;

View File

@ -18,7 +18,7 @@ class CreditInvitationFactory
{ {
public static function create(int $company_id, int $user_id): CreditInvitation public static function create(int $company_id, int $user_id): CreditInvitation
{ {
$ci = new CreditInvitation; $ci = new CreditInvitation();
$ci->company_id = $company_id; $ci->company_id = $company_id;
$ci->user_id = $user_id; $ci->user_id = $user_id;
$ci->client_contact_id = null; $ci->client_contact_id = null;

View File

@ -18,10 +18,10 @@ class GroupSettingFactory
{ {
public static function create(int $company_id, int $user_id): GroupSetting public static function create(int $company_id, int $user_id): GroupSetting
{ {
$settings = new \stdClass; $settings = new \stdClass();
$settings->entity = Client::class; $settings->entity = Client::class;
$gs = new GroupSetting; $gs = new GroupSetting();
$gs->name = ''; $gs->name = '';
$gs->company_id = $company_id; $gs->company_id = $company_id;
$gs->user_id = $user_id; $gs->user_id = $user_id;

View File

@ -18,7 +18,7 @@ class InvoiceInvitationFactory
{ {
public static function create(int $company_id, int $user_id): InvoiceInvitation public static function create(int $company_id, int $user_id): InvoiceInvitation
{ {
$ii = new InvoiceInvitation; $ii = new InvoiceInvitation();
$ii->company_id = $company_id; $ii->company_id = $company_id;
$ii->user_id = $user_id; $ii->user_id = $user_id;
$ii->client_contact_id = null; $ii->client_contact_id = null;

View File

@ -20,7 +20,7 @@ class InvoiceItemFactory
{ {
public static function create(): stdClass public static function create(): stdClass
{ {
$item = new stdClass; $item = new stdClass();
$item->quantity = 0; $item->quantity = 0;
$item->cost = 0; $item->cost = 0;
$item->product_key = ''; $item->product_key = '';

View File

@ -18,7 +18,7 @@ class InvoiceToRecurringInvoiceFactory
{ {
public static function create(Invoice $invoice): RecurringInvoice public static function create(Invoice $invoice): RecurringInvoice
{ {
$recurring_invoice = new RecurringInvoice; $recurring_invoice = new RecurringInvoice();
$recurring_invoice->status_id = RecurringInvoice::STATUS_DRAFT; $recurring_invoice->status_id = RecurringInvoice::STATUS_DRAFT;
$recurring_invoice->discount = $invoice->discount; $recurring_invoice->discount = $invoice->discount;

View File

@ -18,7 +18,7 @@ class PaymentFactory
{ {
public static function create(int $company_id, int $user_id, int $client_id = 0): Payment public static function create(int $company_id, int $user_id, int $client_id = 0): Payment
{ {
$payment = new Payment; $payment = new Payment();
$payment->company_id = $company_id; $payment->company_id = $company_id;
$payment->user_id = $user_id; $payment->user_id = $user_id;

View File

@ -17,7 +17,7 @@ class PaymentTermFactory
{ {
public static function create(int $company_id, int $user_id): PaymentTerm public static function create(int $company_id, int $user_id): PaymentTerm
{ {
$payment_term = new PaymentTerm; $payment_term = new PaymentTerm();
$payment_term->user_id = $user_id; $payment_term->user_id = $user_id;
$payment_term->company_id = $company_id; $payment_term->company_id = $company_id;

View File

@ -17,7 +17,7 @@ class ProductFactory
{ {
public static function create(int $company_id, int $user_id): Product public static function create(int $company_id, int $user_id): Product
{ {
$product = new Product; $product = new Product();
$product->company_id = $company_id; $product->company_id = $company_id;
$product->user_id = $user_id; $product->user_id = $user_id;

View File

@ -17,7 +17,7 @@ class ProjectFactory
{ {
public static function create(int $company_id, int $user_id): Project public static function create(int $company_id, int $user_id): Project
{ {
$project = new Project; $project = new Project();
$project->company_id = $company_id; $project->company_id = $company_id;
$project->user_id = $user_id; $project->user_id = $user_id;
$project->public_notes = ''; $project->public_notes = '';

Some files were not shown because too many files have changed in this diff Show More