---
suivi: 1374
date: 2026-08-31
sujet: paiement_fonds_propres
chantier: mise_en_paiement
type: feature
statut: poussé
hash: 446aa309
fichiers:
  - database/migrations/2026_08_31_160000_add_paiement_fonds_propres_to_depot_factures_table.php
  - app/Support/PaiementFondsPropres.php
  - app/Http/Controllers/PaiementController.php
  - app/Http/Controllers/FactureController.php
  - app/Http/Controllers/SuiviChantierController.php
  - app/Http/Requests/PaiementLigneEnregistrerRequest.php
  - app/Http/Requests/PaiementTraiterRequest.php
  - app/Services/PaiementLignesPayablesService.php
  - app/Services/PaiementLignePersistService.php
  - app/Services/PaiementAppymtBatchService.php
  - app/Models/DepotFacture.php
  - routes/web.php
  - resources/js/Pages/Factures/Paiement/Index.vue
  - resources/js/Pages/Factures/Index.vue
  - resources/js/Pages/SuiviChantier/Index.vue
  - resources/js/Components/ProgrammeFacturesPanel.vue
  - resources/js/Composables/usePaiementTableColumns.js
  - resources/js/Composables/usePaiementLigneEdition.js
  - tests/Unit/PaiementFondsPropresTest.php
  - database/data/journal_mises_a_jour_post_2026_06_12.php
  - public/build/
---

## PROMPT ENVOYÉ

SUIVI #1374 — Case informative « Fonds propres » sur mise en paiement + page programme
(modifiable après comptabilisation, exception #1367). Pré-coche PROGRAMMES/PROJET + 512900/512901.
Hors Sage. Migration booléenne. Cumul programme.

## FICHES LUES

- **#1367** — verrou retenues/montants dès comptabilisée : ce lot ajoute une **exception nommée**
  (`updateFondsPropres`) sans assouplir le verrou pour les autres champs.
- **#1361 / #1373** — OCR hors périmètre ; non touchés.

## SYNTHÈSE

### Stockage
Colonne `depot_factures.paiement_fonds_propres` (boolean **nullable**) :
- `null` = appliquer la suggestion auto ; `true`/`false` = choix saisi.
- Justification table dépôt : MEP + liste programme opèrent sur `DepotFacture` ; le dépôt survit
  après paiement ; `factures.fichier_*` mortes.

### Pré-cochage
Destination ∈ {PROGRAMMES, PROJET, PROJETS} **et** compte ∈ {512900, 512901}
(= `PaiementEntiteFinancialEntityDefaults` HECTARE/ENVOL). Confirmé.
Comptes programme courants hors règle (`455195ENVOL`, `512110`, `512427`…) → **non cochés**
(signalé — élargissement = arbitrage Robin). PROJETS UI encore « à venir » mais inclus pour
anticipation.

### Droits (identiques MEP)
Middleware route : `GS_COMPTABILITE|GS_ADMIN_ERP|GS_DSI|GS_DIRECTION_GENERALE` +
`feature.permission:factures.paiement`. Serveur 403 via `ensurePaiementUser`.
UI programme : mêmes groupes via `m365GroupNames()` brut.

### Exception #1367
`PATCH /depot-factures/{uuid}/paiement-fonds-propres` — **seul** champ patchable post-compta /
post-paiement. N’appelle pas `assertRetenuesEtMontantsVerrouillesPostNv1`. Documenté ici.

### Affichage programme
Colonne + KPI « Fonds propres » (count + montant HT) sur `ProgrammeFacturesPanel`.
**Proposition** pour arbitrage : enrichir la synthèse financière programme / trésorerie plutôt
qu’un nouvel écran dédié — non inventé ici.

### Nouvelle route
`depot-factures.paiement-fonds-propres` → `route:clear` après déploiement.

## DÉPLOIEMENT-TEST

```bash
git pull origin main
php artisan migrate --force
php artisan migrate:status | grep -c Pending
# doit afficher 0 (commande seule, pas &&)
php artisan optimize:clear
php artisan view:clear
php artisan route:clear
php artisan journal:sync
```

## LEÇON

Un flag « informatif post-compta » doit avoir son **propre endpoint** (pas le patch MEP qui refuse
les lignes déjà payées) et être documenté comme exception au verrou #1367, sinon le prochain lot
le « corrigera » par erreur.
