Skip to content
Snippets Groups Projects
Commit 6f37fef0 authored by Jean-Pierre Morfin's avatar Jean-Pierre Morfin
Browse files

fix test against empty amount on book update

- amount < 1 was considered as 0
- 0.00 was not considered as empty so $book->sens was always C
parent 0c6441df
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ if ($action == "confirm_update") { ...@@ -51,7 +51,7 @@ if ($action == "confirm_update") {
$error = 0; $error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) { if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors'); setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++; $error ++;
} }
...@@ -69,11 +69,11 @@ if ($action == "confirm_update") { ...@@ -69,11 +69,11 @@ if ($action == "confirm_update") {
$book->debit = $debit; $book->debit = $debit;
$book->credit = $credit; $book->credit = $credit;
if (! empty($debit)) { if (floatval($debit)!=0.0) {
$book->montant = $debit; $book->montant = $debit;
$book->sens = 'D'; $book->sens = 'D';
} }
if (! empty($credit)) { if (floatval($credit)!=0.0) {
$book->montant = $credit; $book->montant = $credit;
$book->sens = 'C'; $book->sens = 'C';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment