another api fix #46

This commit is contained in:
denisdulici 2017-10-12 18:32:14 +03:00
parent fc9e62dc8d
commit 90fba987fa
2 changed files with 8 additions and 8 deletions

View File

@ -51,6 +51,10 @@ class Invoices extends ApiController
*/
public function store(Request $request)
{
if (empty($request['amount'])) {
$request['amount'] = 0;
}
$invoice = Invoice::create($request->all());
$taxes = [];
@ -119,7 +123,7 @@ class Invoices extends ApiController
}
if (empty($request['amount'])) {
$request['amount'] += $sub_total + $tax_total;
$request['amount'] = $sub_total + $tax_total;
}
$invoice->update($request->input());
@ -219,7 +223,7 @@ class Invoices extends ApiController
}
if (empty($request['amount'])) {
$request['amount'] += $sub_total + $tax_total;
$request['amount'] = $sub_total + $tax_total;
}
$invoice->update($request->input());

View File

@ -331,7 +331,7 @@ class Invoices extends Controller
}
}
$request['amount'] += $sub_total + $tax_total;
$request['amount'] = $sub_total + $tax_total;
$invoice->update($request->input());
@ -402,8 +402,6 @@ class Invoices extends Controller
$request['invoice_status_code'] = 'draft';
$request['amount'] = 0;
// Upload attachment
$attachment_path = $this->getUploadedFilePath($request->file('attachment'), 'invoices');
@ -469,9 +467,7 @@ class Invoices extends Controller
}
}
if (empty($request['amount'])) {
$request['amount'] += $sub_total + $tax_total;
}
$request['amount'] = $sub_total + $tax_total;
$invoice->update($request->input());