This commit is contained in:
Hillel Coren 2017-03-09 16:09:52 +02:00
parent e631a6a7ba
commit 5f8d8517af
4 changed files with 6 additions and 30 deletions

View File

@ -401,7 +401,7 @@ class InvoiceController extends BaseController
if ($invoice->is_recurring) { if ($invoice->is_recurring) {
$response = $this->emailRecurringInvoice($invoice); $response = $this->emailRecurringInvoice($invoice);
} else { } else {
$this->dispatch(new SendInvoiceEmail($invoice, $reminder, $pdfUpload, $template)); $this->dispatch(new SendInvoiceEmail($invoice, $reminder, $template));
$response = true; $response = true;
} }

View File

@ -26,11 +26,6 @@ class SendInvoiceEmail extends Job implements ShouldQueue
*/ */
protected $reminder; protected $reminder;
/**
* @var string
*/
protected $pdfString;
/** /**
* @var array * @var array
*/ */
@ -44,11 +39,10 @@ class SendInvoiceEmail extends Job implements ShouldQueue
* @param bool $reminder * @param bool $reminder
* @param mixed $pdfString * @param mixed $pdfString
*/ */
public function __construct(Invoice $invoice, $reminder = false, $pdfString = false, $template = false) public function __construct(Invoice $invoice, $reminder = false, $template = false)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->reminder = $reminder; $this->reminder = $reminder;
$this->pdfString = $pdfString;
$this->template = $template; $this->template = $template;
} }
@ -59,7 +53,7 @@ class SendInvoiceEmail extends Job implements ShouldQueue
*/ */
public function handle(ContactMailer $mailer) public function handle(ContactMailer $mailer)
{ {
$mailer->sendInvoice($this->invoice, $this->reminder, $this->pdfString, $this->template); $mailer->sendInvoice($this->invoice, $this->reminder, $this->template);
} }
/* /*

View File

@ -36,7 +36,7 @@ class ContactMailer extends Mailer
* *
* @return bool|null|string * @return bool|null|string
*/ */
public function sendInvoice(Invoice $invoice, $reminder = false, $pdfString = false, $template = false) public function sendInvoice(Invoice $invoice, $reminder = false, $template = false)
{ {
if ($invoice->is_recurring) { if ($invoice->is_recurring) {
return false; return false;
@ -61,8 +61,9 @@ class ContactMailer extends Mailer
$emailSubject = !empty($template['subject']) ? $template['subject'] : $account->getEmailSubject($reminder ?: $entityType); $emailSubject = !empty($template['subject']) ? $template['subject'] : $account->getEmailSubject($reminder ?: $entityType);
$sent = false; $sent = false;
$pdfString = false;
if ($account->attachPDF() && ! $pdfString) { if ($account->attachPDF()) {
$pdfString = $invoice->getPDFString(); $pdfString = $invoice->getPDFString();
} }

View File

@ -1308,25 +1308,6 @@
$('#emailModal div.modal-footer button').attr('disabled', true); $('#emailModal div.modal-footer button').attr('disabled', true);
model.invoice().is_public(true); model.invoice().is_public(true);
submitAction('email'); submitAction('email');
/*
var accountLanguageId = parseInt({{ $account->language_id ?: '0' }});
var clientLanguageId = parseInt(model.invoice().client().language_id()) || 0;
var attachPDF = {{ $account->attachPDF() ? 'true' : 'false' }};
// if they aren't attaching the pdf no need to generate it
if ( ! attachPDF) {
submitAction('email');
// if the client's language is different then we can't use the browser version of the PDF
} else if (clientLanguageId && clientLanguageId != accountLanguageId) {
submitAction('email');
// if queues are enabled we need to use PhantomJS
} else if ({{ config('queue.default') != 'sync' ? 'true' : 'false' }}) {
submitAction('email');
} else {
preparePdfData('email');
}
*/
} }
function onSaveDraftClick() { function onSaveDraftClick() {