setEventMessages($book->error, $book->errors, 'errors'); } else { $book->numero_compte = $account_number; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; $book->debit = $debit; $book->credit = $credit; if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } $result = $book->update($user); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { setEventMessages($langs->trans('Saved'), null, 'mesgs'); $action = ''; } } } } else { if ($action == "add") { $error = 0; if (floatval($debit) != 0.0 && floatval($credit) != 0.0) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error++; }
setEventMessages($book->error, $book->errors, 'errors'); } else { $book->numero_compte = $numero_compte; $book->code_tiers = $code_tiers; $book->label_compte = $label_compte; $book->debit = $debit; $book->credit = $credit; if (floatval($debit) != 0.0) { $book->montant = $debit; $book->sens = 'D'; } if (floatval($credit) != 0.0) { $book->montant = $credit; $book->sens = 'C'; } $result = $book->update(); if ($result < 0) { setEventMessages($book->error, $book->errors, 'errors'); } else { setEventMessages($langs->trans('Saved'), null, 'mesgs'); $action = ''; } } } } else { if ($action == "add") { $error = 0; if (intval($debit) != 0 && intval($credit) != 0) { setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); $error++; }