mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 12:42:36 +01:00
Bug fixes
This commit is contained in:
parent
8a071f43df
commit
bf85aa7ddd
@ -42,9 +42,6 @@ class SendRecurringInvoices extends Command
|
||||
|
||||
if ($invoice && !$invoice->isPaid()) {
|
||||
$recurInvoice->account->loadLocalizationSettings($invoice->client);
|
||||
if ($invoice->account->pdf_email_attachment) {
|
||||
$invoice->updateCachedPDF();
|
||||
}
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ class Handler extends ExceptionHandler {
|
||||
}
|
||||
|
||||
// In production, except for maintenance mode, we'll show a custom error screen
|
||||
if (Utils::isNinjaProd() && $e->getStatusCode() != 503) {
|
||||
//if (Utils::isNinjaProd() && $e->getStatusCode() != 503) {
|
||||
if (Utils::isNinjaProd()) {
|
||||
$data = [
|
||||
'error' => get_class($e),
|
||||
'hideHeader' => true,
|
||||
|
@ -527,10 +527,10 @@ class InvoiceController extends BaseController
|
||||
Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT, $url);
|
||||
}
|
||||
|
||||
if ($invoice->account->pdf_email_attachment) {
|
||||
if ($invoice->account->pdf_email_attachment && !$invoice->is_recurring) {
|
||||
$pdfUpload = Input::get('pdfupload');
|
||||
if (!empty($pdfUpload) && strpos($pdfUpload, 'data:application/pdf;base64,') === 0) {
|
||||
$invoice->updateCachedPDF(Input::get('pdfupload'));
|
||||
$invoice->updateCachedPDF($pdfUpload);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Utils;
|
||||
use DateTime;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@ -284,14 +285,15 @@ class Invoice extends EntityModel
|
||||
{
|
||||
if (!$encodedString) {
|
||||
$invitation = $this->invitations[0];
|
||||
$key = $invitation->getLink();
|
||||
$link = $invitation->getLink();
|
||||
|
||||
$curl = curl_init();
|
||||
$jsonEncodedData = json_encode([
|
||||
'targetUrl' => SITE_URL . "/view/{$key}/?phantomjs=true",
|
||||
'targetUrl' => "{$link}?phantomjs=true",
|
||||
'requestType' => 'raw',
|
||||
'delayTime' => 3000,
|
||||
]);
|
||||
|
||||
|
||||
$opts = [
|
||||
CURLOPT_URL => PHANTOMJS_CLOUD . env('PHANTOMJS_CLOUD_KEY'),
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
@ -304,14 +306,12 @@ class Invoice extends EntityModel
|
||||
curl_setopt_array($curl, $opts);
|
||||
$encodedString = strip_tags(curl_exec($curl));
|
||||
curl_close($curl);
|
||||
|
||||
if (!$encodedString) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$encodedString = str_replace('data:application/pdf;base64,', '', $encodedString);
|
||||
file_put_contents($this->getPDFPath(), base64_decode($encodedString));
|
||||
if ($encodedString = base64_decode($encodedString)) {
|
||||
file_put_contents($this->getPDFPath(), $encodedString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,10 @@ class ContactMailer extends Mailer
|
||||
$client = $invoice->client;
|
||||
$account = $invoice->account;
|
||||
|
||||
if ($invoice->trashed() || $client->trashed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$account->loadLocalizationSettings($client);
|
||||
|
||||
$view = 'invoice';
|
||||
|
@ -655,6 +655,10 @@ class InvoiceRepository
|
||||
}
|
||||
}
|
||||
|
||||
if ($recurInvoice->account->pdf_email_attachment) {
|
||||
$invoice->updateCachedPDF();
|
||||
}
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
|
@ -128,14 +128,14 @@ class PaymentService {
|
||||
'billingCity' => $client->city,
|
||||
'billingPostcode' => $client->postal_code,
|
||||
'billingState' => $client->state,
|
||||
'billingCountry' => $client->country->iso_3166_2,
|
||||
'billingCountry' => $client->country ? $client->country->iso_3166_2 : '',
|
||||
'billingPhone' => $contact->phone,
|
||||
'shippingAddress1' => $client->address1,
|
||||
'shippingAddress2' => $client->address2,
|
||||
'shippingCity' => $client->city,
|
||||
'shippingPostcode' => $client->postal_code,
|
||||
'shippingState' => $client->state,
|
||||
'shippingCountry' => $client->country->iso_3166_2,
|
||||
'shippingCountry' => $client->country ? $client->country->iso_3166_2 : '',
|
||||
'shippingPhone' => $contact->phone,
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user