diff --git a/migration/i2.1z/oracle/201502040847_IDEMPIERE-2410.sql b/migration/i2.1z/oracle/201502040847_IDEMPIERE-2410.sql new file mode 100644 index 0000000000..e34d56a9a3 --- /dev/null +++ b/migration/i2.1z/oracle/201502040847_IDEMPIERE-2410.sql @@ -0,0 +1,23 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 4, 2015 8:41:37 AM COT +-- IDEMPIERE-2410 Add Phase parameter to Generate PO from Project process +UPDATE AD_Process SET Updated=TO_DATE('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=225 +; + +-- Feb 4, 2015 8:43:14 AM COT +UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_DATE('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=367 +; + +-- Feb 4, 2015 8:43:14 AM COT +UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_DATE('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=354 +; + +-- Feb 4, 2015 8:43:15 AM COT +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,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200117,0,0,'Y',TO_DATE('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),100,'Project Phase','Phase of a Project',225,20,19,'N',165,10,'N','C_ProjectPhase_ID','Y','D',2073,'aed3df93-775d-4f37-9b17-160d6288de79','N') +; + +SELECT register_migration_script('201502040847_IDEMPIERE-2410.sql') FROM dual +; + diff --git a/migration/i2.1z/postgresql/201502040847_IDEMPIERE-2410.sql b/migration/i2.1z/postgresql/201502040847_IDEMPIERE-2410.sql new file mode 100644 index 0000000000..daccf46c04 --- /dev/null +++ b/migration/i2.1z/postgresql/201502040847_IDEMPIERE-2410.sql @@ -0,0 +1,20 @@ +-- Feb 4, 2015 8:41:37 AM COT +-- IDEMPIERE-2410 Add Phase parameter to Generate PO from Project process +UPDATE AD_Process SET Updated=TO_TIMESTAMP('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=225 +; + +-- Feb 4, 2015 8:43:14 AM COT +UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=367 +; + +-- Feb 4, 2015 8:43:14 AM COT +UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=354 +; + +-- Feb 4, 2015 8:43:15 AM COT +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,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200117,0,0,'Y',TO_TIMESTAMP('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 08:43:14','YYYY-MM-DD HH24:MI:SS'),100,'Project Phase','Phase of a Project',225,20,19,'N',165,10,'N','C_ProjectPhase_ID','Y','D',2073,'aed3df93-775d-4f37-9b17-160d6288de79','N') +; + +SELECT register_migration_script('201502040847_IDEMPIERE-2410.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/ProjectGenPO.java b/org.adempiere.base.process/src/org/compiere/process/ProjectGenPO.java index a5c1795d4c..6ae8c3a22c 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ProjectGenPO.java +++ b/org.adempiere.base.process/src/org/compiere/process/ProjectGenPO.java @@ -28,6 +28,7 @@ import org.compiere.model.MProductPO; import org.compiere.model.MProject; import org.compiere.model.MProjectLine; import org.compiere.util.Env; +import org.compiere.util.Msg; /** * Generate Purchase Order from Project. @@ -89,16 +90,20 @@ public class ProjectGenPO extends SvrProcess else if (m_C_ProjectPhase_ID != 0) { MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName()); - MProjectLine[] lines = project.getPhaseLines(m_C_ProjectPhase_ID); - for (int i = 0; i < lines.length; i++) - createPO (project, lines[i]); + for (MProjectLine line : project.getPhaseLines(m_C_ProjectPhase_ID)) { + if (line.isActive()) { + createPO (project, line); + } + } } else { MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName()); - MProjectLine[] lines = project.getLines(); - for (int i = 0; i < lines.length; i++) - createPO (project, lines[i]); + for (MProjectLine line : project.getLines()) { + if (line.isActive()) { + createPO (project, line); + } + } } return ""; } // doIt @@ -198,10 +203,10 @@ public class ProjectGenPO extends SvrProcess // update ProjectLine projectLine.setC_OrderPO_ID(order.getC_Order_ID()); projectLine.saveEx(); - addLog (order.getC_Order_ID(), + addBufferLog (order.getC_Order_ID(), order.getDateOrdered(), - new BigDecimal(orderLine.getLine()), - "Order:"+order.getDocumentNo()+" Line:"+orderLine.getLine(), + new BigDecimal(orderLine.getLine()), + Msg.getElement(Env.getAD_Language(Env.getCtx()), "C_Order_ID", false)+":"+order.getDocumentNo(), order.get_Table_ID(), order.getC_Order_ID()); } // createPOfromProjectLine