From c3e9380c75d31c939a90ac8578101204ed9ac62d Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 13 Apr 2016 13:15:57 +0300 Subject: [PATCH] Fix for PhantomJS PDF when using iframe_url --- app/Models/Invitation.php | 6 ++++-- app/Models/Invoice.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Models/Invitation.php b/app/Models/Invitation.php index 7abd074a08b4..687e9873457d 100644 --- a/app/Models/Invitation.php +++ b/app/Models/Invitation.php @@ -29,7 +29,9 @@ class Invitation extends EntityModel 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) { $this->load('account'); @@ -39,7 +41,7 @@ class Invitation extends EntityModel $iframe_url = $this->account->iframe_url; if ($this->account->isPro()) { - if ($iframe_url) { + if ($iframe_url && !$forceOnsite) { return "{$iframe_url}?{$this->invitation_key}"; } elseif ($this->account->subdomain) { $url = Utils::replaceSubdomain($url, $this->account->subdomain); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index bdf546395c34..4d9b82c79416 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -789,7 +789,7 @@ class Invoice extends EntityModel implements BalanceAffecting } $invitation = $this->invitations[0]; - $link = $invitation->getLink(); + $link = $invitation->getLink('view', true); $key = env('PHANTOMJS_CLOUD_KEY'); $curl = curl_init();