mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Warn if creating a duplicate expense
This commit is contained in:
parent
324c4d107f
commit
8227726f50
@ -169,6 +169,17 @@ class ExpenseController extends BaseController
|
||||
$data = $request->input();
|
||||
$data['documents'] = $request->file('documents');
|
||||
|
||||
// check for possible duplicate expense
|
||||
$duplcate = Expense::scope()
|
||||
->whereAmount($request->amount)
|
||||
->whereExpenseDate(Utils::toSqlDate($request->expense_date))
|
||||
->orderBy('created_at')
|
||||
->first();
|
||||
if ($duplcate) {
|
||||
Session::flash('warning', trans('texts.duplicate_expense_warning',
|
||||
['link' => link_to($duplcate->present()->url, trans('texts.expense_link'), ['target' => '_blank'])]));
|
||||
}
|
||||
|
||||
$expense = $this->expenseService->save($data);
|
||||
|
||||
Session::flash('message', trans('texts.created_expense'));
|
||||
|
@ -2249,7 +2249,9 @@ $LANG = array(
|
||||
'emailed_payment' => 'Successfully emailed payment',
|
||||
'email_payment' => 'Email Payment',
|
||||
'sent' => 'Sent',
|
||||
'inoviceplane_import' => 'Use :link to migrate your data from InvoicePlane.',
|
||||
'invoiceplane_import' => 'Use :link to migrate your data from InvoicePlane.',
|
||||
'duplicate_expense_warning' => 'Warning: This :link may be a duplicate',
|
||||
'expense_link' => 'expense',
|
||||
|
||||
);
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
]) !!}
|
||||
</div>
|
||||
<div id="inovicePlaneImport" style="display:none"><center>
|
||||
{!! trans('texts.inoviceplane_import', ['link' => link_to(INVOICEPLANE_IMPORT, 'turbo124/Plane2Ninja', ['target' => '_blank'])]) !!}
|
||||
{!! trans('texts.invoiceplane_import', ['link' => link_to(INVOICEPLANE_IMPORT, 'turbo124/Plane2Ninja', ['target' => '_blank'])]) !!}
|
||||
</center></div>
|
||||
<br/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user