Skip to content
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

Merged
merged 6 commits into from
Mar 16, 2024

Conversation

stakovicz
Copy link
Contributor

No description provided.

@stakovicz stakovicz force-pushed the feat-1428-regles-auto-compta branch 2 times, most recently from 194abea to 2efdfc3 Compare January 21, 2024 19:39
@stakovicz
Copy link
Contributor Author

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.

@stakovicz stakovicz marked this pull request as ready for review January 22, 2024 14:12
@stakovicz stakovicz self-assigned this Jan 22, 2024
db/seeds/ComptaRegle.php Outdated Show resolved Hide resolved
db/migrations/20240120222107_compta_regle.php Outdated Show resolved Hide resolved
htdocs/pages/administration/compta_conf_regle.php Outdated Show resolved Hide resolved
Copy link
Contributor

@vinceAmstoutz vinceAmstoutz left a 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[] = "";
Copy link
Member

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 ?

Copy link
Contributor Author

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'));
Copy link
Member

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)

Copy link
Contributor Author

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);
Copy link
Member

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 ?

Copy link
Contributor Author

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'])) {
Copy link
Member

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 ?

Copy link
Contributor Author

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.

@stakovicz stakovicz force-pushed the feat-1428-regles-auto-compta branch from 40f020e to d29d5a3 Compare March 3, 2024 20:55
@agallou agallou merged commit 4cab913 into afup:master Mar 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants