From d0b5697dc6cf03b63789bd4ec595d6cf6b1173b4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 27 Jul 2017 17:43:22 +0200 Subject: [PATCH 01/33] IDEMPIERE-1157 Adding functionality to add charts on the standard windows --- migration/i4.1/oracle/201707261502_ZoomDataSource.sql | 8 ++++++++ migration/i4.1/postgresql/201707261502_ZoomDataSource.sql | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 migration/i4.1/oracle/201707261502_ZoomDataSource.sql create mode 100644 migration/i4.1/postgresql/201707261502_ZoomDataSource.sql diff --git a/migration/i4.1/oracle/201707261502_ZoomDataSource.sql b/migration/i4.1/oracle/201707261502_ZoomDataSource.sql new file mode 100644 index 0000000000..a2002b9f89 --- /dev/null +++ b/migration/i4.1/oracle/201707261502_ZoomDataSource.sql @@ -0,0 +1,8 @@ +-- Jul 26, 2017 3:01:47 PM CEST +-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows +UPDATE AD_Table SET AD_Window_ID=53124,Updated=TO_DATE('2017-07-26 15:01:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53282 +; + +SELECT register_migration_script('201707261502_ZoomDataSource.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201707261502_ZoomDataSource.sql b/migration/i4.1/postgresql/201707261502_ZoomDataSource.sql new file mode 100644 index 0000000000..a097860357 --- /dev/null +++ b/migration/i4.1/postgresql/201707261502_ZoomDataSource.sql @@ -0,0 +1,8 @@ +-- Jul 26, 2017 3:01:47 PM CEST +-- IDEMPIERE-1157 Adding functionality to add charts on the standard windows +UPDATE AD_Table SET AD_Window_ID=53124,Updated=TO_TIMESTAMP('2017-07-26 15:01:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53282 +; + +SELECT register_migration_script('201707261502_ZoomDataSource.sql') FROM dual +; + From c663b563b43c321d063bc4e963f73ff3a511248d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 3 Aug 2017 14:05:44 +0200 Subject: [PATCH 02/33] IDEMPIERE-3443 Payment Schedule leading to -> Current record was changed by another user, please ReQuery --- .../i4.1/oracle/201708031402_IDEMPIERE-3443.sql | 15 +++++++++++++++ .../postgresql/201708031402_IDEMPIERE-3443.sql | 12 ++++++++++++ .../src/org/compiere/model/CalloutInvoice.java | 3 ++- .../src/org/compiere/model/CalloutOrder.java | 2 ++ .../src/org/compiere/model/MInvoice.java | 14 ++++++++++++++ .../src/org/compiere/model/MOrder.java | 16 +++++++++++++++- 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 migration/i4.1/oracle/201708031402_IDEMPIERE-3443.sql create mode 100644 migration/i4.1/postgresql/201708031402_IDEMPIERE-3443.sql diff --git a/migration/i4.1/oracle/201708031402_IDEMPIERE-3443.sql b/migration/i4.1/oracle/201708031402_IDEMPIERE-3443.sql new file mode 100644 index 0000000000..e1df99b3fd --- /dev/null +++ b/migration/i4.1/oracle/201708031402_IDEMPIERE-3443.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3443 +-- Aug 3, 2017 2:01:39 PM CEST +UPDATE AD_Column SET Callout=NULL,Updated=TO_DATE('2017-08-03 14:01:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2187 +; + +-- Aug 3, 2017 2:02:05 PM CEST +UPDATE AD_Column SET Callout=NULL,Updated=TO_DATE('2017-08-03 14:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3500 +; + +SELECT register_migration_script('201708031402_IDEMPIERE-3443.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201708031402_IDEMPIERE-3443.sql b/migration/i4.1/postgresql/201708031402_IDEMPIERE-3443.sql new file mode 100644 index 0000000000..f5b6eb6d64 --- /dev/null +++ b/migration/i4.1/postgresql/201708031402_IDEMPIERE-3443.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-3443 +-- Aug 3, 2017 2:01:39 PM CEST +UPDATE AD_Column SET Callout=NULL,Updated=TO_TIMESTAMP('2017-08-03 14:01:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2187 +; + +-- Aug 3, 2017 2:02:05 PM CEST +UPDATE AD_Column SET Callout=NULL,Updated=TO_TIMESTAMP('2017-08-03 14:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3500 +; + +SELECT register_migration_script('201708031402_IDEMPIERE-3443.sql') FROM dual +; + diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java index d937cafebc..a88914c794 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -275,7 +275,9 @@ public class CalloutInvoice extends CalloutEngine * @param mField field * @param value value * @return null or error message + * @Deprecated - business logic moved to MInvoice.beforeSave - must not create/delete external records with callouts */ + @Deprecated public String paymentTerm (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { Integer C_PaymentTerm_ID = (Integer)value; @@ -290,7 +292,6 @@ public class CalloutInvoice extends CalloutEngine boolean valid = pt.apply (C_Invoice_ID); mTab.setValue("IsPayScheduleValid", valid ? "Y" : "N"); - return ""; } // paymentTerm diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 8600179ba8..89050f16d0 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -745,7 +745,9 @@ public class CalloutOrder extends CalloutEngine * @param mField field * @param value value * @return null or error message + * @Deprecated - business logic moved to MOrder.beforeSave - must not create/delete external records with callouts */ + @Deprecated public String paymentTerm (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { Integer C_PaymentTerm_ID = (Integer)value; diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index c48ce7252d..c53c958515 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -927,6 +927,7 @@ public class MInvoice extends X_C_Invoice implements DocAction } // validatePaySchedule + private volatile static boolean recursiveCall = false; /************************************************************************** * Before Save * @param newRecord new @@ -1028,6 +1029,19 @@ public class MInvoice extends X_C_Invoice implements DocAction } } + if (! recursiveCall && (newRecord || is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) { + recursiveCall = true; + try { + MPaymentTerm pt = new MPaymentTerm (getCtx(), getC_PaymentTerm_ID(), get_TrxName()); + boolean valid = pt.apply(this); + setIsPayScheduleValid(valid); + } catch (Exception e) { + throw e; + } finally { + recursiveCall = false; + } + } + return true; } // beforeSave diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index ed7a0e1021..55134abab9 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -71,7 +71,7 @@ public class MOrder extends X_C_Order implements DocAction /** * */ - private static final long serialVersionUID = -4032643956656204341L; + private static final long serialVersionUID = -7784588474522162502L; /** * Create new Order by copying @@ -921,6 +921,7 @@ public class MOrder extends X_C_Order implements DocAction } // validatePaySchedule + private volatile static boolean recursiveCall = false; /************************************************************************** * Before Save * @param newRecord new @@ -1089,6 +1090,19 @@ public class MOrder extends X_C_Order implements DocAction } } + if (! recursiveCall && (newRecord || is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) { + recursiveCall = true; + try { + MPaymentTerm pt = new MPaymentTerm (getCtx(), getC_PaymentTerm_ID(), get_TrxName()); + boolean valid = pt.applyOrder(this); + setIsPayScheduleValid(valid); + } catch (Exception e) { + throw e; + } finally { + recursiveCall = false; + } + } + return true; } // beforeSave From 60a9930755f98b39e3fa852eb44d9e9298b3fea6 Mon Sep 17 00:00:00 2001 From: Eduardo Jaremicki Moreira Date: Thu, 10 Aug 2017 16:35:11 -0300 Subject: [PATCH 03/33] IDEMPIERE-3448 Request don't send notice messages to internal users --- .../src/org/adempiere/base/event/RequestEventHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/adempiere/base/event/RequestEventHandler.java b/org.adempiere.base/src/org/adempiere/base/event/RequestEventHandler.java index 1db37f7c96..cd96218a8b 100644 --- a/org.adempiere.base/src/org/adempiere/base/event/RequestEventHandler.java +++ b/org.adempiere.base/src/org/adempiere/base/event/RequestEventHandler.java @@ -361,7 +361,7 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed } } if (X_AD_User.NOTIFICATIONTYPE_Notice.equals(NotificationType) - && AD_Role_ID >= 0) + && AD_Role_ID < 0) { if (s_log.isLoggable(Level.CONFIG)) s_log.config("No internal User: " + Name); continue; From a58428373ca6b11694f9bc49b9acb9dea99cf20c Mon Sep 17 00:00:00 2001 From: Eduardo Jaremicki Moreira Date: Thu, 10 Aug 2017 16:40:14 -0300 Subject: [PATCH 04/33] IDEMPIERE-3450 Idempiere config file is recreated without necessity --- org.adempiere.base/src/org/compiere/util/Login.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index 2f201ea09e..cf0c663f89 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -992,8 +992,6 @@ public class Login DB.close(rs, pstmt); rs = null; pstmt = null; } - // - Ini.saveProperties(Ini.isClient()); // Country Env.setContext(m_ctx, "#C_Country_ID", MCountry.getDefault(m_ctx).getC_Country_ID()); // Call ModelValidators afterLoadPreferences - teo_sarca FR [ 1670025 ] From 1b8d9b038eacbd790c14179a864af254f105471f Mon Sep 17 00:00:00 2001 From: Alex Silva de Albuquerque Date: Thu, 10 Aug 2017 17:15:07 -0300 Subject: [PATCH 05/33] IDEMPIERE-3446 Define the workflow approver dynamically - migration scripts --- .../oracle/201708081830_IDEMPIERE-3446.sql | 245 ++++++++++++++++++ .../201708081830_IDEMPIERE-3446.sql | 242 +++++++++++++++++ 2 files changed, 487 insertions(+) create mode 100644 migration/i4.1/oracle/201708081830_IDEMPIERE-3446.sql create mode 100644 migration/i4.1/postgresql/201708081830_IDEMPIERE-3446.sql diff --git a/migration/i4.1/oracle/201708081830_IDEMPIERE-3446.sql b/migration/i4.1/oracle/201708081830_IDEMPIERE-3446.sql new file mode 100644 index 0000000000..366f961902 --- /dev/null +++ b/migration/i4.1/oracle/201708081830_IDEMPIERE-3446.sql @@ -0,0 +1,245 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3446 Define the workflow approver dynamically +-- Aug 8, 2017 6:16:04 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200376,'Manual','Manual List',304,'M',0,0,'Y',TO_DATE('2017-08-08 18:16:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:03','YYYY-MM-DD HH24:MI:SS'),100,'D','a9c99476-070e-4377-960d-19dbe7dff024') +; + +-- Aug 8, 2017 6:16:04 PM BRT +INSERT INTO AD_Table (AD_Table_ID,Name,Description,AD_Window_ID,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,IsChangeLog,ReplicationType,IsCentrallyMaintained,AD_Table_UU,Processing) VALUES (200226,'Workflow Activity Approver','Approvers of the Workflow Process Activity',298,'AD_WF_ActivityApprover',145,'7',0,0,'Y',TO_DATE('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','D','N','L','Y','e6e1ed38-4935-44cd-9740-b5c631062229','N') +; + +-- Aug 8, 2017 6:16:05 PM BRT +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('AD_WF_ActivityApprover',1000000,'N','N','Table AD_WF_ActivityApprover','Y','Y',0,0,TO_DATE('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,200291,'Y',1000000,1,200000,'c6b5803d-773c-465c-8541-18c5e659bf44') +; + +-- Aug 8, 2017 6:16:06 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203132,0,0,'Y',TO_DATE('2017-08-08 18:16:05','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:05','YYYY-MM-DD HH24:MI:SS'),100,'AD_WF_ActivityApprover_ID','Workflow Activity Approver','Workflow Activity Approver','D','559e0c04-8a72-42bf-a85f-37bb6cb2bbbd') +; + +-- Aug 8, 2017 6:16:07 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213223,1,'Workflow Activity Approver',200226,'AD_WF_ActivityApprover_ID',22,'Y','N','Y','N','N',0,'N',13,0,0,'Y',TO_DATE('2017-08-08 18:16:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:07','YYYY-MM-DD HH24:MI:SS'),100,203132,'N','N','D','Y','N','N','Y','fee3c48f-1c60-4298-aac8-8bf8f028b13d','N','N','N','N') +; + +-- Aug 8, 2017 6:16:08 PM BRT +CREATE TABLE AD_WF_ActivityApprover (AD_WF_ActivityApprover_ID NUMBER(10) NOT NULL, CONSTRAINT AD_WF_ActivityApprover_Key PRIMARY KEY (AD_WF_ActivityApprover_ID)) +; + +-- Aug 8, 2017 6:16:09 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213224,1,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200226,129,'AD_Client_ID','@#AD_Client_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_DATE('2017-08-08 18:16:08','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:08','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','D','Y','N','N','Y','78b69227-4782-40e4-ba68-2161894ec669','N','N','N','D') +; + +-- Aug 8, 2017 6:16:09 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD AD_Client_ID NUMBER(10) NOT NULL +; + +-- Aug 8, 2017 6:16:09 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213225,1,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200226,104,'AD_Org_ID','@#AD_Org_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_DATE('2017-08-08 18:16:09','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:09','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','Y','N','N','Y','3f24f5a5-6841-4774-867b-58500aff75c8','N','N','N','D') +; + +-- Aug 8, 2017 6:16:09 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD AD_Org_ID NUMBER(10) NOT NULL +; + +-- Aug 8, 2017 6:16:10 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213226,1,'Created','Date this record was created','The Created field indicates the date that this record was created.',200226,'Created','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_DATE('2017-08-08 18:16:10','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:10','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','Y','N','N','Y','d47875c9-fbd3-49f9-a593-103918b68a51','N','N','N','N') +; + +-- Aug 8, 2017 6:16:11 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD Created DATE DEFAULT SYSDATE NOT NULL +; + +-- Aug 8, 2017 6:16:11 PM BRT +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_Reference_Value_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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213227,1,'Created By','User who created this records','The Created By field indicates the user who created this record.',200226,'CreatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_DATE('2017-08-08 18:16:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:11','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','Y','N','N','Y','4c14993e-fa5c-4680-be68-816680dbbd92','N','N','N','D') +; + +-- Aug 8, 2017 6:16:11 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CreatedBy NUMBER(10) NOT NULL +; + +-- Aug 8, 2017 6:16:12 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203133,0,0,'Y',TO_DATE('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,'AD_WF_ActivityApprover_UU','AD_WF_ActivityApprover_UU','AD_WF_ActivityApprover_UU','D','3d203220-d98b-4e35-bfb3-981bb8a31aee') +; + +-- Aug 8, 2017 6:16:13 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213228,1.00,'AD_WF_ActivityApprover_UU',200226,'AD_WF_ActivityApprover_UU',36,'N','N','N','N','N','N',10,0,0,'Y',TO_DATE('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,203133,'Y','N','D','Y','N','N','Y','ad670aa0-2b6a-484e-9696-7c922e6c4d62','N','N','N','N') +; + +-- Aug 8, 2017 6:16:13 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD AD_WF_ActivityApprover_UU VARCHAR2(36) DEFAULT NULL +; + +-- Aug 8, 2017 6:16:13 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CONSTRAINT AD_WF_ActivityApprover_UU_idx UNIQUE (AD_WF_ActivityApprover_UU) +; + +-- Aug 8, 2017 6:16:14 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213229,1,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200226,'IsActive','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2017-08-08 18:16:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:13','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','Y','N','N','Y','44103c1a-bb91-43d2-9a84-f129f784fc06','N','N','N','N') +; + +-- Aug 8, 2017 6:16:14 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL +; + +-- Aug 8, 2017 6:16:15 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213230,1,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200226,'Updated','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_DATE('2017-08-08 18:16:14','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:14','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','Y','N','N','Y','c14b694f-2fd6-45cb-bf36-7c2911955e59','N','N','N','N') +; + +-- Aug 8, 2017 6:16:15 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD Updated DATE DEFAULT SYSDATE NOT NULL +; + +-- Aug 8, 2017 6:16:16 PM BRT +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_Reference_Value_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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213231,1,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200226,'UpdatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_DATE('2017-08-08 18:16:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:15','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','Y','N','N','Y','26992d33-c633-4372-80de-7b584316625e','N','N','N','D') +; + +-- Aug 8, 2017 6:16:16 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD UpdatedBy NUMBER(10) NOT NULL +; + +-- Aug 8, 2017 6:16:17 PM BRT +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,FKConstraintName,FKConstraintType) VALUES (213232,0,'Workflow Activity','Workflow Activity','The Workflow Activity is the actual Workflow Node in a Workflow Process instance',200226,'AD_WF_Activity_ID',22,'N','Y','Y','N','N',0,'N',19,0,0,'Y',TO_DATE('2017-08-08 18:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:16','YYYY-MM-DD HH24:MI:SS'),100,2307,'N','N','D','Y','N','N','Y','5382008f-687c-4828-86cb-16226e32432c','Y',0,'N','N','ADWFActivity_ADWFActivityAppro','C') +; + +-- Aug 8, 2017 6:16:17 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD AD_WF_Activity_ID NUMBER(10) NOT NULL +; + +-- Aug 8, 2017 6:16:18 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_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,FKConstraintName,FKConstraintType) VALUES (213233,0,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200226,164,'AD_User_ID',22,'N','N','Y','N','N',0,'N',30,0,0,'Y',TO_DATE('2017-08-08 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,138,'Y','N','D','Y','N','N','Y','02bffd80-4df3-46fc-a426-1bc5b8fca3a9','Y',0,'N','N','ADUser_ADWFActivityApprover','N') +; + +-- Aug 8, 2017 6:16:18 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD AD_User_ID NUMBER(10) NOT NULL +; + +-- Aug 8, 2017 6:16:19 PM BRT +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201058,'91502b94-7f41-4bc5-b7c7-08417ccf3ed1',TO_DATE('2017-08-08 18:16:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_WF_ActivityApprover01',TO_DATE('2017-08-08 18:16:18','YYYY-MM-DD HH24:MI:SS'),100,200226,'N','Y','N','N','N') +; + +-- Aug 8, 2017 6:16:19 PM BRT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201345,'27b2b5cb-3191-4fb0-8ea1-36b843084fee',TO_DATE('2017-08-08 18:16:19','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-08 18:16:19','YYYY-MM-DD HH24:MI:SS'),100,213232,201058,10) +; + +-- Aug 8, 2017 6:16:20 PM BRT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201346,'bb95cfc3-7eaf-4b60-98bf-8ae309ce55a2',TO_DATE('2017-08-08 18:16:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-08 18:16:20','YYYY-MM-DD HH24:MI:SS'),100,213233,201058,20) +; + +-- Aug 8, 2017 6:16:20 PM BRT +CREATE UNIQUE INDEX AD_WF_ActivityApprover01 ON AD_WF_ActivityApprover (AD_WF_Activity_ID,AD_User_ID) +; + +-- Aug 8, 2017 6:16:21 PM BRT +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200230,'Approver',298,20,'Y',200226,0,0,'Y',TO_DATE('2017-08-08 18:16:21','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:21','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','N','N',1,'N','D','Y','N','4c965421-0c87-4703-b433-243991bd1628','B') +; + +-- Aug 8, 2017 6:16:23 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205207,'AD_WF_ActivityApprover_UU',200230,213228,'N',36,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:22','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','04c2a8fc-dc5f-41e1-aa27-81a141d4c3f2','N',1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:24 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205208,'Workflow Activity Approver',200230,213223,'N',22,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:23','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:23','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f60eb7d8-0f3c-4ec7-bae6-51ae45e815fa','N',1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:25 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205209,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200230,213224,'Y',22,10,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:24','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','92ce5bb5-6a37-4091-b310-de5dcd9ce603','N',10,1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:26 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205210,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200230,213225,'Y',22,20,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:25','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','50c4e884-caf0-4138-8bb3-280046ac0dc6','Y','N',20,4,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:27 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205211,'Workflow Activity','Workflow Activity','The Workflow Activity is the actual Workflow Node in a Workflow Process instance',200230,213232,'Y',22,30,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:26','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:26','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','448533e5-3dde-4782-a77b-f0c95ede180f','Y',30,1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:27 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205212,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200230,213233,'Y',22,40,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:27','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:27','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','cc73baef-8a0e-4dcd-b544-2ee9f1c419f3','Y',40,4,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:28 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205213,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200230,213229,'Y',1,50,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-08 18:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-08 18:16:28','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','194ceea8-bf9f-419b-b96d-6b7f16197e9c','Y',50,2,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:29 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CONSTRAINT ADWFActivity_ADWFActivityAppro FOREIGN KEY (AD_WF_Activity_ID) REFERENCES ad_wf_activity(ad_wf_activity_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED +; + +-- Aug 8, 2017 6:16:29 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CONSTRAINT ADUser_ADWFActivityApprover FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Aug 8, 2017 6:39:27 PM BRT +UPDATE PA_DocumentStatus SET WhereClause='AD_WF_Activity.Processed=''N'' AND AD_WF_Activity.WFState=''OS'' AND ( +/* Owner of Activity */ +AD_WF_Activity.AD_User_ID=@#AD_User_ID@ +/* Invoker (if no invoker = all) */ +OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE AD_WF_Activity.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID +AND r.ResponsibleType=''H'' AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (AD_WF_Activity.AD_User_ID=@#AD_User_ID@ OR AD_WF_Activity.AD_User_ID IS NULL)) +/* Responsible User */ +OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE AD_WF_Activity.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID +AND r.ResponsibleType=''H'' AND r.AD_User_ID=@#AD_User_ID@) +/* Responsible Role */ +OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID) +WHERE AD_WF_Activity.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType=''R'' AND ur.AD_User_ID=@#AD_User_ID@ AND ur.isActive=''Y'') +/* Manual Responsible */ +OR EXISTS (SELECT * FROM AD_WF_ActivityApprover r WHERE AD_WF_Activity.AD_WF_Activity_ID=r.AD_WF_Activity_ID AND r.AD_User_ID=@#AD_User_ID@ AND r.isActive=''Y'') +) AND AD_WF_Activity.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2017-08-08 18:39:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE PA_DocumentStatus_ID=200004 +; + +-- Aug 10, 2017 10:42:59 AM BRT +UPDATE AD_Tab SET SeqNo=40, AD_Column_ID=NULL, AD_Process_ID=NULL, AD_Image_ID=NULL, AD_ColumnSortYesNo_ID=NULL, AD_ColumnSortOrder_ID=NULL, Included_Tab_ID=NULL, Parent_Column_ID=NULL, AD_CtxHelp_ID=NULL,Updated=TO_DATE('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=581 +; + +-- Aug 10, 2017 10:42:59 AM BRT +UPDATE AD_Tab SET SeqNo=50, AD_Process_ID=NULL, AD_Image_ID=NULL, AD_ColumnSortYesNo_ID=NULL, AD_ColumnSortOrder_ID=NULL, Included_Tab_ID=NULL, Parent_Column_ID=NULL, AD_CtxHelp_ID=NULL,Updated=TO_DATE('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=582 +; + +-- Aug 10, 2017 10:43:00 AM BRT +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,Processing,ImportFields,TabLevel,IsSortTab,EntityType,DisplayLogic,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200231,'Approver',297,30,'Y',200226,0,0,'Y',TO_DATE('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','Y','N','N',2,'N','D','1=1','N','N','805402e4-3226-4e52-9926-0217c1af2c4c','B') +; + +-- Aug 10, 2017 10:43:01 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205214,'AD_WF_ActivityApprover_UU',200231,213228,'N',36,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:00','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:00','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f37c320b-b7cb-46f3-a5f3-d66d4e26a8bd','N',1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:02 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205215,'Workflow Activity Approver',200231,213223,'N',22,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:01','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','eca0834e-a6b5-4d88-a80c-7c4115717154','N',1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:02 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205216,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200231,213224,'Y',22,10,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:02','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','7a92cab3-567a-4f67-b67e-48fcf561e8f5','Y',10,1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:03 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205217,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200231,213225,'Y',22,20,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','f34baace-c472-475e-999c-623ae4449608','Y','Y',20,4,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:04 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205218,'Workflow Activity','Workflow Activity','The Workflow Activity is the actual Workflow Node in a Workflow Process instance',200231,213232,'Y',22,30,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','0e4a2b1a-03f4-4af2-8cea-1497f31d1d0f','Y',30,1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:04 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205219,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200231,213233,'Y',22,40,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','16f0f237-049a-4ccd-a146-97f1909d986f','Y',40,4,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:05 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205220,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200231,213229,'Y',1,50,'N','N','N','N',0,0,'Y',TO_DATE('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b62672fe-d27a-4ba7-a048-b344d74d6404','Y',50,2,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:05 AM BRT +UPDATE AD_Tab SET SeqNo=60, AD_Column_ID=NULL, AD_Process_ID=NULL, AD_Image_ID=NULL, AD_ColumnSortYesNo_ID=NULL, AD_ColumnSortOrder_ID=NULL, Included_Tab_ID=NULL, Parent_Column_ID=NULL, AD_CtxHelp_ID=NULL,Updated=TO_DATE('2017-08-10 10:43:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=580 +; + +SELECT register_migration_script('201708081830_IDEMPIERE-3446.sql') FROM dual +; diff --git a/migration/i4.1/postgresql/201708081830_IDEMPIERE-3446.sql b/migration/i4.1/postgresql/201708081830_IDEMPIERE-3446.sql new file mode 100644 index 0000000000..f0f517f9b7 --- /dev/null +++ b/migration/i4.1/postgresql/201708081830_IDEMPIERE-3446.sql @@ -0,0 +1,242 @@ +-- IDEMPIERE-3446 Define the workflow approver dynamically +-- Aug 8, 2017 6:16:04 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,Description,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200376,'Manual','Manual List',304,'M',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:03','YYYY-MM-DD HH24:MI:SS'),100,'D','a9c99476-070e-4377-960d-19dbe7dff024') +; + +-- Aug 8, 2017 6:16:04 PM BRT +INSERT INTO AD_Table (AD_Table_ID,Name,Description,AD_Window_ID,TableName,LoadSeq,AccessLevel,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSecurityEnabled,IsDeleteable,IsHighVolume,IsView,EntityType,IsChangeLog,ReplicationType,IsCentrallyMaintained,AD_Table_UU,Processing) VALUES (200226,'Workflow Activity Approver','Approvers of the Workflow Process Activity',298,'AD_WF_ActivityApprover',145,'7',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','D','N','L','Y','e6e1ed38-4935-44cd-9740-b5c631062229','N') +; + +-- Aug 8, 2017 6:16:05 PM BRT +INSERT INTO AD_Sequence (Name,CurrentNext,IsAudited,StartNewYear,Description,IsActive,IsTableID,AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,AD_Sequence_ID,IsAutoSequence,StartNo,IncrementNo,CurrentNextSys,AD_Sequence_UU) VALUES ('AD_WF_ActivityApprover',1000000,'N','N','Table AD_WF_ActivityApprover','Y','Y',0,0,TO_TIMESTAMP('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:04','YYYY-MM-DD HH24:MI:SS'),100,200291,'Y',1000000,1,200000,'c6b5803d-773c-465c-8541-18c5e659bf44') +; + +-- Aug 8, 2017 6:16:06 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203132,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:05','YYYY-MM-DD HH24:MI:SS'),100,'AD_WF_ActivityApprover_ID','Workflow Activity Approver','Workflow Activity Approver','D','559e0c04-8a72-42bf-a85f-37bb6cb2bbbd') +; + +-- Aug 8, 2017 6:16:07 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213223,1,'Workflow Activity Approver',200226,'AD_WF_ActivityApprover_ID',22,'Y','N','Y','N','N',0,'N',13,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:07','YYYY-MM-DD HH24:MI:SS'),100,203132,'N','N','D','Y','N','N','Y','fee3c48f-1c60-4298-aac8-8bf8f028b13d','N','N','N','N') +; + +-- Aug 8, 2017 6:16:08 PM BRT +CREATE TABLE AD_WF_ActivityApprover (AD_WF_ActivityApprover_ID NUMERIC(10) NOT NULL, CONSTRAINT AD_WF_ActivityApprover_Key PRIMARY KEY (AD_WF_ActivityApprover_ID)) +; + +-- Aug 8, 2017 6:16:09 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213224,1,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200226,129,'AD_Client_ID','@#AD_Client_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:08','YYYY-MM-DD HH24:MI:SS'),100,102,'N','N','D','Y','N','N','Y','78b69227-4782-40e4-ba68-2161894ec669','N','N','N','D') +; + +-- Aug 8, 2017 6:16:09 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN AD_Client_ID NUMERIC(10) NOT NULL +; + +-- Aug 8, 2017 6:16:09 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213225,1,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200226,104,'AD_Org_ID','@#AD_Org_ID@',22,'N','N','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:09','YYYY-MM-DD HH24:MI:SS'),100,113,'N','N','D','Y','N','N','Y','3f24f5a5-6841-4774-867b-58500aff75c8','N','N','N','D') +; + +-- Aug 8, 2017 6:16:09 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN AD_Org_ID NUMERIC(10) NOT NULL +; + +-- Aug 8, 2017 6:16:10 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213226,1,'Created','Date this record was created','The Created field indicates the date that this record was created.',200226,'Created','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:10','YYYY-MM-DD HH24:MI:SS'),100,245,'N','N','D','Y','N','N','Y','d47875c9-fbd3-49f9-a593-103918b68a51','N','N','N','N') +; + +-- Aug 8, 2017 6:16:11 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL +; + +-- Aug 8, 2017 6:16:11 PM BRT +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_Reference_Value_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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213227,1,'Created By','User who created this records','The Created By field indicates the user who created this record.',200226,'CreatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:11','YYYY-MM-DD HH24:MI:SS'),100,246,'N','N','D','Y','N','N','Y','4c14993e-fa5c-4680-be68-816680dbbd92','N','N','N','D') +; + +-- Aug 8, 2017 6:16:11 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN CreatedBy NUMERIC(10) NOT NULL +; + +-- Aug 8, 2017 6:16:12 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203133,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,'AD_WF_ActivityApprover_UU','AD_WF_ActivityApprover_UU','AD_WF_ActivityApprover_UU','D','3d203220-d98b-4e35-bfb3-981bb8a31aee') +; + +-- Aug 8, 2017 6:16:13 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213228,1.00,'AD_WF_ActivityApprover_UU',200226,'AD_WF_ActivityApprover_UU',36,'N','N','N','N','N','N',10,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:12','YYYY-MM-DD HH24:MI:SS'),100,203133,'Y','N','D','Y','N','N','Y','ad670aa0-2b6a-484e-9696-7c922e6c4d62','N','N','N','N') +; + +-- Aug 8, 2017 6:16:13 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN AD_WF_ActivityApprover_UU VARCHAR(36) DEFAULT NULL +; + +-- Aug 8, 2017 6:16:13 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CONSTRAINT AD_WF_ActivityApprover_UU_idx UNIQUE (AD_WF_ActivityApprover_UU) +; + +-- Aug 8, 2017 6:16:14 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213229,1,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200226,'IsActive','Y',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:13','YYYY-MM-DD HH24:MI:SS'),100,348,'Y','N','D','Y','N','N','Y','44103c1a-bb91-43d2-9a84-f129f784fc06','N','N','N','N') +; + +-- Aug 8, 2017 6:16:14 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL +; + +-- Aug 8, 2017 6:16:15 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213230,1,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',200226,'Updated','SYSDATE',7,'N','N','Y','N','N',0,'N',16,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:14','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:14','YYYY-MM-DD HH24:MI:SS'),100,607,'N','N','D','Y','N','N','Y','c14b694f-2fd6-45cb-bf36-7c2911955e59','N','N','N','N') +; + +-- Aug 8, 2017 6:16:15 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN Updated TIMESTAMP DEFAULT statement_timestamp() NOT NULL +; + +-- Aug 8, 2017 6:16:16 PM BRT +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_Reference_Value_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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213231,1,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',200226,'UpdatedBy',22,'N','N','Y','N','N',0,'N',18,110,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:15','YYYY-MM-DD HH24:MI:SS'),100,608,'N','N','D','Y','N','N','Y','26992d33-c633-4372-80de-7b584316625e','N','N','N','D') +; + +-- Aug 8, 2017 6:16:16 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN UpdatedBy NUMERIC(10) NOT NULL +; + +-- Aug 8, 2017 6:16:17 PM BRT +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,FKConstraintName,FKConstraintType) VALUES (213232,0,'Workflow Activity','Workflow Activity','The Workflow Activity is the actual Workflow Node in a Workflow Process instance',200226,'AD_WF_Activity_ID',22,'N','Y','Y','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:16','YYYY-MM-DD HH24:MI:SS'),100,2307,'N','N','D','Y','N','N','Y','5382008f-687c-4828-86cb-16226e32432c','Y',0,'N','N','ADWFActivity_ADWFActivityAppro','C') +; + +-- Aug 8, 2017 6:16:17 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN AD_WF_Activity_ID NUMERIC(10) NOT NULL +; + +-- Aug 8, 2017 6:16:18 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,AD_Val_Rule_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,FKConstraintName,FKConstraintType) VALUES (213233,0,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200226,164,'AD_User_ID',22,'N','N','Y','N','N',0,'N',30,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:17','YYYY-MM-DD HH24:MI:SS'),100,138,'Y','N','D','Y','N','N','Y','02bffd80-4df3-46fc-a426-1bc5b8fca3a9','Y',0,'N','N','ADUser_ADWFActivityApprover','N') +; + +-- Aug 8, 2017 6:16:18 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD COLUMN AD_User_ID NUMERIC(10) NOT NULL +; + +-- Aug 8, 2017 6:16:19 PM BRT +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201058,'91502b94-7f41-4bc5-b7c7-08417ccf3ed1',TO_TIMESTAMP('2017-08-08 18:16:18','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','AD_WF_ActivityApprover01',TO_TIMESTAMP('2017-08-08 18:16:18','YYYY-MM-DD HH24:MI:SS'),100,200226,'N','Y','N','N','N') +; + +-- Aug 8, 2017 6:16:19 PM BRT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201345,'27b2b5cb-3191-4fb0-8ea1-36b843084fee',TO_TIMESTAMP('2017-08-08 18:16:19','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-08 18:16:19','YYYY-MM-DD HH24:MI:SS'),100,213232,201058,10) +; + +-- Aug 8, 2017 6:16:20 PM BRT +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201346,'bb95cfc3-7eaf-4b60-98bf-8ae309ce55a2',TO_TIMESTAMP('2017-08-08 18:16:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-08 18:16:20','YYYY-MM-DD HH24:MI:SS'),100,213233,201058,20) +; + +-- Aug 8, 2017 6:16:20 PM BRT +CREATE UNIQUE INDEX AD_WF_ActivityApprover01 ON AD_WF_ActivityApprover (AD_WF_Activity_ID,AD_User_ID) +; + +-- Aug 8, 2017 6:16:21 PM BRT +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,Processing,ImportFields,TabLevel,IsSortTab,EntityType,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200230,'Approver',298,20,'Y',200226,0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:21','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','N','N','N',1,'N','D','Y','N','4c965421-0c87-4703-b433-243991bd1628','B') +; + +-- Aug 8, 2017 6:16:23 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205207,'AD_WF_ActivityApprover_UU',200230,213228,'N',36,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:22','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','04c2a8fc-dc5f-41e1-aa27-81a141d4c3f2','N',1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:24 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205208,'Workflow Activity Approver',200230,213223,'N',22,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:23','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f60eb7d8-0f3c-4ec7-bae6-51ae45e815fa','N',1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:25 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205209,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200230,213224,'Y',22,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:24','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','92ce5bb5-6a37-4091-b310-de5dcd9ce603','N',10,1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:26 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205210,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200230,213225,'Y',22,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:25','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','50c4e884-caf0-4138-8bb3-280046ac0dc6','Y','N',20,4,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:27 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205211,'Workflow Activity','Workflow Activity','The Workflow Activity is the actual Workflow Node in a Workflow Process instance',200230,213232,'Y',22,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:26','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','448533e5-3dde-4782-a77b-f0c95ede180f','Y',30,1,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:27 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205212,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200230,213233,'Y',22,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:27','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','cc73baef-8a0e-4dcd-b544-2ee9f1c419f3','Y',40,4,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:28 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205213,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200230,213229,'Y',1,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-08 18:16:28','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-08 18:16:28','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','194ceea8-bf9f-419b-b96d-6b7f16197e9c','Y',50,2,2,1,'N','N','N') +; + +-- Aug 8, 2017 6:16:29 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CONSTRAINT ADWFActivity_ADWFActivityAppro FOREIGN KEY (AD_WF_Activity_ID) REFERENCES ad_wf_activity(ad_wf_activity_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED +; + +-- Aug 8, 2017 6:16:29 PM BRT +ALTER TABLE AD_WF_ActivityApprover ADD CONSTRAINT ADUser_ADWFActivityApprover FOREIGN KEY (AD_User_ID) REFERENCES ad_user(ad_user_id) DEFERRABLE INITIALLY DEFERRED +; + +-- Aug 8, 2017 6:39:27 PM BRT +UPDATE PA_DocumentStatus SET WhereClause='AD_WF_Activity.Processed=''N'' AND AD_WF_Activity.WFState=''OS'' AND ( +/* Owner of Activity */ +AD_WF_Activity.AD_User_ID=@#AD_User_ID@ +/* Invoker (if no invoker = all) */ +OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE AD_WF_Activity.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID +AND r.ResponsibleType=''H'' AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (AD_WF_Activity.AD_User_ID=@#AD_User_ID@ OR AD_WF_Activity.AD_User_ID IS NULL)) +/* Responsible User */ +OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE AD_WF_Activity.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID +AND r.ResponsibleType=''H'' AND r.AD_User_ID=@#AD_User_ID@) +/* Responsible Role */ +OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID) +WHERE AD_WF_Activity.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType=''R'' AND ur.AD_User_ID=@#AD_User_ID@ AND ur.isActive=''Y'') +/* Manual Responsible */ +OR EXISTS (SELECT * FROM AD_WF_ActivityApprover r WHERE AD_WF_Activity.AD_WF_Activity_ID=r.AD_WF_Activity_ID AND r.AD_User_ID=@#AD_User_ID@ AND r.isActive=''Y'') +) AND AD_WF_Activity.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2017-08-08 18:39:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE PA_DocumentStatus_ID=200004 +; + +-- Aug 10, 2017 10:42:59 AM BRT +UPDATE AD_Tab SET SeqNo=40, AD_Column_ID=NULL, AD_Process_ID=NULL, AD_Image_ID=NULL, AD_ColumnSortYesNo_ID=NULL, AD_ColumnSortOrder_ID=NULL, Included_Tab_ID=NULL, Parent_Column_ID=NULL, AD_CtxHelp_ID=NULL,Updated=TO_TIMESTAMP('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=581 +; + +-- Aug 10, 2017 10:42:59 AM BRT +UPDATE AD_Tab SET SeqNo=50, AD_Process_ID=NULL, AD_Image_ID=NULL, AD_ColumnSortYesNo_ID=NULL, AD_ColumnSortOrder_ID=NULL, Included_Tab_ID=NULL, Parent_Column_ID=NULL, AD_CtxHelp_ID=NULL,Updated=TO_TIMESTAMP('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=582 +; + +-- Aug 10, 2017 10:43:00 AM BRT +INSERT INTO AD_Tab (AD_Tab_ID,Name,AD_Window_ID,SeqNo,IsSingleRow,AD_Table_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,HasTree,IsInfoTab,IsTranslationTab,IsReadOnly,Processing,ImportFields,TabLevel,IsSortTab,EntityType,DisplayLogic,IsInsertRecord,IsAdvancedTab,AD_Tab_UU,TreeDisplayedOn) VALUES (200231,'Approver',297,30,'Y',200226,0,0,'Y',TO_TIMESTAMP('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:42:59','YYYY-MM-DD HH24:MI:SS'),100,'N','N','N','Y','N','N',2,'N','D','1=1','N','N','805402e4-3226-4e52-9926-0217c1af2c4c','B') +; + +-- Aug 10, 2017 10:43:01 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205214,'AD_WF_ActivityApprover_UU',200231,213228,'N',36,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:00','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:00','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','f37c320b-b7cb-46f3-a5f3-d66d4e26a8bd','N',1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:02 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205215,'Workflow Activity Approver',200231,213223,'N',22,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:01','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','eca0834e-a6b5-4d88-a80c-7c4115717154','N',1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:03 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205216,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',200231,213224,'Y',22,10,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:02','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','7a92cab3-567a-4f67-b67e-48fcf561e8f5','Y',10,1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:03 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsAllowCopy,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205217,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',200231,213225,'Y',22,20,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,'Y','Y','D','f34baace-c472-475e-999c-623ae4449608','Y','Y',20,4,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:04 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205218,'Workflow Activity','Workflow Activity','The Workflow Activity is the actual Workflow Node in a Workflow Process instance',200231,213232,'Y',22,30,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:03','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','0e4a2b1a-03f4-4af2-8cea-1497f31d1d0f','Y',30,1,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:04 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205219,'User/Contact','User within the system - Internal or Business Partner Contact','The User identifies a unique user in the system. This could be an internal user or a business partner contact',200231,213233,'Y',22,40,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','16f0f237-049a-4ccd-a146-97f1909d986f','Y',40,4,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:05 AM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,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 (205220,'Active','The record is active in the system','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.',200231,213229,'Y',1,50,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-08-10 10:43:04','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','b62672fe-d27a-4ba7-a048-b344d74d6404','Y',50,2,2,1,'N','N','N') +; + +-- Aug 10, 2017 10:43:05 AM BRT +UPDATE AD_Tab SET SeqNo=60, AD_Column_ID=NULL, AD_Process_ID=NULL, AD_Image_ID=NULL, AD_ColumnSortYesNo_ID=NULL, AD_ColumnSortOrder_ID=NULL, Included_Tab_ID=NULL, Parent_Column_ID=NULL, AD_CtxHelp_ID=NULL,Updated=TO_TIMESTAMP('2017-08-10 10:43:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=580 +; + +SELECT register_migration_script('201708081830_IDEMPIERE-3446.sql') FROM dual +; From 99839476c32f7e8e783aef245c0a88d3083ebb13 Mon Sep 17 00:00:00 2001 From: Guilherme Chaddad Date: Thu, 10 Aug 2017 17:15:39 -0300 Subject: [PATCH 06/33] IDEMPIERE-3446 Define the workflow approver dynamically - java --- .../model/I_AD_WF_ActivityApprover.java | 157 +++++++++++++++++ .../compiere/model/MWFActivityApprover.java | 28 +++ .../model/X_AD_WF_ActivityApprover.java | 163 ++++++++++++++++++ .../compiere/model/X_AD_WF_Responsible.java | 6 +- .../src/org/compiere/wf/MWFActivity.java | 12 ++ .../src/org/compiere/wf/MWFResponsible.java | 19 +- .../adempiere/webui/apps/wf/WWFActivity.java | 15 +- 7 files changed, 387 insertions(+), 13 deletions(-) create mode 100644 org.adempiere.base/src/org/compiere/model/I_AD_WF_ActivityApprover.java create mode 100644 org.adempiere.base/src/org/compiere/model/MWFActivityApprover.java create mode 100644 org.adempiere.base/src/org/compiere/model/X_AD_WF_ActivityApprover.java diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_WF_ActivityApprover.java b/org.adempiere.base/src/org/compiere/model/I_AD_WF_ActivityApprover.java new file mode 100644 index 0000000000..b33617abf4 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/I_AD_WF_ActivityApprover.java @@ -0,0 +1,157 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * This program is free software, you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program, if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_WF_ActivityApprover + * @author iDempiere (generated) + * @version Release 4.1 + */ +public interface I_AD_WF_ActivityApprover +{ + + /** TableName=AD_WF_ActivityApprover */ + public static final String Table_Name = "AD_WF_ActivityApprover"; + + /** AD_Table_ID=200226 */ + public static final int Table_ID = 200226; + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 7 - System - Client - Org + */ + BigDecimal accessLevel = BigDecimal.valueOf(7); + + /** Load Meta Data */ + + /** Column name AD_Client_ID */ + public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; + + /** Get Client. + * Client/Tenant for this installation. + */ + public int getAD_Client_ID(); + + /** Column name AD_Org_ID */ + public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; + + /** Set Organization. + * Organizational entity within client + */ + public void setAD_Org_ID (int AD_Org_ID); + + /** Get Organization. + * Organizational entity within client + */ + public int getAD_Org_ID(); + + /** Column name AD_User_ID */ + public static final String COLUMNNAME_AD_User_ID = "AD_User_ID"; + + /** Set User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID); + + /** Get User/Contact. + * User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID(); + + public org.compiere.model.I_AD_User getAD_User() throws RuntimeException; + + /** Column name AD_WF_ActivityApprover_ID */ + public static final String COLUMNNAME_AD_WF_ActivityApprover_ID = "AD_WF_ActivityApprover_ID"; + + /** Set Workflow Activity Approver */ + public void setAD_WF_ActivityApprover_ID (int AD_WF_ActivityApprover_ID); + + /** Get Workflow Activity Approver */ + public int getAD_WF_ActivityApprover_ID(); + + /** Column name AD_WF_ActivityApprover_UU */ + public static final String COLUMNNAME_AD_WF_ActivityApprover_UU = "AD_WF_ActivityApprover_UU"; + + /** Set AD_WF_ActivityApprover_UU */ + public void setAD_WF_ActivityApprover_UU (String AD_WF_ActivityApprover_UU); + + /** Get AD_WF_ActivityApprover_UU */ + public String getAD_WF_ActivityApprover_UU(); + + /** Column name AD_WF_Activity_ID */ + public static final String COLUMNNAME_AD_WF_Activity_ID = "AD_WF_Activity_ID"; + + /** Set Workflow Activity. + * Workflow Activity + */ + public void setAD_WF_Activity_ID (int AD_WF_Activity_ID); + + /** Get Workflow Activity. + * Workflow Activity + */ + public int getAD_WF_Activity_ID(); + + public org.compiere.model.I_AD_WF_Activity getAD_WF_Activity() throws RuntimeException; + + /** Column name Created */ + public static final String COLUMNNAME_Created = "Created"; + + /** Get Created. + * Date this record was created + */ + public Timestamp getCreated(); + + /** Column name CreatedBy */ + public static final String COLUMNNAME_CreatedBy = "CreatedBy"; + + /** Get Created By. + * User who created this records + */ + public int getCreatedBy(); + + /** Column name IsActive */ + public static final String COLUMNNAME_IsActive = "IsActive"; + + /** Set Active. + * The record is active in the system + */ + public void setIsActive (boolean IsActive); + + /** Get Active. + * The record is active in the system + */ + public boolean isActive(); + + /** Column name Updated */ + public static final String COLUMNNAME_Updated = "Updated"; + + /** Get Updated. + * Date this record was updated + */ + public Timestamp getUpdated(); + + /** Column name UpdatedBy */ + public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; + + /** Get Updated By. + * User who updated this records + */ + public int getUpdatedBy(); +} diff --git a/org.adempiere.base/src/org/compiere/model/MWFActivityApprover.java b/org.adempiere.base/src/org/compiere/model/MWFActivityApprover.java new file mode 100644 index 0000000000..233ce8e764 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/MWFActivityApprover.java @@ -0,0 +1,28 @@ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.List; +import java.util.Properties; + +public class MWFActivityApprover extends X_AD_WF_ActivityApprover { + + private static final long serialVersionUID = -7135169624317070006L; + + public MWFActivityApprover(Properties ctx, int AD_WF_ActivityApprover_ID, String trxName) { + super(ctx, AD_WF_ActivityApprover_ID, trxName); + } + + public MWFActivityApprover(Properties ctx, ResultSet rs, String trxName) { + super(ctx, rs, trxName); + } + + public static MWFActivityApprover[] getOfActivity(Properties ctx, int ad_WF_Activity_ID, String trxName) { + final String whereClause = I_AD_WF_ActivityApprover.COLUMNNAME_AD_WF_Activity_ID+"=?"; + List list = new Query(ctx,I_AD_WF_ActivityApprover.Table_Name,whereClause,trxName) + .setParameters(ad_WF_Activity_ID) + .list(); + MWFActivityApprover[] retValue = new MWFActivityApprover[list.size ()]; + list.toArray (retValue); + return retValue; + } +} diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_WF_ActivityApprover.java b/org.adempiere.base/src/org/compiere/model/X_AD_WF_ActivityApprover.java new file mode 100644 index 0000000000..664eb1b083 --- /dev/null +++ b/org.adempiere.base/src/org/compiere/model/X_AD_WF_ActivityApprover.java @@ -0,0 +1,163 @@ +/****************************************************************************** + * Product: iDempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. * + * This program is free software, you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program, if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** Generated Model for AD_WF_ActivityApprover + * @author iDempiere (generated) + * @version Release 4.1 - $Id$ */ +public class X_AD_WF_ActivityApprover extends PO implements I_AD_WF_ActivityApprover, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 20170809L; + + /** Standard Constructor */ + public X_AD_WF_ActivityApprover (Properties ctx, int AD_WF_ActivityApprover_ID, String trxName) + { + super (ctx, AD_WF_ActivityApprover_ID, trxName); + /** if (AD_WF_ActivityApprover_ID == 0) + { + setAD_User_ID (0); + setAD_WF_ActivityApprover_ID (0); + setAD_WF_Activity_ID (0); + } */ + } + + /** Load Constructor */ + public X_AD_WF_ActivityApprover (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 7 - System - Client - Org + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_AD_WF_ActivityApprover[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + public org.compiere.model.I_AD_User getAD_User() throws RuntimeException + { + return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name) + .getPO(getAD_User_ID(), get_TrxName()); } + + /** Set User/Contact. + @param AD_User_ID + User within the system - Internal or Business Partner Contact + */ + public void setAD_User_ID (int AD_User_ID) + { + if (AD_User_ID < 1) + set_Value (COLUMNNAME_AD_User_ID, null); + else + set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID)); + } + + /** Get User/Contact. + @return User within the system - Internal or Business Partner Contact + */ + public int getAD_User_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Workflow Activity Approver. + @param AD_WF_ActivityApprover_ID Workflow Activity Approver */ + public void setAD_WF_ActivityApprover_ID (int AD_WF_ActivityApprover_ID) + { + if (AD_WF_ActivityApprover_ID < 1) + set_ValueNoCheck (COLUMNNAME_AD_WF_ActivityApprover_ID, null); + else + set_ValueNoCheck (COLUMNNAME_AD_WF_ActivityApprover_ID, Integer.valueOf(AD_WF_ActivityApprover_ID)); + } + + /** Get Workflow Activity Approver. + @return Workflow Activity Approver */ + public int getAD_WF_ActivityApprover_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_WF_ActivityApprover_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set AD_WF_ActivityApprover_UU. + @param AD_WF_ActivityApprover_UU AD_WF_ActivityApprover_UU */ + public void setAD_WF_ActivityApprover_UU (String AD_WF_ActivityApprover_UU) + { + set_Value (COLUMNNAME_AD_WF_ActivityApprover_UU, AD_WF_ActivityApprover_UU); + } + + /** Get AD_WF_ActivityApprover_UU. + @return AD_WF_ActivityApprover_UU */ + public String getAD_WF_ActivityApprover_UU () + { + return (String)get_Value(COLUMNNAME_AD_WF_ActivityApprover_UU); + } + + public org.compiere.model.I_AD_WF_Activity getAD_WF_Activity() throws RuntimeException + { + return (org.compiere.model.I_AD_WF_Activity)MTable.get(getCtx(), org.compiere.model.I_AD_WF_Activity.Table_Name) + .getPO(getAD_WF_Activity_ID(), get_TrxName()); } + + /** Set Workflow Activity. + @param AD_WF_Activity_ID + Workflow Activity + */ + public void setAD_WF_Activity_ID (int AD_WF_Activity_ID) + { + if (AD_WF_Activity_ID < 1) + set_ValueNoCheck (COLUMNNAME_AD_WF_Activity_ID, null); + else + set_ValueNoCheck (COLUMNNAME_AD_WF_Activity_ID, Integer.valueOf(AD_WF_Activity_ID)); + } + + /** Get Workflow Activity. + @return Workflow Activity + */ + public int getAD_WF_Activity_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_WF_Activity_ID); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_WF_Responsible.java b/org.adempiere.base/src/org/compiere/model/X_AD_WF_Responsible.java index d9a0f669a6..cdc3be4007 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_WF_Responsible.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_WF_Responsible.java @@ -30,7 +30,7 @@ public class X_AD_WF_Responsible extends PO implements I_AD_WF_Responsible, I_Pe /** * */ - private static final long serialVersionUID = 20161030L; + private static final long serialVersionUID = 20170809L; /** Standard Constructor */ public X_AD_WF_Responsible (Properties ctx, int AD_WF_Responsible_ID, String trxName) @@ -41,7 +41,7 @@ public class X_AD_WF_Responsible extends PO implements I_AD_WF_Responsible, I_Pe setAD_Role_ID (0); setAD_WF_Responsible_ID (0); setEntityType (null); -// U +// @SQL=select get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) from dual setName (null); setResponsibleType (null); } */ @@ -240,6 +240,8 @@ public class X_AD_WF_Responsible extends PO implements I_AD_WF_Responsible, I_Pe public static final String RESPONSIBLETYPE_Role = "R"; /** System Resource = S */ public static final String RESPONSIBLETYPE_SystemResource = "S"; + /** Manual = M */ + public static final String RESPONSIBLETYPE_Manual = "M"; /** Set Responsible Type. @param ResponsibleType Type of the Responsibility for a workflow diff --git a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java index 206566f2e4..f743b0e8a3 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java @@ -49,6 +49,7 @@ import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.MUser; import org.compiere.model.MUserRoles; +import org.compiere.model.MWFActivityApprover; import org.compiere.model.PO; import org.compiere.model.Query; import static org.compiere.model.SystemIDs.*; @@ -1218,6 +1219,17 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable } } } + else if(resp.isManual()) { + MWFActivityApprover[] approvers = MWFActivityApprover.getOfActivity(getCtx(), getAD_WF_Activity_ID(), get_TrxName()); + for (int i = 0; i < approvers.length; i++) + { + if(approvers[i].getAD_User_ID() == Env.getAD_User_ID(getCtx())) + { + autoApproval = true; + break; + } + } + } else if(resp.isOrganization()) { throw new AdempiereException("Support not implemented for "+resp); diff --git a/org.adempiere.base/src/org/compiere/wf/MWFResponsible.java b/org.adempiere.base/src/org/compiere/wf/MWFResponsible.java index ae042c6099..aeae1dccd2 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFResponsible.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFResponsible.java @@ -34,12 +34,11 @@ import org.compiere.util.Msg; public class MWFResponsible extends X_AD_WF_Responsible { /** - * - */ - private static final long serialVersionUID = 8662580480797818563L; + * long - serialVersionUID. + */ + private static final long serialVersionUID = 4167967243996935999L; - - /** + /** * Get WF Responsible from Cache * @param ctx context * @param AD_WF_Responsible_ID id @@ -89,7 +88,7 @@ public class MWFResponsible extends X_AD_WF_Responsible */ public boolean isInvoker() { - return getAD_User_ID() == 0 && getAD_Role_ID() == 0; + return getAD_User_ID() == 0 && getAD_Role_ID() == 0 && !isManual(); } // isInvoker /** @@ -157,6 +156,10 @@ public class MWFResponsible extends X_AD_WF_Responsible if (!RESPONSIBLETYPE_Role.equals(getResponsibleType()) && getAD_Role_ID() > 0) setAD_Role_ID(0); + if (RESPONSIBLETYPE_Manual.equals(getResponsibleType())) { + setAD_User_ID(0); + setAD_Role_ID(0); + } return true; } // beforeSave @@ -178,4 +181,8 @@ public class MWFResponsible extends X_AD_WF_Responsible return sb.toString (); } // toString + public boolean isManual() { + return RESPONSIBLETYPE_Manual.equals(getResponsibleType()); + } + } // MWFResponsible diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java index 0c53f7f96b..c34a1568de 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java @@ -329,7 +329,8 @@ public class WWFActivity extends ADForm implements EventListener pstmt.setInt (2, AD_User_ID); pstmt.setInt (3, AD_User_ID); pstmt.setInt (4, AD_User_ID); - pstmt.setInt (5, AD_Client_ID); + pstmt.setInt (5, AD_User_ID); + pstmt.setInt (6, AD_Client_ID); rs = pstmt.executeQuery (); if (rs.next ()) { count = rs.getInt(1); @@ -378,8 +379,10 @@ public class WWFActivity extends ADForm implements EventListener pstmt.setInt (2, AD_User_ID); pstmt.setInt (3, AD_User_ID); pstmt.setInt (4, AD_User_ID); - pstmt.setInt (5, AD_Client_ID); - rs = pstmt.executeQuery (); + pstmt.setInt (5, AD_User_ID); + pstmt.setInt (6, AD_Client_ID); + + rs = pstmt.executeQuery(); while (rs.next ()) { MWFActivity activity = new MWFActivity(Env.getCtx(), rs, null); @@ -449,8 +452,10 @@ public class WWFActivity extends ADForm implements EventListener + " AND r.ResponsibleType='H' AND r.AD_User_ID=?)" // #3 // Responsible Role + " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)" - + " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType='R' AND ur.AD_User_ID=?)" // #4 - // + + " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType='R' AND ur.AD_User_ID=? AND ur.isActive = 'Y')" // #4 + ///* Manual Responsible */ + + " OR EXISTS (SELECT * FROM AD_WF_ActivityApprover r " + + " WHERE a.AD_WF_Activity_ID=r.AD_WF_Activity_ID AND r.AD_User_ID=? AND r.isActive = 'Y')" + ") AND a.AD_Client_ID=?"; // #5 return where; } From 045595b2cb0037c02cca0204f6ec9b15acd3d7a8 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sun, 13 Aug 2017 22:37:14 +0800 Subject: [PATCH 07/33] IDEMPIERE-3352 Enhancement of Batch Level Costing. Fix a storage update bug. --- org.adempiere.base/src/org/compiere/model/MInventory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index 77f01c2526..2d360d8155 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -710,7 +710,6 @@ public class MInventory extends X_M_Inventory implements DocAction MInventoryLineMA lineMA = new MInventoryLineMA(line, storage.getM_AttributeSetInstance_ID(), maQty.negate(), storage.getDateMaterialPolicy(),true); lineMA.saveEx(); qtyDiff = qtyDiff.subtract(maQty); - storage.addQtyOnHand(maQty.negate()); if (qtyDiff.compareTo(Env.ZERO)==0) break; From 704667fff730c5c71b500e9da912bee6b07de667 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 17 Aug 2017 18:44:24 +0800 Subject: [PATCH 08/33] IDEMPIERE-3424 table m_movement / constraint cbpartnerlocation_mmovement incorrect --- .../i4.1/oracle/201707202213_IDEMPIERE-3424.sql | 17 +++++++++++++++++ .../postgresql/201707202213_IDEMPIERE-3424.sql | 14 ++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql create mode 100755 migration/i4.1/postgresql/201707202213_IDEMPIERE-3424.sql diff --git a/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql b/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql new file mode 100755 index 0000000000..e41e6c0fbb --- /dev/null +++ b/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql @@ -0,0 +1,17 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3424 table m_movement / constraint cbpartnerlocation_mmovement incorrect +-- Jul 20, 2017 20:13:32 PM CEST +ALTER TABLE m_movement DROP CONSTRAINT cbpartnerlocation_mmovement +; + +ALTER TABLE m_movement ADD CONSTRAINT cbpartnerlocation_mmovement FOREIGN KEY (c_bpartner_location_id) + REFERENCES c_bpartner_location (c_bpartner_location_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED +; + + +SELECT register_migration_script('201707202213_IDEMPIERE-3424.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201707202213_IDEMPIERE-3424.sql b/migration/i4.1/postgresql/201707202213_IDEMPIERE-3424.sql new file mode 100755 index 0000000000..e6d227484b --- /dev/null +++ b/migration/i4.1/postgresql/201707202213_IDEMPIERE-3424.sql @@ -0,0 +1,14 @@ +-- IDEMPIERE-3424 table m_movement / constraint cbpartnerlocation_mmovement incorrect +-- Jul 20, 2017 20:13:32 PM CEST +ALTER TABLE m_movement DROP CONSTRAINT cbpartnerlocation_mmovement +; + +ALTER TABLE m_movement ADD CONSTRAINT cbpartnerlocation_mmovement FOREIGN KEY (c_bpartner_location_id) + REFERENCES c_bpartner_location (c_bpartner_location_id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED +; + + +SELECT register_migration_script('201707202213_IDEMPIERE-3424.sql') FROM dual +; + From 73abb0fd8763aaef3699d1e279e9627d03ac1c4e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 23 Aug 2017 20:03:39 +0200 Subject: [PATCH 09/33] IDEMPIERE-3424 table m_movement / constraint cbpartnerlocation_mmovement incorrect / fix oracle migration script --- migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql b/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql index e41e6c0fbb..38d5a2714f 100755 --- a/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql +++ b/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql @@ -6,9 +6,7 @@ SET DEFINE OFF ALTER TABLE m_movement DROP CONSTRAINT cbpartnerlocation_mmovement ; -ALTER TABLE m_movement ADD CONSTRAINT cbpartnerlocation_mmovement FOREIGN KEY (c_bpartner_location_id) - REFERENCES c_bpartner_location (c_bpartner_location_id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED +ALTER TABLE M_Movement ADD CONSTRAINT cbpartnerlocation_mmovement FOREIGN KEY (C_BPartner_Location_ID) REFERENCES c_bpartner_location(c_bpartner_location_id) DEFERRABLE INITIALLY DEFERRED ; From b97d1d670a25968e2966f8305ae7ff82af740595 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sun, 13 Aug 2017 23:13:38 +0700 Subject: [PATCH 10/33] IDEMPIERE-3455:NPE when pack-in to system don't have pack-out language --- .../org/adempiere/pipo2/handler/CommonTranslationHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java index f347c29475..d8f234019a 100644 --- a/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java +++ b/org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/CommonTranslationHandler.java @@ -55,7 +55,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements String language = getStringValue(element, "AD_Language"); MLanguage lang = MLanguage.get(ctx.ctx, language); // skip if not system installed language - if (! lang.isSystemLanguage()) + if (lang == null || ! lang.isSystemLanguage()) return; if (log.isLoggable(Level.INFO)) log.info(elementValue+" "+getStringValue(element, "Name")); From fb3977af882056158692606363d0fca7b028ef54 Mon Sep 17 00:00:00 2001 From: hieplq Date: Thu, 1 Jun 2017 19:15:38 +0700 Subject: [PATCH 11/33] IDEMPIERE-3378:AD_Package_Exp_Detail should use EntityType column to refer AD_EntityType --- .../src/org/adempiere/impexp/GridTabCSVExporter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index 86aed3782e..f4c898aebd 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java @@ -38,6 +38,7 @@ import org.compiere.model.GridTab; import org.compiere.model.GridTable; import org.compiere.model.GridWindow; import org.compiere.model.GridWindowVO; +import org.compiere.model.I_AD_EntityType; import org.compiere.model.MColumn; import org.compiere.model.MLocation; import org.compiere.model.MQuery; @@ -479,7 +480,9 @@ public class GridTabCSVExporter implements IGridTabExporter if (DisplayType.isLookup(column.getAD_Reference_ID())) { // resolve to identifier - search for value first, if not search for name - if not use the ID String foreignTable = column.getReferenceTableName(); - if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable) || "AD_Ref_List".equals(foreignTable))) { + if ("AD_EntityType".equals(foreignTable) && I_AD_EntityType.COLUMNNAME_AD_EntityType_ID.equals(column.getColumnName())){ + name.append("[EntityType]"); // ColumnName is unique value IDEMPIERE-3375 + }else if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable) || "AD_Ref_List".equals(foreignTable))) { MTable fTable = MTable.get(Env.getCtx(), foreignTable); // Hardcoded / do not check for Value on AD_Org, AD_User and AD_Ref_List, must use name for these two tables if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable)) && fTable.getColumn("Value") != null) { From dfe87def6a6662352e95da4b5cd5513b8d1a1554 Mon Sep 17 00:00:00 2001 From: hieplq Date: Thu, 25 May 2017 15:58:49 +0700 Subject: [PATCH 12/33] IDEMPIERE-3375:import/export csv should use AD_Element.ColumnName to lookup --- .../src/org/adempiere/impexp/GridTabCSVExporter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index f4c898aebd..b074057fd1 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java @@ -485,7 +485,9 @@ public class GridTabCSVExporter implements IGridTabExporter }else if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable) || "AD_Ref_List".equals(foreignTable))) { MTable fTable = MTable.get(Env.getCtx(), foreignTable); // Hardcoded / do not check for Value on AD_Org, AD_User and AD_Ref_List, must use name for these two tables - if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable)) && fTable.getColumn("Value") != null) { + if ("AD_Element".equals(foreignTable)){ + name.append("[ColumnName]"); // ColumnName is unique value IDEMPIERE-3375 + }else if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable)) && fTable.getColumn("Value") != null) { name.append("[Value]"); // fully qualified } else if (fTable.getColumn("Name") != null) { name.append("[Name]"); From 7558c711761ca048fd57bab362647739a8d7c7ff Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 25 Aug 2017 12:37:40 +0200 Subject: [PATCH 13/33] IDEMPIERE-3453 Fix Fact_Acct - fact_acct_trunc_dateacct index / based on Nicolas Micoud patch --- db/ddlutils/postgresql/functions/trunc.sql | 7 ++++ .../oracle/201708251228_IDEMPIERE-3453.sql | 31 ++++++++++++++++ .../201708251228_IDEMPIERE-3453.sql | 36 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 migration/i4.1/oracle/201708251228_IDEMPIERE-3453.sql create mode 100644 migration/i4.1/postgresql/201708251228_IDEMPIERE-3453.sql diff --git a/db/ddlutils/postgresql/functions/trunc.sql b/db/ddlutils/postgresql/functions/trunc.sql index 8134292d54..891e8d0319 100644 --- a/db/ddlutils/postgresql/functions/trunc.sql +++ b/db/ddlutils/postgresql/functions/trunc.sql @@ -26,6 +26,13 @@ BEGIN END; $$ LANGUAGE plpgsql IMMUTABLE; +CREATE OR REPLACE FUNCTION trunc(datetime TIMESTAMP WITHOUT TIME ZONE) +RETURNS TIMESTAMP WITHOUT TIME ZONE AS $$ +BEGIN + RETURN CAST(datetime AS DATE); +END; +$$ LANGUAGE plpgsql IMMUTABLE; + CREATE OR REPLACE FUNCTION trunc(datetime TIMESTAMP WITH TIME ZONE, format varchar) RETURNS DATE AS $$ BEGIN diff --git a/migration/i4.1/oracle/201708251228_IDEMPIERE-3453.sql b/migration/i4.1/oracle/201708251228_IDEMPIERE-3453.sql new file mode 100644 index 0000000000..46c5943d88 --- /dev/null +++ b/migration/i4.1/oracle/201708251228_IDEMPIERE-3453.sql @@ -0,0 +1,31 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3453 +-- Aug 25, 2017 12:23:30 PM CEST +UPDATE AD_IndexColumn SET ColumnSQL='TRUNC(DateAcct)',Updated=TO_DATE('2017-08-25 12:23:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_IndexColumn_ID=200741 +; + +-- Aug 25, 2017 12:23:35 PM CEST +DROP INDEX fact_acct_trunc_dateacct +; + +-- Aug 25, 2017 12:23:35 PM CEST +CREATE INDEX fact_acct_trunc_dateacct ON Fact_Acct (TRUNC(DateAcct)) +; + +-- Aug 25, 2017 12:27:32 PM CEST +UPDATE AD_IndexColumn SET ColumnSQL='upper(columnname)',Updated=TO_DATE('2017-08-25 12:27:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_IndexColumn_ID=200079 +; + +-- Aug 25, 2017 12:27:46 PM CEST +DROP INDEX ad_element_uppercolumnname +; + +-- Aug 25, 2017 12:27:46 PM CEST +CREATE UNIQUE INDEX ad_element_uppercolumnname ON AD_Element (upper(columnname)) +; + +SELECT register_migration_script('201708251228_IDEMPIERE-3453.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201708251228_IDEMPIERE-3453.sql b/migration/i4.1/postgresql/201708251228_IDEMPIERE-3453.sql new file mode 100644 index 0000000000..e1a07a7954 --- /dev/null +++ b/migration/i4.1/postgresql/201708251228_IDEMPIERE-3453.sql @@ -0,0 +1,36 @@ +-- IDEMPIERE-3453 + +CREATE OR REPLACE FUNCTION trunc(datetime TIMESTAMP WITHOUT TIME ZONE) +RETURNS TIMESTAMP WITHOUT TIME ZONE AS $$ +BEGIN + RETURN CAST(datetime AS DATE); +END; +$$ LANGUAGE plpgsql IMMUTABLE; + +-- Aug 25, 2017 12:23:30 PM CEST +UPDATE AD_IndexColumn SET ColumnSQL='TRUNC(DateAcct)',Updated=TO_TIMESTAMP('2017-08-25 12:23:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_IndexColumn_ID=200741 +; + +-- Aug 25, 2017 12:23:35 PM CEST +DROP INDEX fact_acct_trunc_dateacct +; + +-- Aug 25, 2017 12:23:35 PM CEST +CREATE INDEX fact_acct_trunc_dateacct ON Fact_Acct (TRUNC(DateAcct)) +; + +-- Aug 25, 2017 12:27:32 PM CEST +UPDATE AD_IndexColumn SET ColumnSQL='upper(columnname)',Updated=TO_TIMESTAMP('2017-08-25 12:27:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_IndexColumn_ID=200079 +; + +-- Aug 25, 2017 12:27:46 PM CEST +DROP INDEX ad_element_uppercolumnname +; + +-- Aug 25, 2017 12:27:46 PM CEST +CREATE UNIQUE INDEX ad_element_uppercolumnname ON AD_Element (upper(columnname)) +; + +SELECT register_migration_script('201708251228_IDEMPIERE-3453.sql') FROM dual +; + From 553867474e9f287111866132b15498c6d537383f Mon Sep 17 00:00:00 2001 From: Soo Fang Lee Date: Fri, 25 Aug 2017 13:05:54 +0200 Subject: [PATCH 14/33] IDEMPIERE-3442 Posting Error: Source Not Balanced after Sales Order=>Doc.Action="Void" --- org.adempiere.base/src/org/compiere/model/MOrder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 55134abab9..23e64ebe1f 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -2468,6 +2468,8 @@ public class MOrder extends X_C_Order implements DocAction if (m_processMsg != null) return false; + setTotalLines(Env.ZERO); + setGrandTotal(Env.ZERO); setProcessed(true); setDocAction(DOCACTION_None); return true; From 58df7a74051beb8b8b6773c47792a042d089f8c7 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 26 Aug 2017 19:21:17 +0200 Subject: [PATCH 15/33] IDEMPIERE-3451 IDEMPIERE_JAVA_OPTIONS property not work - general changes in setup process - enable back the ability to configure the IDEMPIERE_JAVA_OPTIONS in idempiereEnv.properties and preserve it between setups (as suggested in patch from Vinicius and Eduardo) - fix a minor issue on Console Setup - not assuming correctly the default database type - implement update-prd.sh - so other products can be updated (not just org.adempiere.server.product) --- .../install/console/ConfigurationConsole.java | 26 +++++------ .../idempiere-server.bat | 17 +++++++- .../idempiere-server.sh | 17 +++++++- .../utils.unix/myEnvironmentTemplate.sh | 8 ++-- .../utils.windows/myEnvironmentTemplate.bat | 4 +- .../build.properties | 14 +++--- .../update-prd.bat | 43 +++++++++++++++++++ .../update-prd.sh | 9 ++++ .../update.bat | 39 +---------------- .../update.sh | 4 +- 10 files changed, 112 insertions(+), 69 deletions(-) create mode 100644 org.idempiere.eclipse.platform-feature/update-prd.bat create mode 100644 org.idempiere.eclipse.platform-feature/update-prd.sh diff --git a/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java b/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java index dcd87f0119..81829c1359 100644 --- a/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java +++ b/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java @@ -463,25 +463,25 @@ public class ConfigurationConsole { { writer.println("Database Type ["+(dbTypeSelected+1)+"]"); String input = reader.readLine(); - if (input != null && input.trim().length() > 0) + try { - try + if (input == null || input.trim().length() == 0) { - int inputIndex = Integer.parseInt(input); - if (inputIndex <= 0 || inputIndex > ConfigurationData.DBTYPE.length) - { - writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.DBTYPE.length); - continue; - } - data.initDatabase(ConfigurationData.DBTYPE[inputIndex-1]); - data.setDatabaseType(ConfigurationData.DBTYPE[inputIndex-1]); - break; + input = Integer.toString(dbTypeSelected+1); } - catch (NumberFormatException e){ + int inputIndex = Integer.parseInt(input); + if (inputIndex <= 0 || inputIndex > ConfigurationData.DBTYPE.length) + { writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.DBTYPE.length); + continue; } + data.initDatabase(ConfigurationData.DBTYPE[inputIndex-1]); + data.setDatabaseType(ConfigurationData.DBTYPE[inputIndex-1]); + break; + } + catch (NumberFormatException e){ + writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.DBTYPE.length); } - break; } } } diff --git a/org.adempiere.server-feature/idempiere-server.bat b/org.adempiere.server-feature/idempiere-server.bat index 7f3e4427eb..2cb40bfe01 100644 --- a/org.adempiere.server-feature/idempiere-server.bat +++ b/org.adempiere.server-feature/idempiere-server.bat @@ -17,5 +17,20 @@ goto START @Echo Starting iDempiere Server ... @Echo ======================================= +CALL utils\myEnvironment.bat Server + FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c -@"%JAVA%" -Dosgi.console=localhost:12612 -Djetty.home=jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-selector.xml,etc/jetty-ssl.xml,etc/jetty-https.xml,etc/jetty-deployer.xml -XX:MaxPermSize=192m -Dmail.mime.encodefilename=true -Dmail.mime.decodefilename=true -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true -jar %JARFILE% -application org.adempiere.server.application + +@Set VMOPTS=-Xbootclasspath/p:alpn-boot.jar +@Set VMOPTS=%VMOPTS% -Xbootclasspath/p:alpn-boot.jar +@Set VMOPTS=%VMOPTS% -Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn +@Set VMOPTS=%VMOPTS% -Dosgi.compatibility.bootdelegation=true +@Set VMOPTS=%VMOPTS% -Djetty.home=jettyhome +@Set VMOPTS=%VMOPTS% -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml +@Set VMOPTS=%VMOPTS% -Dosgi.console=localhost:12612 +@Set VMOPTS=%VMOPTS% -Dmail.mime.encodefilename=true +@Set VMOPTS=%VMOPTS% -Dmail.mime.decodefilename=true +@Set VMOPTS=%VMOPTS% -Dmail.mime.encodeparameters=true +@Set VMOPTS=%VMOPTS% -Dmail.mime.decodeparameters=true + +@"%JAVA%" %IDEMPIERE_JAVA_OPTIONS% %VMOPTS% -jar %JARFILE% -application org.adempiere.server.application diff --git a/org.adempiere.server-feature/idempiere-server.sh b/org.adempiere.server-feature/idempiere-server.sh index 4e6ad23b24..e6b23ccf31 100644 --- a/org.adempiere.server-feature/idempiere-server.sh +++ b/org.adempiere.server-feature/idempiere-server.sh @@ -18,5 +18,18 @@ echo Starting iDempiere Server echo =================================== unset DISPLAY -BASE=`dirname $( readlink -f idempiere-server.sh )` -$JAVA ${DEBUG} -Xbootclasspath/p:alpn-boot.jar -Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn -Dosgi.compatibility.bootdelegation=true -Djetty.home=$BASE/jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml -Dosgi.console=localhost:12612 -Dmail.mime.encodefilename=true -Dmail.mime.decodefilename=true -Dmail.mime.encodeparameters=true -Dmail.mime.decodeparameters=true -jar $BASE/plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.server.application +BASE=`dirname $( readlink -f $0 )` +. $BASE/utils/myEnvironment.sh Server + +VMOPTS="-Xbootclasspath/p:alpn-boot.jar +-Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn +-Dosgi.compatibility.bootdelegation=true +-Djetty.home=$BASE/jettyhome +-Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml +-Dosgi.console=localhost:12612 +-Dmail.mime.encodefilename=true +-Dmail.mime.decodefilename=true +-Dmail.mime.encodeparameters=true +-Dmail.mime.decodeparameters=true" + +$JAVA ${DEBUG} $IDEMPIERE_JAVA_OPTIONS $VMOPTS -jar $BASE/plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.server.application diff --git a/org.adempiere.server-feature/utils.unix/myEnvironmentTemplate.sh b/org.adempiere.server-feature/utils.unix/myEnvironmentTemplate.sh index 34766434df..fee55a1705 100644 --- a/org.adempiere.server-feature/utils.unix/myEnvironmentTemplate.sh +++ b/org.adempiere.server-feature/utils.unix/myEnvironmentTemplate.sh @@ -64,10 +64,10 @@ export ADEMPIERE_KEYSTOREPASS # Java ADEMPIERE_JAVA=$JAVA_HOME/bin/java export ADEMPIERE_JAVA -ADEMPIERE_JAVA_OPTIONS="@ADEMPIERE_JAVA_OPTIONS@ -DIDEMPIERE_HOME=$IDEMPIERE_HOME" -export ADEMPIERE_JAVA_OPTIONS +IDEMPIERE_JAVA_OPTIONS="@IDEMPIERE_JAVA_OPTIONS@ -DIDEMPIERE_HOME=$IDEMPIERE_HOME" +export IDEMPIERE_JAVA_OPTIONS if [ $DOLLAR$# -eq 0 ] then - cp myEnvironment.sh myEnvironment.sav -fi + cp $IDEMPIERE_HOME/utils/myEnvironment.sh $IDEMPIERE_HOME/utils/myEnvironment.sav +fi \ No newline at end of file diff --git a/org.adempiere.server-feature/utils.windows/myEnvironmentTemplate.bat b/org.adempiere.server-feature/utils.windows/myEnvironmentTemplate.bat index 9b36e362b5..033939af6b 100644 --- a/org.adempiere.server-feature/utils.windows/myEnvironmentTemplate.bat +++ b/org.adempiere.server-feature/utils.windows/myEnvironmentTemplate.bat @@ -46,9 +46,9 @@ @Rem Java @SET ADEMPIERE_JAVA=@JAVA_HOME@\bin\java -@SET ADEMPIERE_JAVA_OPTIONS=@ADEMPIERE_JAVA_OPTIONS@ -DIDEMPIERE_HOME=@IDEMPIERE_HOME@ +@SET IDEMPIERE_JAVA_OPTIONS=@IDEMPIERE_JAVA_OPTIONS@ -DIDEMPIERE_HOME=@IDEMPIERE_HOME@ @SET CLASSPATH="@IDEMPIERE_HOME@\lib\Adempiere.jar;@IDEMPIERE_HOME@\lib\AdempiereCLib.jar;" @Rem Save Environment file -@if (%1) == () copy myEnvironment.bat myEnvironment_%RANDOM%.bat /Y +@if (%1) == () copy utils\myEnvironment.bat utils\myEnvironment_%RANDOM%.bat /Y diff --git a/org.idempiere.eclipse.platform-feature/build.properties b/org.idempiere.eclipse.platform-feature/build.properties index 0b8cfb5f12..f08a8f4cec 100644 --- a/org.idempiere.eclipse.platform-feature/build.properties +++ b/org.idempiere.eclipse.platform-feature/build.properties @@ -1,20 +1,20 @@ bin.includes = feature.xml root.folder.director=director -root.linux.gtk.x86_64=file:director.sh,file:update.sh +root.linux.gtk.x86_64=file:director.sh,file:update.sh,file:update-prd.sh root.linux.gtk.x86_64.permissions.755=*.sh,**/*.sh -root.linux.gtk.x86=file:director.sh,file:update.sh +root.linux.gtk.x86=file:director.sh,file:update.sh,file:update-prd.sh root.linux.gtk.x86.permissions.755=*.sh,**/*.sh -root.macosx.cocoa.x86=file:director.sh,file:update.sh +root.macosx.cocoa.x86=file:director.sh,file:update.sh,file:update-prd.sh root.macosx.cocoa.x86.permissions.755=*.sh,**/*.sh -root.macosx.cocoa.x86_64=file:director.sh,file:update.sh +root.macosx.cocoa.x86_64=file:director.sh,file:update.sh,file:update-prd.sh root.macosx.cocoa.x86_64.permissions.755=*.sh,**/*.sh -root.win32.win32.x86=file:director.bat,file:update.bat -root.win32.win32.x86_64=file:director.bat,file:update.bat +root.win32.win32.x86=file:director.bat,file:update.bat,file:update-prd.bat +root.win32.win32.x86_64=file:director.bat,file:update.bat,file:update-prd.bat -root.solaris.gtk.x86=file:director.sh,file:update.sh +root.solaris.gtk.x86=file:director.sh,file:update.sh,file:update-prd.sh root.solaris.gtk.x86.permissions.755=*.sh,**/*.sh \ No newline at end of file diff --git a/org.idempiere.eclipse.platform-feature/update-prd.bat b/org.idempiere.eclipse.platform-feature/update-prd.bat new file mode 100644 index 0000000000..8da6c4f9cb --- /dev/null +++ b/org.idempiere.eclipse.platform-feature/update-prd.bat @@ -0,0 +1,43 @@ +@Title ... p2 director +@Echo on + +cd %~dp0 +set DESTINATION=%cd% +@echo %DESTINATION% +@echo %1% + +copy idempiere.ini idempiere.ini.sav + +if exist jetty.xml.sav del /q jetty.xml.sav +if exist jettyhome\etc\jetty.xml ( + copy jettyhome\etc\jetty.xml jetty.xml.sav +) + +if exist jetty-ssl.xml.sav del /q jetty-ssl.xml.sav +if exist jettyhome\etc\jetty-ssl.xml ( + copy jettyhome\etc\jetty-ssl.xml jetty-ssl.xml.sav +) + +if exist jetty-selector.xml.sav del /q jetty-selector.xml.sav +if exist jettyhome\etc\jetty-selector.xml ( + copy jettyhome\etc\jetty-selector.xml jetty-selector.xml.sav +) + +@call %DESTINATION%\update-prd %1% org.adempiere.server.product + +copy idempiere.ini.sav idempiere.ini + +if exist jetty.xml.sav ( + copy jetty.xml.sav jettyhome\etc\jetty.xml + del /q jetty.xml.sav +) + +if exist jetty-ssl.xml.sav ( + copy jetty-ssl.xml.sav jettyhome\etc\jetty-ssl.xml + del /q jetty-ssl.xml.sav +) + +if exist jetty-selector.xml.sav ( + copy jetty-selector.xml.sav jettyhome\etc\jetty-selector.xml + del /q jetty-selector.xml.sav +) diff --git a/org.idempiere.eclipse.platform-feature/update-prd.sh b/org.idempiere.eclipse.platform-feature/update-prd.sh new file mode 100644 index 0000000000..a8aa4e76b5 --- /dev/null +++ b/org.idempiere.eclipse.platform-feature/update-prd.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# + +cd $(dirname "${0}") +DESTINATION=$(pwd) + +VMOPTS="-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true" +java $VMOPTS -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination $DESTINATION -repository $1 -u $2 +java $VMOPTS -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination $DESTINATION -repository $1 -i $2 \ No newline at end of file diff --git a/org.idempiere.eclipse.platform-feature/update.bat b/org.idempiere.eclipse.platform-feature/update.bat index 60e31a7c05..a4fbd288ae 100644 --- a/org.idempiere.eclipse.platform-feature/update.bat +++ b/org.idempiere.eclipse.platform-feature/update.bat @@ -6,41 +6,6 @@ set DESTINATION=%cd% @echo %DESTINATION% @echo %1% -copy idempiere.ini idempiere.ini.sav - -if exist jetty.xml.sav del /q jetty.xml.sav -if exist jettyhome\etc\jetty.xml ( - copy jettyhome\etc\jetty.xml jetty.xml.sav -) - -if exist jetty-ssl.xml.sav del /q jetty-ssl.xml.sav -if exist jettyhome\etc\jetty-ssl.xml ( - copy jettyhome\etc\jetty-ssl.xml jetty-ssl.xml.sav -) - -if exist jetty-selector.xml.sav del /q jetty-selector.xml.sav -if exist jettyhome\etc\jetty-selector.xml ( - copy jettyhome\etc\jetty-selector.xml jetty-selector.xml.sav -) - FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c -java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -u org.adempiere.server.product -java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -i org.adempiere.server.product - -copy idempiere.ini.sav idempiere.ini - -if exist jetty.xml.sav ( - copy jetty.xml.sav jettyhome\etc\jetty.xml - del /q jetty.xml.sav -) - -if exist jetty-ssl.xml.sav ( - copy jetty-ssl.xml.sav jettyhome\etc\jetty-ssl.xml - del /q jetty-ssl.xml.sav -) - -if exist jetty-selector.xml.sav ( - copy jetty-selector.xml.sav jettyhome\etc\jetty-selector.xml - del /q jetty-selector.xml.sav -) - +java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -u %2% +java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -i %2% diff --git a/org.idempiere.eclipse.platform-feature/update.sh b/org.idempiere.eclipse.platform-feature/update.sh index 404c8c9490..e26cf3b792 100644 --- a/org.idempiere.eclipse.platform-feature/update.sh +++ b/org.idempiere.eclipse.platform-feature/update.sh @@ -33,9 +33,7 @@ then cp jettyhome/etc/jetty-selector.xml jetty-selector.xml.sav fi -VMOPTS="-Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true" -java $VMOPTS -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination $DESTINATION -repository $1 -u org.adempiere.server.product -java $VMOPTS -jar plugins/org.eclipse.equinox.launcher_1.*.jar -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination $DESTINATION -repository $1 -i org.adempiere.server.product +$DESTINATION/update-prd.sh $1 org.adempiere.server.product cp idempiere.ini.sav idempiere.ini From 19a04cf3cfe85b64f42c59cd58224859f661e291 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 26 Aug 2017 19:30:18 +0200 Subject: [PATCH 16/33] IDEMPIERE-3451 switch update*bat files --- .../update-prd.bat | 38 ++----------------- .../update.bat | 38 +++++++++++++++++-- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/org.idempiere.eclipse.platform-feature/update-prd.bat b/org.idempiere.eclipse.platform-feature/update-prd.bat index 8da6c4f9cb..a4fbd288ae 100644 --- a/org.idempiere.eclipse.platform-feature/update-prd.bat +++ b/org.idempiere.eclipse.platform-feature/update-prd.bat @@ -6,38 +6,6 @@ set DESTINATION=%cd% @echo %DESTINATION% @echo %1% -copy idempiere.ini idempiere.ini.sav - -if exist jetty.xml.sav del /q jetty.xml.sav -if exist jettyhome\etc\jetty.xml ( - copy jettyhome\etc\jetty.xml jetty.xml.sav -) - -if exist jetty-ssl.xml.sav del /q jetty-ssl.xml.sav -if exist jettyhome\etc\jetty-ssl.xml ( - copy jettyhome\etc\jetty-ssl.xml jetty-ssl.xml.sav -) - -if exist jetty-selector.xml.sav del /q jetty-selector.xml.sav -if exist jettyhome\etc\jetty-selector.xml ( - copy jettyhome\etc\jetty-selector.xml jetty-selector.xml.sav -) - -@call %DESTINATION%\update-prd %1% org.adempiere.server.product - -copy idempiere.ini.sav idempiere.ini - -if exist jetty.xml.sav ( - copy jetty.xml.sav jettyhome\etc\jetty.xml - del /q jetty.xml.sav -) - -if exist jetty-ssl.xml.sav ( - copy jetty-ssl.xml.sav jettyhome\etc\jetty-ssl.xml - del /q jetty-ssl.xml.sav -) - -if exist jetty-selector.xml.sav ( - copy jetty-selector.xml.sav jettyhome\etc\jetty-selector.xml - del /q jetty-selector.xml.sav -) +FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c +java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -u %2% +java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -i %2% diff --git a/org.idempiere.eclipse.platform-feature/update.bat b/org.idempiere.eclipse.platform-feature/update.bat index a4fbd288ae..8da6c4f9cb 100644 --- a/org.idempiere.eclipse.platform-feature/update.bat +++ b/org.idempiere.eclipse.platform-feature/update.bat @@ -6,6 +6,38 @@ set DESTINATION=%cd% @echo %DESTINATION% @echo %1% -FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c -java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -u %2% -java -Dorg.eclipse.ecf.provider.filetransfer.excludeContributors=org.eclipse.ecf.provider.filetransfer.httpclient4 -Djava.net.preferIPv4Stack=true -jar %JARFILE% -install director -configuration director/configuration -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %DESTINATION% -repository %1% -i %2% +copy idempiere.ini idempiere.ini.sav + +if exist jetty.xml.sav del /q jetty.xml.sav +if exist jettyhome\etc\jetty.xml ( + copy jettyhome\etc\jetty.xml jetty.xml.sav +) + +if exist jetty-ssl.xml.sav del /q jetty-ssl.xml.sav +if exist jettyhome\etc\jetty-ssl.xml ( + copy jettyhome\etc\jetty-ssl.xml jetty-ssl.xml.sav +) + +if exist jetty-selector.xml.sav del /q jetty-selector.xml.sav +if exist jettyhome\etc\jetty-selector.xml ( + copy jettyhome\etc\jetty-selector.xml jetty-selector.xml.sav +) + +@call %DESTINATION%\update-prd %1% org.adempiere.server.product + +copy idempiere.ini.sav idempiere.ini + +if exist jetty.xml.sav ( + copy jetty.xml.sav jettyhome\etc\jetty.xml + del /q jetty.xml.sav +) + +if exist jetty-ssl.xml.sav ( + copy jetty-ssl.xml.sav jettyhome\etc\jetty-ssl.xml + del /q jetty-ssl.xml.sav +) + +if exist jetty-selector.xml.sav ( + copy jetty-selector.xml.sav jettyhome\etc\jetty-selector.xml + del /q jetty-selector.xml.sav +) From 0312ee82c07cbf3bb24e02b1347f15201a44f081 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 26 Aug 2017 19:33:36 +0200 Subject: [PATCH 17/33] IDEMPIERE-3440 on centos (and like centos) tmp is managed by OS, sometime it corrupt jetty / based on patch from Hiep Lq --- org.adempiere.server-feature/idempiere-server.bat | 1 + org.adempiere.server-feature/idempiere-server.sh | 1 + org.adempiere.server-feature/jettyhome/work/.hgignore | 0 3 files changed, 2 insertions(+) create mode 100644 org.adempiere.server-feature/jettyhome/work/.hgignore diff --git a/org.adempiere.server-feature/idempiere-server.bat b/org.adempiere.server-feature/idempiere-server.bat index 2cb40bfe01..216310fdef 100644 --- a/org.adempiere.server-feature/idempiere-server.bat +++ b/org.adempiere.server-feature/idempiere-server.bat @@ -26,6 +26,7 @@ FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c @Set VMOPTS=%VMOPTS% -Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn @Set VMOPTS=%VMOPTS% -Dosgi.compatibility.bootdelegation=true @Set VMOPTS=%VMOPTS% -Djetty.home=jettyhome +@Set VMOPTS=%VMOPTS% -Djetty.base=jettyhome @Set VMOPTS=%VMOPTS% -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml @Set VMOPTS=%VMOPTS% -Dosgi.console=localhost:12612 @Set VMOPTS=%VMOPTS% -Dmail.mime.encodefilename=true diff --git a/org.adempiere.server-feature/idempiere-server.sh b/org.adempiere.server-feature/idempiere-server.sh index e6b23ccf31..1891706b18 100644 --- a/org.adempiere.server-feature/idempiere-server.sh +++ b/org.adempiere.server-feature/idempiere-server.sh @@ -25,6 +25,7 @@ VMOPTS="-Xbootclasspath/p:alpn-boot.jar -Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.eclipse.jetty.alpn -Dosgi.compatibility.bootdelegation=true -Djetty.home=$BASE/jettyhome +-Djetty.base=$BASE/jettyhome -Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml -Dosgi.console=localhost:12612 -Dmail.mime.encodefilename=true diff --git a/org.adempiere.server-feature/jettyhome/work/.hgignore b/org.adempiere.server-feature/jettyhome/work/.hgignore new file mode 100644 index 0000000000..e69de29bb2 From fde822e31898983ef7542d1884e6d55d36910939 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Thu, 3 Aug 2017 20:03:59 +0530 Subject: [PATCH 18/33] IDEMPIERE-3444: Zoom context menu do not work when user do not have access to sales window. --- .../src/org/adempiere/webui/editor/WEditorPopupMenu.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java index d982dd04a5..e5f7d48e4f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditorPopupMenu.java @@ -123,7 +123,10 @@ public class WEditorPopupMenu extends Menupopup implements EventListener int winID = lookup.getZoom(); int winIDPO = lookup.getZoom(false) ; Boolean canAccess = MRole.getDefault().getWindowAccess(winID); - if (winID <= 0 || canAccess == null) { + Boolean canAccessPO = null; + if (winIDPO > 0) + canAccessPO = MRole.getDefault().getWindowAccess(winIDPO); + if ((winID <= 0 || canAccess == null) && (canAccessPO == null || canAccessPO == false)) { this.zoomEnabled = false; this.newEnabled = false; this.updateEnabled = false; From fb0cdb12e7be17260117948dbca127ec09715392 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 27 Aug 2017 11:55:25 +0200 Subject: [PATCH 19/33] IDEMPIERE-3396 Performance Issue in Process' Saved Parameter --- .../oracle/201708271154_IDEMPIERE-3396.sql | 35 +++++++++++++++++++ .../201708271154_IDEMPIERE-3396.sql | 32 +++++++++++++++++ .../src/org/compiere/model/MPInstance.java | 1 + 3 files changed, 68 insertions(+) create mode 100644 migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql create mode 100644 migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql diff --git a/migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql b/migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql new file mode 100644 index 0000000000..6ae0594afc --- /dev/null +++ b/migration/i4.1/oracle/201708271154_IDEMPIERE-3396.sql @@ -0,0 +1,35 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3396 +-- Aug 27, 2017 11:52:21 AM CEST +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201059,'6a6f51d9-b636-48f8-ae98-33204895c8f4',TO_DATE('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_pinstance_last_ix',TO_DATE('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,282,'N','N','N','N','N') +; + +-- Aug 27, 2017 11:52:37 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201347,'c9cc1891-e41b-4d3e-8c36-f746e5b0fe39',TO_DATE('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,5951,201059,1) +; + +-- Aug 27, 2017 11:52:45 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201348,'7b63fe78-7d25-49a8-a64c-1ab5b9fa90d1',TO_DATE('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,2781,201059,2) +; + +-- Aug 27, 2017 11:53:49 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201349,'50e5ad46-685a-470b-a42c-239f2a104246',TO_DATE('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,8221,201059,3) +; + +-- Aug 27, 2017 11:53:56 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201350,'f65ee789-904b-433f-b4c9-bbc1fde9ca8a',TO_DATE('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,8225,201059,4) +; + +-- Aug 27, 2017 11:54:02 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201351,'1875c8e6-f900-4486-8c22-b6bda65e751a',TO_DATE('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_DATE('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,210890,201059,5) +; + +-- Aug 27, 2017 11:54:08 AM CEST +CREATE INDEX ad_pinstance_last_ix ON AD_PInstance (AD_User_ID,AD_Process_ID,AD_Client_ID,IsActive,Name) +; + +SELECT register_migration_script('201708271154_IDEMPIERE-3396.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql b/migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql new file mode 100644 index 0000000000..747fc23e45 --- /dev/null +++ b/migration/i4.1/postgresql/201708271154_IDEMPIERE-3396.sql @@ -0,0 +1,32 @@ +-- IDEMPIERE-3396 +-- Aug 27, 2017 11:52:21 AM CEST +INSERT INTO AD_TableIndex (AD_Client_ID,AD_Org_ID,AD_TableIndex_ID,AD_TableIndex_UU,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Table_ID,IsCreateConstraint,IsUnique,Processing,TableIndexDrop,IsKey) VALUES (0,0,201059,'6a6f51d9-b636-48f8-ae98-33204895c8f4',TO_TIMESTAMP('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','ad_pinstance_last_ix',TO_TIMESTAMP('2017-08-27 11:52:20','YYYY-MM-DD HH24:MI:SS'),100,282,'N','N','N','N','N') +; + +-- Aug 27, 2017 11:52:37 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201347,'c9cc1891-e41b-4d3e-8c36-f746e5b0fe39',TO_TIMESTAMP('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:52:37','YYYY-MM-DD HH24:MI:SS'),100,5951,201059,1) +; + +-- Aug 27, 2017 11:52:45 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201348,'7b63fe78-7d25-49a8-a64c-1ab5b9fa90d1',TO_TIMESTAMP('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:52:45','YYYY-MM-DD HH24:MI:SS'),100,2781,201059,2) +; + +-- Aug 27, 2017 11:53:49 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201349,'50e5ad46-685a-470b-a42c-239f2a104246',TO_TIMESTAMP('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:53:49','YYYY-MM-DD HH24:MI:SS'),100,8221,201059,3) +; + +-- Aug 27, 2017 11:53:56 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201350,'f65ee789-904b-433f-b4c9-bbc1fde9ca8a',TO_TIMESTAMP('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:53:55','YYYY-MM-DD HH24:MI:SS'),100,8225,201059,4) +; + +-- Aug 27, 2017 11:54:02 AM CEST +INSERT INTO AD_IndexColumn (AD_Client_ID,AD_Org_ID,AD_IndexColumn_ID,AD_IndexColumn_UU,Created,CreatedBy,EntityType,IsActive,Updated,UpdatedBy,AD_Column_ID,AD_TableIndex_ID,SeqNo) VALUES (0,0,201351,'1875c8e6-f900-4486-8c22-b6bda65e751a',TO_TIMESTAMP('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,'D','Y',TO_TIMESTAMP('2017-08-27 11:54:02','YYYY-MM-DD HH24:MI:SS'),100,210890,201059,5) +; + +-- Aug 27, 2017 11:54:08 AM CEST +CREATE INDEX ad_pinstance_last_ix ON AD_PInstance (AD_User_ID,AD_Process_ID,AD_Client_ID,IsActive,Name) +; + +SELECT register_migration_script('201708271154_IDEMPIERE-3396.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MPInstance.java b/org.adempiere.base/src/org/compiere/model/MPInstance.java index 1c215ce208..45c81d03ad 100644 --- a/org.adempiere.base/src/org/compiere/model/MPInstance.java +++ b/org.adempiere.base/src/org/compiere/model/MPInstance.java @@ -406,6 +406,7 @@ public class MPInstance extends X_AD_PInstance int cnt = 0; try { pstmt = DB.prepareStatement(sql, null); + pstmt.setFetchSize(lastRunCount); pstmt.setInt(1, AD_Process_ID); pstmt.setInt(2, AD_User_ID); pstmt.setInt(3, Env.getAD_Client_ID(ctx)); From 09ecb2fc0b45e7a5eed7aa1a136305bd2132335c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 28 Aug 2017 11:51:08 +0200 Subject: [PATCH 20/33] IDEMPIERE-3459 GL Distribution Any Account --- .../src/org/compiere/model/MDistribution.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MDistribution.java b/org.adempiere.base/src/org/compiere/model/MDistribution.java index f269586ce5..963dc65f67 100644 --- a/org.adempiere.base/src/org/compiere/model/MDistribution.java +++ b/org.adempiere.base/src/org/compiere/model/MDistribution.java @@ -40,7 +40,7 @@ public class MDistribution extends X_GL_Distribution /** * */ - private static final long serialVersionUID = -906547096682610205L; + private static final long serialVersionUID = 3782058638272715005L; /** * Get Distribution for combination @@ -90,7 +90,7 @@ public class MDistribution extends X_GL_Distribution int C_SalesRegion_ID, int C_LocTo_ID, int C_LocFrom_ID, int User1_ID, int User2_ID) { - MDistribution[] acctList = get (ctx, Account_ID); + MDistribution[] acctList = getAll(ctx); if (acctList == null || acctList.length == 0) return null; // @@ -157,11 +157,16 @@ public class MDistribution extends X_GL_Distribution MDistribution[] retValue = (MDistribution[])s_accounts.get(key); if (retValue != null) return retValue; - final String whereClause = "Account_ID=?"; - + String whereClause = ""; + Object[] parameters = null; + if (Account_ID >= 0) { + whereClause = "Account_ID=?"; + parameters = new Object[]{Account_ID}; + } List list = new Query(ctx,I_GL_Distribution.Table_Name,whereClause,null) - .setParameters(Account_ID) - .list(); + .setClient_ID() + .setParameters(parameters) + .list(); // retValue = new MDistribution[list.size ()]; list.toArray (retValue); @@ -169,6 +174,17 @@ public class MDistribution extends X_GL_Distribution return retValue; } // get + /** + * Get All Distributions + * @param ctx context + * @param Account_ID id + * @return array of distributions + */ + public static MDistribution[] getAll (Properties ctx) + { + return get(ctx, -1); + } // get + /** Static Logger */ @SuppressWarnings("unused") private static CLogger s_log = CLogger.getCLogger (MDistribution.class); From 205edcdb732452a3afdc3a51f69ebef9e6351d57 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Tue, 29 Aug 2017 15:50:30 +0200 Subject: [PATCH 21/33] IDEMPIERE-3460 Ability to share window validators by several windows --- .../validator/WindowValidatorManager.java | 56 ++++++++++++++----- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/validator/WindowValidatorManager.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/validator/WindowValidatorManager.java index c5e64a8c26..a624a7bc44 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/validator/WindowValidatorManager.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/validator/WindowValidatorManager.java @@ -27,20 +27,32 @@ public class WindowValidatorManager implements BundleActivator, ServiceTrackerCu public WindowValidator addingService( ServiceReference reference) { WindowValidator service = context.getService(reference); - String uuid = (String) reference.getProperty("AD_Window_UU"); - if (uuid == null || "*".equals(uuid)) { - globalValidators.add(service); - return service; + + Object obj = reference.getProperty("AD_Window_UU"); + + if (obj instanceof String) { + String uuid = (String) reference.getProperty("AD_Window_UU"); + if (uuid == null || "*".equals(uuid)) { + globalValidators.add(service); + return service; + } + addService(service, uuid); } - + else if (obj instanceof String []) { + String[] uuids = (String []) reference.getProperty("AD_Window_UU"); + for (String uuid : uuids) + addService(service, uuid); + } + return service; + } + + void addService(WindowValidator service, String uuid) { List list = validatorMap.get(uuid); if (list == null) { list = new ArrayList(); validatorMap.put(uuid, list); } - list.add(service); - - return service; + list.add(service); } @Override @@ -51,14 +63,28 @@ public class WindowValidatorManager implements BundleActivator, ServiceTrackerCu @Override public void removedService(ServiceReference reference, WindowValidator service) { - String uuid = (String) reference.getProperty("AD_Window_UU"); - if (uuid == null || "*".equals(uuid)) { - globalValidators.remove(service); - } else { - List list = validatorMap.get(uuid); - if (list != null) { - list.remove(service); + + Object obj = reference.getProperty("AD_Window_UU"); + + if (obj instanceof String) { + String uuid = (String) reference.getProperty("AD_Window_UU"); + if (uuid == null || "*".equals(uuid)) { + globalValidators.remove(service); } + else + removeService(service, uuid); + } + else if (obj instanceof String []) { + String[] uuids = (String []) reference.getProperty("AD_Window_UU"); + for (String uuid : uuids) + removeService(service, uuid); + } + } + + void removeService(WindowValidator service, String uuid) { + List list = validatorMap.get(uuid); + if (list != null) { + list.remove(service); } } From e287b987c2f5be6f8a6877fbe02756b7b6ab42a1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 30 Aug 2017 14:26:08 +0200 Subject: [PATCH 22/33] IDEMPIERE-3049 String autocomplete NPE / refactor to apply best practices / drop the AD_Org_ID filter (doesn't make sense for non-org tables) / add ReQuery to context menu --- .../src/org/compiere/model/GridField.java | 68 ++++++++----------- .../adempiere/webui/editor/WStringEditor.java | 34 ++++++---- 2 files changed, 48 insertions(+), 54 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index 6e9a5eae0a..1e9eb87d40 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -2361,54 +2361,42 @@ public class GridField /** * Returns a list containing all existing entries of this field - * with the actual AD_Org_ID and AD_Client_ID. + * with the actual AD_Client_ID. * @return List of existing entries for this field */ public List getEntries() { + /* TODO: consider caching the list to avoid repeating queries on every window open (twice, for find and for field) */ + MColumn column = MColumn.get(Env.getCtx(), getAD_Column_ID()); + MTable table = MTable.get(Env.getCtx(), column.getAD_Table_ID()); + String tableName = table.getTableName(); + String columnName = column.getColumnName(); ArrayList list = new ArrayList(); - PreparedStatement pstmt1; - PreparedStatement pstmt2; - String sql = ""; - - try - { - String tableName = null; - String columnName = null; - int AD_Org_ID = Env.getAD_Org_ID(Env.getCtx()); + if (tableName != null && columnName != null) { int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx()); - sql = "SELECT t.TableName, c.ColumnName " + - " FROM AD_COLUMN c INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID)" + - " WHERE AD_Column_ID=?"; - pstmt1 = DB.prepareStatement(sql, null); - pstmt1.setInt(1, getAD_Column_ID()); - ResultSet rs1 = pstmt1.executeQuery(); - if (rs1.next()) - { - tableName = rs1.getString(1); - columnName = rs1.getString(2); - } - DB.close(rs1, pstmt1); - - if (tableName != null && columnName != null) { - sql = "SELECT DISTINCT " + columnName + " FROM " + tableName + " WHERE AD_Client_ID=? " - + " AND AD_Org_ID=?"; - pstmt2 = DB.prepareStatement(sql, null); - pstmt2.setInt(1, AD_Client_ID); - pstmt2.setInt(2, AD_Org_ID); - - ResultSet rs2 = pstmt2.executeQuery(); - while (rs2.next()) - { - list.add(rs2.getString(1)); + PreparedStatement pstmt = null; + ResultSet rs = null; + StringBuilder sql = new StringBuilder() + .append("SELECT DISTINCT ") + .append(columnName) + .append(" FROM ") + .append(tableName) + .append(" WHERE AD_Client_ID=? AND ") + .append(columnName) + .append(" IS NOT NULL ORDER BY 1"); + try { + pstmt = DB.prepareStatement(sql.toString(), null); + pstmt.setInt(1, AD_Client_ID); + + rs = pstmt.executeQuery(); + while (rs.next()) { + list.add(rs.getString(1)); } - DB.close(rs2, pstmt2); + } catch (Exception e) { + log.log(Level.SEVERE, sql.toString(), e); + } finally { + DB.close(rs, pstmt); } } - catch (Exception e) - { - log.log(Level.SEVERE, sql, e); - } - return list; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java index d54e5dc7dc..d89e1efea2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WStringEditor.java @@ -145,7 +145,8 @@ public class WStringEditor extends WEditor implements ContextMenuListener } else getComponent().setMultiline(false); - getComponent().setRows(gridField.getNumLines() <= 0 || tableEditor ? 1 : gridField.getNumLines()); + if (! gridField.isAutocomplete()) // avoid -> Combobox doesn't support multiple rows + getComponent().setRows(gridField.getNumLines() <= 0 || tableEditor ? 1 : gridField.getNumLines()); if (getComponent().getRows() > 1) ZKUpdateUtil.setHeight(getComponent(), "100%"); @@ -154,7 +155,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener if(!(this instanceof WPasswordEditor)){ // check password field - popupMenu = new WEditorPopupMenu(false, false, isShowPreference()); + popupMenu = new WEditorPopupMenu(false, gridField.isAutocomplete(), isShowPreference()); addTextEditorMenu(popupMenu); addChangeLogMenu(popupMenu); } @@ -289,23 +290,28 @@ public class WStringEditor extends WEditor implements ContextMenuListener { WFieldRecordInfo.start(gridField); } + else if (WEditorPopupMenu.REQUERY_EVENT.equals(evt.getContextEvent())) + { + actionRefresh(); + } } - + @Override public void dynamicDisplay() { super.dynamicDisplay(); - //referesh auto complete list + actionRefresh(); + } + + public void actionRefresh() { + //refresh auto complete list if (gridField.isAutocomplete()) { - Combobox combo = (Combobox)getComponent(); - List items = gridField.getEntries(); - if (items.size() != combo.getItemCount()) - { - combo.removeAllItems(); - for(String s : items) { - combo.appendItem(s); - } - } - } + Combobox combo = (Combobox)getComponent(); + List items = gridField.getEntries(); + combo.removeAllItems(); + for(String s : items) { + combo.appendItem(s); + } + } } private AbstractADWindowContent findADWindowContent() { From 8c32a68349ab44daa9c52d72187af59b168920b4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 30 Aug 2017 17:17:32 +0200 Subject: [PATCH 23/33] IDEMPIERE-3465 Improve Remember Me on browser --- .../src/org/adempiere/webui/AdempiereWebUI.java | 12 ++---------- .../src/org/adempiere/webui/panel/LoginPanel.java | 4 +--- .../src/org/adempiere/webui/util/BrowserToken.java | 1 - 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 39e4ed5b03..c4b823b039 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -266,15 +266,8 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb //update session context currSess.setAttribute(SessionContextListener.SESSION_CTX, ServerContext.getCurrentInstance()); - if ("Y".equalsIgnoreCase(Env.getContext(ctx, BrowserToken.REMEMBER_ME)) && MSystem.isZKRememberUserAllowed()) - { - MUser user = MUser.get(ctx); - BrowserToken.save(mSession, user); - } - else - { - BrowserToken.remove(); - } + MUser user = MUser.get(ctx); + BrowserToken.save(mSession, user); Env.setContext(ctx, "#UIClient", "zk"); StringBuilder localHttpAddr = new StringBuilder(Executions.getCurrent().getScheme()); @@ -508,7 +501,6 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb Env.setContext(properties, Env.AD_ROLE_ID, Env.getAD_Role_ID(Env.getCtx())); Env.setContext(properties, Env.AD_ORG_NAME, Env.getContext(Env.getCtx(), Env.AD_ORG_NAME)); Env.setContext(properties, Env.M_WAREHOUSE_ID, Env.getContext(Env.getCtx(), Env.M_WAREHOUSE_ID)); - Env.setContext(properties, BrowserToken.REMEMBER_ME, Env.getContext(Env.getCtx(), BrowserToken.REMEMBER_ME)); Env.setContext(properties, UserPreference.LANGUAGE_NAME, Env.getContext(Env.getCtx(), UserPreference.LANGUAGE_NAME)); Env.setContext(properties, Env.LANGUAGE, Env.getContext(Env.getCtx(), Env.LANGUAGE)); Env.setContext(properties, AEnv.LOCALE, Env.getContext(Env.getCtx(), AEnv.LOCALE)); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index ed8a37c440..ea7b996c42 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -164,6 +164,7 @@ public class LoginPanel extends Window implements EventListener String token = data[1]; if (BrowserToken.validateToken(session, user, token)) { + onUserIdChange(AD_User_ID); if (MSystem.isZKRememberUserAllowed()) { if (email_login) { txtUserId.setValue(user.getEMail()); @@ -174,7 +175,6 @@ public class LoginPanel extends Window implements EventListener txtUserId.setValue(user.getName()); } } - onUserIdChange(AD_User_ID); chkRememberMe.setChecked(true); } if (MSystem.isZKRememberPasswordAllowed()) { @@ -567,8 +567,6 @@ public class LoginPanel extends Window implements EventListener } } - Env.setContext(ctx, BrowserToken.REMEMBER_ME, chkRememberMe.isChecked()); - Session currSess = Executions.getCurrent().getDesktop().getSession(); KeyNamePair clientsKNPairs[] = login.getClients(userId, userPassword); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/BrowserToken.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/BrowserToken.java index 0d6fe1506f..7548198105 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/BrowserToken.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/BrowserToken.java @@ -40,7 +40,6 @@ public final class BrowserToken { private BrowserToken() {} - public final static String REMEMBER_ME = "Login.RememberMe"; /** * save session and user as client side token for future auto login * @param session From 6213d823ed27e1c328e685d5243d303067d488fa Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 30 Aug 2017 18:09:32 +0200 Subject: [PATCH 24/33] IDEMPIERE-3449 Chrome autocomplete contact email/password by user email after record saved --- org.adempiere.base/src/org/compiere/model/MSysConfig.java | 3 ++- .../WEB-INF/src/org/adempiere/webui/component/Textbox.java | 1 + .../WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 04d21dc6d1..8b9ebda7cc 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = -5006794875155447942L; + private static final long serialVersionUID = -1378971388226313818L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -160,6 +160,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String ZK_FOOTER_SERVER_MSG = "ZK_FOOTER_SERVER_MSG"; public static final String ZK_GRID_EDIT_MODELESS = "ZK_GRID_EDIT_MODELESS"; public static final String ZK_INFO_NUM_PAGE_PRELOAD = "ZK_INFO_NUM_PAGE_PRELOAD"; + public static final String ZK_LOGIN_ALLOW_CHROME_SAVE_PASSWORD = "ZK_LOGIN_ALLOW_CHROME_SAVE_PASSWORD"; public static final String ZK_LOGIN_ALLOW_REMEMBER_ME = "ZK_LOGIN_ALLOW_REMEMBER_ME"; public static final String ZK_LOGO_LARGE = "ZK_LOGO_LARGE"; public static final String ZK_LOGO_SMALL = "ZK_LOGO_SMALL"; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Textbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Textbox.java index b9e132aad9..0875a884bc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Textbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Textbox.java @@ -124,6 +124,7 @@ public class Textbox extends org.zkoss.zul.Textbox implements EventListener txtPassword = new Textbox(); txtPassword.setId("txtPassword"); txtPassword.setType("password"); - txtPassword.setCols(25); // txtPassword.setMaxlength(40); ZKUpdateUtil.setWidth(txtPassword, "220px"); + if (MSysConfig.getBooleanValue(MSysConfig.ZK_LOGIN_ALLOW_CHROME_SAVE_PASSWORD, true)) + txtPassword.setClientAttribute("autocomplete", null); lstLanguage = new Combobox(); lstLanguage.setAutocomplete(true); From 1bf66f1064ddeccbc5d614b77b12e9fefc7e2a74 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 30 Aug 2017 18:57:36 +0200 Subject: [PATCH 25/33] IDEMPIERE-3443 Payment Schedule leading to -> Current record was changed by another user, please ReQuery / IDEMPIERE-3462 --- org.adempiere.base/src/org/compiere/model/MInvoice.java | 2 +- org.adempiere.base/src/org/compiere/model/MOrder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index c53c958515..5f4f3d34c5 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1029,7 +1029,7 @@ public class MInvoice extends X_C_Invoice implements DocAction } } - if (! recursiveCall && (newRecord || is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) { + if (! recursiveCall && (!newRecord && is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) { recursiveCall = true; try { MPaymentTerm pt = new MPaymentTerm (getCtx(), getC_PaymentTerm_ID(), get_TrxName()); diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 23e64ebe1f..afb98078fa 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -1090,7 +1090,7 @@ public class MOrder extends X_C_Order implements DocAction } } - if (! recursiveCall && (newRecord || is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) { + if (! recursiveCall && (!newRecord && is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) { recursiveCall = true; try { MPaymentTerm pt = new MPaymentTerm (getCtx(), getC_PaymentTerm_ID(), get_TrxName()); From 53df432dc5e8c6068f40a1773a8e67ef64aa9d3d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 31 Aug 2017 17:52:37 +0200 Subject: [PATCH 26/33] IDEMPIERE-3466 Workflow condition applied across all clients / thanks to Pritesh Shah --- org.adempiere.base/src/org/compiere/wf/MWFNodeNext.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNodeNext.java b/org.adempiere.base/src/org/compiere/wf/MWFNodeNext.java index 12d64953bf..83426263be 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFNodeNext.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFNodeNext.java @@ -25,6 +25,7 @@ import org.compiere.model.PO; import org.compiere.model.Query; import org.compiere.model.X_AD_WF_NodeNext; import org.compiere.process.DocAction; +import org.compiere.util.Env; /** * Workflow Node Next - Transition @@ -127,9 +128,9 @@ public class MWFNodeNext extends X_AD_WF_NodeNext if (!requery && m_conditions != null) return m_conditions; // - final String whereClause = MWFNextCondition.COLUMNNAME_AD_WF_NodeNext_ID+"=?"; + final String whereClause = "AD_WF_NodeNext_ID=? AND AD_Client_ID IN (0,?)"; List list = new Query(getCtx(), MWFNextCondition.Table_Name, whereClause, get_TrxName()) - .setParameters(new Object[]{getAD_WF_NodeNext_ID()}) + .setParameters(new Object[]{getAD_WF_NodeNext_ID(), Env.getAD_Client_ID(Env.getCtx())}) .setOnlyActiveRecords(true) .setOrderBy(MWFNextCondition.COLUMNNAME_SeqNo) .list(); From a9330bf75d270f52bb66d34ec57ecc2b7b94439f Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 31 Aug 2017 21:59:05 +0200 Subject: [PATCH 27/33] IDEMPIERE-3423 MWFActivity missing displaytype validation in set variable nodes --- .../src/org/compiere/model/MColumn.java | 17 +++++++- .../src/org/compiere/model/PO.java | 3 +- .../src/org/compiere/wf/MWFActivity.java | 40 ++++++++++++++++++- .../src/org/compiere/wf/MWFNode.java | 11 +++++ 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index c98f4d1b5e..9e848670ee 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -51,7 +51,7 @@ public class MColumn extends X_AD_Column /** * */ - private static final long serialVersionUID = 3082823885314140209L; + private static final long serialVersionUID = -6914331394933196295L; public static MColumn get (Properties ctx, int AD_Column_ID) { @@ -1133,4 +1133,19 @@ public class MColumn extends X_AD_Column return ""; } + /** + * Is Advanced + * @return true if the column has any field marked as advanced or part of an advanced tab + */ + public boolean isAdvanced() { + final String sql = "" + + "SELECT COUNT(*) " + + "FROM AD_Tab t " + + " JOIN AD_Field f ON ( f.AD_Tab_ID = t.AD_Tab_ID ) " + + "WHERE f.AD_Column_ID = ? " + + " AND ( t.IsAdvancedTab = 'Y' OR f.IsAdvancedField = 'Y' )"; + int cnt = DB.getSQLValueEx(get_TrxName(), sql, getAD_Column_ID()); + return cnt > 0; + } + } // MColumn diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index f68152093b..04de5a0fe7 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -52,6 +52,7 @@ import org.adempiere.exceptions.DBException; import org.adempiere.process.UUIDGenerator; import org.compiere.Adempiere; import org.compiere.acct.Doc; +import org.compiere.util.AdempiereUserError; import org.compiere.util.CCache; import org.compiere.util.CLogMgt; import org.compiere.util.CLogger; @@ -1000,7 +1001,7 @@ public abstract class PO { int index = p_info.getColumnIndex(AD_Column_ID); if (index < 0) - log.log(Level.SEVERE, "Not found - AD_Column_ID=" + AD_Column_ID); + throw new AdempiereUserError("Not found - AD_Column_ID=" + AD_Column_ID); String ColumnName = p_info.getColumnName(index); if (ColumnName.equals("IsApproved")) return set_ValueNoCheck(ColumnName, value); diff --git a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java index f743b0e8a3..ecf5286d99 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java @@ -16,6 +16,8 @@ *****************************************************************************/ package org.compiere.wf; +import static org.compiere.model.SystemIDs.MESSAGE_WORKFLOWRESULT; + import java.io.File; import java.math.BigDecimal; import java.sql.PreparedStatement; @@ -52,12 +54,12 @@ import org.compiere.model.MUserRoles; import org.compiere.model.MWFActivityApprover; import org.compiere.model.PO; import org.compiere.model.Query; -import static org.compiere.model.SystemIDs.*; import org.compiere.model.X_AD_WF_Activity; import org.compiere.print.ReportEngine; import org.compiere.process.DocAction; import org.compiere.process.ProcessInfo; import org.compiere.process.StateEngine; +import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Env; @@ -1286,9 +1288,43 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable dbValue = new Boolean("Y".equals(value)); else if (DisplayType.isNumeric(displayType)) dbValue = new BigDecimal (value); + else if (DisplayType.isID(displayType)) { + MColumn column = MColumn.get(Env.getCtx(), getNode().getAD_Column_ID()); + String referenceTableName = column.getReferenceTableName(); + if (referenceTableName != null) { + MTable refTable = MTable.get(Env.getCtx(), referenceTableName); + dbValue = Integer.valueOf(value); + boolean validValue = true; + PO po = refTable.getPO((Integer)dbValue, trx.getTrxName()); + if (po == null || po.get_ID() == 0) { + // foreign key does not exist + validValue = false; + } + if (validValue && po.getAD_Client_ID() != Env.getAD_Client_ID(Env.getCtx())) { + validValue = false; + if (po.getAD_Client_ID() == 0) { + String accessLevel = refTable.getAccessLevel(); + if ( MTable.ACCESSLEVEL_All.equals(accessLevel) + || MTable.ACCESSLEVEL_SystemPlusClient.equals(accessLevel)) { + // client foreign keys are OK if the table has reference All or System+Client + validValue = true; + } + } + } + if (! validValue) { + throw new Exception("Persistent Object not updated - AD_Table_ID=" + + getAD_Table_ID() + ", Record_ID=" + getRecord_ID() + + " - Value=" + value + " is not valid for a foreign key"); + } + } + } else dbValue = value; - m_po.set_ValueOfColumn(getNode().getAD_Column_ID(), dbValue); + if (!m_po.set_ValueOfColumnReturningBoolean(getNode().getAD_Column_ID(), dbValue)) { + throw new Exception("Persistent Object not updated - AD_Table_ID=" + + getAD_Table_ID() + ", Record_ID=" + getRecord_ID() + + " - Value=" + value + " error : " + CLogger.retrieveErrorString("check logs")); + } m_po.saveEx(); if (dbValue != null && !dbValue.equals(m_po.get_ValueOfColumn(getNode().getAD_Column_ID()))) throw new Exception("Persistent Object not updated - AD_Table_ID=" diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNode.java b/org.adempiere.base/src/org/compiere/wf/MWFNode.java index 92d09ae777..434c037abd 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFNode.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFNode.java @@ -30,6 +30,7 @@ import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; import org.compiere.model.MColumn; +import org.compiere.model.MRole; import org.compiere.model.Query; import org.compiere.model.X_AD_WF_Node; import org.compiere.util.CCache; @@ -603,6 +604,16 @@ public class MWFNode extends X_AD_WF_Node log.saveError("FillMandatory", Msg.getElement(getCtx(), "AttributeValue")); return false; } + if (getAD_Column_ID() > 0) { + // validate that just advanced roles can manipulate secure content via workflows + MColumn column = MColumn.get(getCtx(), getAD_Column_ID()); + if (column.isSecure() || column.isAdvanced()) { + if (! MRole.getDefault().isAccessAdvanced()) { + log.saveError("AccessTableNoUpdate", Msg.getElement(getCtx(), column.getColumnName())); + return false; + } + } + } } else if (action.equals(ACTION_SubWorkflow)) { From e3690e803b237006dd14ba9677cc07ef4ffccfbd Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 7 Sep 2017 19:32:33 +0200 Subject: [PATCH 28/33] IDEMPIERE-3449 - fix login failing when the role in preferences doesn't have any org accessible for the user going into the system --- .../WEB-INF/src/org/adempiere/webui/panel/RolePanel.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index 447fa771d1..656c3b3a9a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -143,6 +143,14 @@ public class RolePanel extends Window implements EventListener, Deferrabl this.setId("rolePanel"); this.setSclass("login-box"); + if (! m_show) { + // check if all mandatory fields are ok to not show + if ( lstRole.getSelectedItem() == null || lstRole.getSelectedItem().getValue() == null + || lstClient.getSelectedItem() == null || lstClient.getSelectedItem().getValue() == null + || lstOrganisation.getSelectedItem() == null || lstOrganisation.getSelectedItem().getValue() == null) { + m_show = true; + } + } if (m_show) { AuFocus auf = null; if (lstClient.getItemCount() > 1) { From 01124f8ee45692cdbe451aae646d4a07e531cb30 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 8 Sep 2017 14:52:25 +0200 Subject: [PATCH 29/33] IDEMPIERE-3471 Fix amount in words for Brazilian Portuguese / Thanks to Ricardo Santana (ralexsander) --- .../src/org/compiere/util/AmtInWords_PT.java | 365 +++++++++++------- 1 file changed, 230 insertions(+), 135 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/AmtInWords_PT.java b/org.adempiere.base/src/org/compiere/util/AmtInWords_PT.java index 836d186236..46f8379ef2 100644 --- a/org.adempiere.base/src/org/compiere/util/AmtInWords_PT.java +++ b/org.adempiere.base/src/org/compiere/util/AmtInWords_PT.java @@ -1,6 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * Product: ADempiereLBR - ADempiere Localization Brazil * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * @@ -10,18 +9,18 @@ * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ package org.compiere.util; +import java.math.BigDecimal; + /** * Portuguese Amount in Words * * @author Jorg Janke - http://www.rgagnon.com/javadetails/java-0426.html - * @translator emontenegro - * @version $Id: AmtInWords_PT.java,v 1.0 2008/01/07 00:54:36 jjanke Exp $ + * @translator emontenegro, ralexsander + * @contributor mgrigioni - UTF-8 Code + * @version $Id: AmtInWords_PT.java,v 1.0 2008/01/07 00:54:36 ralexsander Exp $ */ public class AmtInWords_PT implements AmtInWords { @@ -33,24 +32,48 @@ public class AmtInWords_PT implements AmtInWords super (); } // AmtInWords_PT + private static final String[] centsNames = { + "", + "", + "", + " D\u00e9cimo de", + " Cent\u00e9simo de", + " Mil\u00e9simo de", + " Milion\u00e9simo de", + " Bilion\u00e9simo de", + " Trilion\u00e9simo de" + }; + + private static final String[] centsNamesPlural = { + "", + "", + "", + " D\u00e9cimos de", + " Cent\u00e9simos de", + " Mil\u00e9simos de", + " Milion\u00e9simos de", + " Bilion\u00e9simos de", + " Trilion\u00e9simos de" + }; + private static final String[] majorNames = { "", " Mil", - " Milhão", - " Bilhão", - " Trilhão", - " Quatrilhão", - " Quinquilhão" + " Milh\u00e3o", + " Bilh\u00e3o", + " Trilh\u00e3o", + " Quatrilh\u00e3o", + " Quinquilh\u00e3o" }; private static final String[] majorNamesPlural = { "", " Mil", - " Milhões", - " Bilhões", - " Trilhões", - " Quatrilhões", - " Quinquilhões" + " Milh\u00f5es", + " Bilh\u00f5es", + " Trilh\u00f5es", + " Quatrilh\u00f5es", + " Quinquilh\u00f5es" }; private static final String[] tensNames = { @@ -59,7 +82,7 @@ public class AmtInWords_PT implements AmtInWords " Vinte", " Trinta", " Quarenta", - " Cinqüenta", + " Cinq\u00fcenta", " Sessenta", " Setenta", " Oitenta", @@ -70,7 +93,7 @@ public class AmtInWords_PT implements AmtInWords "", " Um", " Dois", - " Três", + " Tr\u00eas", " Quatro", " Cinco", " Seis", @@ -111,7 +134,7 @@ public class AmtInWords_PT implements AmtInWords if (s.endsWith ("2") && !soFar.equals("")) soFar = " Vinte e " + soFar.trim (); else if (soFar.equals("")) - soFar = tensNames[number % 10] + " e" + soFar; + soFar = tensNames[number % 10] + soFar; else soFar = tensNames[number % 10] + " e" + soFar; number /= 10; @@ -134,29 +157,31 @@ public class AmtInWords_PT implements AmtInWords * @param number * @return amt */ - private String convert (int number) + private String convert (BigDecimal number) { /* special case */ - if (number == 0) + if (number.compareTo(Env.ZERO) == 0) return ""; - if (number == 1) + if (number.compareTo(Env.ONE) == 0) return "Um"; - if (number == -1) + if (number.compareTo(Env.ONE.negate()) == 0) return "Menos Um"; String prefix = ""; - if (number < 0) + if (number.compareTo(Env.ZERO) == -1) { - number = -number; + number = number.negate(); prefix = "Menos"; } - if (number > 1000000 && number < 2000000){ + + /*if ((number >= 1000000 && number < 2000000) + || (number >= 1000000000 && number < 2000000000)){ prefix = "Um"; - } + }*/ String soFar = ""; int place = 0; do { - int n = number % 1000; + int n = number.divideAndRemainder(new BigDecimal(1000))[1].intValue();/// % 1000; if (n != 0) { String s = convertLessThanOneThousand (n); @@ -168,9 +193,9 @@ public class AmtInWords_PT implements AmtInWords { s = s.replaceFirst ("Dois Cento es", "Duzentos"); } - if (s.startsWith ("Três Cento es", 1)) + if (s.startsWith ("Tr\u00eas Cento es", 1)) { - s = s.replaceFirst ("Três Cento es", "Trezentos"); + s = s.replaceFirst ("Tr\u00eas Cento es", "Trezentos"); } if (s.startsWith ("Quatro Cento es", 1)) { @@ -198,22 +223,38 @@ public class AmtInWords_PT implements AmtInWords } if (s.equals(" Um")) { - soFar = majorNames[place] + soFar; + soFar = s + majorNames[place] + (soFar.equals("") ? "" : " e" + soFar); } else { - if (n > 1) { - soFar = s + majorNamesPlural[place] + soFar; - } else { - soFar = s + majorNames[place] + soFar; - } + if (n > 1) + { + soFar = s + majorNamesPlural[place] + (soFar.equals("") ? "" : " e" + soFar); + //soFar = s + majorNamesPlural[place] + soFar; + } + else + { + soFar = s + majorNames[place] + (soFar.equals("") ? "" : " e" + soFar); + } } } place++; - number /= 1000; + number = number.divideAndRemainder(new BigDecimal(1000))[0]; } - while (number > 0); - return (prefix + soFar).trim (); + while (number.compareTo(Env.ZERO) == 1); + return (prefix + soFar) + .replaceAll(" e Mil", " Mil") + .trim (); } // convert + + public String getAmtInWords (BigDecimal amount) throws Exception + { + amount = amount.setScale(2, BigDecimal.ROUND_HALF_UP); + + String samount = amount.toString(); + samount = samount.replaceAll("\\.", ","); + + return getAmtInWords(samount); + } /************************************************************************** @@ -227,130 +268,184 @@ public class AmtInWords_PT implements AmtInWords if (amount == null) return amount; // - StringBuilder sb = new StringBuilder (); - // int pos = amount.lastIndexOf ('.'); // Old - int pos = amount.lastIndexOf (','); - // int pos2 = amount.lastIndexOf (','); // Old - int pos2 = amount.lastIndexOf ('.'); + StringBuffer sb = new StringBuffer (); + int pos = amount.lastIndexOf ('.'); // Old + // int pos = amount.lastIndexOf (','); + int pos2 = amount.lastIndexOf (','); // Old + // int pos2 = amount.lastIndexOf ('.'); if (pos2 > pos) pos = pos2; String oldamt = amount; - // amount = amount.replaceAll (",", ""); // Old + amount = amount.replaceAll ("\\.", "").replaceAll (",", "."); // Old String vlr = amount.replaceAll (",", "."); - amount = amount.replaceAll( "\\.",""); - // int newpos = amount.lastIndexOf ('.'); // Old - int newpos = amount.lastIndexOf (','); - int pesos = Integer.parseInt (amount.substring (0, newpos)); + int newpos = amount.lastIndexOf ('.'); // Old + // int newpos = amount.lastIndexOf (','); + if (newpos == -1) newpos = amount.length(); + BigDecimal reais = new BigDecimal(amount.substring (0, newpos)); double valor = Double.parseDouble(vlr); - sb.append (convert (pesos)); + sb.append (convert (reais)); for (int i = 0; i < oldamt.length (); i++) { if (pos == i) // we are done { - String cents = oldamt.substring (i + 1); - if (valor > 0 && valor < 1) { - if (Integer.parseInt(cents) > 0) + String cents = oldamt.substring (i + 1); + do { - if (Integer.parseInt(cents) > 1) + if(cents.endsWith("0") && cents.length() > 2) + cents = cents.substring(0, cents.length() -1); + } + while (cents.endsWith("0") && cents.length() > 2); + + if (valor > 0 && valor < 1) + { + if (Integer.parseInt(cents) > 0) { - //sb.append (' ') - //.append("e ") - sb.append (convert(Integer.parseInt(cents))) - .append(" Centavos"); - // .append ("/100"); - // .append ("/100 PESOS"); + if (Integer.parseInt(cents) > 1) + { + sb.append (convert(new BigDecimal(cents))) + .append(" Centavos"); + } + else + { + sb.append (convert(new BigDecimal(cents))) + .append(" Centavo"); + } } - else { - //sb.append (' ') - //.append("e ") - sb.append (convert(Integer.parseInt(cents))) - .append(" Centavo"); - // .append ("/100"); - // .append ("/100 PESOS"); - } - } - } - else if ((valor > 1 && valor < 2) || (valor > -2 && valor < -1)){ - if (Integer.parseInt(cents) > 0) - { - if (Integer.parseInt(cents) > 1) - { - sb.append (' ') - .append("Real e ") - .append (convert(Integer.parseInt(cents))) - .append(" Centavos"); - // .append ("/100"); - // .append ("/100 PESOS"); } - else { - sb.append (' ') - .append("Real e ") - .append (convert(Integer.parseInt(cents))) - .append(" Centavo"); - // .append ("/100"); - // .append ("/100 PESOS"); - } - break; - } - } - else if (valor > -1 && valor < 0){ - if (Integer.parseInt(cents) > 0) + else if ((valor > 1 && valor < 2) || (valor > -2 && valor < -1)) { - if (Integer.parseInt(cents) > 1) + if (Integer.parseInt(cents) > 0) { - sb.append ("Menos ") - // .append("Real e ") - .append (convert(Integer.parseInt(cents))) - .append(" Centavos"); - // .append ("/100"); - // .append ("/100 PESOS"); + if (Integer.parseInt(cents) > 1) + { + sb.append (' ') + .append("Real e ") + .append (convert(new BigDecimal(cents))) + .append(" Centavos"); + } + else + { + sb.append (' ') + .append("Real e ") + .append (convert(new BigDecimal(cents))) + .append(" Centavo"); + } + break; } - else { - sb.append ("Menos ") - //.append("Real e ") - .append (convert(Integer.parseInt(cents))) - .append(" Centavo"); - // .append ("/100"); - // .append ("/100 PESOS"); - } - break; } - } - else { - if (Integer.parseInt(cents) > 0) + else if (valor > -1 && valor < 0) { - if (Integer.parseInt(cents) > 1) + if (Integer.parseInt(cents) > 0) { - sb.append (' ') - .append("Reais e ") - .append (convert(Integer.parseInt(cents))) - .append(" Centavos"); - // .append ("/100"); - // .append ("/100 PESOS"); + if (Integer.parseInt(cents) > 1) + { + sb.append ("Menos ") + .append (convert(new BigDecimal(cents))) + .append(centsNamesPlural[cents.length()]) + .append(centsNamesPlural[cents.length()].equals("") ? " Centavos" : " Centavo"); + } + else + { + sb.append ("Menos ") + .append (convert(new BigDecimal(cents))) + .append(centsNames[cents.length()]) + .append(" Centavo"); + } + break; } - else { - sb.append (' ') - .append("Reais e ") - .append (convert(Integer.parseInt(cents))) - .append(" Centavo"); - // .append ("/100"); - // .append ("/100 PESOS"); - } - break; } + else + { + if (!cents.equals("") && Integer.parseInt(cents) > 0) + { + if (Integer.parseInt(cents) > 1) + { + sb.append (' ') + .append("Reais e ") + .append (convert(new BigDecimal(cents))) + .append(centsNamesPlural[cents.length()]) + .append(centsNamesPlural[cents.length()].equals("") ? " Centavos" : " Centavo"); + } + else + { + sb.append (' ') + .append("Reais e ") + .append (convert(new BigDecimal(cents))) + .append(centsNames[cents.length()]) + .append(" Centavo"); + } + break; + } + else + { + if (reais.abs().compareTo(Env.ONE) == 0) + sb.append(" Real"); + else + sb.append(" Reais"); + } } } } - return sb.toString (); + if (pos == -1){ + if (reais.abs().compareTo(Env.ONE) == 0) + sb.append(" Real"); + else + sb.append(" Reais"); + } + + /** Corre\u00e7\u00f5es */ + String result; + result = sb.toString () + .replaceAll(" e Quinquilh", " Quinquilh") + .replaceAll(" e Quatrilh", " Quatrilh") + .replaceAll(" e Trilh", " Trilh") + .replaceAll(" e Bilh", " Bilh") + .replaceAll(" e Milh", " Milh") + .replaceAll("\u00f5es Reais", "\u00f5es de Reais") + .replaceAll("\u00e3o Reais", "\u00e3o de Reais") + .replaceAll(" e Reais", " Reais") + .replaceAll(", de", " de"); + + if (result.indexOf("Quinquilh") > 0 && result.indexOf("Quatrilh") > 0 && result.indexOf("Quatrilh\u00f5es de Rea") == -1 && result.indexOf("Quatrilh\u00e3o de Rea") == -1) + result = result.replaceAll("Quinquilh\u00f5es e", "Quinquilh\u00f5es,").replaceAll("Quinquilh\u00e3o e", "Quinquilh\u00e3o,"); + + if (result.indexOf("Quatrilh") > 0 && result.indexOf("Trilh") > 0 && result.indexOf("Trilh\u00f5es de Rea") == -1 && result.indexOf("Trilh\u00e3o de Rea") == -1) + result = result.replaceAll("Quatrilh\u00f5es e", "Quatrilh\u00f5es,").replaceAll("Quatrilh\u00e3o e", "Quatrilh\u00e3o,"); + + if (result.indexOf("Trilh") > 0 && result.indexOf("Bilh") > 0 && result.indexOf("Bilh\u00f5es de Rea") == -1 && result.indexOf("Bilh\u00e3o de Rea") == -1) + result = result.replaceAll("Trilh\u00f5es e", "Trilh\u00f5es,").replaceAll("Trilh\u00e3o e", "Trilh\u00e3o,"); + + if (result.indexOf("Bilh") > 0 && result.indexOf("Milh") > 0 && result.indexOf("Milh\u00f5es de Rea") == -1 && result.indexOf("Milh\u00e3o de Rea") == -1) + result = result.replaceAll("Bilh\u00f5es e", "Bilh\u00f5es,").replaceAll("Bilh\u00e3o e", "Bilh\u00e3o,"); + + if (result.indexOf("Milh") > 0 && result.indexOf(" de Rea") == -1 && result.indexOf("Mil e") > 0) + result = result.replaceAll("Milh\u00f5es e", "Milh\u00f5es,").replaceAll("Milh\u00e3o e", "Milh\u00e3o,"); + + return result ; } // getAmtInWords - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Exception + { AmtInWords_PT aiw = new AmtInWords_PT(); - // for (int i=0; i<=2147000000; i++) - // System.out.println(aiw.getAmtInWords(i+",00")); - System.out.println(aiw.getAmtInWords("134502932,01")); + System.out.println(aiw.getAmtInWords("42")); + System.out.println(aiw.getAmtInWords("0,42")); + System.out.println(aiw.getAmtInWords("100")); + System.out.println(aiw.getAmtInWords("100,00")); + System.out.println(aiw.getAmtInWords("1003,00")); + System.out.println(aiw.getAmtInWords("5715,13")); + System.out.println(aiw.getAmtInWords("5715,11")); + System.out.println(aiw.getAmtInWords("5715,20")); + System.out.println(aiw.getAmtInWords("5715,30")); + System.out.println(aiw.getAmtInWords("5715,44")); + System.out.println(aiw.getAmtInWords("5715,55")); + System.out.println(aiw.getAmtInWords("5715,60")); + System.out.println(aiw.getAmtInWords("5715,79")); + System.out.println(aiw.getAmtInWords("5715,82")); + System.out.println(aiw.getAmtInWords("5715,90")); + + System.out.println(aiw.getAmtInWords(new BigDecimal(51.34))); } } // AmtInWords_PT From 14faeeec5c454c62dcb399199114183fbbaee5a8 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 8 Sep 2017 15:13:52 +0200 Subject: [PATCH 30/33] IDEMPIERE-3477 Allow use of variables in workflow next condition / thanks to Ricardo Santana (ralexsander) --- .../src/org/compiere/wf/MWFNextCondition.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNextCondition.java b/org.adempiere.base/src/org/compiere/wf/MWFNextCondition.java index 1204fc4f6b..c132f18231 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWFNextCondition.java +++ b/org.adempiere.base/src/org/compiere/wf/MWFNextCondition.java @@ -22,6 +22,7 @@ import java.util.Properties; import java.util.logging.Level; import org.compiere.model.PO; +import org.compiere.util.Env; import org.compiere.model.X_AD_WF_NextCondition; /** @@ -130,15 +131,20 @@ public class MWFNextCondition extends X_AD_WF_NextCondition { String sRet = sValue; - if(sValue != null && sValue.startsWith("@")) + if (sValue == null) + ; + else if (sValue.startsWith("@COL=")) { - if(sValue.startsWith("@COL=")) - { - Object o = po.get_Value(sValue.substring(5)); - - if(o != null) - sRet = o.toString(); - } + Object o = po.get_Value(sValue.substring(5)); + // + if(o != null) + sRet = o.toString(); + } + else if (sValue.startsWith("@") + && sValue.endsWith("@") + && sValue.length() > 1) + { + sRet = Env.parseVariable (sValue, po, null, false); } return sRet; From f74f08c52124dc87624ded7fe6c59ce7b0192e1a Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 8 Sep 2017 15:19:38 +0200 Subject: [PATCH 31/33] IDEMPIERE-3472 Env.parseVariable not keeping unparseable variable / thanks to Ricardo Santana (ralexsander) --- org.adempiere.base/src/org/compiere/util/Env.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index 3458c86fa9..c8eaa091f9 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -1673,7 +1673,14 @@ public final class Env outStr.append("@"); } } - + else if (keepUnparseable) + { + outStr.append("@"+token); + if (format.length() > 0) + outStr.append("<"+format+">"); + outStr.append("@"); + } + inStr = inStr.substring(j+1, inStr.length()); // from second @ i = inStr.indexOf('@'); } From 9361e0f36c0d5a9990cca27b15a94462cfc84b3a Mon Sep 17 00:00:00 2001 From: Andy Conn Date: Fri, 8 Sep 2017 15:29:00 +0200 Subject: [PATCH 32/33] IDEMPIERE-3469 MProductPricing does not consider new Product in current transaction --- .../org/compiere/model/MProductPricing.java | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index da08e5ecc8..3474a11ff7 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -35,6 +35,25 @@ import org.compiere.util.Trace; */ public class MProductPricing { + + String trxName=null; + + public MProductPricing (int M_Product_ID, int C_BPartner_ID, + BigDecimal Qty, boolean isSOTrx, String trxName) + { + this.trxName=trxName; + + m_M_Product_ID = M_Product_ID; + m_C_BPartner_ID = C_BPartner_ID; + if (Qty != null && Env.ZERO.compareTo(Qty) != 0) + m_Qty = Qty; + m_isSOTrx = isSOTrx; + int thereAreVendorBreakRecords = DB.getSQLValue(trxName, + "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)", + m_M_Product_ID, m_C_BPartner_ID); + m_useVendorBreak = thereAreVendorBreakRecords > 0; + } + /** * Constructor @@ -42,19 +61,12 @@ public class MProductPricing * @param C_BPartner_ID partner * @param Qty quantity * @param isSOTrx SO or PO + * @deprecated Use constructor with explicit trxName parameter */ public MProductPricing (int M_Product_ID, int C_BPartner_ID, BigDecimal Qty, boolean isSOTrx) { - m_M_Product_ID = M_Product_ID; - m_C_BPartner_ID = C_BPartner_ID; - if (Qty != null && Env.ZERO.compareTo(Qty) != 0) - m_Qty = Qty; - m_isSOTrx = isSOTrx; - int thereAreVendorBreakRecords = DB.getSQLValue(null, - "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)", - m_M_Product_ID, m_C_BPartner_ID); - m_useVendorBreak = thereAreVendorBreakRecords > 0; + this(M_Product_ID,C_BPartner_ID,Qty,isSOTrx,null); } // MProductPricing private int m_M_Product_ID; @@ -167,7 +179,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt(1, m_M_Product_ID); pstmt.setInt(2, m_M_PriceList_Version_ID); rs = pstmt.executeQuery(); @@ -286,7 +298,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt(1, m_M_Product_ID); pstmt.setInt(2, m_M_PriceList_ID); rs = pstmt.executeQuery(); @@ -367,7 +379,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt(1, m_M_Product_ID); pstmt.setInt(2, m_M_PriceList_ID); rs = pstmt.executeQuery(); @@ -448,7 +460,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt(1, m_M_Product_ID); pstmt.setInt(2, m_M_PriceList_Version_ID); pstmt.setInt(3, m_C_BPartner_ID); @@ -571,7 +583,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt(1, m_M_Product_ID); pstmt.setInt(2, m_M_PriceList_ID); pstmt.setInt(3, m_C_BPartner_ID); @@ -656,7 +668,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt(1, m_M_Product_ID); pstmt.setInt(2, m_M_PriceList_ID); pstmt.setInt(3, m_C_BPartner_ID); @@ -755,7 +767,7 @@ public class MProductPricing ResultSet rs = null; try { - pstmt = DB.prepareStatement (sql, null); + pstmt = DB.prepareStatement (sql, trxName); pstmt.setInt (1, m_C_BPartner_ID); rs = pstmt.executeQuery (); if (rs.next ()) From 82ba01d4a33dcb5a1a9e2f6f7d9f9caebba83d13 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Fri, 8 Sep 2017 15:29:41 +0200 Subject: [PATCH 33/33] IDEMPIERE-3469 MProductPricing does not consider new Product in current transaction / peer review - solve deprecated warnings --- .../src/org/adempiere/model/CalloutRMA.java | 2 +- .../org/compiere/model/CalloutInvoice.java | 6 ++-- .../src/org/compiere/model/CalloutOrder.java | 6 ++-- .../compiere/model/CalloutRequisition.java | 2 +- .../compiere/process/ProjectLinePricing.java | 2 +- .../src/org/compiere/model/MInvoiceLine.java | 2 +- .../src/org/compiere/model/MOrderLine.java | 2 +- .../org/compiere/model/MProductPricing.java | 36 +++++++++++-------- .../src/org/compiere/model/MProjectLine.java | 2 +- .../src/org/compiere/model/MRMALine.java | 2 +- .../org/compiere/model/MRequisitionLine.java | 2 +- 11 files changed, 36 insertions(+), 28 deletions(-) diff --git a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java index 5fc2be2af1..bdadacea6a 100644 --- a/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java +++ b/org.adempiere.base.callout/src/org/adempiere/model/CalloutRMA.java @@ -146,7 +146,7 @@ public class CalloutRMA extends CalloutEngine { return ""; MRMA rma = new MRMA(ctx, M_RMA_ID, null); - MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx()); + MProductPricing pp = new MProductPricing(M_Product_ID, rma.getC_BPartner_ID(), Env.ONE, rma.isSOTrx(), null); int taxId = 0; int precision = 0; diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java index a88914c794..e8b3f4f666 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -327,7 +327,7 @@ public class CalloutInvoice extends CalloutEngine boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyInvoiced"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -564,7 +564,7 @@ public class CalloutInvoice extends CalloutEngine if (QtyInvoiced == null) QtyInvoiced = QtyEntered; boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyInvoiced, IsSOTrx, null); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); @@ -845,7 +845,7 @@ public class CalloutInvoice extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 89050f16d0..7cc24c63aa 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -800,7 +800,7 @@ public class CalloutOrder extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); @@ -1096,7 +1096,7 @@ public class CalloutOrder extends CalloutEngine if (QtyOrdered == null) QtyOrdered = QtyEntered; boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID, C_BPartner_ID, QtyOrdered, IsSOTrx, null); pp.setM_PriceList_ID(M_PriceList_ID); int M_PriceList_Version_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_Version_ID"); pp.setM_PriceList_Version_ID(M_PriceList_Version_ID); @@ -1425,7 +1425,7 @@ public class CalloutOrder extends CalloutEngine int C_BPartner_ID = Env.getContextAsInt(ctx, WindowNo, "C_BPartner_ID"); BigDecimal Qty = (BigDecimal)mTab.getValue("QtyOrdered"); boolean IsSOTrx = Env.getContext(ctx, WindowNo, "IsSOTrx").equals("Y"); - MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx); + MProductPricing pp = new MProductPricing (M_Product_ID.intValue(), C_BPartner_ID, Qty, IsSOTrx, null); // int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java index 87f57e588a..5391757bda 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutRequisition.java @@ -100,7 +100,7 @@ public class CalloutRequisition extends CalloutEngine int C_BPartner_ID = line.getC_BPartner_ID(); BigDecimal Qty = line.getQty(); boolean isSOTrx = false; - MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx); + MProductPricing pp = new MProductPricing (line.getM_Product_ID(), C_BPartner_ID, Qty, isSOTrx, null); // int M_PriceList_ID = req.getM_PriceList_ID(); pp.setM_PriceList_ID(M_PriceList_ID); diff --git a/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java b/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java index 7d6357cd84..695c6201cd 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java +++ b/org.adempiere.base.process/src/org/compiere/process/ProjectLinePricing.java @@ -72,7 +72,7 @@ public class ProjectLinePricing extends SvrProcess // boolean isSOTrx = true; MProductPricing pp = new MProductPricing (projectLine.getM_Product_ID(), - project.getC_BPartner_ID(), projectLine.getPlannedQty(), isSOTrx); + project.getC_BPartner_ID(), projectLine.getPlannedQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(project.getM_PriceList_ID()); pp.setPriceDate(project.getDateContract()); // diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index c2957335dd..e0a80eafb4 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -379,7 +379,7 @@ public class MInvoiceLine extends X_C_InvoiceLine // if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID); m_productPricing = new MProductPricing (getM_Product_ID(), - C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx); + C_BPartner_ID, getQtyInvoiced(), m_IsSOTrx, get_TrxName()); m_productPricing.setM_PriceList_ID(M_PriceList_ID); m_productPricing.setPriceDate(m_DateInvoiced); // diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java index 36c8e1c5ab..ffa04d4299 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java @@ -324,7 +324,7 @@ public class MOrderLine extends X_C_OrderLine protected MProductPricing getProductPricing (int M_PriceList_ID) { m_productPrice = new MProductPricing (getM_Product_ID(), - getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx); + getC_BPartner_ID(), getQtyOrdered(), m_IsSOTrx, get_TrxName()); m_productPrice.setM_PriceList_ID(M_PriceList_ID); m_productPrice.setPriceDate(getDateOrdered()); // diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index 3474a11ff7..b49cd5357e 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -36,23 +36,31 @@ import org.compiere.util.Trace; public class MProductPricing { - String trxName=null; + private String trxName=null; + /** + * Constructor + * @param M_Product_ID product + * @param C_BPartner_ID partner + * @param Qty quantity + * @param isSOTrx SO or PO + * @param trxName the transaction + */ public MProductPricing (int M_Product_ID, int C_BPartner_ID, BigDecimal Qty, boolean isSOTrx, String trxName) - { - this.trxName=trxName; - - m_M_Product_ID = M_Product_ID; - m_C_BPartner_ID = C_BPartner_ID; - if (Qty != null && Env.ZERO.compareTo(Qty) != 0) - m_Qty = Qty; - m_isSOTrx = isSOTrx; - int thereAreVendorBreakRecords = DB.getSQLValue(trxName, - "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)", - m_M_Product_ID, m_C_BPartner_ID); - m_useVendorBreak = thereAreVendorBreakRecords > 0; - } + { + this.trxName=trxName; + + m_M_Product_ID = M_Product_ID; + m_C_BPartner_ID = C_BPartner_ID; + if (Qty != null && Env.ZERO.compareTo(Qty) != 0) + m_Qty = Qty; + m_isSOTrx = isSOTrx; + int thereAreVendorBreakRecords = DB.getSQLValue(trxName, + "SELECT count(M_Product_ID) FROM M_ProductPriceVendorBreak WHERE M_Product_ID=? AND (C_BPartner_ID=? OR C_BPartner_ID is NULL)", + m_M_Product_ID, m_C_BPartner_ID); + m_useVendorBreak = thereAreVendorBreakRecords > 0; + } /** diff --git a/org.adempiere.base/src/org/compiere/model/MProjectLine.java b/org.adempiere.base/src/org/compiere/model/MProjectLine.java index c01137b648..22f92c20fe 100644 --- a/org.adempiere.base/src/org/compiere/model/MProjectLine.java +++ b/org.adempiere.base/src/org/compiere/model/MProjectLine.java @@ -148,7 +148,7 @@ public class MProjectLine extends X_C_ProjectLine return limitPrice; boolean isSOTrx = true; MProductPricing pp = new MProductPricing (getM_Product_ID(), - m_parent.getC_BPartner_ID(), getPlannedQty(), isSOTrx); + m_parent.getC_BPartner_ID(), getPlannedQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(m_parent.getM_PriceList_ID()); if (pp.calculatePrice()) limitPrice = pp.getPriceLimit(); diff --git a/org.adempiere.base/src/org/compiere/model/MRMALine.java b/org.adempiere.base/src/org/compiere/model/MRMALine.java index 86ab492117..d9899cf8b6 100644 --- a/org.adempiere.base/src/org/compiere/model/MRMALine.java +++ b/org.adempiere.base/src/org/compiere/model/MRMALine.java @@ -147,7 +147,7 @@ public class MRMALine extends X_M_RMALine } else if (getM_Product_ID() != 0) { - MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx()); + MProductPricing pp = new MProductPricing (getM_Product_ID(), getParent().getC_BPartner_ID(), Env.ONE, getParent().isSOTrx(), get_TrxName()); MInvoice invoice = getParent().getOriginalInvoice(); if (invoice != null) diff --git a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java index a2b6c9ab73..322c82de36 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisitionLine.java @@ -234,7 +234,7 @@ public class MRequisitionLine extends X_M_RequisitionLine if (log.isLoggable(Level.FINE)) log.fine("M_PriceList_ID=" + M_PriceList_ID); boolean isSOTrx = false; MProductPricing pp = new MProductPricing (getM_Product_ID(), - getC_BPartner_ID(), getQty(), isSOTrx); + getC_BPartner_ID(), getQty(), isSOTrx, get_TrxName()); pp.setM_PriceList_ID(M_PriceList_ID); // pp.setPriceDate(getDateOrdered()); //