mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support sending payment email #1477
This commit is contained in:
parent
432e3cf3ab
commit
ec56df33ce
@ -6,6 +6,7 @@ use App\Http\Requests\CreatePaymentRequest;
|
||||
use App\Http\Requests\PaymentRequest;
|
||||
use App\Http\Requests\UpdatePaymentRequest;
|
||||
use App\Models\Client;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Ninja\Datatables\PaymentDatatable;
|
||||
@ -136,7 +137,10 @@ class PaymentController extends BaseController
|
||||
if ($payment->invoiceJsonBackup()) {
|
||||
$actions[] = ['url' => url("/invoices/invoice_history/{$payment->invoice->public_id}?payment_id={$payment->public_id}"), 'label' => trans('texts.view_invoice')];
|
||||
}
|
||||
|
||||
$actions[] = ['url' => url("/invoices/{$payment->invoice->public_id}/edit"), 'label' => trans('texts.edit_invoice')];
|
||||
$actions[] = DropdownButton::DIVIDER;
|
||||
$actions[] = ['url' => 'javascript:submitAction("email")', 'label' => trans('texts.email_payment')];
|
||||
|
||||
if ($payment->canBeRefunded()) {
|
||||
$actions[] = ['url' => "javascript:showRefundModal({$payment->public_id}, \"{$payment->getCompletedAmount()}\", \"{$payment->present()->completedAmount}\", \"{$payment->present()->currencySymbol}\")", 'label' => trans('texts.refund_payment')];
|
||||
@ -215,7 +219,7 @@ class PaymentController extends BaseController
|
||||
*/
|
||||
public function update(UpdatePaymentRequest $request)
|
||||
{
|
||||
if (in_array($request->action, ['archive', 'delete', 'restore', 'refund'])) {
|
||||
if (in_array($request->action, ['archive', 'delete', 'restore', 'refund', 'email'])) {
|
||||
return self::bulk();
|
||||
}
|
||||
|
||||
@ -234,11 +238,17 @@ class PaymentController extends BaseController
|
||||
$action = Input::get('action');
|
||||
$amount = Input::get('refund_amount');
|
||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
||||
$count = $this->paymentService->bulk($ids, $action, ['refund_amount' => $amount]);
|
||||
|
||||
if ($count > 0) {
|
||||
$message = Utils::pluralize($action == 'refund' ? 'refunded_payment' : $action.'d_payment', $count);
|
||||
Session::flash('message', $message);
|
||||
if ($action === 'email') {
|
||||
$payment = Payment::scope($ids)->first();
|
||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||
Session::flash('message', trans('texts.emailed_payment'));
|
||||
} else {
|
||||
$count = $this->paymentService->bulk($ids, $action, ['refund_amount' => $amount]);
|
||||
if ($count > 0) {
|
||||
$message = Utils::pluralize($action == 'refund' ? 'refunded_payment' : $action.'d_payment', $count);
|
||||
Session::flash('message', $message);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->returnBulk(ENTITY_PAYMENT, $action, $ids);
|
||||
|
@ -122,6 +122,15 @@ class PaymentDatatable extends EntityDatatable
|
||||
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id]);
|
||||
},
|
||||
],
|
||||
[
|
||||
trans('texts.email_payment'),
|
||||
function ($model) {
|
||||
return "javascript:submitForm_payment('email', {$model->public_id})";
|
||||
},
|
||||
function ($model) {
|
||||
return Auth::user()->can('editByOwner', [ENTITY_PAYMENT, $model->user_id]);
|
||||
},
|
||||
],
|
||||
[
|
||||
trans('texts.refund_payment'),
|
||||
function ($model) {
|
||||
|
@ -2246,7 +2246,8 @@ $LANG = array(
|
||||
'plan_price' => 'Plan Price',
|
||||
'wrong_confirmation' => 'Incorrect confirmation code',
|
||||
'oauth_taken' => 'The account is already registered',
|
||||
|
||||
'emailed_payment' => 'Successfully emailed payment',
|
||||
'email_payment' => 'Email Payment',
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
Loading…
x
Reference in New Issue
Block a user