mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Proposals
This commit is contained in:
parent
754dd15af7
commit
89f3671205
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use App\Http\Requests\CreateProposalRequest;
|
use App\Http\Requests\CreateProposalRequest;
|
||||||
use App\Http\Requests\ProposalRequest;
|
use App\Http\Requests\ProposalRequest;
|
||||||
use App\Http\Requests\UpdateProposalRequest;
|
use App\Http\Requests\UpdateProposalRequest;
|
||||||
|
use App\Jobs\SendInvoiceEmail;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Proposal;
|
use App\Models\Proposal;
|
||||||
use App\Models\ProposalTemplate;
|
use App\Models\ProposalTemplate;
|
||||||
@ -107,7 +108,7 @@ class ProposalController extends BaseController
|
|||||||
$action = Input::get('action');
|
$action = Input::get('action');
|
||||||
|
|
||||||
if ($action == 'email') {
|
if ($action == 'email') {
|
||||||
$this->contactMailer->sendInvoice($proposal->invoice, false, false, $proposal);
|
$this->dispatch(new SendInvoiceEmail($proposal->invoice, auth()->user()->id, false, false, $proposal));
|
||||||
Session::flash('message', trans('texts.emailed_proposal'));
|
Session::flash('message', trans('texts.emailed_proposal'));
|
||||||
} else {
|
} else {
|
||||||
Session::flash('message', trans('texts.created_proposal'));
|
Session::flash('message', trans('texts.created_proposal'));
|
||||||
@ -126,7 +127,7 @@ class ProposalController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'email') {
|
if ($action == 'email') {
|
||||||
$this->contactMailer->sendInvoice($proposal->invoice, false, false, $proposal);
|
$this->dispatch(new SendInvoiceEmail($proposal->invoice, auth()->user()->id, false, false, $proposal));
|
||||||
Session::flash('message', trans('texts.emailed_proposal'));
|
Session::flash('message', trans('texts.emailed_proposal'));
|
||||||
} else {
|
} else {
|
||||||
Session::flash('message', trans('texts.updated_proposal'));
|
Session::flash('message', trans('texts.updated_proposal'));
|
||||||
|
@ -43,6 +43,11 @@ class SendInvoiceEmail extends Job implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
protected $server;
|
protected $server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Proposal
|
||||||
|
*/
|
||||||
|
protected $proposal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
@ -51,12 +56,13 @@ class SendInvoiceEmail extends Job implements ShouldQueue
|
|||||||
* @param bool $reminder
|
* @param bool $reminder
|
||||||
* @param mixed $pdfString
|
* @param mixed $pdfString
|
||||||
*/
|
*/
|
||||||
public function __construct(Invoice $invoice, $userId = false, $reminder = false, $template = false)
|
public function __construct(Invoice $invoice, $userId = false, $reminder = false, $template = false, $proposal = false)
|
||||||
{
|
{
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
$this->reminder = $reminder;
|
$this->reminder = $reminder;
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
|
$this->proposal = $proposal;
|
||||||
$this->server = config('database.default');
|
$this->server = config('database.default');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +78,7 @@ class SendInvoiceEmail extends Job implements ShouldQueue
|
|||||||
Auth::onceUsingId($this->userId);
|
Auth::onceUsingId($this->userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
$mailer->sendInvoice($this->invoice, $this->reminder, $this->template);
|
$mailer->sendInvoice($this->invoice, $this->reminder, $this->template, $this->proposal);
|
||||||
|
|
||||||
if (App::runningInConsole() && $this->userId) {
|
if (App::runningInConsole() && $this->userId) {
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
|
@ -146,12 +146,12 @@ class ContactMailer extends Mailer
|
|||||||
$subject,
|
$subject,
|
||||||
$reminder,
|
$reminder,
|
||||||
$isFirst,
|
$isFirst,
|
||||||
$data
|
$extra
|
||||||
) {
|
) {
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
$account = $invoice->account;
|
$account = $invoice->account;
|
||||||
$user = $invitation->user;
|
$user = $invitation->user;
|
||||||
$proposal = $data['proposal'];
|
$proposal = $extra['proposal'];
|
||||||
|
|
||||||
if ($user->trashed()) {
|
if ($user->trashed()) {
|
||||||
$user = $account->users()->orderBy('id')->first();
|
$user = $account->users()->orderBy('id')->first();
|
||||||
@ -197,7 +197,7 @@ class ContactMailer extends Mailer
|
|||||||
'account' => $account,
|
'account' => $account,
|
||||||
'client' => $client,
|
'client' => $client,
|
||||||
'invoice' => $invoice,
|
'invoice' => $invoice,
|
||||||
'documents' => $data['documentStrings'],
|
'documents' => $extra['documentStrings'],
|
||||||
'notes' => $reminder,
|
'notes' => $reminder,
|
||||||
'bccEmail' => $isFirst ? $account->getBccEmail() : false,
|
'bccEmail' => $isFirst ? $account->getBccEmail() : false,
|
||||||
'fromEmail' => $account->getFromEmail(),
|
'fromEmail' => $account->getFromEmail(),
|
||||||
@ -205,11 +205,11 @@ class ContactMailer extends Mailer
|
|||||||
|
|
||||||
if (! $proposal) {
|
if (! $proposal) {
|
||||||
if ($account->attachPDF()) {
|
if ($account->attachPDF()) {
|
||||||
$data['pdfString'] = $data['pdfString'];
|
$data['pdfString'] = $extra['pdfString'];
|
||||||
$data['pdfFileName'] = $invoice->getFileName();
|
$data['pdfFileName'] = $invoice->getFileName();
|
||||||
}
|
}
|
||||||
if ($account->attachUBL()) {
|
if ($account->attachUBL()) {
|
||||||
$data['ublString'] = $data['ublString'];
|
$data['ublString'] = $extra['ublString'];
|
||||||
$data['ublFileName'] = $invoice->getFileName('xml');
|
$data['ublFileName'] = $invoice->getFileName('xml');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,8 +106,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onEmailClick() {
|
function onEmailClick() {
|
||||||
$('#action').val('email');
|
sweetConfirm(function() {
|
||||||
$('#saveButton').click();
|
$('#action').val('email');
|
||||||
|
$('#saveButton').click();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@if ($proposal)
|
@if ($proposal)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user