feat(commercial) : validators M2 fournisseurs (RG-2.03/2.07/2.08/2.10) (ERP-89) #68
Reference in New Issue
Block a user
Delete Branch "feature/ERP-89-validators-m2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Étape 4/7 du M2 fournisseurs — stackée sur #67 (ERP-88).
Périmètre (RG-2.03 / 2.07 / 2.08 / 2.10)
Décision figée ERP-89 : les RG inter-champs passent par
Assert\Callback+->atPath()sur l'entité Supplier (et non dans le Processor), pour que chaque 422 porte unpropertyPathconsommable parextractApiViolations(mapping inline, pas un toast — ERP-101).Supplier::validateCategoryType()→atPath('categories'): catégories de type FOURNISSEUR uniquement sursupplier.categories(miroir d'ERP-88 côté adresse).Supplier::validatePaymentTypeConsistency()→atPath('bank'): VIREMENT impose une banque.atPath('ribs'): LCR impose ≥ 1 RIB (le 409 sur DELETE du dernier RIB en LCR reste porté par ERP-88).SupplierInformationCompletenessValidator(8 champs Information dontvolumeForecast), invoqué par leSupplierProcessoraprès détection back du rôle Commerciale viaBusinessRoleAwareInterface. Le Processor ne porte que rôle / mode strict / gating.Tests (16, verts)
SupplierValidationTest— Callbacks RG-2.07/2.08/2.10, assertion par propertyPath.SupplierInformationCompletenessValidatorTest— complétude / champs manquants / zéros valides.SupplierProcessorTest— détection rôle RG-2.03 (POST + PATCH main-only + non-Commerciale).make test: 499 tests OK.php-cs-fixer: clean.Retours review — points assumés (non bloquants)
Le review (👍 mergeable, aucun défaut bloquant) relève deux points de comportement. Tous deux sont voulus et conformes à la spec + au jumeau M1 déjà en prod — aucun changement de code, on les documente ici :
Archivage d'un fournisseur incomplet par une Commerciale → 422. Lecture littérale de RG-2.03 (« POST et tout PATCH ») et miroir de RG-1.04 (M1). Acté par le test
testCommercialeIncompleteInformationOnMainOnlyPatchIsUnprocessable. Comportement assumé.Friction lifecycle : si un Admin crée un fournisseur sans remplir l'onglet Information (201, non gaté), une Commerciale ne peut plus modifier aucun champ tant que les 8 champs Information ne sont pas complétés. Conforme RG-2.03 + miroir M1. Comportement assumé.
RG inter-champs via Assert\Callback->atPath() sur l'entite Supplier (decision figee ERP-89), pour un 422 a propertyPath consommable par extractApiViolations : - RG-2.10 : categories de type FOURNISSEUR (supplier.categories) -> atPath('categories') - RG-2.07 : VIREMENT impose une banque -> atPath('bank') - RG-2.08 : LCR impose au moins un RIB -> atPath('ribs') RG-2.03 (completude Information pour le role Commerciale, detection back via BusinessRoleAwareInterface) portee par SupplierInformationCompletenessValidator, invoque par le SupplierProcessor. Tests : SupplierValidationTest (Callbacks 2.07/2.08/2.10), SupplierInformationCompletenessValidatorTest, SupplierProcessorTest (RG-2.03).b580bb6576to544da49404