mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Fixes for static analysis
This commit is contained in:
parent
c22a3c2386
commit
3fe876d479
@ -56,7 +56,7 @@ class TaskFilters extends QueryFilters
|
||||
* - all
|
||||
* - invoiced
|
||||
*
|
||||
* @param string client_status The invoice status as seen by the client
|
||||
* @param string $value The invoice status as seen by the client
|
||||
* @return Builder
|
||||
*/
|
||||
public function client_status(string $value = ''): Builder
|
||||
|
@ -230,7 +230,6 @@ class InvoiceItemSumInclusive
|
||||
|
||||
$item_tax += $this->formatValue($item_tax_rate1_total, $this->currency->precision);
|
||||
|
||||
// if($item_tax_rate1_total != 0)
|
||||
if (strlen($this->item->tax_name1) > 1) {
|
||||
$this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total);
|
||||
}
|
||||
|
@ -111,13 +111,13 @@ class ProRata
|
||||
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:
|
||||
|
@ -64,6 +64,7 @@ class SubscriptionCalculator
|
||||
}
|
||||
|
||||
if ($refund_invoice) {
|
||||
/** @var \App\Models\Subscription $subscription **/
|
||||
$subscription = Subscription::find($this->invoice->subscription_id);
|
||||
$pro_rata = new ProRata;
|
||||
|
||||
|
@ -58,7 +58,7 @@ class ActivityController extends BaseController
|
||||
|
||||
$system = ctrans('texts.system');
|
||||
|
||||
$data = $activities->cursor()->map(function ($activity) use ($system) {
|
||||
$data = $activities->cursor()->map(function ($activity) {
|
||||
|
||||
return $activity->activity_string();
|
||||
|
||||
@ -90,7 +90,7 @@ class ActivityController extends BaseController
|
||||
|
||||
$system = ctrans('texts.system');
|
||||
|
||||
$data = $activities->cursor()->map(function ($activity) use ($system) {
|
||||
$data = $activities->cursor()->map(function ($activity) {
|
||||
|
||||
return $activity->activity_string();
|
||||
|
||||
|
@ -62,11 +62,15 @@ class ContactForgotPasswordController extends Controller
|
||||
|
||||
if (Ninja::isHosted() && $request->session()->has('company_key')) {
|
||||
MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key'));
|
||||
|
||||
/** @var \App\Models\Company $company **/
|
||||
$company = Company::where('company_key', $request->session()->get('company_key'))->first();
|
||||
$account = $company->account;
|
||||
}
|
||||
|
||||
if (! $account) {
|
||||
|
||||
/** @var \App\Models\Account $account **/
|
||||
$account = Account::first();
|
||||
$company = $account->companies->first();
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
}
|
||||
}
|
||||
|
||||
public function client()
|
||||
public function client(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Client::class)->withTrashed();
|
||||
}
|
||||
@ -225,32 +225,32 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
return $this->where('is_primary', true);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public function invoice_invitations()
|
||||
public function invoice_invitations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(InvoiceInvitation::class);
|
||||
}
|
||||
|
||||
public function recurring_invoice_invitations()
|
||||
public function recurring_invoice_invitations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(RecurringInvoiceInvitation::class);
|
||||
}
|
||||
|
||||
public function quote_invitations()
|
||||
public function quote_invitations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(QuoteInvitation::class);
|
||||
}
|
||||
|
||||
public function credit_invitations()
|
||||
public function credit_invitations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(CreditInvitation::class);
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio
|
||||
* @property-read mixed $id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel company()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel newModelQuery($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel newQuery($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel query(?$value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel find($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel with($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel withTrashed($value)
|
||||
|
@ -66,41 +66,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereAllowCancellation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereAllowPlanChanges($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereAllowQueryOverrides($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereAssignedUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereAutoBill($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereCompanyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereCurrencyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereFrequencyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereGroupId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereIsAmountDiscount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereIsDeleted($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereMaxSeatsLimit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereMinSeatsLimit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereOptionalProductIds($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereOptionalRecurringProductIds($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription wherePerSeatEnabled($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription wherePlanMap($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription wherePrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereProductIds($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription wherePromoCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription wherePromoDiscount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription wherePromoPrice($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereRecurringProductIds($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereRefundPeriod($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereRegistrationRequired($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereTrialDuration($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereTrialEnabled($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereUseInventoryManagement($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription whereWebhookConfiguration($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription withTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Subscription withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
|
@ -69,7 +69,9 @@ class CreditCard
|
||||
// $error .= " - {$response->approval_message}";
|
||||
|
||||
// $error_code = property_exists($response, 'approval_message') ? $response->approval_message : 'Undefined code';
|
||||
|
||||
$error = '';
|
||||
$error_code = '';
|
||||
|
||||
$data = [
|
||||
'response' => $response,
|
||||
'error' => $error,
|
||||
|
@ -100,6 +100,7 @@ class CreditCard implements MethodInterface
|
||||
);
|
||||
|
||||
if ($request->shouldUseToken()) {
|
||||
/** @var \App\Models\ClientGatewayToken $cgt **/
|
||||
$cgt = ClientGatewayToken::where('token', $request->token)->first();
|
||||
$token = $cgt->token;
|
||||
}
|
||||
|
@ -61,11 +61,13 @@ class PaymentIntentProcessingWebhook implements ShouldQueue
|
||||
|
||||
foreach ($this->stripe_request as $transaction) {
|
||||
if (array_key_exists('payment_intent', $transaction)) {
|
||||
/** @var \App\Models\Payment $payment **/
|
||||
$payment = Payment::query()
|
||||
->where('company_id', $company->id)
|
||||
->where('transaction_reference', $transaction['payment_intent'])
|
||||
->first();
|
||||
} else {
|
||||
/** @var \App\Models\Payment $payment **/
|
||||
$payment = Payment::query()
|
||||
->where('company_id', $company->id)
|
||||
->where('transaction_reference', $transaction['id'])
|
||||
@ -80,6 +82,7 @@ class PaymentIntentProcessingWebhook implements ShouldQueue
|
||||
}
|
||||
|
||||
if (isset($transaction['payment_method'])) {
|
||||
/** @var \App\Models\ClientGatewayToken $cgt **/
|
||||
$cgt = ClientGatewayToken::where('token', $transaction['payment_method'])->first();
|
||||
|
||||
if ($cgt && $cgt->meta?->state == 'unauthorized') {
|
||||
@ -94,7 +97,7 @@ class PaymentIntentProcessingWebhook implements ShouldQueue
|
||||
if ($this->payment_completed) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \App\Models\CompanyGateway $company_gateway **/
|
||||
$company_gateway = CompanyGateway::find($this->company_gateway_id);
|
||||
$stripe_driver = $company_gateway->driver()->init();
|
||||
|
||||
@ -123,8 +126,10 @@ class PaymentIntentProcessingWebhook implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \App\Models\Company $company **/
|
||||
$company = Company::where('company_key', $this->company_key)->first();
|
||||
|
||||
|
||||
/** @var \App\Models\Payment $payment **/
|
||||
$payment = Payment::query()
|
||||
->where('company_id', $company->id)
|
||||
->where('transaction_reference', $charge['id'])
|
||||
|
@ -113,8 +113,10 @@ class PaymentIntentWebhook implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \App\Models\Company $company **/
|
||||
$company = Company::where('company_key', $this->company_key)->first();
|
||||
|
||||
/** @var \App\Models\Payment $payment **/
|
||||
$payment = Payment::query()
|
||||
->where('company_id', $company->id)
|
||||
->where('transaction_reference', $charge['id'])
|
||||
|
@ -58,6 +58,7 @@ class StripeWebhook implements ShouldQueue
|
||||
|
||||
$company = Company::where('company_key', $this->company_key)->first();
|
||||
|
||||
/** @var \App\Models\CompanyGateway $company_gateway **/
|
||||
$company_gateway = CompanyGateway::find($this->company_gateway_id);
|
||||
|
||||
$stripe = $company_gateway->driver()->init();
|
||||
|
@ -49,6 +49,7 @@ class UpdateCustomer implements ShouldQueue
|
||||
|
||||
$company = Company::where('company_key', $this->company_key)->first();
|
||||
|
||||
/** @var \App\Models\CompanyGateway $company_gateway **/
|
||||
$company_gateway = CompanyGateway::find($this->company_gateway_id);
|
||||
$client = Client::withTrashed()->find($this->client_id);
|
||||
|
||||
|
@ -9,6 +9,7 @@ parameters:
|
||||
- 'app/Jobs/Ninja/*'
|
||||
- 'app/Console/Commands/*'
|
||||
- 'app/DataMapper/Analytics/*'
|
||||
- 'app/PaymentDrivers/Authorize/*'
|
||||
universalObjectCratesClasses:
|
||||
- App\DataMapper\Tax\RuleInterface
|
||||
- App\DataMapper\FeesAndLimits
|
||||
|
Loading…
Reference in New Issue
Block a user