---
suivi: 1336
date: 2026-08-13
sujet: reprise_siwi_paye_pdf_libelle
chantier: marches_reprise
type: fix
statut: poussé
hash: 7546b46b
fichiers:
  - app/Support/Siwi/SiwiTauxTva.php
  - app/Http/Controllers/SiwiImportController.php
  - app/Services/SiwiImportPageService.php
  - app/Services/SiwiRepriseActionService.php
  - app/Models/SiwiMarche.php
  - app/Models/SiwiOperation.php
  - database/migrations/2026_08_13_200000_add_siwi_travail_paye_et_libelle.php
  - resources/js/Pages/SiwiImport/Index.vue
  - database/data/journal_mises_a_jour_post_2026_06_12.php
  - public/build/
  - docs/suivi/SUIVI_1336_reprise_siwi_paye_pdf_libelle.md
---

## PROMPT ENVOYÉ

SUIVI #1336 — quatre défauts page `/siwi-import` : Payé HT manquant
(conversion TTC→HT), libellé « Montant marché HT », 404 PDF (casse +
messages), nom programme éditable avant création (TRAVAIL).

## SYNTHÈSE

### Fiches lues
- `#1334` : Suggestion ERP TRAVAIL + `SiwiTauxTva` — étendu `ttcVersHt`.
- `#1335` : hors périmètre actionnable — **non défait** (pas de retour
  des blocages `qualification_motif` / `poste_fiable` / `applicable_marche`).
- `#1332` : localisation commune — PATCH étendu avec `libelle_retenu`.

### DÉFAUT 1 — Payé HT
- Colonne TRAVAIL `siwi_marches.paye_ht_retenu` (migration).
- Proposition : `HT = TTC / (1 + taux%/100)` via `SiwiTauxTva::ttcVersHt`
  (aucun `×1.2` en dur). TVA 0 % = neutre.
- **Réserve** : conversion approximative si situations à taux différents —
  affichée comme proposition, pas vérité.
- Création marché : `marche_reprise_lignes.montant_paye_ht` alimenté.

### DÉFAUT 2 — Libellés Suggestion ERP
- « Montant HT » → « Montant marché HT ».
- Vérifiés : Facturé HT, Payé HT (nouveau), % RG, RG retenue HT,
  Intitulé suggéré, Note d’arbitrage — pas d’autre ambiguïté marché/facturé.

### DÉFAUT 3 — PDF 404
- **Cause** : `abort(404, …)` produisait une page Laravel « 404 Not Found »
  peu explicite ; la casse `.PDF`/`.pdf` était déjà essayée mais sans
  listage du dossier ni message métier. Sur OVH (FS sensible à la casse),
  un écart de nom réel reste possible.
- **Corrigé** : id `^\d+$` avant tout chemin ; rapprochement
  `siwi_documents` ; résolution réelle (candidats + `opendir`) ;
  messages texte explicites (absent index / absent dépôt / hors dépôt) ;
  orphelins comptés (`documents_depot`) et **non servis**.
- Chemin racine : `config('siwi.import_path')` défaut
  `/home/hectare-envol/siwi-import`.

### DÉFAUT 4 — Nom programme
- Colonne TRAVAIL `siwi_operations.libelle_retenu` (même migration).
- Éditable avant création ; lecture seule après ; nom SIWI conservé en
  référence. `siwi:import` n’écrase pas (SOURCE only).

### Vérification écran
**NON faite** depuis Cursor (pas de session M365 / prod navigation privée).
Lot **non validé écran** — tests 1–14 à rejouer en prod après déploiement.

## DÉPLOIEMENT-TEST

```bash
git pull origin main
php artisan migrate --force
php artisan optimize:clear && php artisan view:clear
php artisan journal:sync
```

Vérifier orphelins affichés sous Avancement ; ouvrir `/siwi-import/documents/3372/pdf`.

## LEÇON

Sur OVH, une 404 Laravel « Not Found » masque le motif métier : préférer
une réponse texte explicite. Un dépôt hors docroot exige id validé +
index avant toute construction de chemin ; les orphelins disque doivent
être ignorés, pas servis.
