feat : M5 — Tickets de pesée (ERP-188 → ERP-193) (#144)
Auto Tag Develop / tag (push) Successful in 8s

MR unique regroupant tout le module M5 « Tickets de pesée » (remplace les MR empilées #140/#141/#142/#143).

## Périmètre
- **ERP-188** — Page liste des tickets de pesée + export XLSX (colonnes Fournisseur/Client/Autre + Statut).
- **ERP-189** — Écran « Ajouter » (4 champs en haut, 2 blocs de pesée, pesée bascule/manuelle, date+heure horodatée à la validation).
- **ERP-190** — Écran « Modifier » + bouton Imprimer.
- **ERP-191** — i18n + libellés + branchement site courant.
- **ERP-192** — Bon de pesée PDF généré côté back (template Twig → Dompdf), endpoint `GET /api/weighing_tickets/{id}/print.pdf`.
- **ERP-193** — Cycle de vie brouillon/validé (status DRAFT/VALIDATED, numéro attribué à la validation), DSD saisi conservé en pesée manuelle, retours métier design.

## Vérifications
- Back : tests Logistique + architecture verts, php-cs-fixer propre, migrations appliquées (dev + test).
- Front : suite Vitest complète verte, ESLint propre.

Base : `develop` — contient les 16 commits du M5 (rien d'autre).
Reviewed-on: #144
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #144.
This commit is contained in:
2026-06-24 14:38:01 +00:00
committed by Autin
parent a4158d4e37
commit faafd99ef8
47 changed files with 4121 additions and 254 deletions
@@ -56,18 +56,16 @@ final class WeighbridgeReadingApiTest extends AbstractApiTestCase
self::assertLessThanOrEqual(50000, $data['weight']);
self::assertIsInt($data['dsd']);
self::assertGreaterThanOrEqual(1, $data['dsd']);
// manualNumber est null en mode bascule (cle potentiellement omise si
// skip_null_values est actif — tolerant aux deux cas).
self::assertNull($data['manualNumber'] ?? null);
}
public function testManualWeighingKeepsWeightAndAllocatesDsd(): void
public function testManualWeighingKeepsWeightAndEnteredDsd(): void
{
$client = $this->manageClientWithCurrentSite();
$response = $client->request('POST', '/api/weighbridge_readings', [
'headers' => ['Content-Type' => 'application/ld+json'],
'json' => ['mode' => 'MANUAL', 'weight' => 23187, 'manualNumber' => 'PAP-555'],
// Le DSD est SAISI par l'operateur et conserve tel quel (ERP-193).
'json' => ['mode' => 'MANUAL', 'weight' => 23187, 'dsd' => 16619],
]);
self::assertResponseStatusCodeSame(200);
@@ -75,8 +73,7 @@ final class WeighbridgeReadingApiTest extends AbstractApiTestCase
self::assertSame('MANUAL', $data['mode']);
self::assertSame(23187, $data['weight']);
self::assertSame('PAP-555', $data['manualNumber']);
self::assertGreaterThanOrEqual(1, $data['dsd']);
self::assertSame(16619, $data['dsd'], 'Le DSD saisi est conserve, pas d\'auto-increment.');
}
public function testManagePermissionIsRequired(): void
@@ -117,11 +114,25 @@ final class WeighbridgeReadingApiTest extends AbstractApiTestCase
'json' => ['mode' => 'MANUAL'],
]);
// Garde-fou ERP-101 : la 422 doit cibler `weight` (Callback validateManualWeight).
// Garde-fou ERP-101 : la 422 doit cibler `weight` (Callback validateManualFields).
self::assertResponseStatusCodeSame(422);
self::assertViolationOnPath($response, 'weight');
}
public function testManualWeighingRequiresDsd(): void
{
$client = $this->manageClientWithCurrentSite();
$response = $client->request('POST', '/api/weighbridge_readings', [
'headers' => ['Content-Type' => 'application/ld+json'],
'json' => ['mode' => 'MANUAL', 'weight' => 23187],
]);
// En manuel, le DSD est saisi → obligatoire (Callback validateManualFields).
self::assertResponseStatusCodeSame(422);
self::assertViolationOnPath($response, 'dsd');
}
/**
* Garde-fou ERP-101 (miroir AbstractWeighingTicketApiTestCase) : une 422 doit
* porter une violation sur le `propertyPath` attendu, consommable inline par