mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fixes for tests
This commit is contained in:
parent
d465fd3f2e
commit
b08d805728
@ -17,6 +17,11 @@ use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
* @class \App\Http\Requests\Yodlee\YodleeAuthRequest
|
||||
* @property string $token
|
||||
* @property string $state
|
||||
*/
|
||||
class YodleeAuthRequest extends Request
|
||||
{
|
||||
/**
|
||||
@ -39,7 +44,6 @@ class YodleeAuthRequest extends Request
|
||||
return [];
|
||||
}
|
||||
|
||||
/** @var Request $token */
|
||||
public function getTokenContent()
|
||||
{
|
||||
if ($this->state) {
|
||||
|
@ -66,9 +66,6 @@ class ZipDocuments implements ShouldQueue
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
* @throws \ZipStream\Exception\FileNotFoundException
|
||||
* @throws \ZipStream\Exception\FileNotReadableException
|
||||
* @throws \ZipStream\Exception\OverflowException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
@ -62,9 +62,6 @@ class ZipQuotes implements ShouldQueue
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
* @throws \ZipStream\Exception\FileNotFoundException
|
||||
* @throws \ZipStream\Exception\FileNotReadableException
|
||||
* @throws \ZipStream\Exception\OverflowException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
@ -124,7 +124,6 @@ class BaseModel extends Model
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @extends \Illuminate\Database\Eloquent\Builder
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeCompany($query): \Illuminate\Database\Eloquent\Builder
|
||||
|
@ -238,7 +238,10 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
return $this->hasMany(CompanyLedger::class)->orderBy('id', 'desc');
|
||||
}
|
||||
|
||||
public function company_ledger()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger>
|
||||
*/
|
||||
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
|
||||
}
|
||||
@ -516,7 +519,10 @@ class Client extends BaseModel implements HasLocalePreference
|
||||
throw new \Exception('Could not find a settings object', 1);
|
||||
}
|
||||
|
||||
public function documents() :MorphMany
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents() :\Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
}
|
||||
|
@ -395,6 +395,9 @@ class Company extends BaseModel
|
||||
return $this->calculate_taxes && in_array($this->getSetting('country_id'), $this->tax_coverage_countries);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents()
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
|
@ -44,28 +44,6 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
* @property-read \App\Models\User $user
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
|
||||
* @property-read int|null $users_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser authCompany()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereAccountId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereCompanyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereIsAdmin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereIsLocked($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereIsOwner($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereNinjaPortalUrl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereNotifications($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser wherePermissions($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser wherePermissionsUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereReactSettings($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereSettings($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereSlackWebhookUrl($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser withTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser withoutTrashed()
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token
|
||||
@ -130,18 +108,18 @@ class CompanyUser extends Pivot
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<User>
|
||||
*/
|
||||
public function user_pivot()
|
||||
public function user_pivot(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
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
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<Company>
|
||||
*/
|
||||
public function company_pivot()
|
||||
public function company_pivot(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'react_settings', 'is_admin', 'is_owner', 'is_locked', 'slack_webhook_url', 'migrating');
|
||||
}
|
||||
@ -156,6 +134,9 @@ class CompanyUser extends Pivot
|
||||
return $this->belongsTo(Company::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function users(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(User::class)->withTrashed();
|
||||
|
@ -270,6 +270,9 @@ class Credit extends BaseModel
|
||||
return $this->belongsTo(Invoice::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger>
|
||||
*/
|
||||
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
|
||||
@ -289,11 +292,17 @@ class Credit extends BaseModel
|
||||
return $this->belongsToMany(Invoice::class)->using(Paymentable::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Payment>
|
||||
*/
|
||||
public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Payment::class, 'paymentable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
|
@ -150,7 +150,10 @@ class Expense extends BaseModel
|
||||
return self::class;
|
||||
}
|
||||
|
||||
public function documents()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ class GroupSetting extends StaticModel
|
||||
return $this->hasMany(Client::class, 'id', 'group_settings_id');
|
||||
}
|
||||
|
||||
public function documents()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ use App\Helpers\Invoice\InvoiceSumInclusive;
|
||||
use App\Utils\Traits\Invoice\ActionsInvoice;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Events\Invoice\InvoiceReminderWasEmailed;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
|
||||
/**
|
||||
* App\Models\Invoice
|
||||
@ -302,16 +303,25 @@ class Invoice extends BaseModel
|
||||
return $this->belongsTo(Subscription::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Payment>
|
||||
*/
|
||||
public function payments(): \Illuminate\Database\Eloquent\Relations\MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Payment::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger>
|
||||
*/
|
||||
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
|
||||
@ -322,32 +332,41 @@ class Invoice extends BaseModel
|
||||
return $this->hasMany(Activity::class)->orderBy('id', 'DESC')->take(50);
|
||||
}
|
||||
|
||||
public function history()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<Backup>
|
||||
*/
|
||||
public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Backup::class, Activity::class);
|
||||
}
|
||||
|
||||
public function credits()
|
||||
public function credits(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Credit::class);
|
||||
}
|
||||
|
||||
public function tasks()
|
||||
public function tasks(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Task::class);
|
||||
}
|
||||
|
||||
public function task()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<Task>
|
||||
*/
|
||||
public function task(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
return $this->hasOne(Task::class);
|
||||
}
|
||||
|
||||
public function expenses()
|
||||
public function expenses(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(Expense::class);
|
||||
}
|
||||
|
||||
public function expense()
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne<Expense>
|
||||
*/
|
||||
public function expense(): \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
{
|
||||
return $this->hasOne(Expense::class);
|
||||
}
|
||||
|
@ -216,21 +216,24 @@ class Payment extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphedByMany
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Paymentable>
|
||||
*/
|
||||
public function invoices()
|
||||
public function invoices(): \Illuminate\Database\Eloquent\Relations\MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(Invoice::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphedByMany
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany<Paymentable>
|
||||
*/
|
||||
public function credits()
|
||||
public function credits(): \Illuminate\Database\Eloquent\Relations\MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(Credit::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<CompanyLedger>
|
||||
*/
|
||||
public function company_ledger(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(CompanyLedger::class, 'company_ledgerable');
|
||||
@ -266,7 +269,7 @@ class Payment extends BaseModel
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function translatedType()
|
||||
public function translatedType(): string
|
||||
{
|
||||
if (! $this->type_id) {
|
||||
return '';
|
||||
|
@ -227,6 +227,9 @@ class Quote extends BaseModel
|
||||
return $this->belongsTo(Vendor::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<Backup>
|
||||
*/
|
||||
public function history(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Backup::class, Activity::class);
|
||||
@ -267,6 +270,9 @@ class Quote extends BaseModel
|
||||
return $this->hasMany(QuoteInvitation::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Document>
|
||||
*/
|
||||
public function documents(): \Illuminate\Database\Eloquent\Relations\MorphMany
|
||||
{
|
||||
return $this->morphMany(Document::class, 'documentable');
|
||||
|
@ -80,7 +80,7 @@ class ImportCustomers
|
||||
{
|
||||
$account = $this->stripe->company_gateway->company->account;
|
||||
|
||||
if (Ninja::isHosted() && ! $account->isPaidHostedClient() && Client::where('company_id', $this->stripe->company_gateway->company_id)->count() > config('ninja.quotas.free.clients')) {
|
||||
if (Ninja::isHosted() && ! $account->isPaidHostedClient() && Client::query()->where('company_id', $this->stripe->company_gateway->company_id)->count() > config('ninja.quotas.free.clients')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ class ImportCustomers
|
||||
$client->phone = $customer->address->phone ? $customer->phone : '';
|
||||
|
||||
if ($customer->address->country) {
|
||||
$country = Country::where('iso_3166_2', $customer->address->country)->first();
|
||||
$country = Country::query()->where('iso_3166_2', $customer->address->country)->first();
|
||||
|
||||
if ($country) {
|
||||
$client->country_id = $country->id;
|
||||
@ -124,7 +124,7 @@ class ImportCustomers
|
||||
}
|
||||
|
||||
if ($customer->currency) {
|
||||
$currency = Currency::where('code', $customer->currency)->first();
|
||||
$currency = Currency::query()->where('code', $customer->currency)->first();
|
||||
|
||||
if ($currency) {
|
||||
$settings = $client->settings;
|
||||
@ -209,7 +209,7 @@ class ImportCustomers
|
||||
// nlog(count($searchResults));
|
||||
|
||||
if (count($searchResults) == 1) {
|
||||
$cgt = ClientGatewayToken::where('gateway_customer_reference', $searchResults->data[0]->id)->where('company_id', $this->stripe->company_gateway->company->id)->exists();
|
||||
$cgt = ClientGatewayToken::query()->where('gateway_customer_reference', $searchResults->data[0]->id)->where('company_id', $this->stripe->company_gateway->company->id)->exists();
|
||||
|
||||
if (! $cgt) {
|
||||
nlog('customer '.$searchResults->data[0]->id.' does not exist.');
|
||||
|
Loading…
Reference in New Issue
Block a user