mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Updates for static analysis
This commit is contained in:
parent
3766a67ec1
commit
fab3b30b38
@ -27,6 +27,7 @@ use App\Services\Subscription\SubscriptionService;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
@ -167,16 +168,19 @@ class PaymentController extends Controller
|
||||
|
||||
$payment = $payment->service()->applyCredits($payment_hash)->save();
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Collection<\App\Models\Invoice> $invoices */
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')));
|
||||
|
||||
$invoices->each(function ($i) {
|
||||
$i->is_proforma = false;
|
||||
$i->saveQuietly();
|
||||
|
||||
$invoices->each(function ($invoice) {
|
||||
/** @var \App\Models\Invoice $invoice **/
|
||||
$invoice->is_proforma = false;
|
||||
$invoice->saveQuietly();
|
||||
});
|
||||
|
||||
event('eloquent.created: App\Models\Payment', $payment);
|
||||
|
||||
if ($invoices->sum('balance') > 0) {
|
||||
/** @var \App\Models\Invoice $invoice **/
|
||||
$invoice = $invoices->first();
|
||||
|
||||
return redirect()->route('client.invoice.show', ['invoice' => $invoice->hashed_id, 'hash' => $request->input('hash')]);
|
||||
|
@ -168,7 +168,8 @@ class SendRecurring implements ShouldQueue
|
||||
private function createRecurringInvitations($invoice) :Invoice
|
||||
{
|
||||
if ($this->recurring_invoice->invitations->count() == 0) {
|
||||
$this->recurring_invoice = $this->recurring_invoice->service()->createInvitations()->save();
|
||||
$this->recurring_invoice->service()->createInvitations()->save();
|
||||
$this->recurring_invoice = $this->recurring_invoice->fresh();
|
||||
}
|
||||
|
||||
$this->recurring_invoice->invitations->each(function ($recurring_invitation) use ($invoice) {
|
||||
@ -195,18 +196,4 @@ class SendRecurring implements ShouldQueue
|
||||
|
||||
nlog(print_r($exception->getMessage(), 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 1/8/2022
|
||||
*
|
||||
* Improvements here include moving the emailentity and autobilling into the queue.
|
||||
*
|
||||
* Further improvements could using the CompanyRecurringCron.php stub which divides
|
||||
* the recurring invoices into companies and spins them off into their own queue to
|
||||
* improve parallel processing.
|
||||
*
|
||||
* Need to be careful we do not overload redis and OOM.
|
||||
*/
|
||||
}
|
@ -20,7 +20,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property string $hash
|
||||
* @property string $fee_total
|
||||
* @property int|null $fee_invoice_id
|
||||
* @property object|array $data
|
||||
* @property mixed $data
|
||||
* @property int|null $payment_id
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
|
@ -106,7 +106,7 @@ use Illuminate\Support\Facades\Storage;
|
||||
* @property-read int|null $payments_count
|
||||
* @property-read \App\Models\Project|null $project
|
||||
* @property-read \App\Models\User $user
|
||||
* @property-read \App\Models\Vendor|null $vendor
|
||||
* @property \App\Models\Vendor|null $vendor
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
|
||||
* @method static \Database\Factories\PurchaseOrderFactory factory($count = null, $state = [])
|
||||
|
@ -82,6 +82,8 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
* @property-read int|null $notifications_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
|
||||
* @property-read int|null $tokens_count
|
||||
* @property \App\Models\CompanyToken $token
|
||||
* @property int $company_id
|
||||
* @method static \Database\Factories\UserFactory factory($count = null, $state = [])
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User filter(\App\Filters\QueryFilters $filters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
|
||||
|
@ -74,9 +74,6 @@ class CheckoutComPaymentDriver extends BaseDriver
|
||||
*/
|
||||
public $gateway;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $payment_method; //the gateway type id
|
||||
|
||||
public static $methods = [
|
||||
@ -178,7 +175,7 @@ class CheckoutComPaymentDriver extends BaseDriver
|
||||
/**
|
||||
* Process the payment response
|
||||
*
|
||||
* @param Request $request The payment request
|
||||
* @param \Illuminate\Http\Request $request The payment request
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function processPaymentResponse($request)
|
||||
|
@ -616,7 +616,7 @@ class PdfBuilder
|
||||
/**
|
||||
* Formats the line items for display.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @param array<\App\DataMapper\InvoiceItem> $items
|
||||
* @param string $table_type
|
||||
*
|
||||
* @return array
|
||||
@ -954,7 +954,7 @@ class PdfBuilder
|
||||
* Performs a variable check to ensure
|
||||
* the variable exists
|
||||
*
|
||||
* @param string $variables
|
||||
* @param string $variable
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
@ -1468,7 +1468,7 @@ class PdfBuilder
|
||||
* Passes an array of items by reference
|
||||
* and performs a nl2br
|
||||
*
|
||||
* @param array $variables
|
||||
* @param array $items
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
@ -103,26 +103,31 @@ class PdfMock
|
||||
|
||||
switch ($this->request['entity_type']) {
|
||||
case 'invoice':
|
||||
/** @var \App\Models\Invoice | \App\Models\Credit | \App\Models\Quote $entity */
|
||||
$entity = Invoice::factory()->make();
|
||||
$entity->client = Client::factory()->make(['settings' => $settings]);
|
||||
$entity->invitation = InvoiceInvitation::factory()->make();
|
||||
break;
|
||||
case 'quote':
|
||||
/** @var \App\Models\Invoice | \App\Models\Credit | \App\Models\Quote $entity */
|
||||
$entity = Quote::factory()->make();
|
||||
$entity->client = Client::factory()->make(['settings' => $settings]);
|
||||
$entity->invitation = QuoteInvitation::factory()->make();
|
||||
break;
|
||||
case 'credit':
|
||||
/** @var \App\Models\Invoice | \App\Models\Credit | \App\Models\Quote $entity */
|
||||
$entity = Credit::factory()->make();
|
||||
$entity->client = Client::factory()->make(['settings' => $settings]);
|
||||
$entity->invitation = CreditInvitation::factory()->make();
|
||||
break;
|
||||
case 'purchase_order':
|
||||
/** @var \App\Models\Invoice | \App\Models\Credit | \App\Models\Quote $entity */
|
||||
$entity = PurchaseOrder::factory()->make();
|
||||
$entity->client = Client::factory()->make(['settings' => $settings]);
|
||||
$entity->invitation = PurchaseOrderInvitation::factory()->make();
|
||||
break;
|
||||
case PurchaseOrder::class:
|
||||
/** @var \App\Models\PurchaseOrder $entity */
|
||||
$entity = PurchaseOrder::factory()->make();
|
||||
$entity->invitation = PurchaseOrderInvitation::factory()->make();
|
||||
$entity->vendor = Vendor::factory()->make();
|
||||
|
@ -42,7 +42,7 @@ class StubBuilder
|
||||
|
||||
public $entity_type;
|
||||
|
||||
public mixed $recipient;
|
||||
public \App\Models\Client | \App\Models\Vendor $recipient;
|
||||
|
||||
public mixed $contact;
|
||||
|
||||
|
@ -27,6 +27,7 @@ class UpdatePrice extends AbstractService
|
||||
|
||||
foreach ($line_items as $key => $line_item) {
|
||||
|
||||
/** @var \App\Models\Product $product **/
|
||||
$product = Product::where('company_id', $this->recurring_invoice->company_id)
|
||||
->where('product_key', $line_item->product_key)
|
||||
->where('is_deleted', 0)
|
||||
|
@ -11,15 +11,16 @@
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\ExpenseCategory;
|
||||
use App\Transformers\ExpenseCategoryTransformer;
|
||||
use App\Models\Document;
|
||||
use App\Models\ExpenseCategory;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Transformers\ExpenseCategoryTransformer;
|
||||
|
||||
/**
|
||||
* class ExpenseTransformer.
|
||||
|
@ -11,10 +11,12 @@
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Expense;
|
||||
use App\Models\Document;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Models\PurchaseOrderInvitation;
|
||||
|
||||
class PurchaseOrderTransformer extends EntityTransformer
|
||||
{
|
||||
|
@ -11,10 +11,11 @@
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\Activity;
|
||||
use App\Models\Backup;
|
||||
use App\Models\Document;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Backup;
|
||||
use App\Models\Client;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Document;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use League\Fractal\Resource\Item;
|
||||
|
@ -11,11 +11,13 @@
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Document;
|
||||
use App\Models\RecurringExpense;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\RecurringExpense;
|
||||
use League\Fractal\Resource\Item;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* class RecurringExpenseTransformer.
|
||||
|
@ -11,9 +11,12 @@
|
||||
|
||||
namespace App\Transformers;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\Project;
|
||||
use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Project;
|
||||
use App\Models\Document;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use League\Fractal\Resource\Item;
|
||||
|
@ -45,15 +45,13 @@ trait MakesReminders
|
||||
public function calculateTemplate(string $entity_string): string
|
||||
{
|
||||
|
||||
/** @var \App\Models\Invoice | \App\Models\Quote | \App\Models\RecurringInvoice | \App\Models\Credit $this **/
|
||||
|
||||
/** @var \App\Models\Invoice | \App\Models\Quote | \App\Models\RecurringInvoice | \App\Models\Credit $this **/
|
||||
$client = $this->client;
|
||||
|
||||
if ($entity_string != 'invoice') {
|
||||
return $entity_string;
|
||||
}
|
||||
|
||||
//if the invoice
|
||||
if ($this->inReminderWindow(
|
||||
$client->getSetting('schedule_reminder1'),
|
||||
$client->getSetting('num_days_reminder1')
|
||||
|
Loading…
x
Reference in New Issue
Block a user