Dont save payments with a zero alloc amount, delete payments with a zero alloc amount, fix javascript calculating payment balance
This commit is contained in:
@@ -126,8 +126,7 @@ class AdminController extends Controller
|
||||
|
||||
if ($items->count() == 1) {
|
||||
$oo = $items->pop();
|
||||
|
||||
if (! $amount['id']) {
|
||||
if ($amount['id'] == 0) {
|
||||
$oo->delete();
|
||||
continue;
|
||||
}
|
||||
@@ -138,7 +137,13 @@ class AdminController extends Controller
|
||||
}
|
||||
|
||||
$oo->amount = ($oo->invoice->due >= 0) && ($oo->invoice->due-$amount['id'] >= 0) ? $amount['id'] : 0;
|
||||
|
||||
// If the amount is empty, ignore it.
|
||||
if (! $oo->amount)
|
||||
continue;
|
||||
|
||||
$oo->site_id = config('site')->site_id;
|
||||
$oo->active = TRUE;
|
||||
$o->items()->save($oo);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user