Fix amount remove from piggy bug.

This commit is contained in:
James Cole
2017-01-08 18:23:07 +01:00
parent 19990f49b0
commit 78b71e72f1
2 changed files with 2 additions and 1 deletions

View File

@@ -324,7 +324,7 @@ class PiggyBankController extends Controller
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
if (bccomp($amount, $savedSoFar) === -1) {
if (bccomp($amount, $savedSoFar) <= 0) {
$repetition = $piggyBank->currentRelevantRep();
$repetition->currentamount = bcsub($repetition->currentamount, $amount);
$repetition->save();

View File

@@ -805,6 +805,7 @@ return [
'add_set_amount_to_piggy' => 'Add :amount to fill this piggy bank on :date',
'delete_piggy_bank' => 'Delete piggy bank ":name"',
'cannot_add_amount_piggy' => 'Could not add :amount to ":name".',
'cannot_remove_from_piggy' => 'Could not remove :amount from ":name".',
'deleted_piggy_bank' => 'Deleted piggy bank ":name"',
'added_amount_to_piggy' => 'Added :amount to ":name"',
'removed_amount_from_piggy' => 'Removed :amount from ":name"',