mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:29:03 -05:00 
			
		
		
		
	Merge pull request #9642 from turbo124/v5-develop
Update intended path when redirecting to CP.
This commit is contained in:
		
						commit
						b45f9f711a
					
				@ -24,6 +24,7 @@ class TaxData
 | 
			
		||||
 | 
			
		||||
    public function __construct(public Response $origin)
 | 
			
		||||
    {
 | 
			
		||||
        // @phpstan-ignore-next-line
 | 
			
		||||
        foreach($origin as $key => $value) {
 | 
			
		||||
            $this->{$key} = $value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -109,10 +109,11 @@ class Handler extends ExceptionHandler
 | 
			
		||||
            Integration::configureScope(function (Scope $scope): void {
 | 
			
		||||
                $name = 'hosted@invoiceninja.com';
 | 
			
		||||
 | 
			
		||||
                if (auth()->guard('contact') && auth()->guard('contact')->user()) {
 | 
			
		||||
                if (auth()->guard('contact') && auth()->guard('contact')->user()) { // @phpstan-ignore-line
 | 
			
		||||
                    $name = 'Contact = '.auth()->guard('contact')->user()->email;
 | 
			
		||||
                    $key = auth()->guard('contact')->user()->company->account->key;
 | 
			
		||||
                } elseif (auth()->guard('user') && auth()->guard('user')->user()) {
 | 
			
		||||
                } elseif (auth()->guard('user') && auth()->guard('user')->user()) { // @phpstan-ignore-line
 | 
			
		||||
 | 
			
		||||
                    $name = 'Admin = '.auth()->guard('user')->user()->email;
 | 
			
		||||
                    $key = auth()->user()->account->key;
 | 
			
		||||
                } else {
 | 
			
		||||
@ -131,13 +132,14 @@ class Handler extends ExceptionHandler
 | 
			
		||||
            }
 | 
			
		||||
        } elseif (app()->bound('sentry')) {
 | 
			
		||||
            Integration::configureScope(function (Scope $scope): void {
 | 
			
		||||
                if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
 | 
			
		||||
                if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {// @phpstan-ignore-line
 | 
			
		||||
 | 
			
		||||
                    $scope->setUser([
 | 
			
		||||
                        'id'    => auth()->guard('contact')->user()->company->account->key,
 | 
			
		||||
                        'email' => 'anonymous@example.com',
 | 
			
		||||
                        'name'  => 'Anonymous User',
 | 
			
		||||
                    ]);
 | 
			
		||||
                } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->companyIsSet() && auth()->user()->company()->account->report_errors) {
 | 
			
		||||
                } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->companyIsSet() && auth()->user()->company()->account->report_errors) {// @phpstan-ignore-line
 | 
			
		||||
                    $scope->setUser([
 | 
			
		||||
                        'id'    => auth()->user()->account->key,
 | 
			
		||||
                        'email' => 'anonymous@example.com',
 | 
			
		||||
 | 
			
		||||
@ -25,8 +25,6 @@ use League\Csv\Writer;
 | 
			
		||||
 | 
			
		||||
class ActivityExport extends BaseExport
 | 
			
		||||
{
 | 
			
		||||
    private $entity_transformer;
 | 
			
		||||
 | 
			
		||||
    public string $date_key = 'created_at';
 | 
			
		||||
 | 
			
		||||
    private string $date_format = 'YYYY-MM-DD';
 | 
			
		||||
@ -43,7 +41,7 @@ class ActivityExport extends BaseExport
 | 
			
		||||
    {
 | 
			
		||||
        $this->company = $company;
 | 
			
		||||
        $this->input = $input;
 | 
			
		||||
        $this->entity_transformer = new ActivityTransformer();
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function returnJson()
 | 
			
		||||
@ -143,10 +141,10 @@ class ActivityExport extends BaseExport
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function decorateAdvancedFields(Task $task, array $entity): array
 | 
			
		||||
    {
 | 
			
		||||
        return $entity;
 | 
			
		||||
    }
 | 
			
		||||
    // private function decorateAdvancedFields(Task $task, array $entity): array
 | 
			
		||||
    // {
 | 
			
		||||
    //     return $entity;
 | 
			
		||||
    // }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function processMetaData(array $row, $resource): array
 | 
			
		||||
 | 
			
		||||
@ -971,9 +971,10 @@ class BaseExport
 | 
			
		||||
    protected function addPaymentStatusFilters(Builder $query, string $status): Builder
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        /** @var array $status_parameters */
 | 
			
		||||
        $status_parameters = explode(',', $status);
 | 
			
		||||
 | 
			
		||||
        if(in_array('all', $status_parameters) || count($status_parameters) == 0) {
 | 
			
		||||
        if((count($status_parameters) == 0) || in_array('all', $status_parameters)) {
 | 
			
		||||
            return $query;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1028,6 +1029,7 @@ class BaseExport
 | 
			
		||||
    protected function addRecurringInvoiceStatusFilter(Builder $query, string $status): Builder
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        /** @var array $status_parameters */
 | 
			
		||||
        $status_parameters = explode(',', $status);
 | 
			
		||||
 | 
			
		||||
        if (in_array('all', $status_parameters) || count($status_parameters) == 0) {
 | 
			
		||||
@ -1132,6 +1134,7 @@ class BaseExport
 | 
			
		||||
    protected function addPurchaseOrderStatusFilter(Builder $query, string $status): Builder
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        /** @var array $status_parameters */
 | 
			
		||||
        $status_parameters = explode(',', $status);
 | 
			
		||||
 | 
			
		||||
        if (in_array('all', $status_parameters) || count($status_parameters) == 0) {
 | 
			
		||||
@ -1180,6 +1183,7 @@ class BaseExport
 | 
			
		||||
    protected function addInvoiceStatusFilter(Builder $query, string $status): Builder
 | 
			
		||||
    {
 | 
			
		||||
               
 | 
			
		||||
        /** @var array $status_parameters */
 | 
			
		||||
        $status_parameters = explode(',', $status);
 | 
			
		||||
 | 
			
		||||
        if(in_array('all', $status_parameters) || count($status_parameters) == 0) {
 | 
			
		||||
 | 
			
		||||
@ -243,16 +243,16 @@ class ClientExport extends BaseExport
 | 
			
		||||
        return $entity;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function calculateStatus($client)
 | 
			
		||||
    {
 | 
			
		||||
        if ($client->is_deleted) {
 | 
			
		||||
            return ctrans('texts.deleted');
 | 
			
		||||
        }
 | 
			
		||||
    // private function calculateStatus($client)
 | 
			
		||||
    // {
 | 
			
		||||
    //     if ($client->is_deleted) {
 | 
			
		||||
    //         return ctrans('texts.deleted');
 | 
			
		||||
    //     }
 | 
			
		||||
 | 
			
		||||
        if ($client->deleted_at) {
 | 
			
		||||
            return ctrans('texts.archived');
 | 
			
		||||
        }
 | 
			
		||||
    //     if ($client->deleted_at) {
 | 
			
		||||
    //         return ctrans('texts.archived');
 | 
			
		||||
    //     }
 | 
			
		||||
 | 
			
		||||
        return ctrans('texts.active');
 | 
			
		||||
    }
 | 
			
		||||
    //     return ctrans('texts.active');
 | 
			
		||||
    // }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -155,7 +155,7 @@ class ContactExport extends BaseExport
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (in_array('client.user_id', $this->input['report_keys'])) {
 | 
			
		||||
            $entity['client.user_id'] = $client->user ? $client->user->present()->name() : '';
 | 
			
		||||
            $entity['client.user_id'] = $client->user ? $client->user->present()->name() : '';// @phpstan-ignore-line
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (in_array('client.assigned_user_id', $this->input['report_keys'])) {
 | 
			
		||||
 | 
			
		||||
@ -133,16 +133,16 @@ class ProductExport extends BaseExport
 | 
			
		||||
        // return $this->decorateAdvancedFields($product, $entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function decorateAdvancedFields(Product $product, array $entity): array
 | 
			
		||||
    {
 | 
			
		||||
        if (in_array('vendor_id', $this->input['report_keys'])) {
 | 
			
		||||
            $entity['vendor'] = $product->vendor()->exists() ? $product->vendor->name : '';
 | 
			
		||||
        }
 | 
			
		||||
    // private function decorateAdvancedFields(Product $product, array $entity): array
 | 
			
		||||
    // {
 | 
			
		||||
    //     if (in_array('vendor_id', $this->input['report_keys'])) {
 | 
			
		||||
    //         $entity['vendor'] = $product->vendor()->exists() ? $product->vendor->name : '';
 | 
			
		||||
    //     }
 | 
			
		||||
 | 
			
		||||
        // if (array_key_exists('project_id', $this->input['report_keys'])) {
 | 
			
		||||
        //     $entity['project'] = $product->project()->exists() ? $product->project->name : '';
 | 
			
		||||
        // }
 | 
			
		||||
    //     // if (array_key_exists('project_id', $this->input['report_keys'])) {
 | 
			
		||||
    //     //     $entity['project'] = $product->project()->exists() ? $product->project->name : '';
 | 
			
		||||
    //     // }
 | 
			
		||||
 | 
			
		||||
        return $entity;
 | 
			
		||||
    }
 | 
			
		||||
    //     return $entity;
 | 
			
		||||
    // }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -66,11 +66,11 @@ class ProductSalesExport extends BaseExport
 | 
			
		||||
        'custom_value4' => 'custom_value4',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    private array $decorate_keys = [
 | 
			
		||||
        'client',
 | 
			
		||||
        'currency',
 | 
			
		||||
        'date',
 | 
			
		||||
    ];
 | 
			
		||||
    // private array $decorate_keys = [
 | 
			
		||||
    //     'client',
 | 
			
		||||
    //     'currency',
 | 
			
		||||
    //     'date',
 | 
			
		||||
    // ];
 | 
			
		||||
 | 
			
		||||
    public function __construct(Company $company, array $input)
 | 
			
		||||
    {
 | 
			
		||||
@ -330,8 +330,8 @@ class ProductSalesExport extends BaseExport
 | 
			
		||||
     * @param  string $product_key
 | 
			
		||||
     * @return ?\Illuminate\Database\Eloquent\Model
 | 
			
		||||
     */
 | 
			
		||||
    private function getProduct(string $product_key)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->products->firstWhere('product_key', $product_key);
 | 
			
		||||
    }
 | 
			
		||||
    // private function getProduct(string $product_key)
 | 
			
		||||
    // {
 | 
			
		||||
    //     return $this->products->firstWhere('product_key', $product_key);
 | 
			
		||||
    // }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -41,6 +41,9 @@ class ContactLoginController extends Controller
 | 
			
		||||
        $company = false;
 | 
			
		||||
        $account = false;
 | 
			
		||||
 | 
			
		||||
        if($request->query('intended'))
 | 
			
		||||
            $request->session()->put('url.intended', $request->query('intended'));
 | 
			
		||||
        
 | 
			
		||||
        if ($request->session()->has('company_key')) {
 | 
			
		||||
            MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key'));
 | 
			
		||||
            $company = Company::where('company_key', $request->session()->get('company_key'))->first();
 | 
			
		||||
@ -81,6 +84,7 @@ class ContactLoginController extends Controller
 | 
			
		||||
 | 
			
		||||
    public function login(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        Auth::shouldUse('contact');
 | 
			
		||||
 | 
			
		||||
        if (Ninja::isHosted() && $request->has('company_key')) {
 | 
			
		||||
@ -125,6 +129,9 @@ class ContactLoginController extends Controller
 | 
			
		||||
 | 
			
		||||
    protected function sendLoginResponse(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $intended = $request->session()->has('url.intended') ? $request->session()->get('url.intended') : false;
 | 
			
		||||
 | 
			
		||||
        $request->session()->regenerate();
 | 
			
		||||
 | 
			
		||||
        $this->clearLoginAttempts($request);
 | 
			
		||||
@ -135,6 +142,9 @@ class ContactLoginController extends Controller
 | 
			
		||||
 | 
			
		||||
        $this->setRedirectPath();
 | 
			
		||||
        
 | 
			
		||||
        if($intended)
 | 
			
		||||
            $this->redirectTo = $intended;
 | 
			
		||||
 | 
			
		||||
        return $request->wantsJson()
 | 
			
		||||
                    ? new JsonResponse([], 204)
 | 
			
		||||
                    : redirect()->intended($this->redirectPath());
 | 
			
		||||
@ -146,8 +156,8 @@ class ContactLoginController extends Controller
 | 
			
		||||
 | 
			
		||||
        event(new ContactLoggedIn($client, $client->company, Ninja::eventVars()));
 | 
			
		||||
 | 
			
		||||
        if (session()->get('url.intended')) {
 | 
			
		||||
            return redirect(session()->get('url.intended'));
 | 
			
		||||
        if ($request->session()->has('url.intended')) {
 | 
			
		||||
            return redirect($request->session()->get('url.intended'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->setRedirectPath();
 | 
			
		||||
@ -165,19 +175,20 @@ class ContactLoginController extends Controller
 | 
			
		||||
 | 
			
		||||
    private function setRedirectPath()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) {
 | 
			
		||||
            $this->redirectTo = '/client/dashboard';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES)) {
 | 
			
		||||
            $this->redirectTo = '/client/invoices';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES)) {
 | 
			
		||||
            $this->redirectTo = '/client/recurring_invoices';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES)) {
 | 
			
		||||
            $this->redirectTo = '/client/quotes';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)) {
 | 
			
		||||
            $this->redirectTo = '/client/credits';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS)) {
 | 
			
		||||
            $this->redirectTo = '/client/tasks';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES)) {
 | 
			
		||||
            $this->redirectTo = '/client/expenses';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -997,9 +997,10 @@ class BaseController extends Controller
 | 
			
		||||
 | 
			
		||||
                if(request()->has('einvoice')) {
 | 
			
		||||
 | 
			
		||||
                    $ro = new Schema();
 | 
			
		||||
                    $response_data['einvoice_schema'] = $ro('Peppol');
 | 
			
		||||
 | 
			
		||||
                    if(class_exists(Schema::class)){
 | 
			
		||||
                        $ro = new Schema();
 | 
			
		||||
                        $response_data['einvoice_schema'] = $ro('Peppol');
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $response['static'] = $response_data;
 | 
			
		||||
 | 
			
		||||
@ -66,15 +66,15 @@ class ContactHashLoginController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        if (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) {
 | 
			
		||||
            return '/client/invoices';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES)) {
 | 
			
		||||
            return '/client/recurring_invoices';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES)) {
 | 
			
		||||
            return '/client/quotes';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)) {
 | 
			
		||||
            return '/client/credits';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS)) {
 | 
			
		||||
            return '/client/tasks';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES)) {
 | 
			
		||||
            return '/client/expenses';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -115,14 +115,16 @@ class InvitationController extends Controller
 | 
			
		||||
                        ]);
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            $this->middleware('auth:contact');
 | 
			
		||||
            return redirect()->route('client.login');
 | 
			
		||||
            if(!auth()->guard('contact')->check()){
 | 
			
		||||
                $this->middleware('auth:contact');
 | 
			
		||||
                return redirect()->route('client.login', ['intended' => route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key}), 'silent' => $is_silent])]);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            request()->session()->invalidate();
 | 
			
		||||
            auth()->guard('contact')->loginUsingId($client_contact->id, true);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        if (auth()->guard('contact')->user() && ! request()->has('silent') && ! $invitation->viewed_date) {
 | 
			
		||||
            $invitation->markViewed();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -458,7 +458,7 @@ class CreditController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * Perform bulk actions on the list view.
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     *
 | 
			
		||||
     * @OA\Post(
 | 
			
		||||
     *      path="/api/v1/credits/bulk",
 | 
			
		||||
@ -700,7 +700,7 @@ class CreditController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function downloadPdf($invitation_key)
 | 
			
		||||
    {
 | 
			
		||||
@ -768,7 +768,7 @@ class CreditController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function downloadECredit($invitation_key)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ class FilterController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * Display a listing of the resource.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     * @return \Illuminate\Http\JsonResponse
 | 
			
		||||
     */
 | 
			
		||||
    public function index(Request $request, string $entity)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -800,7 +800,7 @@ class InvoiceController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function downloadPdf($invitation_key)
 | 
			
		||||
    {
 | 
			
		||||
@ -870,7 +870,7 @@ class InvoiceController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function downloadEInvoice($invitation_key)
 | 
			
		||||
    {
 | 
			
		||||
@ -938,7 +938,7 @@ class InvoiceController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invoice
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function deliveryNote(ShowInvoiceRequest $request, Invoice $invoice)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -54,7 +54,7 @@ class PreviewPurchaseOrderController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a template filled with entity variables.
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Illuminate\Http\Response
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response | \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     *
 | 
			
		||||
     * @OA\Post(
 | 
			
		||||
     *      path="/api/v1/preview/purchase_order",
 | 
			
		||||
 | 
			
		||||
@ -434,7 +434,7 @@ class PurchaseOrderController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * Perform bulk actions on the list view.
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response | \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     *
 | 
			
		||||
     * @OA\Post(
 | 
			
		||||
     *      path="/api/v1/purchase_orders/bulk",
 | 
			
		||||
@ -826,7 +826,7 @@ class PurchaseOrderController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function downloadPdf($invitation_key)
 | 
			
		||||
    {
 | 
			
		||||
@ -891,7 +891,7 @@ class PurchaseOrderController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     */
 | 
			
		||||
    public function downloadEPurchaseOrder($invitation_key)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -465,7 +465,7 @@ class QuoteController extends BaseController
 | 
			
		||||
    /**
 | 
			
		||||
     * Perform bulk actions on the list view.
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @OA\Post(
 | 
			
		||||
@ -832,7 +832,7 @@ class QuoteController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param $invitation_key
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     * @return \Symfony\Component\HttpFoundation\StreamedResponse | \Illuminate\Http\JsonResponse | \Illuminate\Http\Response | \Symfony\Component\HttpFoundation\BinaryFileResponse
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public function downloadPdf($invitation_key)
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,7 @@ trait VerifiesUserEmail
 | 
			
		||||
    use MakesHash;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return \Illuminate\Http\RedirectResponse
 | 
			
		||||
     * @return \Illuminate\View\View
 | 
			
		||||
     */
 | 
			
		||||
    public function confirm()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ class VendorContactHashLoginController extends Controller
 | 
			
		||||
    /**
 | 
			
		||||
     * Logs a user into the client portal using their contact_key
 | 
			
		||||
     * @param  string $contact_key  The contact key
 | 
			
		||||
     * @return Auth|\Illuminate\Support\Facades\Redirect
 | 
			
		||||
     * @return \Illuminate\Http\RedirectResponse
 | 
			
		||||
     */
 | 
			
		||||
    public function login(string $contact_key)
 | 
			
		||||
    {
 | 
			
		||||
@ -27,7 +27,7 @@ class VendorContactHashLoginController extends Controller
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * @return \Illuminate\Support\Facades\Redirect
 | 
			
		||||
     * @return \Illuminate\Http\RedirectResponse
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    public function magicLink(string $magic_link)
 | 
			
		||||
@ -35,6 +35,11 @@ class VendorContactHashLoginController extends Controller
 | 
			
		||||
        return redirect($this->setRedirectPath());
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * errorPage
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Illuminate\View\View
 | 
			
		||||
     */
 | 
			
		||||
    public function errorPage()
 | 
			
		||||
    {
 | 
			
		||||
        return render('generic.error', ['title' => session()->get('title'), 'notification' => session()->get('notification')]);
 | 
			
		||||
 | 
			
		||||
@ -65,7 +65,7 @@ class Kernel extends HttpKernel
 | 
			
		||||
     *
 | 
			
		||||
     * These middleware are run during every request to your application.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<int,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $middleware = [
 | 
			
		||||
        CheckForMaintenanceMode::class,
 | 
			
		||||
@ -79,7 +79,7 @@ class Kernel extends HttpKernel
 | 
			
		||||
    /**
 | 
			
		||||
     * The application's route middleware groups.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<string, array<int,string>>
 | 
			
		||||
     */
 | 
			
		||||
    protected $middlewareGroups = [
 | 
			
		||||
        'web' => [
 | 
			
		||||
@ -125,7 +125,7 @@ class Kernel extends HttpKernel
 | 
			
		||||
     *
 | 
			
		||||
     * These middleware may be assigned to groups or used individually.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<string,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $middlewareAliases = [
 | 
			
		||||
        'auth' => Authenticate::class,
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@ class CheckForMaintenanceMode extends Middleware
 | 
			
		||||
    /**
 | 
			
		||||
     * The URIs that should be reachable while maintenance mode is enabled.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<int,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $except = [
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
@ -163,17 +163,17 @@ class ContactKeyLogin
 | 
			
		||||
    {
 | 
			
		||||
        if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) {
 | 
			
		||||
            return '/client/dashboard';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES)) {
 | 
			
		||||
            return '/client/invoices';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES)) {
 | 
			
		||||
            return '/client/recurring_invoices';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES)) {
 | 
			
		||||
            return '/client/quotes';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)) {
 | 
			
		||||
            return '/client/credits';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_TASKS)) {
 | 
			
		||||
            return '/client/tasks';
 | 
			
		||||
        } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES) {
 | 
			
		||||
        } elseif ((bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_EXPENSES)) {
 | 
			
		||||
            return '/client/expenses';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@ class EncryptCookies extends Middleware
 | 
			
		||||
    /**
 | 
			
		||||
     * The names of the cookies that should not be encrypted.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<int,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $except = [
 | 
			
		||||
        //
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ class ThrottleRequestsWithPredis extends ThrottleRequests
 | 
			
		||||
    /**
 | 
			
		||||
     * The Redis factory implementation.
 | 
			
		||||
     *
 | 
			
		||||
     * @var \Illuminate\Contracts\Redis\Factory
 | 
			
		||||
     * @var \Illuminate\Redis\Connections\Connection
 | 
			
		||||
     */
 | 
			
		||||
    protected $redis;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@ class TrimStrings extends Middleware
 | 
			
		||||
    /**
 | 
			
		||||
     * The names of the attributes that should not be trimmed.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<int,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $except = [
 | 
			
		||||
        'current_password',
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ class TrustProxies extends Middleware
 | 
			
		||||
    /**
 | 
			
		||||
     * The trusted proxies for this application.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<int,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $proxies;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,7 @@ class VerifyCsrfToken extends Middleware
 | 
			
		||||
    /**
 | 
			
		||||
     * The URIs that should be excluded from CSRF verification.
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @var array<int,string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $except = [
 | 
			
		||||
        'setup/*',
 | 
			
		||||
 | 
			
		||||
@ -17,7 +17,7 @@ class ShowCreditRequest extends FormRequest
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']); 
 | 
			
		||||
 | 
			
		||||
        return ! $this->credit->is_deleted
 | 
			
		||||
            && auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS
 | 
			
		||||
            && (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS)
 | 
			
		||||
            && auth()->guard('contact')->user()->client_id === $this->credit->client_id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ class ShowCreditsRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    public function authorize()
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ class ProcessInvoicesInBulkRequest extends FormRequest
 | 
			
		||||
        
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,6 @@ class ShowInvoiceRequest extends Request
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return (int) auth()->guard('contact')->user()->client_id === (int) $this->invoice->client_id
 | 
			
		||||
            && auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
 | 
			
		||||
            && (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ class ShowInvoicesRequest extends FormRequest
 | 
			
		||||
        
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ class StorePrePaymentRequest extends FormRequest
 | 
			
		||||
            $query->without('gateway_tokens', 'documents', 'contacts.company', 'contacts'); // Exclude 'grandchildren' relation of 'client'
 | 
			
		||||
        }]);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ class ProcessQuotesInBulkRequest extends FormRequest
 | 
			
		||||
        
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -22,8 +22,8 @@ class ShowQuoteRequest extends FormRequest
 | 
			
		||||
        
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->client->id === (int) $this->quote->client_id
 | 
			
		||||
             && auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
 | 
			
		||||
        return (int)auth()->guard('contact')->user()->client->id === (int) $this->quote->client_id
 | 
			
		||||
             && (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ class ShowQuotesRequest extends FormRequest
 | 
			
		||||
        
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,7 @@ class RequestCancellationRequest extends FormRequest
 | 
			
		||||
        
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -20,8 +20,8 @@ class ShowRecurringInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->client->id == $this->recurring_invoice->client_id
 | 
			
		||||
            && auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES;
 | 
			
		||||
        return (int)auth()->guard('contact')->user()->client->id == $this->recurring_invoice->client_id
 | 
			
		||||
            && (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ class ShowRecurringInvoicesRequest extends FormRequest
 | 
			
		||||
    {
 | 
			
		||||
        auth()->guard('contact')->user()->loadMissing(['company']);
 | 
			
		||||
 | 
			
		||||
        return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES;
 | 
			
		||||
        return (bool)(auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -50,21 +50,25 @@ class IbpRequest extends FormRequest
 | 
			
		||||
 | 
			
		||||
    public function getCompany(): ?Company
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\Company */
 | 
			
		||||
        return Company::where('company_key', $this->company_key)->first();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCompanyGateway(): ?CompanyGateway
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\CompanyGateway */
 | 
			
		||||
        return CompanyGateway::find($this->decodePrimaryKey($this->company_gateway_id));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPaymentHash(): ?PaymentHash
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\PaymentHash */
 | 
			
		||||
        return PaymentHash::where('hash', $this->hash)->firstOrFail();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getClient(): ?Client
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\Client */
 | 
			
		||||
        return Client::find($this->getPaymentHash()->data->client_id);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -47,21 +47,25 @@ class Mollie3dsRequest extends FormRequest
 | 
			
		||||
 | 
			
		||||
    public function getCompany(): ?Company
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\Company */
 | 
			
		||||
        return Company::where('company_key', $this->company_key)->first();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCompanyGateway(): ?CompanyGateway
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\CompanyGateway */
 | 
			
		||||
        return CompanyGateway::find($this->decodePrimaryKey($this->company_gateway_id));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPaymentHash(): ?PaymentHash
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\PaymentHash */
 | 
			
		||||
        return PaymentHash::where('hash', $this->hash)->first();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getClient(): ?Client
 | 
			
		||||
    {
 | 
			
		||||
        /** @var \App\Models\Client */
 | 
			
		||||
        return Client::find($this->getPaymentHash()->data->client_id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -81,7 +81,7 @@ class RefundPaymentRequest extends Request
 | 
			
		||||
    public function payment(): ?\App\Models\Payment
 | 
			
		||||
    {
 | 
			
		||||
        $input = $this->all();
 | 
			
		||||
 | 
			
		||||
        return Payment::whereId($input['id'])->first();
 | 
			
		||||
        /** @var \App\Models\Payment */
 | 
			
		||||
        return Payment::find($input['id']);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -45,19 +45,21 @@ class PaymentWebhookRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        MultiDB::findAndSetDbByCompanyKey($this->company_key);
 | 
			
		||||
 | 
			
		||||
        /** @var \App\Models\CompanyGateway */
 | 
			
		||||
        return CompanyGateway::withTrashed()->find($this->decodePrimaryKey($this->company_gateway_id));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Resolve payment hash.
 | 
			
		||||
     *
 | 
			
		||||
     * @return null|\App\Models\PaymentHash
 | 
			
		||||
     * @return null|bool|\App\Models\PaymentHash
 | 
			
		||||
     */
 | 
			
		||||
    public function getPaymentHash()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->query('hash')) {
 | 
			
		||||
            MultiDB::findAndSetDbByCompanyKey($this->company_key);
 | 
			
		||||
 | 
			
		||||
            /** @var \App\Models\PaymentHash */
 | 
			
		||||
            return PaymentHash::where('hash', $this->query('hash'))->firstOrFail();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -73,6 +75,7 @@ class PaymentWebhookRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        MultiDB::findAndSetDbByCompanyKey($this->company_key);
 | 
			
		||||
    
 | 
			
		||||
        /** @var \App\Models\Company */
 | 
			
		||||
        return Company::where('company_key', $this->company_key)->firstOrFail();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -27,9 +27,8 @@ class ShowDocumentRequest extends FormRequest
 | 
			
		||||
    public function authorize()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        /** @var \App\Models\VendorContact auth()->guard('vendor')->user() */
 | 
			
		||||
        return auth()->guard('vendor')->user()->vendor_id == $this->document->documentable_id
 | 
			
		||||
            || $this->document->company_id == auth()->guard('vendor')->user()->company_id;
 | 
			
		||||
        return (bool) (auth()->guard('vendor')->user()->vendor_id == $this->document->documentable_id
 | 
			
		||||
            || $this->document->company_id == auth()->guard('vendor')->user()->company_id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ class ProcessPurchaseOrdersInBulkRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
    public function authorize()
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->guard('vendor')->user()->vendor->company->enabled_modules & PortalComposer::MODULE_PURCHASE_ORDERS;
 | 
			
		||||
        return (bool)(auth()->guard('vendor')->user()->vendor->company->enabled_modules & PortalComposer::MODULE_PURCHASE_ORDERS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,6 @@ class ShowPurchaseOrderRequest extends Request
 | 
			
		||||
    public function authorize(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return (int) auth()->guard('vendor')->user()->vendor_id === (int) $this->purchase_order->vendor_id
 | 
			
		||||
            && auth()->guard('vendor')->user()->company->enabled_modules & PortalComposer::MODULE_PURCHASE_ORDERS;
 | 
			
		||||
            && (bool)(auth()->guard('vendor')->user()->company->enabled_modules & PortalComposer::MODULE_PURCHASE_ORDERS);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,6 @@ class ShowPurchaseOrdersRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->guard('vendor')->user()->company->enabled_modules & PortalComposer::MODULE_PURCHASE_ORDERS;
 | 
			
		||||
        return (bool)(auth()->guard('vendor')->user()->company->enabled_modules & PortalComposer::MODULE_PURCHASE_ORDERS);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -44,13 +44,11 @@ class ValidProjectForClient implements Rule
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $project = Project::withTrashed()->find($this->input['project_id']);
 | 
			
		||||
 | 
			
		||||
        if (! $project) {
 | 
			
		||||
            $this->message = 'Project not found';
 | 
			
		||||
            return;
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(!isset($this->input['client_id'])) {
 | 
			
		||||
 | 
			
		||||
@ -55,6 +55,8 @@ class ProcessBrevoWebhook implements ShouldQueue
 | 
			
		||||
        'events' => [],
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    /** @var ?\App\Models\Company $company*/
 | 
			
		||||
    private ?Company $company = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -86,11 +88,12 @@ class ProcessBrevoWebhook implements ShouldQueue
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
        MultiDB::findAndSetDbByCompanyKey($this->request['tags'][0]);
 | 
			
		||||
 | 
			
		||||
        /** @phpstan-ignore-next-line */
 | 
			
		||||
        $this->company = Company::where('company_key', $this->request['tags'][0])->first();
 | 
			
		||||
 | 
			
		||||
        $this->invitation = $this->discoverInvitation($this->request['message-id']);
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,6 @@ class CompanyExport implements ShouldQueue
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
@ -468,10 +467,10 @@ class CompanyExport implements ShouldQueue
 | 
			
		||||
        $x->addItems($this->export_data['subscriptions']);
 | 
			
		||||
        $this->export_data = null;
 | 
			
		||||
 | 
			
		||||
        $this->export_data['system_logs'] = $this->company->system_logs->map(function ($log) {
 | 
			
		||||
            $log->client_id = $this->encodePrimaryKey($log->client_id);
 | 
			
		||||
            $log->company_id = $this->encodePrimaryKey($log->company_id);
 | 
			
		||||
        
 | 
			
		||||
        $this->export_data['system_logs'] = $this->company->system_logs->map(function ($log) {
 | 
			
		||||
            $log->client_id = $this->encodePrimaryKey($log->client_id);/** @phpstan-ignore-line */
 | 
			
		||||
            $log->company_id = $this->encodePrimaryKey($log->company_id);/** @phpstan-ignore-line */
 | 
			
		||||
            return $log;
 | 
			
		||||
        })->makeHidden(['id'])->all();
 | 
			
		||||
 | 
			
		||||
@ -496,9 +495,9 @@ class CompanyExport implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $this->export_data['task_statuses'] = $this->company->task_statuses->map(function ($status) {
 | 
			
		||||
            $status->id = $this->encodePrimaryKey($status->id);
 | 
			
		||||
            $status->user_id = $this->encodePrimaryKey($status->user_id);
 | 
			
		||||
            $status->company_id = $this->encodePrimaryKey($status->company_id);
 | 
			
		||||
            $status->id = $this->encodePrimaryKey($status->id); /** @phpstan-ignore-line */
 | 
			
		||||
            $status->user_id = $this->encodePrimaryKey($status->user_id);/** @phpstan-ignore-line */
 | 
			
		||||
            $status->company_id = $this->encodePrimaryKey($status->company_id); /** @phpstan-ignore-line */
 | 
			
		||||
 | 
			
		||||
            return $status;
 | 
			
		||||
        })->all();
 | 
			
		||||
@ -511,8 +510,9 @@ class CompanyExport implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $this->export_data['tax_rates'] = $this->company->tax_rates->map(function ($rate) {
 | 
			
		||||
            $rate->company_id = $this->encodePrimaryKey($rate->company_id);
 | 
			
		||||
            $rate->user_id = $this->encodePrimaryKey($rate->user_id);
 | 
			
		||||
            $rate->company_id = $this->encodePrimaryKey($rate->company_id); /** @phpstan-ignore-line */
 | 
			
		||||
            $rate->user_id = $this->encodePrimaryKey($rate->user_id); /** @phpstan-ignore-line */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            return $rate;
 | 
			
		||||
        })->makeHidden(['id'])->all();
 | 
			
		||||
@ -550,9 +550,8 @@ class CompanyExport implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $this->export_data['webhooks'] = $this->company->webhooks->map(function ($hook) {
 | 
			
		||||
            $hook->user_id = $this->encodePrimaryKey($hook->user_id);
 | 
			
		||||
            $hook->company_id = $this->encodePrimaryKey($hook->company_id);
 | 
			
		||||
 | 
			
		||||
            $hook->user_id = $this->encodePrimaryKey($hook->user_id);/** @phpstan-ignore-line */
 | 
			
		||||
            $hook->company_id = $this->encodePrimaryKey($hook->company_id);/** @phpstan-ignore-line */
 | 
			
		||||
            return $hook;
 | 
			
		||||
        })->makeHidden(['id'])->all();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -417,7 +417,7 @@ class CompanyImport implements ShouldQueue
 | 
			
		||||
     * import to start if there are users > plan number
 | 
			
		||||
     * due to entity user_id dependencies
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     * @return self
 | 
			
		||||
     */
 | 
			
		||||
    private function checkUserCount()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -96,7 +96,7 @@ class UpdateCalculatedFields
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        return round(($duration / 60 / 60), 0);
 | 
			
		||||
        return (int) round(($duration / 60 / 60), 0);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -48,8 +48,6 @@ class MarkOpened implements ShouldQueue
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,6 @@ class CreateUbl implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job
 | 
			
		||||
     * @return ?string
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -669,7 +669,7 @@ class NinjaMailerJob implements ShouldQueue
 | 
			
		||||
         *  just for this request.
 | 
			
		||||
         */
 | 
			
		||||
 | 
			
		||||
        $token = $user->oauth_user_token->access_token;
 | 
			
		||||
        $token = $user->oauth_user_token->access_token; /** @phpstan-ignore-line */
 | 
			
		||||
 | 
			
		||||
        if (!$token) {
 | 
			
		||||
            $this->company->account->gmailCredentialNotification();
 | 
			
		||||
 | 
			
		||||
@ -84,9 +84,6 @@ class ProcessMailgunWebhook implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -55,8 +55,6 @@ class EmailRefundPayment implements ShouldQueue
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -83,13 +83,11 @@ class ProcessPostmarkWebhook implements ShouldQueue
 | 
			
		||||
    /**
 | 
			
		||||
     * Execute the job.
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function handle()
 | 
			
		||||
    {
 | 
			
		||||
        MultiDB::findAndSetDbByCompanyKey($this->request['Tag']);
 | 
			
		||||
        $this->company = Company::where('company_key', $this->request['Tag'])->first();
 | 
			
		||||
        $this->company = Company::where('company_key', $this->request['Tag'])->first(); /** @phpstan-ignore-line */
 | 
			
		||||
 | 
			
		||||
        $this->invitation = $this->discoverInvitation($this->request['MessageID']);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -59,14 +59,14 @@ use Laracasts\Presenter\PresentableTrait;
 | 
			
		||||
 * @property int|null $trial_duration
 | 
			
		||||
 * @property int $is_onboarding
 | 
			
		||||
 * @property object|null $onboarding
 | 
			
		||||
 * @property int $is_migrated
 | 
			
		||||
 * @property bool $is_migrated
 | 
			
		||||
 * @property string|null $platform
 | 
			
		||||
 * @property int|null $hosted_client_count
 | 
			
		||||
 * @property int|null $hosted_company_count
 | 
			
		||||
 * @property string|null $inapp_transaction_id
 | 
			
		||||
 * @property bool $set_react_as_default_ap
 | 
			
		||||
 * @property bool $is_flagged
 | 
			
		||||
 * @property int $is_verified_account
 | 
			
		||||
 * @property bool $is_verified_account
 | 
			
		||||
 * @property string|null $account_sms_verification_code
 | 
			
		||||
 * @property string|null $account_sms_verification_number
 | 
			
		||||
 * @property bool $account_sms_verified
 | 
			
		||||
 | 
			
		||||
@ -110,7 +110,7 @@ use Laracasts\Presenter\PresentableTrait;
 | 
			
		||||
 * @property string $payment_balance
 | 
			
		||||
 * @property mixed $tax_data
 | 
			
		||||
 * @property int $is_tax_exempt
 | 
			
		||||
 * @property int $has_valid_vat_number
 | 
			
		||||
 * @property bool $has_valid_vat_number
 | 
			
		||||
 * @mixin \Eloquent
 | 
			
		||||
 */
 | 
			
		||||
class Client extends BaseModel implements HasLocalePreference
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ use Illuminate\Database\Eloquent\Model;
 | 
			
		||||
 * @property string $hash 32 char length AlphaNum
 | 
			
		||||
 * @property float $fee_total
 | 
			
		||||
 * @property int|null $fee_invoice_id
 | 
			
		||||
 * @property \stdClass $data
 | 
			
		||||
 * @property \stdClass|array $data
 | 
			
		||||
 * @property int|null $payment_id
 | 
			
		||||
 * @property \Illuminate\Support\Carbon|null $created_at
 | 
			
		||||
 * @property \Illuminate\Support\Carbon|null $updated_at
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ use Laracasts\Presenter\PresentableTrait;
 | 
			
		||||
 * @property string|null $due_date
 | 
			
		||||
 * @property bool $is_deleted
 | 
			
		||||
 * @property array $line_items
 | 
			
		||||
 * @property object|null $backup
 | 
			
		||||
 * @property object|string|null $backup
 | 
			
		||||
 * @property string|null $footer
 | 
			
		||||
 * @property string|null $public_notes
 | 
			
		||||
 * @property string|null $private_notes
 | 
			
		||||
 | 
			
		||||
@ -43,7 +43,7 @@ use Illuminate\Support\Carbon;
 | 
			
		||||
 * @property bool $is_running
 | 
			
		||||
 * @property string|null $time_log
 | 
			
		||||
 * @property string|null $number
 | 
			
		||||
 * @property string $rate
 | 
			
		||||
 * @property float $rate
 | 
			
		||||
 * @property bool $invoice_documents
 | 
			
		||||
 * @property int $is_date_based
 | 
			
		||||
 * @property int|null $status_order
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ use Laracasts\Presenter\PresentableTrait;
 | 
			
		||||
 * @property int|null $failed_logins
 | 
			
		||||
 * @property string|null $referral_code
 | 
			
		||||
 * @property string|null $oauth_user_id
 | 
			
		||||
 * @property object|null $oauth_user_token
 | 
			
		||||
 * @property object|array|null $oauth_user_token
 | 
			
		||||
 * @property string|null $oauth_provider_id
 | 
			
		||||
 * @property string|null $google_2fa_secret
 | 
			
		||||
 * @property string|null $accepted_terms_version
 | 
			
		||||
@ -69,7 +69,7 @@ use Laracasts\Presenter\PresentableTrait;
 | 
			
		||||
 * @property string|null $custom_value4
 | 
			
		||||
 * @property int|null $created_at
 | 
			
		||||
 * @property int|null $updated_at
 | 
			
		||||
 * @property int|null $deleted_at
 | 
			
		||||
 * @property int|null|Carbon $deleted_at
 | 
			
		||||
 * @property string|null $oauth_user_refresh_token
 | 
			
		||||
 * @property string|null $last_confirmed_email_address
 | 
			
		||||
 * @property bool $has_password
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ use Laracasts\Presenter\PresentableTrait;
 | 
			
		||||
 * @property int $user_id
 | 
			
		||||
 * @property int|null $assigned_user_id
 | 
			
		||||
 * @property int $company_id
 | 
			
		||||
 * @property string|null $currency_id
 | 
			
		||||
 * @property int|null $currency_id
 | 
			
		||||
 * @property string|null $name
 | 
			
		||||
 * @property string|null $address1
 | 
			
		||||
 * @property string|null $address2
 | 
			
		||||
 | 
			
		||||
@ -126,10 +126,10 @@ class TaskRepository extends BaseRepository
 | 
			
		||||
                $time_log[count($time_log) - 1][1] = time();
 | 
			
		||||
                $task->is_running = false;
 | 
			
		||||
            } elseif ($data['action'] == 'offline') {
 | 
			
		||||
                $task->is_running = $data['is_running'] ? 1 : 0;
 | 
			
		||||
                $task->is_running = $data['is_running'] ? true : false;
 | 
			
		||||
            }
 | 
			
		||||
        } elseif (isset($data['is_running'])) {
 | 
			
		||||
            $task->is_running = $data['is_running'] ? 1 : 0;
 | 
			
		||||
            $task->is_running = $data['is_running'] ? true : false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $task->calculated_start_date = $this->harvestStartDate($time_log, $task);
 | 
			
		||||
 | 
			
		||||
@ -114,38 +114,40 @@ class PdfMock
 | 
			
		||||
            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->client = Client::factory()->make(['settings' => $settings]); //@phpstan-ignore-line
 | 
			
		||||
                $entity->client->setRelation('company', $this->company);
 | 
			
		||||
                $entity->invitation = InvoiceInvitation::factory()->make();
 | 
			
		||||
                $entity->invitation = InvoiceInvitation::factory()->make(); //@phpstan-ignore-line
 | 
			
		||||
                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->client = Client::factory()->make(['settings' => $settings]); //@phpstan-ignore-line
 | 
			
		||||
                $entity->client->setRelation('company', $this->company);
 | 
			
		||||
                $entity->invitation = QuoteInvitation::factory()->make();
 | 
			
		||||
                $entity->invitation = QuoteInvitation::factory()->make(); //@phpstan-ignore-line
 | 
			
		||||
                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->client = Client::factory()->make(['settings' => $settings]); //@phpstan-ignore-line
 | 
			
		||||
                $entity->client->setRelation('company', $this->company);
 | 
			
		||||
                $entity->invitation = CreditInvitation::factory()->make();
 | 
			
		||||
                $entity->invitation = CreditInvitation::factory()->make(); //@phpstan-ignore-line
 | 
			
		||||
                break;
 | 
			
		||||
            case 'purchase_order':
 | 
			
		||||
 | 
			
		||||
                /** @var \App\Models\PurchaseOrder $entity */
 | 
			
		||||
                $entity = PurchaseOrder::factory()->make();
 | 
			
		||||
                // $entity->client = Client::factory()->make(['settings' => $settings]);
 | 
			
		||||
                $entity->vendor = Vendor::factory()->make();
 | 
			
		||||
                $entity->vendor = Vendor::factory()->make(); /** @phpstan-ignore-line */
 | 
			
		||||
                $entity->vendor->setRelation('company', $this->company);
 | 
			
		||||
                $entity->invitation = PurchaseOrderInvitation::factory()->make();
 | 
			
		||||
                $entity->invitation = PurchaseOrderInvitation::factory()->make();/** @phpstan-ignore-line */
 | 
			
		||||
 | 
			
		||||
                break;
 | 
			
		||||
            case PurchaseOrder::class:
 | 
			
		||||
                /** @var \App\Models\PurchaseOrder $entity */
 | 
			
		||||
                $entity = PurchaseOrder::factory()->make();
 | 
			
		||||
                $entity->invitation = PurchaseOrderInvitation::factory()->make();
 | 
			
		||||
                $entity->vendor = Vendor::factory()->make();
 | 
			
		||||
                $entity->vendor = Vendor::factory()->make(); /** @phpstan-ignore-line */
 | 
			
		||||
 | 
			
		||||
                $entity->invitation->setRelation('company', $this->company);
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
@ -184,7 +186,7 @@ class PdfMock
 | 
			
		||||
    /**
 | 
			
		||||
     * getTaxMap
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
 | 
			
		||||
     * @return  \Illuminate\Support\Collection
 | 
			
		||||
     */
 | 
			
		||||
    private function getTaxMap(): \Illuminate\Support\Collection
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -171,7 +171,7 @@ class PaymentLinkService
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!$this->subscription->trial_enabled) {
 | 
			
		||||
            return new \Exception("Trials are disabled for this product");
 | 
			
		||||
            throw new \Exception("Trials are disabled for this product");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //create recurring invoice with start date = trial_duration + 1 day
 | 
			
		||||
 | 
			
		||||
@ -57,9 +57,8 @@ class ZipTax implements TaxProviderInterface
 | 
			
		||||
     * callApi
 | 
			
		||||
     *
 | 
			
		||||
     * @param  array $parameters
 | 
			
		||||
     * @return Response| \Illuminate\Http\JsonResponse
 | 
			
		||||
     */
 | 
			
		||||
    private function callApi(array $parameters): Response
 | 
			
		||||
    private function callApi(array $parameters)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        return Http::retry(3, 1000)->withHeaders([])->get($this->endpoint, $parameters);
 | 
			
		||||
 | 
			
		||||
@ -54,7 +54,7 @@ class ProjectTransformer extends EntityTransformer
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function includeClient(Project $project): \League\Fractal\Resource\Item
 | 
			
		||||
    public function includeClient(Project $project): ?\League\Fractal\Resource\Item
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        if (!$project->client) {
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,7 @@ class HtmlEngine
 | 
			
		||||
    /** @var \App\Models\Company $company */
 | 
			
		||||
    public $company;
 | 
			
		||||
 | 
			
		||||
    /** @var \App\DataMapper\CompanySettings $settings **/
 | 
			
		||||
    /** @var \App\DataMapper\CompanySettings|\stdClass $settings **/
 | 
			
		||||
    public $settings;
 | 
			
		||||
 | 
			
		||||
    public $entity_calc;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user