IDEMPIERE-4461 : Feedback email recipient(s) : add flexibility (#261)
* IDEMPIERE-4461 : Feedback email recipient(s) : add flexibility Search recipients in SysConfig and if not found, fallback on System.SupportEMail * IDEMPIERE-4461 : Feedback email recipient(s) : add flexibility fixes suggested by @hengsin Co-authored-by: hengsin <152246+hengsin@users.noreply.github.com>
This commit is contained in:
parent
a21fe225e1
commit
4856ca67fc
|
@ -43,7 +43,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 4339975517612838655L;
|
private static final long serialVersionUID = -7393845332390162370L;
|
||||||
|
|
||||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||||
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
||||||
|
@ -96,6 +96,8 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String EMAIL_NOTIFY_2PACK = "EMAIL_NOTIFY_2PACK";
|
public static final String EMAIL_NOTIFY_2PACK = "EMAIL_NOTIFY_2PACK";
|
||||||
public static final String EMAIL_TEST_MAILTEXT_ID = "EMAIL_TEST_MAILTEXT_ID";
|
public static final String EMAIL_TEST_MAILTEXT_ID = "EMAIL_TEST_MAILTEXT_ID";
|
||||||
public static final String ENABLE_PAYMENTBOX_BUTTON = "ENABLE_PAYMENTBOX_BUTTON";
|
public static final String ENABLE_PAYMENTBOX_BUTTON = "ENABLE_PAYMENTBOX_BUTTON";
|
||||||
|
public static final String FEEDBACK_EMAIL_CC = "FEEDBACK_EMAIL_CC";
|
||||||
|
public static final String FEEDBACK_EMAIL_TO = "FEEDBACK_EMAIL_TO";
|
||||||
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
|
public static final String GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS = "GRIDTABLE_LOAD_TIMEOUT_IN_SECONDS";
|
||||||
public static final String HTML_REPORT_THEME = "HTML_REPORT_THEME";
|
public static final String HTML_REPORT_THEME = "HTML_REPORT_THEME";
|
||||||
public static final String IBAN_VALIDATION = "IBAN_VALIDATION";
|
public static final String IBAN_VALIDATION = "IBAN_VALIDATION";
|
||||||
|
|
|
@ -22,9 +22,11 @@ import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.util.FeedbackManager;
|
import org.adempiere.webui.util.FeedbackManager;
|
||||||
import org.adempiere.webui.window.WEMailDialog;
|
import org.adempiere.webui.window.WEMailDialog;
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MSystem;
|
import org.compiere.model.MSystem;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.util.ByteArrayDataSource;
|
import org.compiere.util.ByteArrayDataSource;
|
||||||
|
import org.compiere.util.EMail;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
|
@ -113,10 +115,22 @@ public class DefaultFeedbackService implements IFeedbackService {
|
||||||
dialog.setAttribute(Window.MODE_KEY, Mode.OVERLAPPED);
|
dialog.setAttribute(Window.MODE_KEY, Mode.OVERLAPPED);
|
||||||
|
|
||||||
MSystem system = MSystem.get(Env.getCtx());
|
MSystem system = MSystem.get(Env.getCtx());
|
||||||
if (!Util.isEmpty(system.getSupportEMail()))
|
|
||||||
|
for (String s : getFeedbackRecipient(MSysConfig.FEEDBACK_EMAIL_TO).split(",")) {
|
||||||
|
if (!Util.isEmpty(s.trim()) && EMail.validate(s.trim()))
|
||||||
|
dialog.addTo(s.trim(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.isEmpty(dialog.getTo()) && !Util.isEmpty(system.getSupportEMail()))
|
||||||
{
|
{
|
||||||
dialog.addTo(system.getSupportEMail(), true);
|
dialog.addTo(system.getSupportEMail(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String s : getFeedbackRecipient(MSysConfig.FEEDBACK_EMAIL_CC).split(",")) {
|
||||||
|
if (!Util.isEmpty(s.trim()) && EMail.validate(s.trim()))
|
||||||
|
dialog.addCC(s.trim(), false);
|
||||||
|
}
|
||||||
|
|
||||||
AEnv.showWindow(dialog);
|
AEnv.showWindow(dialog);
|
||||||
if (imageBytes != null && imageBytes.length > 0) {
|
if (imageBytes != null && imageBytes.length > 0) {
|
||||||
ByteArrayDataSource screenShot = new ByteArrayDataSource(imageBytes, "image/png");
|
ByteArrayDataSource screenShot = new ByteArrayDataSource(imageBytes, "image/png");
|
||||||
|
@ -125,6 +139,11 @@ public class DefaultFeedbackService implements IFeedbackService {
|
||||||
}
|
}
|
||||||
dialog.focus();
|
dialog.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getFeedbackRecipient(String scValue) {
|
||||||
|
String retValue = MSysConfig.getValue(scValue, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));
|
||||||
|
return Util.isEmpty(retValue) ? "" : retValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class CreateNewRequestAction implements EventListener<Event>{
|
protected static class CreateNewRequestAction implements EventListener<Event>{
|
||||||
|
|
Loading…
Reference in New Issue