From 8a042fb578937db031f0178aa593c3f1b95e7a87 Mon Sep 17 00:00:00 2001 From: tristan Date: Mon, 29 Jun 2026 10:52:02 +0200 Subject: [PATCH] =?UTF-8?q?fix(logistique)=20:=20bloque=20les=20caract?= =?UTF-8?q?=C3=A8res=20sp=C3=A9ciaux=20dans=20le=20champ=20=C2=AB=20Autre?= =?UTF-8?q?=20=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assert\Regex(FREE_TEXT) sur otherLabel (miroir companyName/competitors) + masque FREE_TEXT_MASK sur l'input « Autre » (new.vue / edit.vue). --- .../pages/weighing-tickets/[id]/edit.vue | 2 + .../logistique/pages/weighing-tickets/new.vue | 2 + .../Domain/Entity/WeighingTicket.php | 2 + .../Api/WeighingTicketLifecycleTest.php | 37 +++++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/frontend/modules/logistique/pages/weighing-tickets/[id]/edit.vue b/frontend/modules/logistique/pages/weighing-tickets/[id]/edit.vue index d42b2bd..bb8bf6d 100644 --- a/frontend/modules/logistique/pages/weighing-tickets/[id]/edit.vue +++ b/frontend/modules/logistique/pages/weighing-tickets/[id]/edit.vue @@ -58,6 +58,7 @@ authManageOnSite($this->siteByCode('86')); + + // Le back reste l'autorite (le masque front FREE_TEXT_MASK filtre deja a la + // frappe) : un libelle « Autre » avec des caracteres parasites -> 422 sur + // otherLabel (Assert\Regex FREE_TEXT), mappee inline cote front (ERP-101). + $response = $this->postTicket($http, [ + 'counterpartyType' => 'AUTRE', + 'otherLabel' => 'Chantier ~#|<>{}', + 'emptyDate' => '2026-06-17T09:00:00+02:00', + 'emptyWeight' => 7150, + 'emptyMode' => 'AUTO', + ]); + + self::assertResponseStatusCodeSame(422); + self::assertViolationOnPath($response, 'otherLabel'); + } + + public function testOtherLabelLegitimateIsAccepted(): void + { + $http = $this->authManageOnSite($this->siteByCode('86')); + + // Lettres accentuees, chiffres, espaces, parentheses, °, & : tout autorise + // par FREE_TEXT (miroir des raisons sociales Client/Fournisseur). + $body = $this->postTicket($http, [ + 'counterpartyType' => 'AUTRE', + 'otherLabel' => 'Chantier Léon (Pôle n°2) & Cie', + 'emptyDate' => '2026-06-17T09:00:00+02:00', + 'emptyWeight' => 7150, + 'emptyMode' => 'AUTO', + ])->toArray(); + + self::assertResponseStatusCodeSame(201); + self::assertSame('Chantier Léon (Pôle n°2) & Cie', $body['otherLabel']); + } + public function testValidateRequiresCounterparty(): void { $http = $this->authManageOnSite($this->siteByCode('86'));