IDEMPIERE-1846:Extend Scheduler by SchedulerSubject and SchedulerMessage
This commit is contained in:
parent
88eeb0cdba
commit
bf9a6c91a5
|
@ -0,0 +1,43 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
-- Jul 14, 2015 12:25:14 AM ICT
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (1000000,0,'Mail Template','Text templates for mailings','The Mail Template indicates the mail template for return messages. Mail text can include variables. The priority of parsing is User/Contact, Business Partner and then the underlying business object (like Request, Dunning, Workflow object).<br>
|
||||
So, @Name@ would resolve into the User name (if user is defined defined), then Business Partner name (if business partner is defined) and then the Name of the business object if it has a Name.<br>
|
||||
For Multi-Lingual systems, the template is translated based on the Business Partner''s language selection.',688,'R_MailText_ID',10,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2015-07-14 00:25:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-14 00:25:14','YYYY-MM-DD HH24:MI:SS'),100,1515,'N','N','D','N','N','N','Y','69fd9dea-4a77-4270-82db-70b78db81d7b','Y',0,'N','N')
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:25:25 AM ICT
|
||||
UPDATE AD_Column SET FKConstraintName='RMailText_ADScheduler', FKConstraintType='N',Updated=TO_DATE('2015-07-14 00:25:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1000000
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:25:25 AM ICT
|
||||
ALTER TABLE AD_Scheduler ADD R_MailText_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:25:25 AM ICT
|
||||
ALTER TABLE AD_Scheduler ADD CONSTRAINT RMailText_ADScheduler FOREIGN KEY (R_MailText_ID) REFERENCES r_mailtext(r_mailtext_id) DEFERRABLE INITIALLY DEFERRED
|
||||
;
|
||||
-- Jul 14, 2015 12:58:50 AM ICT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (1000000,'Mail Template','Text templates for mailings','The Mail Template indicates the mail template for return messages. Mail text can include variables. The priority of parsing is User/Contact, Business Partner and then the underlying business object (like Request, Dunning, Workflow object).<br>
|
||||
So, @Name@ would resolve into the User name (if user is defined defined), then Business Partner name (if business partner is defined) and then the Name of the business object if it has a Name.<br>
|
||||
For Multi-Lingual systems, the template is translated based on the Business Partner''s language selection.',589,1000000,'Y',0,160,0,'N','N','N','N',0,0,'Y',TO_DATE('2015-07-14 00:58:50','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-07-14 00:58:50','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','279a9bda-15f1-4f41-b52d-7d0818c21d90','Y',150,1,1,1,'N','N','N')
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:59:33 AM ICT
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, XPosition=4, ColumnSpan=2,Updated=TO_DATE('2015-07-14 00:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1000000
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:59:33 AM ICT
|
||||
UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2015-07-14 00:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200501
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:59:33 AM ICT
|
||||
UPDATE AD_Field SET SeqNo=0,Updated=TO_DATE('2015-07-14 00:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9434
|
||||
;
|
||||
-- Jul 14, 2015 2:07:07 AM ICT
|
||||
UPDATE AD_Field SET IsUpdateable='Y',Updated=TO_DATE('2015-07-14 02:07:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1000000
|
||||
;
|
||||
SELECT register_migration_script('201514071982-IDEMPIERE-1846.sql') FROM dual
|
||||
;
|
|
@ -0,0 +1,40 @@
|
|||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
|
||||
-- Jul 14, 2015 12:25:14 AM ICT
|
||||
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (1000000,0,'Mail Template','Text templates for mailings','The Mail Template indicates the mail template for return messages. Mail text can include variables. The priority of parsing is User/Contact, Business Partner and then the underlying business object (like Request, Dunning, Workflow object).<br>
|
||||
So, @Name@ would resolve into the User name (if user is defined defined), then Business Partner name (if business partner is defined) and then the Name of the business object if it has a Name.<br>
|
||||
For Multi-Lingual systems, the template is translated based on the Business Partner''s language selection.',688,'R_MailText_ID',10,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2015-07-14 00:25:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-14 00:25:14','YYYY-MM-DD HH24:MI:SS'),100,1515,'N','N','D','N','N','N','Y','69fd9dea-4a77-4270-82db-70b78db81d7b','Y',0,'N','N')
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:25:25 AM ICT
|
||||
UPDATE AD_Column SET FKConstraintName='RMailText_ADScheduler', FKConstraintType='N',Updated=TO_TIMESTAMP('2015-07-14 00:25:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1000000
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:25:25 AM ICT
|
||||
ALTER TABLE AD_Scheduler ADD COLUMN R_MailText_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:25:25 AM ICT
|
||||
ALTER TABLE AD_Scheduler ADD CONSTRAINT RMailText_ADScheduler FOREIGN KEY (R_MailText_ID) REFERENCES r_mailtext(r_mailtext_id) DEFERRABLE INITIALLY DEFERRED
|
||||
;
|
||||
-- Jul 14, 2015 12:58:50 AM ICT
|
||||
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (1000000,'Mail Template','Text templates for mailings','The Mail Template indicates the mail template for return messages. Mail text can include variables. The priority of parsing is User/Contact, Business Partner and then the underlying business object (like Request, Dunning, Workflow object).<br>
|
||||
So, @Name@ would resolve into the User name (if user is defined defined), then Business Partner name (if business partner is defined) and then the Name of the business object if it has a Name.<br>
|
||||
For Multi-Lingual systems, the template is translated based on the Business Partner''s language selection.',589,1000000,'Y',0,160,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2015-07-14 00:58:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-07-14 00:58:50','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','279a9bda-15f1-4f41-b52d-7d0818c21d90','Y',150,1,1,1,'N','N','N')
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:59:33 AM ICT
|
||||
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, XPosition=4, ColumnSpan=2,Updated=TO_TIMESTAMP('2015-07-14 00:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1000000
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:59:33 AM ICT
|
||||
UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2015-07-14 00:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200501
|
||||
;
|
||||
|
||||
-- Jul 14, 2015 12:59:33 AM ICT
|
||||
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2015-07-14 00:59:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9434
|
||||
;
|
||||
-- Jul 14, 2015 2:07:07 AM ICT
|
||||
UPDATE AD_Field SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2015-07-14 02:07:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1000000
|
||||
;
|
||||
SELECT register_migration_script('201514071982-IDEMPIERE-1846.sql') FROM dual
|
||||
;
|
|
@ -241,6 +241,21 @@ public interface I_AD_Scheduler
|
|||
*/
|
||||
public int getRecord_ID();
|
||||
|
||||
/** Column name R_MailText_ID */
|
||||
public static final String COLUMNNAME_R_MailText_ID = "R_MailText_ID";
|
||||
|
||||
/** Set Mail Template.
|
||||
* Text templates for mailings
|
||||
*/
|
||||
public void setR_MailText_ID (int R_MailText_ID);
|
||||
|
||||
/** Get Mail Template.
|
||||
* Text templates for mailings
|
||||
*/
|
||||
public int getR_MailText_ID();
|
||||
|
||||
public org.compiere.model.I_R_MailText getR_MailText() throws RuntimeException;
|
||||
|
||||
/** Column name Supervisor_ID */
|
||||
public static final String COLUMNNAME_Supervisor_ID = "Supervisor_ID";
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20141030L;
|
||||
private static final long serialVersionUID = 20150714L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_Scheduler (Properties ctx, int AD_Scheduler_ID, String trxName)
|
||||
|
@ -335,6 +335,34 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
|
|||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_R_MailText getR_MailText() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_R_MailText)MTable.get(getCtx(), org.compiere.model.I_R_MailText.Table_Name)
|
||||
.getPO(getR_MailText_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Mail Template.
|
||||
@param R_MailText_ID
|
||||
Text templates for mailings
|
||||
*/
|
||||
public void setR_MailText_ID (int R_MailText_ID)
|
||||
{
|
||||
if (R_MailText_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_R_MailText_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_R_MailText_ID, Integer.valueOf(R_MailText_ID));
|
||||
}
|
||||
|
||||
/** Get Mail Template.
|
||||
@return Text templates for mailings
|
||||
*/
|
||||
public int getR_MailText_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_R_MailText_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_User getSupervisor() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name)
|
||||
|
|
|
@ -33,6 +33,7 @@ import java.util.logging.Level;
|
|||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MMailText;
|
||||
import org.compiere.model.MNote;
|
||||
import org.compiere.model.MOrgInfo;
|
||||
import org.compiere.model.MPInstance;
|
||||
|
@ -278,12 +279,26 @@ public class Scheduler extends AdempiereServer
|
|||
|
||||
if (email)
|
||||
{
|
||||
MMailText mailTemplate = new MMailText(m_schedulerctx, m_model.getR_MailText_ID(), null);
|
||||
String mailContent = "";
|
||||
|
||||
if (mailTemplate.is_new()){
|
||||
mailContent = m_model.getDescription();
|
||||
}else{
|
||||
mailTemplate.setUser(user);
|
||||
mailTemplate.setLanguage(Env.getContext(m_schedulerctx, "#AD_Language"));
|
||||
// if user has bpartner link. maybe use language depend user
|
||||
mailContent = mailTemplate.getMailText(true);
|
||||
schedulerName = mailTemplate.getMailHeader();
|
||||
}
|
||||
|
||||
MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID());
|
||||
if (fileList != null && !fileList.isEmpty()) {
|
||||
client.sendEMailAttachments(from, user, schedulerName, m_model.getDescription(), fileList);
|
||||
client.sendEMailAttachments(from, user, schedulerName, mailContent, fileList);
|
||||
} else {
|
||||
client.sendEMail(from, user, schedulerName, pi.getSummary() + " " + pi.getLogInfo(), null);
|
||||
client.sendEMail(from, user, schedulerName, mailContent + "\n" + pi.getSummary() + " " + pi.getLogInfo(), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue