mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enabled sending payment confirmation email for manual payment entries
This commit is contained in:
parent
43556928ec
commit
a301e58609
@ -733,14 +733,19 @@ class PaymentController extends BaseController
|
|||||||
->withErrors($errors)
|
->withErrors($errors)
|
||||||
->withInput();
|
->withInput();
|
||||||
} else {
|
} else {
|
||||||
$this->paymentRepo->save($publicId, Input::all());
|
$payment = $this->paymentRepo->save($publicId, Input::all());
|
||||||
|
|
||||||
if ($publicId) {
|
if ($publicId) {
|
||||||
Session::flash('message', trans('texts.updated_payment'));
|
Session::flash('message', trans('texts.updated_payment'));
|
||||||
|
|
||||||
return Redirect::to('payments/');
|
return Redirect::to('payments/');
|
||||||
|
} else {
|
||||||
|
if (Input::get('email_receipt')) {
|
||||||
|
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||||
|
Session::flash('message', trans('texts.created_payment_emailed_client'));
|
||||||
} else {
|
} else {
|
||||||
Session::flash('message', trans('texts.created_payment'));
|
Session::flash('message', trans('texts.created_payment'));
|
||||||
|
}
|
||||||
|
|
||||||
return Redirect::to('clients/'.Input::get('client'));
|
return Redirect::to('clients/'.Input::get('client'));
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,11 @@ class Payment extends EntityModel
|
|||||||
return $this->belongsTo('App\Models\Client')->withTrashed();
|
return $this->belongsTo('App\Models\Client')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\User')->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
public function account()
|
public function account()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Account');
|
return $this->belongsTo('App\Models\Account');
|
||||||
|
@ -84,8 +84,15 @@ class ContactMailer extends Mailer
|
|||||||
|
|
||||||
$data = ['body' => str_replace(array_keys($variables), array_values($variables), $emailTemplate)];
|
$data = ['body' => str_replace(array_keys($variables), array_values($variables), $emailTemplate)];
|
||||||
|
|
||||||
|
if ($payment->invitation) {
|
||||||
$user = $payment->invitation->user;
|
$user = $payment->invitation->user;
|
||||||
$this->sendTo($payment->contact->email, $user->email, $accountName, $subject, $view, $data);
|
$contact = $payment->contact->email;
|
||||||
|
} else {
|
||||||
|
$user = $payment->user;
|
||||||
|
$contact = $payment->client->contacts[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sendTo($contact->email, $user->email, $accountName, $subject, $view, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendLicensePaymentConfirmation($name, $email, $amount, $license, $productId)
|
public function sendLicensePaymentConfirmation($name, $email, $amount, $license, $productId)
|
||||||
|
@ -694,5 +694,7 @@ return array(
|
|||||||
'timezone_unset' => 'Please :link to set your timezone',
|
'timezone_unset' => 'Please :link to set your timezone',
|
||||||
'click_here' => 'click here',
|
'click_here' => 'click here',
|
||||||
|
|
||||||
|
'email_receipt' => 'Email payment receipt to the client',
|
||||||
|
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
{!! Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
|
{!! Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') !!}
|
||||||
{!! Former::text('transaction_reference') !!}
|
{!! Former::text('transaction_reference') !!}
|
||||||
|
|
||||||
|
@if (!$payment)
|
||||||
|
{!! Former::checkbox('email_receipt')->label(' ')->text(trans('texts.email_receipt')) !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user