From dae313ae781306fbdaad2ea39be1f3aa88fd54aa Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Wed, 25 Oct 2017 12:46:16 +0200 Subject: [PATCH] IDEMPIERE-3529 - Add parameters to InvoicePrint process --- .../oracle/201710251241_IDEMPIERE-3529.sql | 14 ++++++++++++++ .../postgresql/201710251241_IDEMPIERE-3529.sql | 11 +++++++++++ .../adempiere/webui/process/InvoicePrint.java | 18 +++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 migration/i4.1/oracle/201710251241_IDEMPIERE-3529.sql create mode 100644 migration/i4.1/postgresql/201710251241_IDEMPIERE-3529.sql diff --git a/migration/i4.1/oracle/201710251241_IDEMPIERE-3529.sql b/migration/i4.1/oracle/201710251241_IDEMPIERE-3529.sql new file mode 100644 index 0000000000..e2d6ee3dad --- /dev/null +++ b/migration/i4.1/oracle/201710251241_IDEMPIERE-3529.sql @@ -0,0 +1,14 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3529 - Add parameters to InvoicePrint process +-- Oct 25, 2017 12:09:30 PM CEST +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200219,0,0,'Y',TO_DATE('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200,60,19,170,'N',200097,0,'N','C_DocType_ID','Y','D',196,'554013bb-d6c0-4795-a9c6-aa2cb6dfc2bf','N') +; + +-- Oct 25, 2017 12:16:28 PM CEST +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200220,0,0,'Y',TO_DATE('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,'Paid','The document is paid',200,70,17,319,'N',0,'N','IsPaid','Y','D',1402,'7d2f7567-fb4f-44b0-a098-ddaa81ca7a4f','N') +; + +SELECT register_migration_script('201710251241_IDEMPIERE-3529.sql') FROM dual +; diff --git a/migration/i4.1/postgresql/201710251241_IDEMPIERE-3529.sql b/migration/i4.1/postgresql/201710251241_IDEMPIERE-3529.sql new file mode 100644 index 0000000000..7eba976b0d --- /dev/null +++ b/migration/i4.1/postgresql/201710251241_IDEMPIERE-3529.sql @@ -0,0 +1,11 @@ +-- IDEMPIERE-3529 - Add parameters to InvoicePrint process +-- Oct 25, 2017 12:09:30 PM CEST +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200219,0,0,'Y',TO_TIMESTAMP('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-10-25 12:09:30','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200,60,19,170,'N',200097,0,'N','C_DocType_ID','Y','D',196,'554013bb-d6c0-4795-a9c6-aa2cb6dfc2bf','N') +; + +-- Oct 25, 2017 12:16:28 PM CEST +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200220,0,0,'Y',TO_TIMESTAMP('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-10-25 12:16:28','YYYY-MM-DD HH24:MI:SS'),100,'Paid','The document is paid',200,70,17,319,'N',0,'N','IsPaid','Y','D',1402,'7d2f7567-fb4f-44b0-a098-ddaa81ca7a4f','N') +; + +SELECT register_migration_script('201710251241_IDEMPIERE-3529.sql') FROM dual +; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java index 2c2c1d907e..768c5ecab4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/process/InvoicePrint.java @@ -68,6 +68,8 @@ public class InvoicePrint extends SvrProcess protected int m_C_Invoice_ID = 0; protected String m_DocumentNo_From = null; protected String m_DocumentNo_To = null; + private String p_IsPaid = null; + private int m_C_DocType_ID = 0; protected volatile StringBuffer sql = new StringBuffer(); protected volatile List params = new ArrayList(); @@ -101,6 +103,10 @@ public class InvoicePrint extends SvrProcess m_DocumentNo_From = (String)para[i].getParameter(); m_DocumentNo_To = (String)para[i].getParameter_To(); } + else if (name.equals("IsPaid")) + p_IsPaid = (String)para[i].getParameter(); + else if (name.equals("C_DocType_ID")) + m_C_DocType_ID = para[i].getParameterAsInt(); else log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name); } @@ -124,7 +130,9 @@ public class InvoicePrint extends SvrProcess + ", C_Invoice_ID=" + m_C_Invoice_ID + ", EmailPDF=" + p_EMailPDF + ",R_MailText_ID=" + p_R_MailText_ID + ", DateInvoiced=" + m_dateInvoiced_From + "-" + m_dateInvoiced_To - + ", DocumentNo=" + m_DocumentNo_From + "-" + m_DocumentNo_To); + + ", DocumentNo=" + m_DocumentNo_From + "-" + m_DocumentNo_To + + ", IsPaid=" + p_IsPaid + + ", C_DocType_ID=" + m_C_DocType_ID); MMailText mText = null; if (p_R_MailText_ID != 0) @@ -377,6 +385,14 @@ public class InvoicePrint extends SvrProcess /* if emailed to customer only select COmpleted & CLosed invoices */ sql.append(" AND i.DocStatus IN ('CO','CL') "); } + if (p_IsPaid != null && p_IsPaid.length() == 1) + { + sql.append(" AND i.IsPaid='").append(p_IsPaid).append("'"); + } + if (m_C_DocType_ID != 0) + { + sql.append (" AND i.C_DocTypeTarget_ID=").append(m_C_DocType_ID); + } } String orgWhere = MRole.getDefault(getCtx(), false).getOrgWhere(MRole.SQL_RO); if (!Util.isEmpty(orgWhere, true)) {