Openbravo Issue Tracking System - POS2
View Issue Details
0055379POS2POSpublic2023-02-17 13:102024-04-30 16:58
montse_cabanas 
cberner 
highmajorhave not tried
closedfixed 
5
 
24Q224Q2 
No
0055379: Error send email with variables
When variables (@var@) are put in the subject or body of an email, the variable is not replaced by its data
If you define in the Email Configuration template replacements for subject, body or attachment they don’t apply

1-In Backoffice Document Types window > Template Definition and Email Configuraiton tabs put some @variables@ to apply for POS Order

2-Send email of a ticket from POS: the replacement won’t happen in the subject, body nor attachment file name
No tags attached.
blocks defect 0051642 closed cberner Error send email with variables 
Issue History
2024-04-30 16:53cbernerTypedefect => backport
2024-04-30 16:53cbernerTarget Version => 24Q2
2024-04-30 16:53cbernerAssigned ToTriage Platform Base => cberner
2024-04-30 16:55hgbotNote Added: 0163961
2024-04-30 16:58hgbotResolutionopen => fixed
2024-04-30 16:58hgbotStatusscheduled => closed
2024-04-30 16:58hgbotFixed in Version => 24Q2
2024-04-30 16:58hgbotNote Added: 0163964
2024-04-30 16:58hgbotNote Added: 0163965

Notes
(0163961)
hgbot   
2024-04-30 16:55   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/2604 [^]
(0163964)
hgbot   
2024-04-30 16:58   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 6b1988fb2d7e0e64470237371880a95474691caf
Author: Cristian Berner <cristian.berner@openbravo.com>
Date: 30-04-2024 16:54:12
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/6b1988fb2d7e0e64470237371880a95474691caf [^]

Fixes ISSUE-55379: Send email variables not applied or failing with CSS @media notation

Variables are @variableName@ strings in the email template that are
replaced by their respective property value. Previously only those
strings that match @variableName @ (see the white-space) were being
replaced, which was wrong.

We changed to replace @variableName@, removing that white-space. This
resulted in some templates failing due to usage of css @media notations,
to fix this, the replacement method was changed from
String.replaceFirst, which accepted a regex string, to
StringUtils.replaceOnce, which accepts a text search string, which will
not trigger regex pattern errors.

This should result in that we can use @variableName@ in emails, and also
css @media properties. If a variable does not exist, it will not be
replaced.

---
M src/org/openbravo/pos2/mailing/Mailer.java
---
(0163965)
hgbot   
2024-04-30 16:58   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/2604 [^]