diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 2cf498cfa7cd..d696c083de43 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -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')]); diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 49343ed73033..ad6074309f80 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -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. -*/ +} \ No newline at end of file diff --git a/app/Models/PaymentHash.php b/app/Models/PaymentHash.php index 875e412bd1c4..019ac21ac33a 100644 --- a/app/Models/PaymentHash.php +++ b/app/Models/PaymentHash.php @@ -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 diff --git a/app/Models/PurchaseOrder.php b/app/Models/PurchaseOrder.php index f30a9076e427..e634636acda0 100644 --- a/app/Models/PurchaseOrder.php +++ b/app/Models/PurchaseOrder.php @@ -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 = []) diff --git a/app/Models/User.php b/app/Models/User.php index 8a69ea4d9dc2..db2f87506444 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -82,6 +82,8 @@ use Illuminate\Foundation\Auth\User as Authenticatable; * @property-read int|null $notifications_count * @property-read \Illuminate\Database\Eloquent\Collection $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() diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index 719e0119c42b..7c65fadc8508 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -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) diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 819130cff9ef..8a8226e09e1d 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -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 * */ diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index 34ac517d975e..ade1e5d3694c 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -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(); diff --git a/app/Services/Preview/StubBuilder.php b/app/Services/Preview/StubBuilder.php index c17d3de593ba..3755f077e742 100644 --- a/app/Services/Preview/StubBuilder.php +++ b/app/Services/Preview/StubBuilder.php @@ -42,7 +42,7 @@ class StubBuilder public $entity_type; - public mixed $recipient; + public \App\Models\Client | \App\Models\Vendor $recipient; public mixed $contact; diff --git a/app/Services/Recurring/UpdatePrice.php b/app/Services/Recurring/UpdatePrice.php index 9e4569be1ff7..77c729669bdc 100644 --- a/app/Services/Recurring/UpdatePrice.php +++ b/app/Services/Recurring/UpdatePrice.php @@ -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) diff --git a/app/Transformers/ExpenseTransformer.php b/app/Transformers/ExpenseTransformer.php index 48a3ed7c4a7d..653d0ee155ff 100644 --- a/app/Transformers/ExpenseTransformer.php +++ b/app/Transformers/ExpenseTransformer.php @@ -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. diff --git a/app/Transformers/PurchaseOrderTransformer.php b/app/Transformers/PurchaseOrderTransformer.php index 360e1edcf922..527cca34666f 100644 --- a/app/Transformers/PurchaseOrderTransformer.php +++ b/app/Transformers/PurchaseOrderTransformer.php @@ -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 { diff --git a/app/Transformers/QuoteTransformer.php b/app/Transformers/QuoteTransformer.php index ca2d092057fd..bdbe0bfa27a2 100644 --- a/app/Transformers/QuoteTransformer.php +++ b/app/Transformers/QuoteTransformer.php @@ -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; diff --git a/app/Transformers/RecurringExpenseTransformer.php b/app/Transformers/RecurringExpenseTransformer.php index 74f42eb79349..6d323093387c 100644 --- a/app/Transformers/RecurringExpenseTransformer.php +++ b/app/Transformers/RecurringExpenseTransformer.php @@ -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. diff --git a/app/Transformers/TaskTransformer.php b/app/Transformers/TaskTransformer.php index 503ec0612799..af78d20d92eb 100644 --- a/app/Transformers/TaskTransformer.php +++ b/app/Transformers/TaskTransformer.php @@ -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; diff --git a/app/Utils/Traits/MakesReminders.php b/app/Utils/Traits/MakesReminders.php index 2447d2c1f316..753fb1d98608 100644 --- a/app/Utils/Traits/MakesReminders.php +++ b/app/Utils/Traits/MakesReminders.php @@ -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')