diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 0272cc925c4c..da9cfa4fbfe1 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -140,7 +140,7 @@ class TemplateEmail extends Mailable 'whitelabel' => $this->client->user->account->isPaid() ? true : false, 'logo' => $this->company->present()->logo($settings), 'links' => $this->build_email->getAttachmentLinks(), - 'email_preferences' => (Ninja::isHosted() && in_array($settings->email_sending_method, ['default', 'mailgun'])) ? $this->company->domain() . URL::signedRoute('client.email_preferences', ['entity' => $this->invitation->getEntityString(), 'invitation_key' => $this->invitation->key], absolute: false) : false, + 'email_preferences' => (Ninja::isHosted() && $this->invitation && in_array($settings->email_sending_method, ['default', 'mailgun'])) ? $this->company->domain() . URL::signedRoute('client.email_preferences', ['entity' => $this->invitation->getEntityString(), 'invitation_key' => $this->invitation->key], absolute: false) : false, ]); foreach ($this->build_email->getAttachments() as $file) { diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index c87375b3dcf6..61bfda77f8b3 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -698,7 +698,7 @@ class RecurringInvoice extends BaseModel public function subscription(): \Illuminate\Database\Eloquent\Relations\BelongsTo { - return $this->belongsTo(Subscription::class); + return $this->belongsTo(Subscription::class)->withTrashed(); } public function translate_entity() diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index e5b78ddc72e9..a06b71a3af3d 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -41,6 +41,7 @@ use Laracasts\Presenter\PresentableTrait; * @property string|null $phone * @property string|null $private_notes * @property string|null $website + * @property string|null $routing_id * @property bool $is_deleted * @property string|null $vat_number * @property string|null $transaction_name diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index a8ffd38cd61e..b067cfbefe8f 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -579,15 +579,18 @@ class BaseDriver extends AbstractPaymentDriver $nmo->company = $this->client->company; $nmo->settings = $this->client->company->settings; - $invoices = Invoice::query()->whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get(); - - $invoices->first()->invitations->each(function ($invitation) use ($nmo) { - if (! $invitation->contact->trashed()) { - $nmo->to_user = $invitation->contact; - NinjaMailerJob::dispatch($nmo); - } - }); + if($this->payment_hash) + { + $invoices = Invoice::query()->whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get(); + $invoices->first()->invitations->each(function ($invitation) use ($nmo) { + if (! $invitation->contact->trashed()) { + $nmo->to_user = $invitation->contact; + NinjaMailerJob::dispatch($nmo); + } + }); + } + $message = [ 'server_response' => $response, 'data' => $this->payment_hash->data, diff --git a/app/PaymentDrivers/PaytracePaymentDriver.php b/app/PaymentDrivers/PaytracePaymentDriver.php index 4cdc8571a5ef..7d7838c5610c 100644 --- a/app/PaymentDrivers/PaytracePaymentDriver.php +++ b/app/PaymentDrivers/PaytracePaymentDriver.php @@ -256,27 +256,15 @@ class PaytracePaymentDriver extends BaseDriver { $fields = parent::getClientRequiredFields(); - nlog("a"); - - nlog($fields); - $fields[] = ['name' => 'client_address_line_1', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_city', 'label' => ctrans('texts.city'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_state', 'label' => ctrans('texts.state'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required']; - -nlog("b"); - -nlog($fields); - return $fields; } - - - public function auth(): bool { try { diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index c0274a3e81a7..78cbf8e718c1 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -109,7 +109,10 @@ class UserTransformer extends EntityTransformer $transformer = new CompanyUserTransformer($this->serializer); - $cu = $user->company_users()->whereCompanyId($user->company_id)->first(); + $cu = $user->company_users()->where('company_id',$user->company_id)->first(); + + if(!$cu) + return null; return $this->includeItem($cu, $transformer, CompanyUser::class); }