Skip to content

#962 [Hook] fix: keep the project tooltip layout on the projects only - #963

Open
evarisk-kilyan wants to merge 1 commit into
Eoxia:developfrom
evarisk-kilyan:fix/962-project-tooltip-leak
Open

evarisk-kilyan wants to merge 1 commit into
Eoxia:developfrom
evarisk-kilyan:fix/962-project-tooltip-leak

Conversation

@evarisk-kilyan

Copy link
Copy Markdown
Contributor

Closes #962

Problème

Sur la CardPro d'un tiers, l'infobulle d'une proposition commerciale affichait OpportunityAmount 0,00 € non traduit, alors que la même mention est bien traduite sur les projets.

Cause

Les contextes d'une page s'empilent dans le hookmanager (contextarray est cumulatif). Le initHooks(array('projectdao')) fait par Project::getNomUrl() restait donc actif pour toutes les infobulles construites ensuite, quel que soit leur objet.

Le hook getTooltipContent de ReedCRM ne testait que ce contexte : sur la CardPro, les propositions listées à côté des projets étaient reconstruites avec la mise en page projet — montant d'opportunité ajouté sur la ligne du picto, ligne de réf. reformatée, ... des extrafields supprimé. Et comme Propal::getTooltipContentArray() charge propal et pas projects, la clé OpportunityAmount restait brute.

À l'inverse, projectdao n'étant enregistré qu'en fin de getNomUrl(), la première infobulle projet d'une page n'était jamais mise en page.

Correctif

La reconnaissance se fait maintenant sur l'objet lui-même ($object->element === 'project'), et projects est chargé en début de bloc pour les libellés.

Tests

Infobulles rendues en CLI avec projectdao déjà présent dans le contexte (cas de la CardPro) :

Avant

--- PROPAL TOOLTIP ---
Proposition commerciale Montant opportunité  0,00 € Ouvert Réf..: PR2606-0015 Client: … Date: 11/06/2026 …

Après

--- PROPAL TOOLTIP ---
Proposition commerciale Ouvert Réf.: PR2606-0015 Client: … Date: 11/06/2026 … Périodicité de contrôle (Jours): … ...

L'infobulle projet est inchangée (montant d'opportunité, ref + dates, libellé, description).

… only

The contexts of a page pile up in the hookmanager, so the 'projectdao' registered by the
first Project::getNomUrl() stayed set for every tooltip built afterwards, whatever its
object. On the CardPro of a third party, the proposals listed next to the projects were
therefore rebuilt with the project layout: an "OpportunityAmount 0,00 €" added on the
picto row — untranslated, Propal::getTooltipContentArray() loading 'propal' and not
'projects' —, a reformatted ref line and the extrafields "..." dropped.

The tooltip is now recognised on the object itself, which also applies the layout to the
first project link of a page, and 'projects' is loaded up front for the labels.
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.

Traduction manquante lors du survol de proposition dans la CardPro du tiers

1 participant