1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

check document completed upload before user submitted form

This commit is contained in:
Hillel Coren 2016-05-25 21:42:22 +03:00
parent bd817a3700
commit 85184f9a5b

View File

@ -148,11 +148,14 @@ class ExpenseRepository extends BaseRepository
// Documents
$document_ids = !empty($input['document_ids'])?array_map('intval', $input['document_ids']):array();;
foreach ($document_ids as $document_id){
$document = Document::scope($document_id)->first();
if($document && Auth::user()->can('edit', $document)){
$document->invoice_id = null;
$document->expense_id = $expense->id;
$document->save();
// check document completed upload before user submitted form
if ($document_id) {
$document = Document::scope($document_id)->first();
if($document && Auth::user()->can('edit', $document)){
$document->invoice_id = null;
$document->expense_id = $expense->id;
$document->save();
}
}
}