diff --git a/app/Export/CSV/RecurringInvoiceExport.php b/app/Export/CSV/RecurringInvoiceExport.php index 6df397c64855..330f29695c83 100644 --- a/app/Export/CSV/RecurringInvoiceExport.php +++ b/app/Export/CSV/RecurringInvoiceExport.php @@ -66,7 +66,6 @@ class RecurringInvoiceExport extends BaseExport 'vendor' => 'vendor_id', 'project' => 'project_id', 'frequency_id' => 'frequency_id', - 'next_send_date' => 'next_send_date' ]; private array $decorate_keys = [ diff --git a/app/Http/Livewire/InvoicesTable.php b/app/Http/Livewire/InvoicesTable.php index 9a84f50870a9..80b43cdd0059 100644 --- a/app/Http/Livewire/InvoicesTable.php +++ b/app/Http/Livewire/InvoicesTable.php @@ -89,9 +89,12 @@ class InvoicesTable extends Component ->withTrashed() ->paginate($this->per_page); + /** @var \App\Models\ClientContact $client_contact */ + $client_contact = auth()->user(); + return render('components.livewire.invoices-table', [ 'invoices' => $query, - 'gateway_available' => ! empty(auth()->user()->client->service()->getPaymentMethods(-1)), + 'gateway_available' => ! empty($client_contact->client->service()->getPaymentMethods(-1)), ]); } } diff --git a/app/Http/Livewire/PaymentMethods/UpdateDefaultMethod.php b/app/Http/Livewire/PaymentMethods/UpdateDefaultMethod.php index e8f67863936e..565d08b0daeb 100644 --- a/app/Http/Livewire/PaymentMethods/UpdateDefaultMethod.php +++ b/app/Http/Livewire/PaymentMethods/UpdateDefaultMethod.php @@ -32,7 +32,7 @@ class UpdateDefaultMethod extends Component MultiDB::setDb($this->company->db); - $this->is_disabled = $this->token->is_default; + // $this->is_disabled = $this->token->is_default; } public function makeDefault(): void diff --git a/app/Http/Livewire/RequiredClientInfo.php b/app/Http/Livewire/RequiredClientInfo.php index f8777538673a..4027c8698c40 100644 --- a/app/Http/Livewire/RequiredClientInfo.php +++ b/app/Http/Livewire/RequiredClientInfo.php @@ -52,7 +52,7 @@ class RequiredClientInfo extends Component public $contact; /** - * @var Client + * @var \App\Models\Client */ public $client; @@ -227,6 +227,7 @@ class RequiredClientInfo extends Component ->push(); if ($contact_update && $client_update) { + /** @var \App\Models\CompanyGateway $cg */ $cg = CompanyGateway::find($this->company_gateway_id); if ($cg && $cg->update_details) { diff --git a/app/Http/Livewire/WepaySignup.php b/app/Http/Livewire/WepaySignup.php index 7ef0b68ea0bd..5524cc17314f 100644 --- a/app/Http/Livewire/WepaySignup.php +++ b/app/Http/Livewire/WepaySignup.php @@ -53,7 +53,7 @@ class WepaySignup extends Component public $saved; - public $company; + public Company $company; protected $rules = [ 'first_name' => ['required'], @@ -71,7 +71,7 @@ class WepaySignup extends Component MultiDB::setDb($this->company->db); $user = User::find($this->user_id); - $this->company = Company::where('company_key', $this->company->company_key)->first(); + $this->company = Company::query()->where('company_key', $this->company->company_key)->first(); $this->fill([ 'wepay_payment_tos_agree' => '', @@ -100,7 +100,7 @@ class WepaySignup extends Component $data = $this->validate($this->rules); //need to create or get a new WePay CompanyGateway - $cg = CompanyGateway::where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992') + $cg = CompanyGateway::query()->where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992') ->where('company_id', $this->company->id) ->firstOrNew(); diff --git a/app/Http/Middleware/ClientPortalEnabled.php b/app/Http/Middleware/ClientPortalEnabled.php index 57b63d02cebd..c26e8ed64e24 100644 --- a/app/Http/Middleware/ClientPortalEnabled.php +++ b/app/Http/Middleware/ClientPortalEnabled.php @@ -25,7 +25,10 @@ class ClientPortalEnabled */ public function handle($request, Closure $next) { - if (auth()->user()->client->getSetting('enable_client_portal') === false) { + /** @var \App\Models\ClientContact $client_contact */ + $client_contact = auth()->user(); + + if ($client_contact->client->getSetting('enable_client_portal') === false) { return redirect()->route('client.error')->with(['title' => ctrans('texts.client_portal'), 'notification' => 'This section of the app has been disabled by the administrator.']); } diff --git a/app/Http/Middleware/ContactAccount.php b/app/Http/Middleware/ContactAccount.php index 1cecef46a1cd..c91dbb7133ad 100644 --- a/app/Http/Middleware/ContactAccount.php +++ b/app/Http/Middleware/ContactAccount.php @@ -28,6 +28,7 @@ class ContactAccount public function handle($request, Closure $next) { if (! Ninja::isHosted()) { + /** @var \App\Models\Account $account */ $account = Account::first(); session()->put('account_key', $account->key); diff --git a/app/Http/Middleware/ContactKeyLogin.php b/app/Http/Middleware/ContactKeyLogin.php index b45f1c465ca6..e49306665e11 100644 --- a/app/Http/Middleware/ContactKeyLogin.php +++ b/app/Http/Middleware/ContactKeyLogin.php @@ -67,7 +67,7 @@ class ContactKeyLogin } } elseif ($request->segment(3) && config('ninja.db.multi_db_enabled')) { if (MultiDB::findAndSetDbByContactKey($request->segment(3))) { - if ($client_contact = ClientContact::with('company')->where('contact_key', $request->segment(3))->first()) { + if ($client_contact = ClientContact::query()->with('company')->where('contact_key', $request->segment(3))->first()) { if ($client_contact->company->settings->enable_client_portal_password) { return redirect()->route('client.login', ['company_key' => $client_contact->company->company_key]); } @@ -107,7 +107,7 @@ class ContactKeyLogin } } elseif ($request->has('client_hash') && config('ninja.db.multi_db_enabled')) { if (MultiDB::findAndSetDbByClientHash($request->input('client_hash'))) { - if ($client = Client::where('client_hash', $request->input('client_hash'))->first()) { + if ($client = Client::query()->where('client_hash', $request->input('client_hash'))->first()) { $primary_contact = $client->primary_contact()->first(); if (empty($primary_contact->email)) { diff --git a/app/Http/Middleware/ContactRegister.php b/app/Http/Middleware/ContactRegister.php index 60e48d8771c0..97237cda8d46 100644 --- a/app/Http/Middleware/ContactRegister.php +++ b/app/Http/Middleware/ContactRegister.php @@ -30,7 +30,7 @@ class ContactRegister 'portal_mode' => 'subdomain', ]; - $company = Company::where($query)->first(); + $company = Company::query()->where($query)->first(); if ($company) { if (! $company->client_can_register) { diff --git a/app/Jobs/Cron/UpdateCalculatedFields.php b/app/Jobs/Cron/UpdateCalculatedFields.php index 62ace5ac7d70..e60b8483bb5b 100644 --- a/app/Jobs/Cron/UpdateCalculatedFields.php +++ b/app/Jobs/Cron/UpdateCalculatedFields.php @@ -43,7 +43,7 @@ class UpdateCalculatedFields if (! config('ninja.db.multi_db_enabled')) { - Project::with('tasks')->whereHas('tasks', function ($query){ + Project::query()->with('tasks')->whereHas('tasks', function ($query){ $query->where('updated_at', '>', now()->subHours(2)); }) ->cursor() diff --git a/app/Libraries/OAuth/OAuth.php b/app/Libraries/OAuth/OAuth.php index 59582bad187f..c684c62ac675 100644 --- a/app/Libraries/OAuth/OAuth.php +++ b/app/Libraries/OAuth/OAuth.php @@ -40,7 +40,7 @@ class OAuth const SOCIAL_APPLE = 8; /** - * @param Socialite $user + * @param \Laravel\Socialite\Facades\Socialite $socialite_user * @return bool | \App\Models\User | \App\Models\User | null */ public static function handleAuth($socialite_user, $provider) diff --git a/app/Mail/DownloadBackup.php b/app/Mail/DownloadBackup.php index ffc89d21d000..d3daecacdadd 100644 --- a/app/Mail/DownloadBackup.php +++ b/app/Mail/DownloadBackup.php @@ -36,7 +36,7 @@ class DownloadBackup extends Mailable { App::setLocale($this->company->getLocale()); - $company = Company::where('company_key', $this->company->company_key)->first(); + $company = Company::query()->where('company_key', $this->company->company_key)->first(); return $this->from(config('mail.from.address'), config('mail.from.name')) ->subject(ctrans('texts.download_backup_subject', ['company' => $company->present()->name()])) diff --git a/app/Models/Client.php b/app/Models/Client.php index c815fc59921b..f14e741e1e0f 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -106,6 +106,7 @@ use Illuminate\Contracts\Translation\HasLocalePreference; * @method static \Database\Factories\ClientFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|Client filter(\App\Filters\QueryFilters $filters) * @method static \Illuminate\Database\Eloquent\Builder|Client without() + * @method static \Illuminate\Database\Eloquent\Builder|Client select() * @property string $payment_balance * @property mixed $tax_data * @property int $is_tax_exempt diff --git a/app/Models/ClientContact.php b/app/Models/ClientContact.php index 0116d611b474..0ff98447c367 100644 --- a/app/Models/ClientContact.php +++ b/app/Models/ClientContact.php @@ -76,7 +76,6 @@ use Laracasts\Presenter\PresentableTrait; * @property-read int|null $quote_invitations_count * @property-read int|null $recurring_invoice_invitations_count * @property-read \App\Models\User $user - * @method static \Illuminate\Database\Eloquent\Builder|ClientContact company() * @method static \Database\Factories\ClientContactFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|ClientContact newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ClientContact newQuery() diff --git a/app/Models/ClientGatewayToken.php b/app/Models/ClientGatewayToken.php index 2b6950048d23..fd5ed8795b7b 100644 --- a/app/Models/ClientGatewayToken.php +++ b/app/Models/ClientGatewayToken.php @@ -69,27 +69,27 @@ class ClientGatewayToken extends BaseModel return self::class; } - public function client() + public function client(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Client::class)->withTrashed(); } - public function gateway() + public function gateway(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->hasOne(CompanyGateway::class, 'id', 'company_gateway_id'); } - public function gateway_type() + public function gateway_type(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->hasOne(GatewayType::class, 'id', 'gateway_type_id'); } - public function company() + public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Company::class); } - public function user() + public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class)->withTrashed(); } diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index a8e7540eae7f..0ad3651ec11a 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -28,7 +28,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property bool $update_details * @property bool $is_deleted * @property string $config - * @property object $fees_and_limits + * @property mixed $fees_and_limits * @property string|null $custom_value1 * @property string|null $custom_value2 * @property string|null $custom_value3 diff --git a/app/Models/CompanyUser.php b/app/Models/CompanyUser.php index c07e2ed6a78a..ba3306808f37 100644 --- a/app/Models/CompanyUser.php +++ b/app/Models/CompanyUser.php @@ -13,8 +13,6 @@ namespace App\Models; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Relations\Pivot; -use Illuminate\Database\Eloquent\Relations\HasOne; -use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * App\Models\CompanyUser @@ -79,34 +77,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property-read \Illuminate\Database\Eloquent\Collection $cu * @property-read \Illuminate\Database\Eloquent\Collection $token * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users - * @property-read \Illuminate\Database\Eloquent\Collection $token - * @property-read \Illuminate\Database\Eloquent\Collection $tokens - * @property-read \Illuminate\Database\Eloquent\Collection $users * @mixin \Eloquent */ class CompanyUser extends Pivot @@ -153,32 +123,40 @@ class CompanyUser extends Pivot return self::class; } - public function account() + public function account(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Account::class); } + /** + * + * @return \Illuminate\Database\Eloquent\Relations\HasOne + */ public function user_pivot() { return $this->hasOne(User::class)->withPivot('permissions', 'settings', 'react_settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url', 'migrating'); } - + + /** + * + * @return \Illuminate\Database\Eloquent\Relations\HasOne + */ public function company_pivot() { return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'react_settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url', 'migrating'); } - public function user(): BelongsTo + public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class)->withTrashed(); } - public function company() + public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Company::class); } - public function users() + public function users(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(User::class)->withTrashed(); } @@ -189,7 +167,7 @@ class CompanyUser extends Pivot return $this->hasMany(CompanyToken::class, 'user_id', 'user_id'); } - public function tokens() + public function tokens(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany(CompanyToken::class, 'user_id', 'user_id'); } diff --git a/app/Models/Payment.php b/app/Models/Payment.php index cc1576912a5c..3fc2bd5cb46c 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -180,46 +180,52 @@ class Payment extends BaseModel return self::class; } - public function client() + public function client(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Client::class)->withTrashed(); } - public function company_gateway() + public function company_gateway(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(CompanyGateway::class)->withTrashed(); } - public function company() + public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Company::class); } - public function contact() + public function contact(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(ClientContact::class); } - public function user() + public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class)->withTrashed(); } - public function assigned_user() + public function assigned_user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'assigned_user_id', 'id')->withTrashed(); } - public function documents() + public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany { return $this->morphMany(Document::class, 'documentable'); } + /** + * @return MorphedByMany + */ public function invoices() { return $this->morphedByMany(Invoice::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps(); } + /** + * @return MorphedByMany + */ public function credits() { return $this->morphedByMany(Credit::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps(); @@ -230,32 +236,32 @@ class Payment extends BaseModel return $this->morphMany(CompanyLedger::class, 'company_ledgerable'); } - public function type() + public function type(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(PaymentType::class); } - public function currency() + public function currency(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Currency::class); } - public function transaction() + public function transaction(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(BankTransaction::class); } - public function exchange_currency() + public function exchange_currency(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Currency::class, 'exchange_currency_id', 'id'); } - public function vendor() + public function vendor(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Vendor::class); } - public function project() + public function project(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Project::class); } @@ -271,7 +277,7 @@ class Payment extends BaseModel return $pt->name($this->type_id); } - public function gateway_type() + public function gateway_type(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(GatewayType::class); } @@ -457,12 +463,12 @@ class Payment extends BaseModel ]; } - public function translate_entity() + public function translate_entity(): string { return ctrans('texts.payment'); } - public function portalUrl($use_react_url) + public function portalUrl($use_react_url): string { return $use_react_url ? config('ninja.react_url')."/#/payments/{$this->hashed_id}/edit" : config('ninja.app_url'); } diff --git a/app/PaymentDrivers/CheckoutCom/CheckoutSetupWebhook.php b/app/PaymentDrivers/CheckoutCom/CheckoutSetupWebhook.php index f9dcc30dcacc..d35d07bd22ed 100644 --- a/app/PaymentDrivers/CheckoutCom/CheckoutSetupWebhook.php +++ b/app/PaymentDrivers/CheckoutCom/CheckoutSetupWebhook.php @@ -55,6 +55,7 @@ class CheckoutSetupWebhook implements ShouldQueue MultiDB::findAndSetDbByCompanyKey($this->company_key); + /** @var \App\Models\CompanyGateway $company_gateway */ $company_gateway = CompanyGateway::find($this->company_gateway_id); $this->checkout = $company_gateway->driver()->init(); diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index b68d4e120ed8..d223fc9aa948 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -95,7 +95,7 @@ class ACH { $stripe_event = $event['data']['object']; - $token = ClientGatewayToken::where('token', $stripe_event['id']) + $token = ClientGatewayToken::query()->where('token', $stripe_event['id']) ->where('gateway_customer_reference', $stripe_event['customer']) ->first(); diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index a8dbeb7da64b..0e0ae3891bb9 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -1357,13 +1357,13 @@ class SubscriptionService case RecurringInvoice::FREQUENCY_MONTHLY: return now()->diffInDays(now()->addMonthNoOverflow()); case RecurringInvoice::FREQUENCY_TWO_MONTHS: - return now()->diffInDays(now()->addMonthNoOverflow(2)); + return now()->diffInDays(now()->addMonthsNoOverflow(2)); case RecurringInvoice::FREQUENCY_THREE_MONTHS: - return now()->diffInDays(now()->addMonthNoOverflow(3)); + return now()->diffInDays(now()->addMonthsNoOverflow(3)); case RecurringInvoice::FREQUENCY_FOUR_MONTHS: - return now()->diffInDays(now()->addMonthNoOverflow(4)); + return now()->diffInDays(now()->addMonthsNoOverflow(4)); case RecurringInvoice::FREQUENCY_SIX_MONTHS: - return now()->diffInDays(now()->addMonthNoOverflow(6)); + return now()->diffInDays(now()->addMonthsNoOverflow(6)); case RecurringInvoice::FREQUENCY_ANNUALLY: return now()->diffInDays(now()->addYear()); case RecurringInvoice::FREQUENCY_TWO_YEARS: @@ -1397,13 +1397,13 @@ class SubscriptionService case RecurringInvoice::FREQUENCY_MONTHLY: return $date->addMonthNoOverflow(); case RecurringInvoice::FREQUENCY_TWO_MONTHS: - return $date->addMonthNoOverflow(2); + return $date->addMonthsNoOverflow(2); case RecurringInvoice::FREQUENCY_THREE_MONTHS: - return $date->addMonthNoOverflow(3); + return $date->addMonthsNoOverflow(3); case RecurringInvoice::FREQUENCY_FOUR_MONTHS: - return $date->addMonthNoOverflow(4); + return $date->addMonthsNoOverflow(4); case RecurringInvoice::FREQUENCY_SIX_MONTHS: - return $date->addMonthNoOverflow(6); + return $date->addMonthsNoOverflow(6); case RecurringInvoice::FREQUENCY_ANNUALLY: return $date->addYear(); case RecurringInvoice::FREQUENCY_TWO_YEARS: diff --git a/app/Services/TaskScheduler/TaskSchedulerService.php b/app/Services/TaskScheduler/TaskSchedulerService.php deleted file mode 100644 index b5533ca8d2ee..000000000000 --- a/app/Services/TaskScheduler/TaskSchedulerService.php +++ /dev/null @@ -1,165 +0,0 @@ -action_name = $request->job; - $scheduler->paused = $request->get('paused', false); - $scheduler->start_from = $request->get('start_from') ? Carbon::parse((int) $request->get('start_from')) : Carbon::now(); - $scheduler->repeat_every = $request->get('repeat_every'); - $scheduler->scheduled_run = $request->get('start_from') ? Carbon::parse((int) $request->get('start_from')) : Carbon::now(); - $scheduler->company_id = auth()->user()->company()->id; - $scheduler = $this->setJobParameters($scheduler, $request); - $scheduler->save(); - } - - public function update(Scheduler $scheduler, UpdateScheduleRequest $request) - { - if (array_key_exists('job', $request->all())) { - $scheduler->action_name = $request->get('job'); - $scheduler = $this->setJobParameters($scheduler, $request); - } - $data = $request->validated(); - $update = $this->scheduler->update($data); - } - - private function runValidation($form_request, $data) - { - $_syn_request_class = new $form_request(); - $_syn_request_class->setContainer(app()); - $_syn_request_class->initialize($data); - $_syn_request_class->prepareForValidation(); - $_syn_request_class->setValidator(Validator::make($_syn_request_class->all(), $_syn_request_class->rules())); - - return $_syn_request_class->validated(); - } - - public function setJobParameters(Scheduler $scheduler, $request) - { - switch ($scheduler->action_name) { - case Scheduler::CREATE_CLIENT_REPORT: - $scheduler->action_name = Scheduler::CREATE_CLIENT_REPORT; - $scheduler->action_class = $this->getClassPath(ClientExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_CLIENT_CONTACT_REPORT: - $scheduler->action_name = Scheduler::CREATE_CLIENT_CONTACT_REPORT; - $scheduler->action_class = $this->getClassPath(ContactExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_CREDIT_REPORT: - - $scheduler->action_name = Scheduler::CREATE_CREDIT_REPORT; - $scheduler->action_class = $this->getClassPath(CreditExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_DOCUMENT_REPORT: - $scheduler->action_name = Scheduler::CREATE_DOCUMENT_REPORT; - $scheduler->action_class = $this->getClassPath(DocumentExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_EXPENSE_REPORT: - $scheduler->action_name = Scheduler::CREATE_EXPENSE_REPORT; - $scheduler->action_class = $this->getClassPath(ExpenseExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_INVOICE_ITEM_REPORT: - $scheduler->action_name = Scheduler::CREATE_INVOICE_ITEM_REPORT; - $scheduler->action_class = $this->getClassPath(InvoiceItemExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_INVOICE_REPORT: - $scheduler->action_name = Scheduler::CREATE_INVOICE_REPORT; - $scheduler->action_class = $this->getClassPath(InvoiceExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_PAYMENT_REPORT: - $scheduler->action_name = Scheduler::CREATE_PAYMENT_REPORT; - $scheduler->action_class = $this->getClassPath(PaymentExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_PRODUCT_REPORT: - $scheduler->action_name = Scheduler::CREATE_PRODUCT_REPORT; - $scheduler->action_class = $this->getClassPath(ProductExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_PROFIT_AND_LOSS_REPORT: - $scheduler->action_name = Scheduler::CREATE_PROFIT_AND_LOSS_REPORT; - $scheduler->action_class = $this->getClassPath(ProfitAndLoss::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_QUOTE_ITEM_REPORT: - $scheduler->action_name = Scheduler::CREATE_QUOTE_ITEM_REPORT; - $scheduler->action_class = $this->getClassPath(QuoteItemExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_QUOTE_REPORT: - $scheduler->action_name = Scheduler::CREATE_QUOTE_REPORT; - $scheduler->action_class = $this->getClassPath(QuoteExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_RECURRING_INVOICE_REPORT: - $scheduler->action_name = Scheduler::CREATE_RECURRING_INVOICE_REPORT; - $scheduler->action_class = $this->getClassPath(RecurringInvoiceExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - case Scheduler::CREATE_TASK_REPORT: - $scheduler->action_name = Scheduler::CREATE_TASK_REPORT; - $scheduler->action_class = $this->getClassPath(TaskExport::class); - $scheduler->parameters = $this->runValidation(GenericReportRequest::class, $request->all()); - break; - } - - return $scheduler; - } - - public function getClassPath($class): string - { - return $class = is_object($class) ? get_class($class) : $class; - } - - public function updateJob(Scheduler $scheduler, UpdateScheduledJobRequest $request) - { - $scheduler = $this->setJobParameters($scheduler, $request); - $scheduler->save(); - } -} diff --git a/app/Transformers/TaskStatusTransformer.php b/app/Transformers/TaskStatusTransformer.php index c2c2f3347fad..f3f9465e29db 100644 --- a/app/Transformers/TaskStatusTransformer.php +++ b/app/Transformers/TaskStatusTransformer.php @@ -24,7 +24,7 @@ class TaskStatusTransformer extends EntityTransformer 'id' => (string) $this->encodePrimaryKey($task_status->id), 'name' => (string) $task_status->name, 'color' => (string) $task_status->color, - 'sort_order' => (int) $task_status->sort_order, //deprecated + // 'sort_order' => (int) $task_status->sort_order, //deprecated 'is_deleted' => (bool) $task_status->is_deleted, 'created_at' => (int) $task_status->created_at, 'updated_at' => (int) $task_status->updated_at,