[fix] Correction de l'erreur "Invalid operation (*)" sur /contractAdmin/orders#151
Merged
Merged
Conversation
Le template contractadmin/orders.mtt calculait `o.quantity * o.productQt` pour l'input de pesée (bloc multiWeight + variablePrice) sans vérifier la nullité de `productQt` (champ SNull<SFloat> dans Product). Quand un produit a multiWeight=true mais qt=null, Neko lançait "Invalid operation (*)". On introduit une variable locale `effectiveQt` qui vaut `o.productQt` si non-null, sinon 1, aligné sur le comportement de OrderService ligne 872. L'opérateur ternaire n'étant pas supporté par le compilateur Templo, on utilise deux instructions ::set:: / ::if::. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
InterAMAP44
approved these changes
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexte
Une erreur serveur "Invalid operation (*)" se produisait sur la page
/contractAdmin/orders/<id>pour certains catalogues, rendant la pageinaccessible.
Trace :
Called from contractadmin/orders.mtt line 123
at URL /contractAdmin/orders/82897
Cause
Le template tente d'afficher
o.quantity * o.productQtdans l'inputde saisie du poids (bloc
multiWeight && variablePrice). Orproduct.qtest
SNull<SFloat>— un produit peut avoirmultiWeight=truesansqtrenseigné. Dans ce cas
o.productQtest null et Neko lève"Invalid operation (*)" à la multiplication.
Solution
Introduction d'une variable locale
effectiveQtdans le template :::set effectiveQt = o.productQt::
::if effectiveQt == null::::set effectiveQt = 1::::end::
Cette valeur par défaut de 1 est cohérente avec
OrderService.updateUserOrderQuantity(ligne 872) qui applique le même fallback côté serveur.
Note : l'opérateur ternaire
? :n'est pas supporté par le compilateurTemplo — d'où l'usage de deux instructions
::set::/::if::.Comment tester
/contractAdmin/orders/<catalog_id>?d=<distrib_id>affiche la quantité (quantity × 1)
🤖 Co-rédigé avec Claude Code
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com