IDEMPIERE-3660 Improve Packin / PackIn is not notifying for non System tenant

This commit is contained in:
Carlos Ruiz 2018-03-16 18:03:03 -03:00
parent 89c00b7ada
commit 00ec75b027
2 changed files with 51 additions and 14 deletions

View File

@ -56,7 +56,7 @@ public class MClient extends X_AD_Client
/** /**
* *
*/ */
private static final long serialVersionUID = -4420908648355523008L; private static final long serialVersionUID = 8418331925351272377L;
/** /**
* Get client * Get client
@ -799,8 +799,8 @@ public class MClient extends X_AD_Client
/************ /************
* Create EMail from Request User * Create EMail from Request User
* @param to recipient * @param to recipient
* @param subject sunject * @param subject subject
* @param message nessage * @param message message
* @return EMail * @return EMail
*/ */
public EMail createEMail (String to, public EMail createEMail (String to,
@ -812,8 +812,8 @@ public class MClient extends X_AD_Client
/************ /************
* Create EMail from Request User * Create EMail from Request User
* @param to recipient * @param to recipient
* @param subject sunject * @param subject subject
* @param message nessage * @param message message
* @param html * @param html
* @return EMail * @return EMail
*/ */
@ -834,12 +834,43 @@ public class MClient extends X_AD_Client
return email; return email;
} // createEMail } // createEMail
/************
* Create EMail with a specific from address
* @param from recipient
* @param to recipient
* @param subject subject
* @param message message
* @param html
* @return EMail
*/
public EMail createEMailFrom (String from, String to,
String subject, String message, boolean html)
{
if (from == null || from.length() == 0)
{
log.warning("No From");
return null;
}
if (to == null || to.length() == 0)
{
log.warning("No To");
return null;
}
//
EMail email = new EMail (this,
from, to,
subject, message, html);
if (isSmtpAuthorization())
email.createAuthenticator (getRequestUser(), getRequestUserPW());
return email;
} // createEMailFrom
/** /**
* Create EMail from User * Create EMail from User
* @param from optional sender * @param from optional sender
* @param to recipient * @param to recipient
* @param subject sunject * @param subject subject
* @param message nessage * @param message message
* @return EMail * @return EMail
*/ */
public EMail createEMail (MUser from, MUser to, public EMail createEMail (MUser from, MUser to,
@ -852,8 +883,8 @@ public class MClient extends X_AD_Client
* Create EMail from User * Create EMail from User
* @param from optional sender * @param from optional sender
* @param to recipient * @param to recipient
* @param subject sunject * @param subject subject
* @param message nessage * @param message message
* @param html * @param html
* @return EMail * @return EMail
*/ */
@ -877,8 +908,8 @@ public class MClient extends X_AD_Client
* Create EMail from User * Create EMail from User
* @param from optional sender * @param from optional sender
* @param to recipient * @param to recipient
* @param subject sunject * @param subject subject
* @param message nessage * @param message message
* @return EMail * @return EMail
*/ */
public EMail createEMail (MUser from, String to, public EMail createEMail (MUser from, String to,
@ -891,8 +922,8 @@ public class MClient extends X_AD_Client
* Create EMail from User * Create EMail from User
* @param from optional sender * @param from optional sender
* @param to recipient * @param to recipient
* @param subject sunject * @param subject subject
* @param message nessage * @param message message
* @param html * @param html
* @return EMail * @return EMail
*/ */

View File

@ -154,7 +154,13 @@ public class PackInNotifier {
StringTokenizer st = new StringTokenizer(emailList, " ,;", false); StringTokenizer st = new StringTokenizer(emailList, " ,;", false);
String to = st.nextToken(); String to = st.nextToken();
EMail email = client.createEMail(null, to, subject.toString(), message.toString()); String from = client.getRequestEMail();
if (from == null && client.getAD_Client_ID() != 0 && MClient.isSendCredentialsSystem()) {
MClient sysclient = MClient.get(Env.getCtx(), 0);
from = sysclient.getRequestEMail();
}
EMail email = client.createEMailFrom(from, to, subject.toString(), message.toString(), false);
if (email != null) if (email != null)
{ {
if (!packIn.isSuccess()) { if (!packIn.isSuccess()) {