1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fix preview links

This commit is contained in:
Hillel Coren 2017-12-03 15:04:17 +02:00
parent a99f45c628
commit f34f3e18b1
2 changed files with 27 additions and 4 deletions

View File

@ -1733,6 +1733,29 @@ class Account extends Eloquent
{
return $this->hasFeature(FEATURE_CLIENT_PORTAL_PASSWORD) && $this->enable_portal_password;
}
public function getBaseUrl()
{
if ($this->hasFeature(FEATURE_CUSTOM_URL)) {
if ($this->iframe_url) {
return $this->iframe_url;
}
if (Utils::isNinjaProd() && ! Utils::isReseller()) {
$url = $this->present()->clientPortalLink();
} else {
$url = url('/');
}
if ($this->subdomain) {
$url = Utils::replaceSubdomain($url, $this->subdomain);
}
return $url;
} else {
return url('/');
}
}
}
Account::creating(function ($account)

View File

@ -33,14 +33,14 @@
'number': invoice ? invoice.invoice_number : '0001',
'password': passwordHtml,
'documents': documentsHtml,
'viewLink': '{{ link_to('#', url('/view/...')) }}$password',
'viewLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
'viewButton': isQuote || (invoice && invoice.invoice_type_id == {{ INVOICE_TYPE_QUOTE }}) ?
'{!! Form::flatButton('view_quote', '#0b4d78') !!}$password' :
'{!! Form::flatButton('view_invoice', '#0b4d78') !!}$password',
'paymentLink': '{{ link_to('#', url('/payment/...')) }}$password',
'paymentLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
'paymentButton': '{!! Form::flatButton('pay_now', '#36c157') !!}$password',
'autoBill': '{{ trans('texts.auto_bill_notification_placeholder') }}',
'portalLink': "{{ URL::to('/client/portal/...') }}",
'portalLink': "{{ auth()->user()->account->getBaseUrl() . '/...' }}",
'portalButton': '{!! Form::flatButton('view_portal', '#36c157') !!}',
'customClient1': invoice ? invoice.client.custom_value1 : 'custom value',
'customClient2': invoice ? invoice.client.custom_value2 : 'custom value',
@ -53,7 +53,7 @@
// Add any available payment method links
@foreach (\App\Models\Gateway::$gatewayTypes as $type)
@if ($type != GATEWAY_TYPE_TOKEN)
{!! "keys['" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)) . "Link'] = '" . URL::to('/payment/...') . "';" !!}
{!! "keys['" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)) . "Link'] = '" . auth()->user()->account->getBaseUrl() . "/...';" !!}
{!! "keys['" . Utils::toCamelCase(\App\Models\GatewayType::getAliasFromId($type)) . "Button'] = '" . Form::flatButton('pay_now', '#36c157') . "';" !!}
@endif
@endforeach