1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Add portal_url variable

This commit is contained in:
David Bomba 2021-04-19 11:19:00 +10:00
parent a1494a25d0
commit 25fe52ab18
2 changed files with 26 additions and 0 deletions

View File

@ -153,6 +153,8 @@ class HtmlEngine
$data['$date'] = ['value' => $this->translateDate($this->entity->date, $this->entity->client->date_format(), $this->entity->client->locale()) ?: ' ', 'label' => ctrans('texts.credit_date')];
}
$data['$portal_url'] = ['value' => $this->invitation->getPortalLink(), 'label' =>''];
$data['$entity_number'] = &$data['$number'];
$data['$invoice.discount'] = ['value' => Number::formatMoney($this->entity_calc->getTotalDiscount(), $this->client) ?: ' ', 'label' => ctrans('texts.discount')];
$data['$discount'] = &$data['$invoice.discount'];

View File

@ -66,6 +66,30 @@ trait Inviteable
}
}
public function getPortalLink() :string
{
$domain = isset($this->company->portal_domain) ?: $this->company->domain();
switch ($this->company->portal_mode) {
case 'subdomain':
return $domain.'/client/';
break;
case 'iframe':
return $domain.'/client/';
//return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key;
break;
case 'domain':
return $domain.'/client/';
break;
default:
return '';
break;
}
}
public function getAdminLink() :string
{
return $this->getLink().'?silent=true';