Skip to content

FIX: doc preview loupe on shipments (BL) in comm card#755

Merged
ATM-NicolasV merged 2 commits into
21.0_atmfrom
FIX/docPreviewShippingInCommCard
Jul 9, 2026
Merged

FIX: doc preview loupe on shipments (BL) in comm card#755
ATM-NicolasV merged 2 commits into
21.0_atmfrom
FIX/docPreviewShippingInCommCard

Conversation

@ATM-NicolasV

Copy link
Copy Markdown

Symptôme

Sur la fiche tiers (onglet Client/Prospect), cliquer sur la loupe d'aperçu PDF d'un BL renvoie la page générique de prod « This website or feature is currently temporarily not available… ». L'aperçu du même BL reste accessible depuis sa page dédiée.

Cause racine

comm/card.php passait $sendingstatic->element (= "shipping") comme modulepart à showPreview()document.php?modulepart=shipping. Or dol_check_secure_access_document() (core/lib/files.lib.php ~3401) ne gère que expedition/shipment ; shipping n'est qu'un alias de nom de module (MODULE_MAPPING: 'expedition' => 'shipping', les fichiers sont stockés sous expedition/sending/). Le modulepart=shipping tombe dans la branche générique, teste $conf->shipping->dir_output (vide) → dol_print_error("not supported value for modulepart parameter (shipping)") + exit → masqué en prod.

Les 5 autres listes (devis, commandes, factures, contrats, interventions) fonctionnent car leur ->element correspond déjà à un modulepart valide. Seule l'Expédition a element (shipping) ≠ modulepart (expedition). Les pages dédiées marchent car elles utilisent en dur modulepart='expedition' (expedition/document.php:196).

Correctif

  • Passer le modulepart 'expedition' (comme la page dédiée) au lieu de $sendingstatic->element.
  • Ajouter le paramètre entity qui manquait sur cette liste (multi-société), comme les autres listes.
  • Suppression du $param = '' devenu inutile.

Même famille que la PR Dolibarr#37057 (FIX/docPreviewInCommCard), qui avait ajouté entity= aux listes sœurs mais laissé le bug de modulepart du BL.

Portée

1 fichier, 2 lignes (htdocs/comm/card.php, bloc « Latest shipments »). Aucune migration, aucun effet de bord sur les autres listes. php -l OK.

ATM-NicolasV and others added 2 commits July 9, 2026 13:07
On the thirdparty card (client/prospect tab), the PDF preview magnifier of
a shipment (BL) pointed to document.php?modulepart=shipping. The security
check dol_check_secure_access_document() only handles 'expedition'/'shipment'
('shipping' is just a module-name alias; files live under the 'expedition'
directory), so it fell through to the generic branch and raised
dol_print_error "not supported value for modulepart parameter (shipping)",
shown in production as the generic "temporarily not available" page.

Pass the 'expedition' modulepart (same as expedition/document.php) instead of
$sendingstatic->element ('shipping'), and add the missing entity parameter
like the other lists. Drop the now-unused $param.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wrap the shipment (BL) doc-preview fix in comm/card.php with the
/**DEBUT/FIN SPECIFIQUE ATM **/ markers so the divergence from core is
isolated and merges cleanly on future core upgrades. The original core
line is kept as a comment for reference. Add the corresponding line to
ChangeLogAtm.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ATM-NicolasV
ATM-NicolasV merged commit 2156dea into 21.0_atm Jul 9, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant