mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on download PDF route
This commit is contained in:
parent
34b3501842
commit
25d2af4891
@ -958,7 +958,13 @@ class AccountController extends BaseController
|
|||||||
'text' => $reason,
|
'text' => $reason,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->userMailer->sendTo(CONTACT_EMAIL, $email, $name, 'Invoice Ninja Feedback [Canceled Account]', 'contact', $data);
|
$subject = 'Invoice Ninja - Canceled Account';
|
||||||
|
|
||||||
|
if (Auth::user()->isPaidPro()) {
|
||||||
|
$subject .= ' [PRO]';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->userMailer->sendTo(CONTACT_EMAIL, $email, $name, $subject, 'contact', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
@ -162,6 +162,21 @@ class PublicClientController extends BaseController
|
|||||||
return $paymentTypes;
|
return $paymentTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function download($invitationKey)
|
||||||
|
{
|
||||||
|
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||||
|
return response()->view('error', [
|
||||||
|
'error' => trans('texts.invoice_not_found'),
|
||||||
|
'hideHeader' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$invoice = $invitation->invoice;
|
||||||
|
$pdfString = $invoice->getPDFString();
|
||||||
|
|
||||||
|
dd($pdfString);
|
||||||
|
}
|
||||||
|
|
||||||
public function dashboard()
|
public function dashboard()
|
||||||
{
|
{
|
||||||
if (!$invitation = $this->getInvitation()) {
|
if (!$invitation = $this->getInvitation()) {
|
||||||
|
@ -37,6 +37,7 @@ Route::post('/get_started', 'AccountController@getStarted');
|
|||||||
|
|
||||||
// Client visible pages
|
// Client visible pages
|
||||||
Route::get('view/{invitation_key}', 'PublicClientController@view');
|
Route::get('view/{invitation_key}', 'PublicClientController@view');
|
||||||
|
Route::get('download/{invitation_key}', 'PublicClientController@download');
|
||||||
Route::get('view', 'HomeController@viewLogo');
|
Route::get('view', 'HomeController@viewLogo');
|
||||||
Route::get('approve/{invitation_key}', 'QuoteController@approve');
|
Route::get('approve/{invitation_key}', 'QuoteController@approve');
|
||||||
Route::get('payment/{invitation_key}/{payment_type?}', 'PaymentController@show_payment');
|
Route::get('payment/{invitation_key}/{payment_type?}', 'PaymentController@show_payment');
|
||||||
|
@ -735,6 +735,10 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
$link = $invitation->getLink();
|
$link = $invitation->getLink();
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
|
||||||
|
if (Utils::isNinjaDev()) {
|
||||||
|
$link = env('TEST_LINK');
|
||||||
|
}
|
||||||
|
|
||||||
$jsonEncodedData = json_encode([
|
$jsonEncodedData = json_encode([
|
||||||
'url' => "{$link}?phantomjs=true",
|
'url' => "{$link}?phantomjs=true",
|
||||||
'renderType' => 'html',
|
'renderType' => 'html',
|
||||||
@ -761,11 +765,11 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
$response = curl_exec($curl);
|
$response = curl_exec($curl);
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
|
|
||||||
$encodedString = strip_tags($response);
|
$pdfString = strip_tags($response);
|
||||||
$pdfString = Utils::decodePDF($encodedString);
|
|
||||||
|
|
||||||
if ( ! $pdfString || strlen($pdfString) < 200) {
|
if ( ! $pdfString || strlen($pdfString) < 200) {
|
||||||
Utils::logError("PhantomJSCloud - failed to create pdf: {$encodedString}");
|
Utils::logError("PhantomJSCloud - failed to create pdf: {$pdfString}");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $pdfString;
|
return $pdfString;
|
||||||
|
@ -107,6 +107,11 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||||||
return $this->account->isPro();
|
return $this->account->isPro();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPaidPro()
|
||||||
|
{
|
||||||
|
return $this->isPro() && ! $this->isTrial();
|
||||||
|
}
|
||||||
|
|
||||||
public function isTrial()
|
public function isTrial()
|
||||||
{
|
{
|
||||||
return $this->account->isTrial();
|
return $this->account->isTrial();
|
||||||
|
@ -56,7 +56,7 @@ class ContactMailer extends Mailer
|
|||||||
$sent = false;
|
$sent = false;
|
||||||
|
|
||||||
if ($account->attatchPDF() && !$pdfString) {
|
if ($account->attatchPDF() && !$pdfString) {
|
||||||
$pdfString = $invoice->getPDFString();
|
$pdfString = Utils::decodePDF($invoice->getPDFString());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($invoice->invitations as $invitation) {
|
foreach ($invoice->invitations as $invitation) {
|
||||||
@ -184,7 +184,7 @@ class ContactMailer extends Mailer
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($account->attatchPDF()) {
|
if ($account->attatchPDF()) {
|
||||||
$data['pdfString'] = $invoice->getPDFString();
|
$data['pdfString'] = Utils::decodePDF($invoice->getPDFString());
|
||||||
$data['pdfFileName'] = $invoice->getFileName();
|
$data['pdfFileName'] = $invoice->getFileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user