mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for returning company users when called from other routes
This commit is contained in:
parent
dfb59a0d28
commit
aa6153f571
@ -140,7 +140,7 @@ class TemplateEmail extends Mailable
|
|||||||
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
|
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
|
||||||
'logo' => $this->company->present()->logo($settings),
|
'logo' => $this->company->present()->logo($settings),
|
||||||
'links' => $this->build_email->getAttachmentLinks(),
|
'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) {
|
foreach ($this->build_email->getAttachments() as $file) {
|
||||||
|
@ -698,7 +698,7 @@ class RecurringInvoice extends BaseModel
|
|||||||
|
|
||||||
public function subscription(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
public function subscription(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Subscription::class);
|
return $this->belongsTo(Subscription::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function translate_entity()
|
public function translate_entity()
|
||||||
|
@ -41,6 +41,7 @@ use Laracasts\Presenter\PresentableTrait;
|
|||||||
* @property string|null $phone
|
* @property string|null $phone
|
||||||
* @property string|null $private_notes
|
* @property string|null $private_notes
|
||||||
* @property string|null $website
|
* @property string|null $website
|
||||||
|
* @property string|null $routing_id
|
||||||
* @property bool $is_deleted
|
* @property bool $is_deleted
|
||||||
* @property string|null $vat_number
|
* @property string|null $vat_number
|
||||||
* @property string|null $transaction_name
|
* @property string|null $transaction_name
|
||||||
|
@ -579,14 +579,17 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$nmo->company = $this->client->company;
|
$nmo->company = $this->client->company;
|
||||||
$nmo->settings = $this->client->company->settings;
|
$nmo->settings = $this->client->company->settings;
|
||||||
|
|
||||||
$invoices = Invoice::query()->whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
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) {
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||||
if (! $invitation->contact->trashed()) {
|
if (! $invitation->contact->trashed()) {
|
||||||
$nmo->to_user = $invitation->contact;
|
$nmo->to_user = $invitation->contact;
|
||||||
NinjaMailerJob::dispatch($nmo);
|
NinjaMailerJob::dispatch($nmo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$message = [
|
$message = [
|
||||||
'server_response' => $response,
|
'server_response' => $response,
|
||||||
|
@ -256,27 +256,15 @@ class PaytracePaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
$fields = parent::getClientRequiredFields();
|
$fields = parent::getClientRequiredFields();
|
||||||
|
|
||||||
nlog("a");
|
|
||||||
|
|
||||||
nlog($fields);
|
|
||||||
|
|
||||||
$fields[] = ['name' => 'client_address_line_1', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'required'];
|
$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_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_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_state', 'label' => ctrans('texts.state'), 'type' => 'text', 'validation' => 'required'];
|
||||||
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];
|
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];
|
||||||
|
|
||||||
|
|
||||||
nlog("b");
|
|
||||||
|
|
||||||
nlog($fields);
|
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function auth(): bool
|
public function auth(): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -109,7 +109,10 @@ class UserTransformer extends EntityTransformer
|
|||||||
|
|
||||||
$transformer = new CompanyUserTransformer($this->serializer);
|
$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);
|
return $this->includeItem($cu, $transformer, CompanyUser::class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user