-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
afup#1428 compta regle auto DB + CRUD #1430
Conversation
194abea
to
2efdfc3
Compare
J'ai extrais la logique de la qualification automatique pour que ce soit testable unitairement. Maintenant, que les TU sont en places, je vais rendre ça dynamique d'après les règles en base de données. |
398ea39
to
ff3af39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bravo @stakovicz !
return $this->_bdd->obtenirTous($requete); | ||
} else { | ||
$data = $this->_bdd->obtenirTous($requete); | ||
$result[] = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
il n'y a pas un souci ici ? en testant en local j'ai un warning. Dans quels cas on a besoin de ce tableau associatif ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effectivement, j'ai supprimé cette partie du code et corrigé l'utilisation.
$formulaire->addElement('select', 'vat', 'Taux de TVA', array('0' => 'N.C.', '5_5' => '5.5%', '10' => '10%', '20' => '20%')); | ||
$formulaire->addElement('select', 'category_id', 'Catégorie', $compta->obtenirListCategories()); | ||
$formulaire->addElement('select', 'event_id', 'Évènement', $compta->obtenirListEvenements()); | ||
$formulaire->addElement('select', 'attachment_required', 'Justificatif obligatoire ?', array(null => 'N.C.', '1' => 'Oui', '0' => 'Non')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en testant en local, l'enregistrement du champ attachment_required et de mode_regl_id ne fonctionne pas
Voici ce que ça donne en base en ayant sélectionné autre chose que NC :
MariaDB [web]> select * from compta_regle;
+----+-----------+-----------------+-----------+------+-------------+----------+--------------+---------------------+
| id | label | condition | is_credit | vat | category_id | event_id | mode_regl_id | attachment_required |
+----+-----------+-----------------+-----------+------+-------------+----------+--------------+---------------------+
| 1 | Mailchimp | MAILCHIMP CARTE | 0 | 0 | 31 | 27 | NULL | NULL |
+----+-----------+-----------------+-----------+------+-------------+----------+--------------+---------------------+
1 row in set (0.00 sec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il y avait aussi un problème avec le is_credit
. J'ai ajouté un test fonctionnel pour valider l'enregistrement de tout les champs.
} | ||
if (null !== $rule['vat']) { | ||
$tx = ['0' => 0, '5_5' => 0.055, '10' => 0.1, '20' => 0.2]; | ||
$operationQualified['montant_ht_soumis_tva_' . $rule['vat']] = round($operationQualified['montant'] / (1+$tx[$rule['vat']]), 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
la méthode Vat::getRoundedWithoutVatPriceFromPriceWithVat ne pourrait-elle pas être utilisée ici ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top ! Je ne connaissais pas cette fonction.
|
||
foreach ($this->rules as $rule) { | ||
if (($operation->isCredit() === (bool) $rule['is_credit']) || is_null($rule['is_credit'])) { | ||
if (0 === strpos($operationQualified['description'], $rule['condition'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nous avons des entrées comme celle-ci :
PAIEMENT CB 2702 124 95 EUR MAILCHIMP CARTE 8466
ne faudrait-il pas faire un
if (false !== strpos($operationQualified['description'], $rule['condition'])) {
Pour faire des règles qui ne commencent pas forcément par la condition ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. modifié, j'avais repris exactement la même méthodologie.
40f020e
to
d29d5a3
Compare
No description provided.