+ if (!array_key_exists('compte', $flux) ||
+ (!is_null($flux['compte']) &&
+ !$db->simpleQuerySingle('SELECT 1 FROM compta_comptes WHERE id = ?;', false, $flux['compte'])))
+ {
+ throw new UserException('Compte débité inconnu.');
+ }
+ $flux['compte'] = is_null($flux['compte']) ? null : strtoupper(trim($flux['compte']));
+
+ $flux['montant'] = str_replace(',', '.', $flux['montant']);
+ $flux['montant'] = (float)$flux['montant'];
+
+ $sum_montant = round($sum_montant + $flux['montant'], 2);