Fix for PhantomJS PDF when using iframe_url

This commit is contained in:
Hillel Coren 2016-04-13 13:15:57 +03:00
parent b6fa4620b9
commit c3e9380c75
2 changed files with 5 additions and 3 deletions

View File

@ -29,7 +29,9 @@ class Invitation extends EntityModel
return $this->belongsTo('App\Models\Account'); return $this->belongsTo('App\Models\Account');
} }
public function getLink($type = 'view') // If we're getting the link for PhantomJS to generate the PDF
// we need to make sure it's served from our site
public function getLink($type = 'view', $forceOnsite = false)
{ {
if (!$this->account) { if (!$this->account) {
$this->load('account'); $this->load('account');
@ -39,7 +41,7 @@ class Invitation extends EntityModel
$iframe_url = $this->account->iframe_url; $iframe_url = $this->account->iframe_url;
if ($this->account->isPro()) { if ($this->account->isPro()) {
if ($iframe_url) { if ($iframe_url && !$forceOnsite) {
return "{$iframe_url}?{$this->invitation_key}"; return "{$iframe_url}?{$this->invitation_key}";
} elseif ($this->account->subdomain) { } elseif ($this->account->subdomain) {
$url = Utils::replaceSubdomain($url, $this->account->subdomain); $url = Utils::replaceSubdomain($url, $this->account->subdomain);

View File

@ -789,7 +789,7 @@ class Invoice extends EntityModel implements BalanceAffecting
} }
$invitation = $this->invitations[0]; $invitation = $this->invitations[0];
$link = $invitation->getLink(); $link = $invitation->getLink('view', true);
$key = env('PHANTOMJS_CLOUD_KEY'); $key = env('PHANTOMJS_CLOUD_KEY');
$curl = curl_init(); $curl = curl_init();