mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02: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,
|
||||
'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) {
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user