mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 21:14:35 -04:00
Merge branch 'v5-develop' of https://github.com/invoiceninja/invoiceninja into feature-brevo
This commit is contained in:
commit
04be097edd
@ -1 +1 @@
|
||||
5.8.8
|
||||
5.8.12
|
@ -15,6 +15,7 @@ use App;
|
||||
use App\Factory\ClientContactFactory;
|
||||
use App\Factory\VendorContactFactory;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Account;
|
||||
use App\Models\BankTransaction;
|
||||
use App\Models\Client;
|
||||
@ -128,6 +129,7 @@ class CheckData extends Command
|
||||
$this->checkUserState();
|
||||
$this->checkContactEmailAndSendEmailStatus();
|
||||
$this->checkPaymentCurrency();
|
||||
$this->checkSubdomainsSet();
|
||||
|
||||
if (Ninja::isHosted()) {
|
||||
$this->checkAccountStatuses();
|
||||
@ -666,7 +668,7 @@ class CheckData extends Command
|
||||
->pluck('p')
|
||||
->first();
|
||||
|
||||
$over_payment = $over_payment*-1;
|
||||
$over_payment = $over_payment * -1;
|
||||
|
||||
if (floatval($over_payment) == floatval($client->balance)) {
|
||||
} else {
|
||||
@ -918,7 +920,7 @@ class CheckData extends Command
|
||||
$val = $invoice->balance;
|
||||
|
||||
$invoice->balance = 0;
|
||||
$invoice->paid_to_date=$val;
|
||||
$invoice->paid_to_date = $val;
|
||||
$invoice->saveQuietly();
|
||||
|
||||
$p = $invoice->payments->first();
|
||||
@ -1019,17 +1021,36 @@ 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()
|
||||
{
|
||||
$p = Payment::with('company','client')
|
||||
$p = Payment::with('company', 'client')
|
||||
->withTrashed()
|
||||
->where('currency_id', '')
|
||||
->orWhereNull('currency_id');
|
||||
|
||||
$this->logMessage($p->count() . " Payments with No currency set");
|
||||
|
||||
if($p->count() != 0)
|
||||
if($p->count() != 0) {
|
||||
$this->isValid = false;
|
||||
}
|
||||
|
||||
if ($this->option('fix') == 'true') {
|
||||
|
||||
|
@ -29,7 +29,8 @@ use Illuminate\Support\Str;
|
||||
|
||||
class CreateAccount extends Command
|
||||
{
|
||||
use MakesHash, GeneratesCounter;
|
||||
use MakesHash;
|
||||
use GeneratesCounter;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
@ -97,7 +98,7 @@ class CreateAccount extends Command
|
||||
'phone' => '',
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
|
@ -61,7 +61,8 @@ use stdClass;
|
||||
|
||||
class CreateSingleAccount extends Command
|
||||
{
|
||||
use MakesHash, GeneratesCounter;
|
||||
use MakesHash;
|
||||
use GeneratesCounter;
|
||||
|
||||
protected $description = 'Create Single Sample Account';
|
||||
|
||||
@ -105,7 +106,7 @@ class CreateSingleAccount extends Command
|
||||
try {
|
||||
$pdo = \DB::connection('ronin')->getPdo();
|
||||
|
||||
if(class_exists(\Modules\Ronin\app\Models\Admin::class)){
|
||||
if(class_exists(\Modules\Ronin\app\Models\Admin::class)) {
|
||||
$this->info('Creating Ronin Account');
|
||||
$this->createRoninAccount();
|
||||
}
|
||||
@ -139,7 +140,7 @@ class CreateSingleAccount extends Command
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'slack_webhook_url' => config('ninja.notification.slack'),
|
||||
'default_password_timeout' => 30*60000,
|
||||
'default_password_timeout' => 30 * 60000,
|
||||
'portal_mode' => 'domain',
|
||||
'portal_domain' => 'http://ninja.test:8000',
|
||||
'track_inventory' => true
|
||||
@ -188,7 +189,7 @@ class CreateSingleAccount extends Command
|
||||
]);
|
||||
}
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
@ -581,7 +582,7 @@ class CreateSingleAccount extends Command
|
||||
'task_rate' => rand(1, 200),
|
||||
]);
|
||||
|
||||
for($x=0; $x < rand(2, 5); $x++) {
|
||||
for($x = 0; $x < rand(2, 5); $x++) {
|
||||
$task = $this->createTask($client);
|
||||
$task->project_id = $project->id;
|
||||
$task->save();
|
||||
@ -801,7 +802,7 @@ class CreateSingleAccount extends Command
|
||||
private function createGateways($company, $user)
|
||||
{
|
||||
if (config('ninja.testvars.stripe') && ($this->gateway == 'all' || $this->gateway == 'stripe')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
@ -814,15 +815,15 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
if (config('ninja.testvars.paypal') && ($this->gateway == 'all' || $this->gateway == 'paypal')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e';
|
||||
@ -835,15 +836,15 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
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->user_id = $user->id;
|
||||
$cg->gateway_key = '80af24a6a691230bbec33e930ab40665';
|
||||
@ -856,8 +857,8 @@ class CreateSingleAccount extends Command
|
||||
|
||||
// $gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{3} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{3} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
@ -866,7 +867,7 @@ class CreateSingleAccount extends Command
|
||||
|
||||
|
||||
if (config('ninja.testvars.checkout') && ($this->gateway == 'all' || $this->gateway == 'checkout')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
||||
@ -877,17 +878,17 @@ class CreateSingleAccount extends Command
|
||||
$cg->config = encrypt(config('ninja.testvars.checkout'));
|
||||
$cg->save();
|
||||
|
||||
$gateway_types = $cg->driver(new Client)->gatewayTypes();
|
||||
$gateway_types = $cg->driver(new Client())->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
if (config('ninja.testvars.authorize') && ($this->gateway == 'all' || $this->gateway == 'authorizenet')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
|
||||
@ -898,17 +899,17 @@ class CreateSingleAccount extends Command
|
||||
$cg->config = encrypt(config('ninja.testvars.authorize'));
|
||||
$cg->save();
|
||||
|
||||
$gateway_types = $cg->driver(new Client)->gatewayTypes();
|
||||
$gateway_types = $cg->driver(new Client())->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
if (config('ninja.testvars.wepay') && ($this->gateway == 'all' || $this->gateway == 'wepay')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '8fdeed552015b3c7b44ed6c8ebd9e992';
|
||||
@ -921,15 +922,15 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
if (config('ninja.testvars.braintree') && ($this->gateway == 'all' || $this->gateway == 'braintree')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = 'f7ec488676d310683fb51802d076d713';
|
||||
@ -942,8 +943,8 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
@ -951,7 +952,7 @@ class CreateSingleAccount extends Command
|
||||
|
||||
|
||||
if (config('ninja.testvars.paytrace.decrypted') && ($this->gateway == 'all' || $this->gateway == 'paytrace')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = 'bbd736b3254b0aabed6ad7fda1298c88';
|
||||
@ -966,15 +967,15 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
if (config('ninja.testvars.mollie') && ($this->gateway == 'all' || $this->gateway == 'mollie')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '1bd651fb213ca0c9d66ae3c336dc77e8';
|
||||
@ -987,15 +988,15 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
}
|
||||
|
||||
if (config('ninja.testvars.square') && ($this->gateway == 'all' || $this->gateway == 'square')) {
|
||||
$cg = new CompanyGateway;
|
||||
$cg = new CompanyGateway();
|
||||
$cg->company_id = $company->id;
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '65faab2ab6e3223dbe848b1686490baz';
|
||||
@ -1008,8 +1009,8 @@ class CreateSingleAccount extends Command
|
||||
|
||||
$gateway_types = $cg->driver()->gatewayTypes();
|
||||
|
||||
$fees_and_limits = new stdClass;
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits;
|
||||
$fees_and_limits = new stdClass();
|
||||
$fees_and_limits->{$gateway_types[0]} = new FeesAndLimits();
|
||||
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
|
@ -47,7 +47,8 @@ use Illuminate\Support\Str;
|
||||
|
||||
class CreateTestData extends Command
|
||||
{
|
||||
use MakesHash, GeneratesCounter;
|
||||
use MakesHash;
|
||||
use GeneratesCounter;
|
||||
|
||||
/**
|
||||
* @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->company_id = $company->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->company_id = $company->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->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
|
@ -54,7 +54,9 @@ use Illuminate\Support\Str;
|
||||
|
||||
class DemoMode extends Command
|
||||
{
|
||||
use MakesHash, GeneratesCounter, AppSetup;
|
||||
use MakesHash;
|
||||
use GeneratesCounter;
|
||||
use AppSetup;
|
||||
|
||||
protected $signature = 'ninja:demo-mode';
|
||||
|
||||
@ -151,7 +153,7 @@ class DemoMode extends Command
|
||||
(new CreateCompanyPaymentTerms($company, $user))->handle();
|
||||
(new CreateCompanyTaskStatuses($company, $user))->handle();
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
@ -182,7 +184,7 @@ class DemoMode extends Command
|
||||
'email_verified_at' => now(),
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $u2->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
|
@ -73,7 +73,7 @@ class DesignUpdate extends Command
|
||||
$invoice_design = new \App\Services\PdfMaker\Design(strtolower($design->name));
|
||||
$invoice_design->document();
|
||||
|
||||
$design_object = new stdClass;
|
||||
$design_object = new stdClass();
|
||||
$design_object->includes = $invoice_design->getSectionHTML('style');
|
||||
$design_object->header = $invoice_design->getSectionHTML('header');
|
||||
$design_object->body = $invoice_design->getSectionHTML('body');
|
||||
|
@ -61,7 +61,7 @@ class MobileLocalization extends Command
|
||||
|
||||
private function laravelResources()
|
||||
{
|
||||
$resources =(array)$this->getResources();
|
||||
$resources = (array)$this->getResources();
|
||||
|
||||
if(is_iterable($resources)) {
|
||||
foreach ($resources as $key => $val) {
|
||||
|
@ -28,7 +28,8 @@ use Illuminate\Support\Facades\App;
|
||||
//@deprecated 27-11-2022 - only ever should be used for testing
|
||||
class SendRemindersCron extends Command
|
||||
{
|
||||
use MakesReminders, MakesDates;
|
||||
use MakesReminders;
|
||||
use MakesDates;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
@ -97,7 +98,7 @@ class SendRemindersCron extends Command
|
||||
});
|
||||
}
|
||||
|
||||
private function calcLateFee($invoice, $template) :Invoice
|
||||
private function calcLateFee($invoice, $template): Invoice
|
||||
{
|
||||
$late_fee_amount = 0;
|
||||
$late_fee_percent = 0;
|
||||
@ -137,7 +138,7 @@ class SendRemindersCron extends Command
|
||||
*
|
||||
* @return Invoice
|
||||
*/
|
||||
private function setLateFee($invoice, $amount, $percent) :Invoice
|
||||
private function setLateFee($invoice, $amount, $percent): Invoice
|
||||
{
|
||||
App::forgetInstance('translator');
|
||||
$t = app('translator');
|
||||
@ -158,7 +159,7 @@ class SendRemindersCron extends Command
|
||||
$fee += round($invoice->balance * $percent / 100, 2);
|
||||
}
|
||||
|
||||
$invoice_item = new InvoiceItem;
|
||||
$invoice_item = new InvoiceItem();
|
||||
$invoice_item->type_id = '5';
|
||||
$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())]);
|
||||
|
@ -53,7 +53,7 @@ class SendTestEmails extends Command
|
||||
|
||||
$to_user = User::first();
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo = new NinjaMailerObject();
|
||||
$nmo->mailable = new TestMailServer('Email Server Works!', config('mail.from.address'));
|
||||
$nmo->company = $to_user->account->companies()->first();
|
||||
$nmo->settings = $to_user->account->companies()->first()->settings;
|
||||
|
@ -58,6 +58,7 @@ class TranslationsExport extends Command
|
||||
'it',
|
||||
'ja',
|
||||
'km_KH',
|
||||
'lo_LA',
|
||||
'lt',
|
||||
'lv_LV',
|
||||
'mk_MK',
|
||||
@ -95,7 +96,7 @@ class TranslationsExport extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$type =$this->option('type') ?? 'export';
|
||||
$type = $this->option('type') ?? 'export';
|
||||
|
||||
if ($type == 'import') {
|
||||
$this->import();
|
||||
@ -137,6 +138,10 @@ class TranslationsExport extends Command
|
||||
Storage::disk('local')->makeDirectory("lang/{$lang}");
|
||||
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
@ -47,58 +47,58 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
/* 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 */
|
||||
$schedule->job(new QueueSize)->everyFiveMinutes()->withoutOverlapping()->name('queue-size-job')->onOneServer();
|
||||
$schedule->job(new QueueSize())->everyFiveMinutes()->withoutOverlapping()->name('queue-size-job')->onOneServer();
|
||||
|
||||
/* 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*/
|
||||
$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 */
|
||||
$schedule->job(new TaskScheduler())->hourlyAt(10)->withoutOverlapping()->name('task-scheduler-job')->onOneServer();
|
||||
|
||||
/* 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*/
|
||||
$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 */
|
||||
$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 */
|
||||
$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 */
|
||||
$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*/
|
||||
$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 */
|
||||
$schedule->job(new SchedulerCheck)->dailyAt('01:10')->withoutOverlapping();
|
||||
$schedule->job(new SchedulerCheck())->dailyAt('01:10')->withoutOverlapping();
|
||||
|
||||
/* 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 */
|
||||
$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 */
|
||||
$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 */
|
||||
$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 */
|
||||
$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 */
|
||||
$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()) {
|
||||
$schedule->call(function () {
|
||||
@ -108,10 +108,10 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
/* Run hosted specific jobs */
|
||||
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 */
|
||||
$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();
|
||||
|
||||
|
@ -64,7 +64,7 @@ class ClientSettings extends BaseSettings
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
public static function defaults() : stdClass
|
||||
public static function defaults(): stdClass
|
||||
{
|
||||
$data = (object) [
|
||||
'entity' => (string) Client::class,
|
||||
|
@ -229,7 +229,7 @@ class CompanySettings extends BaseSettings
|
||||
public $require_quote_signature = false; //@TODO ben to confirm
|
||||
|
||||
//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
|
||||
|
||||
@ -860,7 +860,7 @@ class CompanySettings extends BaseSettings
|
||||
*/
|
||||
public static function notificationDefaults(): stdClass
|
||||
{
|
||||
$notification = new stdClass;
|
||||
$notification = new stdClass();
|
||||
$notification->email = [];
|
||||
$notification->email = ['invoice_sent_all'];
|
||||
|
||||
@ -876,7 +876,7 @@ class CompanySettings extends BaseSettings
|
||||
*/
|
||||
public static function notificationAdminDefaults(): stdClass
|
||||
{
|
||||
$notification = new stdClass;
|
||||
$notification = new stdClass();
|
||||
$notification->email = [];
|
||||
$notification->email = ['invoice_sent_all'];
|
||||
|
||||
|
@ -27,7 +27,7 @@ class DefaultSettings extends BaseSettings
|
||||
/**
|
||||
* @return stdClass
|
||||
*/
|
||||
public static function userSettings() : stdClass
|
||||
public static function userSettings(): stdClass
|
||||
{
|
||||
return (object) [
|
||||
// class_basename(User::class) => self::userSettingsObject(),
|
||||
|
@ -133,12 +133,12 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailInvoiceSubject()
|
||||
{
|
||||
return ctrans('texts.invoice_subject', ['number'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.invoice_subject', ['number' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailCreditSubject()
|
||||
{
|
||||
return ctrans('texts.credit_subject', ['number'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.credit_subject', ['number' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailInvoiceTemplate()
|
||||
@ -157,7 +157,7 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailQuoteSubject()
|
||||
{
|
||||
return ctrans('texts.quote_subject', ['number'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.quote_subject', ['number' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailQuoteTemplate()
|
||||
@ -212,7 +212,7 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailReminder1Subject()
|
||||
{
|
||||
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.reminder_subject', ['invoice' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailReminder1Template()
|
||||
@ -222,7 +222,7 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailReminder2Subject()
|
||||
{
|
||||
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.reminder_subject', ['invoice' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailReminder2Template()
|
||||
@ -232,7 +232,7 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailReminder3Subject()
|
||||
{
|
||||
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.reminder_subject', ['invoice' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailReminder3Template()
|
||||
@ -242,7 +242,7 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailReminderEndlessSubject()
|
||||
{
|
||||
return ctrans('texts.reminder_subject', ['invoice'=>'$number', 'account'=>'$company.name']);
|
||||
return ctrans('texts.reminder_subject', ['invoice' => '$number', 'account' => '$company.name']);
|
||||
}
|
||||
|
||||
public static function emailReminderEndlessTemplate()
|
||||
|
@ -8,11 +8,11 @@
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\DataMapper\Settings;
|
||||
|
||||
class SettingsData
|
||||
{
|
||||
|
||||
public bool $auto_archive_invoice = false; // @implemented
|
||||
|
||||
public string $qr_iban = ''; //@implemented
|
||||
|
@ -13,7 +13,6 @@ namespace App\DataMapper\Tax;
|
||||
|
||||
class TaxModel
|
||||
{
|
||||
|
||||
/** @var string $seller_subregion */
|
||||
public string $seller_subregion = 'CA';
|
||||
|
||||
|
@ -22,7 +22,6 @@ use App\Models\Product;
|
||||
*/
|
||||
class Rule extends BaseRule implements RuleInterface
|
||||
{
|
||||
|
||||
/** @var string $seller_region */
|
||||
public string $seller_region = 'US';
|
||||
|
||||
|
@ -51,7 +51,7 @@ class BaseTransaction implements TransactionInterface
|
||||
'credit_status',
|
||||
];
|
||||
|
||||
public function transform(array $data) :array
|
||||
public function transform(array $data): array
|
||||
{
|
||||
// $invoice = $data['invoice'];
|
||||
// $payment = $data['payment'];
|
||||
@ -66,7 +66,7 @@ class BaseTransaction implements TransactionInterface
|
||||
$data['client'],
|
||||
$data['credit'],
|
||||
['metadata' => $data['metadata']],
|
||||
['event_id' => $this->event_id, 'timestamp' =>time()],
|
||||
['event_id' => $this->event_id, 'timestamp' => time()],
|
||||
);
|
||||
// return [
|
||||
// 'event_id' => $this->event_id,
|
||||
|
@ -13,5 +13,5 @@ namespace App\DataMapper\Transactions;
|
||||
|
||||
interface TransactionInterface
|
||||
{
|
||||
public function transform(array $data) :array;
|
||||
public function transform(array $data): array;
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ namespace App\DataProviders;
|
||||
|
||||
class Domains
|
||||
{
|
||||
|
||||
private static array $verify_domains = [
|
||||
private static array $verify_domains = [
|
||||
'0-00.usa.cc',
|
||||
'0-180.com',
|
||||
'0-30-24.com',
|
||||
|
@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class AccountCreated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $user;
|
||||
|
||||
|
@ -21,7 +21,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class StripeConnectFailure
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public function __construct(public Company $company, public string $db)
|
||||
{
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class ClientWasArchived
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
|
@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CompanyDocumentsDeleted
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Company
|
||||
|
@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class ContactLoggedIn
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $client_contact;
|
||||
|
||||
|
@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasArchived
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $credit;
|
||||
|
||||
|
@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasCreated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $credit;
|
||||
|
||||
|
@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasDeleted
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $credit;
|
||||
|
||||
|
@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasEmailed
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $invitation;
|
||||
|
||||
|
@ -18,7 +18,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasEmailedAndFailed
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $credit;
|
||||
|
||||
|
@ -19,7 +19,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $credit;
|
||||
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class DocumentWasArchived
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Document
|
||||
|
@ -24,7 +24,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class InvoiceWasCreated implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
|
@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class InvoiceWasUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
|
@ -20,7 +20,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class MethodDeleted
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var ClientGatewayToken
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class PaymentWasEmailed
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
|
@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class PaymentWasEmailedAndFailed
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Payment
|
||||
|
@ -20,7 +20,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class QuoteWasApproved
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $contact;
|
||||
|
||||
|
@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -22,7 +22,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
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)
|
||||
|
@ -10,7 +10,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SubscriptionWasCreated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var Subscription
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class UserWasDeleted
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $user;
|
||||
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class UserWasRestored
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $user;
|
||||
|
||||
|
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class UserWasUpdated
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
public $user;
|
||||
|
||||
|
4
app/Events/Vendor/VendorContactLoggedIn.php
vendored
4
app/Events/Vendor/VendorContactLoggedIn.php
vendored
@ -23,7 +23,9 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class VendorContactLoggedIn
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
use Dispatchable;
|
||||
use InteractsWithSockets;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -214,7 +214,7 @@ class Handler extends ExceptionHandler
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
if ($exception instanceof ModelNotFoundException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>$exception->getMessage()], 400);
|
||||
return response()->json(['message' => $exception->getMessage()], 400);
|
||||
} elseif ($exception instanceof InternalPDFFailure && $request->expectsJson()) {
|
||||
return response()->json(['message' => $exception->getMessage()], 500);
|
||||
} elseif ($exception instanceof PhantomPDFFailure && $request->expectsJson()) {
|
||||
@ -222,11 +222,11 @@ class Handler extends ExceptionHandler
|
||||
} elseif ($exception instanceof FilePermissionsFailure) {
|
||||
return response()->json(['message' => $exception->getMessage()], 500);
|
||||
} elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>'Too many requests'], 429);
|
||||
return response()->json(['message' => 'Too many requests'], 429);
|
||||
// } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
|
||||
// return response()->json(['message'=>'Fatal error'], 500); //@deprecated
|
||||
} elseif ($exception instanceof AuthorizationException && $request->expectsJson()) {
|
||||
return response()->json(['message'=> $exception->getMessage()], 401);
|
||||
return response()->json(['message' => $exception->getMessage()], 401);
|
||||
} elseif ($exception instanceof TokenMismatchException) {
|
||||
return redirect()
|
||||
->back()
|
||||
@ -235,9 +235,9 @@ class Handler extends ExceptionHandler
|
||||
'message' => ctrans('texts.token_expired'),
|
||||
'message-type' => 'danger', ]);
|
||||
} elseif ($exception instanceof NotFoundHttpException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>'Route does not exist'], 404);
|
||||
return response()->json(['message' => 'Route does not exist'], 404);
|
||||
} elseif ($exception instanceof MethodNotAllowedHttpException && $request->expectsJson()) {
|
||||
return response()->json(['message'=>'Method not supported for this route'], 404);
|
||||
return response()->json(['message' => 'Method not supported for this route'], 404);
|
||||
} elseif ($exception instanceof ValidationException && $request->expectsJson()) {
|
||||
return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422);
|
||||
} elseif ($exception instanceof RelationNotFoundException && $request->expectsJson()) {
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -9,7 +9,6 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
@ -25,7 +25,6 @@ use League\Csv\Writer;
|
||||
|
||||
class ActivityExport extends BaseExport
|
||||
{
|
||||
|
||||
private $entity_transformer;
|
||||
|
||||
public string $date_key = 'created_at';
|
||||
@ -143,7 +142,7 @@ class ActivityExport extends BaseExport
|
||||
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Task $task, array $entity) :array
|
||||
private function decorateAdvancedFields(Task $task, array $entity): array
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ class BaseExport
|
||||
return $query;
|
||||
}
|
||||
|
||||
protected function resolveKey($key, $entity, $transformer) :string
|
||||
protected function resolveKey($key, $entity, $transformer): string
|
||||
{
|
||||
$parts = explode(".", $key);
|
||||
|
||||
@ -985,7 +985,7 @@ class BaseExport
|
||||
return array_merge($this->{$entity_report_keys}, $this->item_report_keys);
|
||||
}
|
||||
|
||||
public function buildHeader() :array
|
||||
public function buildHeader(): array
|
||||
{
|
||||
$helper = new Helpers();
|
||||
|
||||
|
@ -153,7 +153,7 @@ class ClientExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Client $client) :array
|
||||
private function buildRow(Client $client): array
|
||||
{
|
||||
$transformed_contact = false;
|
||||
|
||||
@ -211,7 +211,7 @@ class ClientExport extends BaseExport
|
||||
return $clean_row;
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Client $client, array $entity) :array
|
||||
private function decorateAdvancedFields(Client $client, array $entity): array
|
||||
{
|
||||
if (in_array('client.user', $this->input['report_keys'])) {
|
||||
$entity['client.user'] = $client->user->present()->name();
|
||||
|
@ -25,7 +25,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ContactExport extends BaseExport
|
||||
{
|
||||
|
||||
private ClientTransformer $client_transformer;
|
||||
|
||||
private ClientContactTransformer $contact_transformer;
|
||||
@ -106,7 +105,7 @@ class ContactExport extends BaseExport
|
||||
}
|
||||
|
||||
|
||||
private function buildRow(ClientContact $contact) :array
|
||||
private function buildRow(ClientContact $contact): array
|
||||
{
|
||||
$transformed_contact = false;
|
||||
|
||||
@ -133,7 +132,7 @@ class ContactExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($contact->client, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Client $client, array $entity) :array
|
||||
private function decorateAdvancedFields(Client $client, array $entity): array
|
||||
{
|
||||
if (in_array('client.country_id', $this->input['report_keys'])) {
|
||||
$entity['country'] = $client->country ? ctrans("texts.country_{$client->country->name}") : '';
|
||||
|
@ -24,7 +24,6 @@ use League\Csv\Writer;
|
||||
|
||||
class CreditExport extends BaseExport
|
||||
{
|
||||
|
||||
private CreditTransformer $credit_transformer;
|
||||
|
||||
private Decorator $decorator;
|
||||
@ -128,7 +127,7 @@ class CreditExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Credit $credit) :array
|
||||
private function buildRow(Credit $credit): array
|
||||
{
|
||||
$transformed_credit = $this->credit_transformer->transform($credit);
|
||||
|
||||
@ -159,7 +158,7 @@ class CreditExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($credit, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Credit $credit, array $entity) :array
|
||||
private function decorateAdvancedFields(Credit $credit, array $entity): array
|
||||
{
|
||||
// if (in_array('country_id', $this->input['report_keys'])) {
|
||||
// $entity['country'] = $credit->client->country ? ctrans("texts.country_{$credit->client->country->name}") : '';
|
||||
@ -186,11 +185,11 @@ class CreditExport extends BaseExport
|
||||
// }
|
||||
|
||||
if (in_array('credit.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['credit.assigned_user_id'] = $credit->assigned_user ? $credit->assigned_user->present()->name(): '';
|
||||
$entity['credit.assigned_user_id'] = $credit->assigned_user ? $credit->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('credit.user_id', $this->input['report_keys'])) {
|
||||
$entity['credit.user_id'] = $credit->user ? $credit->user->present()->name(): '';
|
||||
$entity['credit.user_id'] = $credit->user ? $credit->user->present()->name() : '';
|
||||
}
|
||||
|
||||
return $entity;
|
||||
|
@ -22,7 +22,6 @@ use League\Csv\Writer;
|
||||
|
||||
class DocumentExport extends BaseExport
|
||||
{
|
||||
|
||||
private $entity_transformer;
|
||||
|
||||
public string $date_key = 'created_at';
|
||||
@ -101,7 +100,7 @@ class DocumentExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Document $document) :array
|
||||
private function buildRow(Document $document): array
|
||||
{
|
||||
$transformed_entity = $this->entity_transformer->transform($document);
|
||||
|
||||
@ -120,7 +119,7 @@ class DocumentExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($document, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Document $document, array $entity) :array
|
||||
private function decorateAdvancedFields(Document $document, array $entity): array
|
||||
{
|
||||
if (in_array('record_type', $this->input['report_keys'])) {
|
||||
$entity['record_type'] = class_basename($document->documentable);
|
||||
|
@ -23,7 +23,6 @@ use League\Csv\Writer;
|
||||
|
||||
class ExpenseExport extends BaseExport
|
||||
{
|
||||
|
||||
private $expense_transformer;
|
||||
|
||||
private Decorator $decorator;
|
||||
@ -103,7 +102,7 @@ class ExpenseExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Expense $expense) :array
|
||||
private function buildRow(Expense $expense): array
|
||||
{
|
||||
$transformed_expense = $this->expense_transformer->transform($expense);
|
||||
$transformed_expense['currency_id'] = $expense->currency ? $expense->currency->code : $expense->company->currency()->code;
|
||||
@ -130,7 +129,7 @@ class ExpenseExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($expense, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Expense $expense, array $entity) :array
|
||||
private function decorateAdvancedFields(Expense $expense, array $entity): array
|
||||
{
|
||||
// if (in_array('expense.currency_id', $this->input['report_keys'])) {
|
||||
// $entity['expense.currency_id'] = $expense->currency ? $expense->currency->code : '';
|
||||
|
@ -107,7 +107,7 @@ class InvoiceExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Invoice $invoice) :array
|
||||
private function buildRow(Invoice $invoice): array
|
||||
{
|
||||
$transformed_invoice = $this->invoice_transformer->transform($invoice);
|
||||
|
||||
@ -132,7 +132,7 @@ class InvoiceExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($invoice, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Invoice $invoice, array $entity) :array
|
||||
private function decorateAdvancedFields(Invoice $invoice, array $entity): array
|
||||
{
|
||||
|
||||
// if (in_array('invoice.country_id', $this->input['report_keys'])) {
|
||||
@ -160,11 +160,11 @@ class InvoiceExport extends BaseExport
|
||||
}
|
||||
|
||||
if (in_array('invoice.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name(): '';
|
||||
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('invoice.user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name(): '';
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ use League\Csv\Writer;
|
||||
|
||||
class InvoiceItemExport extends BaseExport
|
||||
{
|
||||
|
||||
private $invoice_transformer;
|
||||
|
||||
public string $date_key = 'date';
|
||||
@ -171,7 +170,7 @@ class InvoiceItemExport extends BaseExport
|
||||
}
|
||||
}
|
||||
|
||||
private function buildRow(Invoice $invoice) :array
|
||||
private function buildRow(Invoice $invoice): array
|
||||
{
|
||||
$transformed_invoice = $this->invoice_transformer->transform($invoice);
|
||||
|
||||
@ -200,7 +199,7 @@ class InvoiceItemExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($invoice, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Invoice $invoice, array $entity) :array
|
||||
private function decorateAdvancedFields(Invoice $invoice, array $entity): array
|
||||
{
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||
@ -235,11 +234,11 @@ class InvoiceItemExport extends BaseExport
|
||||
// }
|
||||
|
||||
if (in_array('invoice.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name(): '';
|
||||
$entity['invoice.assigned_user_id'] = $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('invoice.user_id', $this->input['report_keys'])) {
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name(): '';
|
||||
$entity['invoice.user_id'] = $invoice->user ? $invoice->user->present()->name() : '';
|
||||
}
|
||||
|
||||
return $entity;
|
||||
|
@ -102,7 +102,7 @@ class PaymentExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Payment $payment) :array
|
||||
private function buildRow(Payment $payment): array
|
||||
{
|
||||
$transformed_entity = $this->entity_transformer->transform($payment);
|
||||
|
||||
@ -129,7 +129,7 @@ class PaymentExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($payment, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Payment $payment, array $entity) :array
|
||||
private function decorateAdvancedFields(Payment $payment, array $entity): array
|
||||
{
|
||||
// if (in_array('status_id', $this->input['report_keys'])) {
|
||||
// $entity['status'] = $payment->stringStatus($payment->status_id);
|
||||
|
@ -101,7 +101,7 @@ class ProductExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Product $product) :array
|
||||
private function buildRow(Product $product): array
|
||||
{
|
||||
$transformed_entity = $this->entity_transformer->transform($product);
|
||||
|
||||
@ -124,7 +124,7 @@ class ProductExport extends BaseExport
|
||||
// return $this->decorateAdvancedFields($product, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Product $product, array $entity) :array
|
||||
private function decorateAdvancedFields(Product $product, array $entity): array
|
||||
{
|
||||
if (in_array('vendor_id', $this->input['report_keys'])) {
|
||||
$entity['vendor'] = $product->vendor()->exists() ? $product->vendor->name : '';
|
||||
|
@ -37,6 +37,7 @@ class ProductSalesExport extends BaseExport
|
||||
'product_key' => 'product_key',
|
||||
'notes' => 'notes',
|
||||
'quantity' => 'quantity',
|
||||
'currency' => 'currency',
|
||||
'cost' => 'price',
|
||||
'price' => 'cost',
|
||||
'markup' => 'markup',
|
||||
@ -144,7 +145,7 @@ class ProductSalesExport extends BaseExport
|
||||
$this->csv->insertOne([]);
|
||||
|
||||
|
||||
if ($grouped->count() >=1) {
|
||||
if ($grouped->count() >= 1) {
|
||||
$header = [];
|
||||
|
||||
foreach ($grouped->first() as $key => $value) {
|
||||
@ -160,9 +161,10 @@ class ProductSalesExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow($invoice, $invoice_item) :array
|
||||
private function buildRow($invoice, $invoice_item): array
|
||||
{
|
||||
$transformed_entity = (array)$invoice_item;
|
||||
$transformed_entity['price'] = ($invoice_item->product_cost ?? 1) * ($invoice->exchange_rate ?? 1) ;
|
||||
|
||||
$entity = [];
|
||||
|
||||
@ -171,6 +173,8 @@ class ProductSalesExport extends BaseExport
|
||||
|
||||
if (array_key_exists($key, $transformed_entity)) {
|
||||
$entity[$keyval] = $transformed_entity[$key];
|
||||
} elseif($key == 'currency') {
|
||||
$entity['currency'] = $invoice->client->currency()->code;
|
||||
} else {
|
||||
$entity[$keyval] = '';
|
||||
}
|
||||
@ -182,11 +186,11 @@ class ProductSalesExport extends BaseExport
|
||||
return $entity;
|
||||
}
|
||||
|
||||
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 */
|
||||
$unit_cost = $entity['cost'] == 0 ? 1 : $entity['cost'];
|
||||
|
||||
@ -253,7 +257,7 @@ class ProductSalesExport extends BaseExport
|
||||
* @param mixed $entity
|
||||
* @return float
|
||||
*/
|
||||
private function calculateDiscount(Invoice $invoice, $entity) :float
|
||||
private function calculateDiscount(Invoice $invoice, $entity): float
|
||||
{
|
||||
if ($entity['discount'] == 0) {
|
||||
return 0;
|
||||
@ -274,7 +278,7 @@ class ProductSalesExport extends BaseExport
|
||||
* @param string $product_key
|
||||
* @return Product
|
||||
*/
|
||||
private function getProduct(string $product_key) :?Product
|
||||
private function getProduct(string $product_key): ?Product
|
||||
{
|
||||
return $this->products->firstWhere('product_key', $product_key);
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ use App\Transformers\PurchaseOrderTransformer;
|
||||
|
||||
class PurchaseOrderExport extends BaseExport
|
||||
{
|
||||
|
||||
private $purchase_order_transformer;
|
||||
|
||||
public string $date_key = 'date';
|
||||
@ -151,7 +150,7 @@ class PurchaseOrderExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(PurchaseOrder $purchase_order) :array
|
||||
private function buildRow(PurchaseOrder $purchase_order): array
|
||||
{
|
||||
$transformed_purchase_order = $this->purchase_order_transformer->transform($purchase_order);
|
||||
|
||||
@ -177,7 +176,7 @@ class PurchaseOrderExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($purchase_order, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity) :array
|
||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity): array
|
||||
{
|
||||
if (in_array('country_id', $this->input['report_keys'])) {
|
||||
$entity['country'] = $purchase_order->vendor->country ? ctrans("texts.country_{$purchase_order->vendor->country->name}") : '';
|
||||
|
@ -23,7 +23,6 @@ use League\Csv\Writer;
|
||||
|
||||
class PurchaseOrderItemExport extends BaseExport
|
||||
{
|
||||
|
||||
private $purchase_order_transformer;
|
||||
|
||||
public string $date_key = 'date';
|
||||
@ -157,7 +156,7 @@ class PurchaseOrderItemExport extends BaseExport
|
||||
}
|
||||
}
|
||||
|
||||
private function buildRow(PurchaseOrder $purchase_order) :array
|
||||
private function buildRow(PurchaseOrder $purchase_order): array
|
||||
{
|
||||
$transformed_purchase_order = $this->purchase_order_transformer->transform($purchase_order);
|
||||
|
||||
@ -185,7 +184,7 @@ class PurchaseOrderItemExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($purchase_order, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity) :array
|
||||
private function decorateAdvancedFields(PurchaseOrder $purchase_order, array $entity): array
|
||||
{
|
||||
if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
$entity['currency'] = $purchase_order->vendor->currency() ? $purchase_order->vendor->currency()->code : $purchase_order->company->currency()->code;
|
||||
|
@ -23,7 +23,6 @@ use League\Csv\Writer;
|
||||
|
||||
class QuoteExport extends BaseExport
|
||||
{
|
||||
|
||||
private $quote_transformer;
|
||||
|
||||
public string $date_key = 'date';
|
||||
@ -113,7 +112,7 @@ class QuoteExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Quote $quote) :array
|
||||
private function buildRow(Quote $quote): array
|
||||
{
|
||||
$transformed_invoice = $this->quote_transformer->transform($quote);
|
||||
|
||||
@ -137,7 +136,7 @@ class QuoteExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($quote, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Quote $quote, array $entity) :array
|
||||
private function decorateAdvancedFields(Quote $quote, array $entity): array
|
||||
{
|
||||
if (in_array('quote.currency_id', $this->input['report_keys'])) {
|
||||
$entity['quote.currency'] = $quote->client->currency()->code;
|
||||
@ -156,11 +155,11 @@ class QuoteExport extends BaseExport
|
||||
}
|
||||
|
||||
if (in_array('quote.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['quote.assigned_user_id'] = $quote->assigned_user ? $quote->assigned_user->present()->name(): '';
|
||||
$entity['quote.assigned_user_id'] = $quote->assigned_user ? $quote->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('quote.user_id', $this->input['report_keys'])) {
|
||||
$entity['quote.user_id'] = $quote->user ? $quote->user->present()->name(): '';
|
||||
$entity['quote.user_id'] = $quote->user ? $quote->user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ use League\Csv\Writer;
|
||||
|
||||
class QuoteItemExport extends BaseExport
|
||||
{
|
||||
|
||||
private $quote_transformer;
|
||||
|
||||
public string $date_key = 'date';
|
||||
@ -46,7 +45,7 @@ class QuoteItemExport extends BaseExport
|
||||
$this->company = $company;
|
||||
$this->input = $input;
|
||||
$this->quote_transformer = new QuoteTransformer();
|
||||
$this->decorator = new Decorator;
|
||||
$this->decorator = new Decorator();
|
||||
}
|
||||
|
||||
public function init(): Builder
|
||||
@ -164,7 +163,7 @@ class QuoteItemExport extends BaseExport
|
||||
}
|
||||
}
|
||||
|
||||
private function buildRow(Quote $quote) :array
|
||||
private function buildRow(Quote $quote): array
|
||||
{
|
||||
$transformed_quote = $this->quote_transformer->transform($quote);
|
||||
|
||||
@ -192,7 +191,7 @@ class QuoteItemExport extends BaseExport
|
||||
// return $entity;
|
||||
return $this->decorateAdvancedFields($quote, $entity);
|
||||
}
|
||||
private function decorateAdvancedFields(Quote $quote, array $entity) :array
|
||||
private function decorateAdvancedFields(Quote $quote, array $entity): array
|
||||
{
|
||||
// if (in_array('currency_id', $this->input['report_keys'])) {
|
||||
// $entity['currency'] = $quote->client->currency() ? $quote->client->currency()->code : $quote->company->currency()->code;
|
||||
@ -207,11 +206,11 @@ class QuoteItemExport extends BaseExport
|
||||
// }
|
||||
|
||||
if (in_array('quote.assigned_user_id', $this->input['report_keys'])) {
|
||||
$entity['quote.assigned_user_id'] = $quote->assigned_user ? $quote->assigned_user->present()->name(): '';
|
||||
$entity['quote.assigned_user_id'] = $quote->assigned_user ? $quote->assigned_user->present()->name() : '';
|
||||
}
|
||||
|
||||
if (in_array('quote.user_id', $this->input['report_keys'])) {
|
||||
$entity['quote.user_id'] = $quote->user ? $quote->user->present()->name(): '';
|
||||
$entity['quote.user_id'] = $quote->user ? $quote->user->present()->name() : '';
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ use League\Csv\Writer;
|
||||
|
||||
class RecurringInvoiceExport extends BaseExport
|
||||
{
|
||||
|
||||
private $invoice_transformer;
|
||||
|
||||
public string $date_key = 'date';
|
||||
@ -106,7 +105,7 @@ class RecurringInvoiceExport extends BaseExport
|
||||
}
|
||||
|
||||
|
||||
private function buildRow(RecurringInvoice $invoice) :array
|
||||
private function buildRow(RecurringInvoice $invoice): array
|
||||
{
|
||||
$transformed_invoice = $this->invoice_transformer->transform($invoice);
|
||||
|
||||
@ -118,10 +117,9 @@ class RecurringInvoiceExport extends BaseExport
|
||||
|
||||
if (is_array($parts) && $parts[0] == 'recurring_invoice' && array_key_exists($parts[1], $transformed_invoice)) {
|
||||
$entity[$key] = $transformed_invoice[$parts[1]];
|
||||
} elseif($parts[0] == 'item'){
|
||||
} elseif($parts[0] == 'item') {
|
||||
$entity[$key] = '';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// nlog($key);
|
||||
$entity[$key] = $this->decorator->transform($key, $invoice);
|
||||
// $entity[$key] = '';
|
||||
@ -134,7 +132,7 @@ class RecurringInvoiceExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($invoice, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(RecurringInvoice $invoice, array $entity) :array
|
||||
private function decorateAdvancedFields(RecurringInvoice $invoice, array $entity): array
|
||||
{
|
||||
// if (in_array('country_id', $this->input['report_keys'])) {
|
||||
// $entity['country'] = $invoice->client->country ? ctrans("texts.country_{$invoice->client->country->name}") : '';
|
||||
|
@ -26,7 +26,6 @@ use League\Csv\Writer;
|
||||
|
||||
class TaskExport extends BaseExport
|
||||
{
|
||||
|
||||
private $entity_transformer;
|
||||
|
||||
public string $date_key = 'created_at';
|
||||
@ -120,7 +119,7 @@ class TaskExport extends BaseExport
|
||||
|
||||
$this->storage_array = [];
|
||||
});
|
||||
// nlog($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'])) {
|
||||
$entity[$key] = '';
|
||||
} else {
|
||||
// nlog($key);
|
||||
$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)) {
|
||||
$this->storage_array[] = $entity;
|
||||
} else {
|
||||
@ -201,14 +192,14 @@ class TaskExport extends BaseExport
|
||||
|
||||
$this->storage_array[] = $entity;
|
||||
|
||||
unset($entity['task.start_date']);
|
||||
unset($entity['task.end_date']);
|
||||
unset($entity['task.duration']);
|
||||
$entity['task.start_date'] = '';
|
||||
$entity['task.end_date'] = '';
|
||||
$entity['task.duration'] = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Task $task, array $entity) :array
|
||||
private function decorateAdvancedFields(Task $task, array $entity): array
|
||||
{
|
||||
if (in_array('task.status_id', $this->input['report_keys'])) {
|
||||
$entity['task.status_id'] = $task->status()->exists() ? $task->status->name : '';
|
||||
|
@ -24,7 +24,6 @@ use League\Csv\Writer;
|
||||
|
||||
class VendorExport extends BaseExport
|
||||
{
|
||||
|
||||
private $vendor_transformer;
|
||||
|
||||
private $contact_transformer;
|
||||
@ -106,7 +105,7 @@ class VendorExport extends BaseExport
|
||||
return $this->csv->toString();
|
||||
}
|
||||
|
||||
private function buildRow(Vendor $vendor) :array
|
||||
private function buildRow(Vendor $vendor): array
|
||||
{
|
||||
$transformed_contact = false;
|
||||
|
||||
@ -136,7 +135,7 @@ class VendorExport extends BaseExport
|
||||
return $this->decorateAdvancedFields($vendor, $entity);
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Vendor $vendor, array $entity) :array
|
||||
private function decorateAdvancedFields(Vendor $vendor, array $entity): array
|
||||
{
|
||||
if (in_array('vendor.country_id', $this->input['report_keys'])) {
|
||||
$entity['country'] = $vendor->country ? ctrans("texts.country_{$vendor->country->name}") : '';
|
||||
|
@ -29,8 +29,7 @@ class ClientDecorator extends Decorator implements DecoratorInterface
|
||||
|
||||
if($client && method_exists($this, $key)) {
|
||||
return $this->{$key}($client);
|
||||
}
|
||||
elseif($client && $client->{$key}) {
|
||||
} elseif($client && $client->{$key}) {
|
||||
return $client->{$key};
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,7 @@ class ContactDecorator implements DecoratorInterface
|
||||
|
||||
if($contact && method_exists($this, $key)) {
|
||||
return $this->{$key}($contact);
|
||||
}
|
||||
elseif($contact && $contact->{$key}){
|
||||
} elseif($contact && $contact->{$key}) {
|
||||
return $contact->{$key};
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class CreditDecorator implements DecoratorInterface
|
||||
|
||||
if($credit && method_exists($this, $key)) {
|
||||
return $this->{$key}($credit);
|
||||
} elseif($credit && $credit->{$key}){
|
||||
} elseif($credit && $credit->{$key}) {
|
||||
return $credit->{$key};
|
||||
}
|
||||
|
||||
@ -125,11 +125,11 @@ class CreditDecorator implements DecoratorInterface
|
||||
}
|
||||
public function assigned_user_id(Credit $credit)
|
||||
{
|
||||
return $credit->assigned_user ? $credit->assigned_user->present()->name(): '';
|
||||
return $credit->assigned_user ? $credit->assigned_user->present()->name() : '';
|
||||
}
|
||||
public function user_id(Credit $credit)
|
||||
{
|
||||
return $credit->user ? $credit->user->present()->name(): '';
|
||||
return $credit->user ? $credit->user->present()->name() : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ namespace App\Export\Decorators;
|
||||
|
||||
class Decorator implements DecoratorInterface
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class InvoiceDecorator extends Decorator implements DecoratorInterface
|
||||
|
||||
if($invoice && method_exists($this, $key)) {
|
||||
return $this->{$key}($invoice);
|
||||
}elseif($invoice && $invoice->{$key}){
|
||||
} elseif($invoice && $invoice->{$key}) {
|
||||
return $invoice->{$key};
|
||||
}
|
||||
|
||||
@ -82,11 +82,11 @@ class InvoiceDecorator extends Decorator implements DecoratorInterface
|
||||
|
||||
public function assigned_user_id(Invoice $invoice)
|
||||
{
|
||||
return $invoice->assigned_user ? $invoice->assigned_user->present()->name(): '';
|
||||
return $invoice->assigned_user ? $invoice->assigned_user->present()->name() : '';
|
||||
}
|
||||
public function user_id(Invoice $invoice)
|
||||
{
|
||||
return $invoice->user ? $invoice->user->present()->name(): '';
|
||||
return $invoice->user ? $invoice->user->present()->name() : '';
|
||||
}
|
||||
|
||||
public function recurring_id(Invoice $invoice)
|
||||
|
@ -15,7 +15,6 @@ use App\Models\Payment;
|
||||
|
||||
class PaymentDecorator extends Decorator implements DecoratorInterface
|
||||
{
|
||||
|
||||
private $entity_key = 'payment';
|
||||
|
||||
public function transform(string $key, $entity): mixed
|
||||
@ -42,8 +41,7 @@ class PaymentDecorator extends Decorator implements DecoratorInterface
|
||||
|
||||
if($payment && method_exists($this, $key)) {
|
||||
return $this->{$key}($payment);
|
||||
}
|
||||
elseif($payment && $payment->{$key}){
|
||||
} elseif($payment && $payment->{$key}) {
|
||||
return $payment->{$key};
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@ use App\Models\BankIntegration;
|
||||
|
||||
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->user_id = $user_id;
|
||||
$bank_integration->company_id = $company_id;
|
||||
|
@ -15,9 +15,9 @@ use App\Models\BankTransaction;
|
||||
|
||||
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->company_id = $company_id;
|
||||
|
||||
|
@ -15,9 +15,9 @@ use App\Models\BankTransactionRule;
|
||||
|
||||
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->company_id = $company_id;
|
||||
|
||||
|
@ -16,9 +16,9 @@ use Illuminate\Support\Str;
|
||||
|
||||
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->user_id = $user_id;
|
||||
$client_contact->company_id = $company_id;
|
||||
|
@ -17,9 +17,9 @@ use Illuminate\Support\Str;
|
||||
|
||||
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->user_id = $user_id;
|
||||
$client->name = '';
|
||||
|
@ -15,9 +15,9 @@ use App\Models\ClientGatewayToken;
|
||||
|
||||
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->is_default = false;
|
||||
$client_gateway_token->meta = '';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user