Prevent partial from being negative

This commit is contained in:
Hillel Coren 2016-09-27 10:37:37 +03:00
parent 6088a36175
commit c5d0786ed6

View File

@ -475,7 +475,7 @@ class InvoiceRepository extends BaseRepository
} }
if (isset($data['partial'])) { if (isset($data['partial'])) {
$invoice->partial = min(round(Utils::parseFloat($data['partial']), 2), $invoice->balance); $invoice->partial = max(0,min(round(Utils::parseFloat($data['partial']), 2), $invoice->balance));
} }
$invoice->amount = $total; $invoice->amount = $total;