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/201707202213_IDEMPIERE-3424.sql b/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql new file mode 100755 index 0000000000..38d5a2714f --- /dev/null +++ b/migration/i4.1/oracle/201707202213_IDEMPIERE-3424.sql @@ -0,0 +1,15 @@ +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) DEFERRABLE INITIALLY DEFERRED +; + + +SELECT register_migration_script('201707202213_IDEMPIERE-3424.sql') FROM dual +; + 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/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/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/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/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/oracle/201709151000_IDEMPIERE-3488.sql b/migration/i4.1/oracle/201709151000_IDEMPIERE-3488.sql new file mode 100644 index 0000000000..06b9126c82 --- /dev/null +++ b/migration/i4.1/oracle/201709151000_IDEMPIERE-3488.sql @@ -0,0 +1,11 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3488 Improvement to Error Message for Negative Inventory Disallow exception +-- Sep 14, 2017 6:28:55 PM GMT+08:00 +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','The {0} warehouse does not allow negative inventory for Product = {1}, ASI = {2}, Locator = {3} (Shortage of {4})',0,0,'Y',TO_DATE('2017-09-14 18:28:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-09-14 18:28:54','YYYY-MM-DD HH24:MI:SS'),100,200431,'NegativeInventoryDisallowedInfo','D','1a686715-09f5-4437-9885-882719423bd1') +; + +SELECT register_migration_script('201709151000_IDEMPIERE-3488.sql') FROM dual +; + diff --git a/migration/i4.1/oracle/201710131406_IDEMPIERE-3517.sql b/migration/i4.1/oracle/201710131406_IDEMPIERE-3517.sql new file mode 100644 index 0000000000..650e5aa4ca --- /dev/null +++ b/migration/i4.1/oracle/201710131406_IDEMPIERE-3517.sql @@ -0,0 +1,23 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3517 Report Cube - OrgTrx Dimension is not displayed +-- Oct 13, 2017 2:04:42 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_OT@=Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-10-13 14:04:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2344 +; + +-- Oct 13, 2017 2:05:12 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_AY@=Y ', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-10-13 14:05:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3886 +; + +-- Oct 13, 2017 2:05:54 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_OT@=Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-10-13 14:05:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57023 +; + +-- Oct 13, 2017 2:06:02 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_AY@=Y ', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-10-13 14:06:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57013 +; + +SELECT register_migration_script('201710131406_IDEMPIERE-3517.sql') FROM dual +; + diff --git a/migration/i4.1/oracle/201710131604-IDEMPIERE-3519.sql b/migration/i4.1/oracle/201710131604-IDEMPIERE-3519.sql new file mode 100644 index 0000000000..a30fc754fe --- /dev/null +++ b/migration/i4.1/oracle/201710131604-IDEMPIERE-3519.sql @@ -0,0 +1,14 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3519:column updated, created of c_salesregion_trl isn't yet sync so miss default value +-- Oct 13, 2017 12:41:29 PM ICT +ALTER TABLE C_SalesRegion_Trl MODIFY Created DATE DEFAULT SYSDATE +; + +-- Oct 13, 2017 12:41:53 PM ICT +ALTER TABLE C_SalesRegion_Trl MODIFY Updated DATE DEFAULT SYSDATE +; + +SELECT register_migration_script('201710131604-IDEMPIERE-3519.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 +; + 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 +; + 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/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 +; 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 +; + 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/migration/i4.1/postgresql/201709151000_IDEMPIERE-3488.sql b/migration/i4.1/postgresql/201709151000_IDEMPIERE-3488.sql new file mode 100644 index 0000000000..d585048143 --- /dev/null +++ b/migration/i4.1/postgresql/201709151000_IDEMPIERE-3488.sql @@ -0,0 +1,8 @@ +-- IDEMPIERE-3488 Improvement to Error Message for Negative Inventory Disallow exception +-- Sep 14, 2017 6:28:55 PM GMT+08:00 +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','The {0} warehouse does not allow negative inventory for Product = {1}, ASI = {2}, Locator = {3} (Shortage of {4})',0,0,'Y',TO_TIMESTAMP('2017-09-14 18:28:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-09-14 18:28:54','YYYY-MM-DD HH24:MI:SS'),100,200431,'NegativeInventoryDisallowedInfo','D','1a686715-09f5-4437-9885-882719423bd1') +; + +SELECT register_migration_script('201709151000_IDEMPIERE-3488.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201710131406_IDEMPIERE-3517.sql b/migration/i4.1/postgresql/201710131406_IDEMPIERE-3517.sql new file mode 100644 index 0000000000..15d9e8d635 --- /dev/null +++ b/migration/i4.1/postgresql/201710131406_IDEMPIERE-3517.sql @@ -0,0 +1,20 @@ +-- IDEMPIERE-3517 Report Cube - OrgTrx Dimension is not displayed +-- Oct 13, 2017 2:04:42 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_OT@=Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-10-13 14:04:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2344 +; + +-- Oct 13, 2017 2:05:12 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_AY@=Y ', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-10-13 14:05:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3886 +; + +-- Oct 13, 2017 2:05:54 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_OT@=Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-10-13 14:05:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57023 +; + +-- Oct 13, 2017 2:06:02 PM CEST +UPDATE AD_Field SET DisplayLogic='@$Element_AY@=Y ', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-10-13 14:06:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57013 +; + +SELECT register_migration_script('201710131406_IDEMPIERE-3517.sql') FROM dual +; + diff --git a/migration/i4.1/postgresql/201710131604-IDEMPIERE-3519.sql b/migration/i4.1/postgresql/201710131604-IDEMPIERE-3519.sql new file mode 100644 index 0000000000..e3b3479330 --- /dev/null +++ b/migration/i4.1/postgresql/201710131604-IDEMPIERE-3519.sql @@ -0,0 +1,11 @@ +-- IDEMPIERE-3519:column updated, created of c_salesregion_trl isn't yet sync so miss default value +-- Oct 13, 2017 12:41:29 PM ICT +INSERT INTO t_alter_column values('c_salesregion_trl','Created','TIMESTAMP',null,'statement_timestamp()') +; + +-- Oct 13, 2017 12:41:53 PM ICT +INSERT INTO t_alter_column values('c_salesregion_trl','Updated','TIMESTAMP',null,'statement_timestamp()') +; + +SELECT register_migration_script('201710131604-IDEMPIERE-3519.sql') FROM dual +; diff --git a/migration/i4.1z/oracle/201406081604_IDEMPIERE-1926.sql b/migration/i4.1z/oracle/201406081604_IDEMPIERE-1926.sql new file mode 100644 index 0000000000..4356469511 --- /dev/null +++ b/migration/i4.1z/oracle/201406081604_IDEMPIERE-1926.sql @@ -0,0 +1,81 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Aug 6, 2014 1:21:20 AM ICT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,Description,Name,AD_Ref_List_UU,Value,Created,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID) VALUES (200261,302,'Show a info window','User Info','eaf4fa91-3fa3-47f9-9b7f-6ac5b475da68','I',TO_DATE('2014-08-06 01:21:19','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2014-08-06 01:21:19','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0) +; + +-- Aug 6, 2014 1:21:21 AM ICT +INSERT INTO AD_Column (IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,FKConstraintName,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES ('Y',0,211619,'N','N','N',0,'N',10,'N','N','N','Y','85c2fb04-a9ea-48da-b8b5-f665cd351f59','Y','AD_InfoWindow_ID','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.','Info Window','Y',TO_DATE('2014-08-06 01:21:20','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-08-06 01:21:20','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N','ADInfoWindow_ADWFNode','N',3068,19,129) +; + +-- Aug 6, 2014 1:21:21 AM ICT +ALTER TABLE AD_WF_Node ADD AD_InfoWindow_ID NUMBER(10) DEFAULT NULL +; + +-- Aug 6, 2014 1:21:22 AM ICT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,DisplayLogic,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,Created) VALUES ('N',122,14,'N','N',190,'Y',203315,'N','The Info window is used to search and select records as well as display information relevant to the selection.','@Action@=I','Info and search/select Window','Info Window','90092f42-98b1-42cc-915d-86cf77336874','Y','N',100,0,100,TO_DATE('2014-08-06 01:21:21','YYYY-MM-DD HH24:MI:SS'),'Y','Y',180,1,'N',0,2,1,'N','N',211619,'D',TO_DATE('2014-08-06 01:21:21','YYYY-MM-DD HH24:MI:SS')) +; + +-- Aug 6, 2014 1:21:22 AM ICT +UPDATE AD_Field SET SeqNo=200, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1264 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=210, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3666 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=220, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10088 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=230, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10091 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=240, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10090 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=250, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12615 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=260, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12614 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=270, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12616 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=280, DisplayLogic='@Action@=C | @Action@=W | @Action@=X | @Action@=B | @Action@=I', AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8761 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=290, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1269 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=300, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1268 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=310, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8766 +; + +-- Aug 6, 2014 1:21:24 AM ICT +UPDATE AD_Field SET SeqNo=320, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2578 +; + +-- Aug 6, 2014 1:21:24 AM ICT +UPDATE AD_Field SET DisplayLogic='@Action@=C | @Action@=W | @Action@=X | @Action@=B | @Action@=I', AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10920 +; + +-- Aug 6, 2014 1:21:24 AM ICT +UPDATE AD_Field SET DisplayLogic='@Action@=C | @Action@=W | @Action@=X | @Action@=B | @Action@=I', AD_Org_ID=0, AD_Client_ID=0,Updated=TO_DATE('2014-08-06 01:21:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10921 +; +SELECT register_migration_script('201406081604_IDEMPIERE-1926.sql') FROM dual +; diff --git a/migration/i4.1z/oracle/201708020730_IDEMPIERE-2353.sql b/migration/i4.1z/oracle/201708020730_IDEMPIERE-2353.sql new file mode 100644 index 0000000000..3e835df36e --- /dev/null +++ b/migration/i4.1z/oracle/201708020730_IDEMPIERE-2353.sql @@ -0,0 +1,119 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2353 Please, add to WLocationDialog & C_Location new field Address5 +-- 23.07.2017 11:06:25 MSK +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203117,0,0,'Y',TO_DATE('2017-07-23 11:06:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-23 11:06:24','YYYY-MM-DD HH24:MI:SS'),100,'Address5','Address 5','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.','Address 5','D','3b1f35e1-30e1-4bc6-b108-6a1c9da54f51') +; + +-- 23.07.2017 11:06:51 MSK +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,IsToolbarButton,IsSecure) VALUES (213141,1,'Address 5','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',162,'Address5',60,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2017-07-23 11:06:50','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-23 11:06:50','YYYY-MM-DD HH24:MI:SS'),100,203117,'N','N','D','N','N','N','Y','680e8d95-5b70-4d81-a4bb-b9b7f54a3cce','Y','N','N') +; + +-- 23.07.2017 11:08:15 MSK +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,IsToolbarButton,IsSecure) VALUES (213142,1,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',162,'Comments',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_DATE('2017-07-23 11:08:15','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-23 11:08:15','YYYY-MM-DD HH24:MI:SS'),100,230,'Y','N','D','N','N','N','Y','79d8ffc6-6885-43a1-bc9e-9fbd73771f52','Y','N','N') +; + +-- 23.07.2017 11:10:55 MSK +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 (205137,'Address 5','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',154,213141,'Y',60,190,'N','N','N','N',0,0,'Y',TO_DATE('2017-07-23 11:10:54','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-23 11:10:54','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','11698caa-47e0-44f2-a319-31185fc081d7','Y',70,1,5,1,'N','N','N') +; + +-- 23.07.2017 11:11:02 MSK +UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:11:58 MSK +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 (205138,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',154,213142,'Y',60,200,'N','N','N','N',0,0,'Y',TO_DATE('2017-07-23 11:11:57','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-23 11:11:57','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','84a69cfb-ae19-4379-8427-69e017a6d480','Y',70,1,5,1,'N','N','N') +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=545 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=550 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=547 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6297 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202473 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202474 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202475 +; + +-- 23.07.2017 11:13:33 MSK +UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202476 +; + +-- 23.07.2017 11:13:33 MSK +UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:13:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205138 +; + +-- 23.07.2017 11:14:17 MSK +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:14:17 MSK +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=546 +; + +-- 23.07.2017 11:14:17 MSK +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=5754 +; + +-- 23.07.2017 11:18:35 MSK +UPDATE C_Country SET CaptureSequence='@CO@ @R@ @A1@ @C@ @P@ @A2@ @A3@ @A4@ @A5@',Updated=TO_DATE('2017-07-23 11:18:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=286 +; + +-- 23.07.2017 11:20:04 MSK +ALTER TABLE C_Location ADD Address5 VARCHAR2(60) DEFAULT NULL +; + +-- 23.07.2017 11:20:19 MSK +ALTER TABLE C_Location ADD Comments VARCHAR2(2000) DEFAULT NULL +; + +-- 23.07.2017 11:21:03 MSK +UPDATE AD_Field SET SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:21:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=546 +; + +-- 23.07.2017 11:21:03 MSK +UPDATE AD_Field SET SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:21:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5754 +; + +-- 23.07.2017 11:21:03 MSK +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-23 11:21:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:22:13 MSK +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2017-07-23 11:22:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213141 +; + +-- 23.07.2017 11:31:57 MSK +UPDATE C_Country SET CaptureSequence='@CO@ @R@ @A1@ @C@ @P@ @A2@ @A3@ @A4@ @A5@ @Com@',Updated=TO_DATE('2017-07-23 11:31:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=286 +; + +SELECT register_migration_script('201708020730_IDEMPIERE-2353.sql') FROM dual +; + diff --git a/migration/i4.1z/oracle/201708020731_IDEMPIERE-2353.sql b/migration/i4.1z/oracle/201708020731_IDEMPIERE-2353.sql new file mode 100644 index 0000000000..0afb270515 --- /dev/null +++ b/migration/i4.1z/oracle/201708020731_IDEMPIERE-2353.sql @@ -0,0 +1,67 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-2353 Please, add to WLocationDialog & C_Location new field Address5 +-- 24.07.2017 20:26:19 MSK +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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213143,1,'Flat/Office','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',200102,'Address5',60,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2017-07-24 20:26:19','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-24 20:26:19','YYYY-MM-DD HH24:MI:SS'),100,203117,'Y','N','D','N','N','N','Y','1d76a532-ff6f-4a10-a6f8-f09a4cf881e5','Y','N','N','N') +; + +-- 24.07.2017 20:27:20 MSK +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (213144,0,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',200102,'Comments',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_DATE('2017-07-24 20:27:19','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-24 20:27:19','YYYY-MM-DD HH24:MI:SS'),100,230,'Y','N','D','N','N','N','Y','40cdc476-a73a-4822-bc8a-c17937bc9078','Y',0,'N','N') +; + +-- 24.07.2017 20:27:27 MSK +ALTER TABLE C_AddressTransaction ADD Comments VARCHAR2(2000) DEFAULT NULL +; + +-- 24.07.2017 20:27:43 MSK +ALTER TABLE C_AddressTransaction ADD Address5 VARCHAR2(60) DEFAULT NULL +; + +-- 24.07.2017 20:29:51 MSK +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 (205139,'Flat/Office','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',200111,213143,'Y',22,160,'N','N','N','N',0,0,'Y',TO_DATE('2017-07-24 20:29:51','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-24 20:29:51','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','274fb6ef-ff02-4d8f-aabd-06f2c0165640','Y',70,1,2,1,'N','N','N') +; + +-- 24.07.2017 20:30:52 MSK +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205140,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',200111,213144,'Y',0,170,0,'N','N','N','N',0,0,'Y',TO_DATE('2017-07-24 20:30:51','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2017-07-24 20:30:51','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9dd4eef9-4dac-4d13-9862-390ca03ea8e0','Y',160,1,1,1,'N','N','N') +; + +-- 24.07.2017 20:32:17 MSK +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205139 +; + +-- 24.07.2017 20:32:17 MSK +UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202460 +; + +-- 24.07.2017 20:32:17 MSK +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202459 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202468 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202464 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202463 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202465 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202462 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_DATE('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205140 +; + +SELECT register_migration_script('201708020731_IDEMPIERE-2353.sql') FROM dual +; + diff --git a/migration/i4.1z/postgresql/201406081604_IDEMPIERE-1926.sql b/migration/i4.1z/postgresql/201406081604_IDEMPIERE-1926.sql new file mode 100644 index 0000000000..bc3ebd67a0 --- /dev/null +++ b/migration/i4.1z/postgresql/201406081604_IDEMPIERE-1926.sql @@ -0,0 +1,78 @@ +-- Aug 6, 2014 1:21:20 AM ICT +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,Description,Name,AD_Ref_List_UU,Value,Created,CreatedBy,Updated,UpdatedBy,IsActive,EntityType,AD_Client_ID,AD_Org_ID) VALUES (200261,302,'Show a info window','User Info','eaf4fa91-3fa3-47f9-9b7f-6ac5b475da68','I',TO_TIMESTAMP('2014-08-06 01:21:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2014-08-06 01:21:19','YYYY-MM-DD HH24:MI:SS'),100,'Y','D',0,0) +; + +-- Aug 6, 2014 1:21:21 AM ICT +INSERT INTO AD_Column (IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,FKConstraintName,FKConstraintType,AD_Element_ID,AD_Reference_ID,AD_Table_ID) VALUES ('Y',0,211619,'N','N','N',0,'N',10,'N','N','N','Y','85c2fb04-a9ea-48da-b8b5-f665cd351f59','Y','AD_InfoWindow_ID','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.','Info Window','Y',TO_TIMESTAMP('2014-08-06 01:21:20','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-08-06 01:21:20','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N','ADInfoWindow_ADWFNode','N',3068,19,129) +; + +-- Aug 6, 2014 1:21:21 AM ICT +ALTER TABLE AD_WF_Node ADD COLUMN AD_InfoWindow_ID NUMERIC(10) DEFAULT NULL +; + +-- Aug 6, 2014 1:21:22 AM ICT +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,DisplayLogic,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,AD_Column_ID,EntityType,Created) VALUES ('N',122,14,'N','N',190,'Y',203315,'N','The Info window is used to search and select records as well as display information relevant to the selection.','@Action@=I','Info and search/select Window','Info Window','90092f42-98b1-42cc-915d-86cf77336874','Y','N',100,0,100,TO_TIMESTAMP('2014-08-06 01:21:21','YYYY-MM-DD HH24:MI:SS'),'Y','Y',180,1,'N',0,2,1,'N','N',211619,'D',TO_TIMESTAMP('2014-08-06 01:21:21','YYYY-MM-DD HH24:MI:SS')) +; + +-- Aug 6, 2014 1:21:22 AM ICT +UPDATE AD_Field SET SeqNo=200, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1264 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=210, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=3666 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=220, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10088 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=230, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10091 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=240, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10090 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=250, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12615 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=260, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12614 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=270, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12616 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=280, DisplayLogic='@Action@=C | @Action@=W | @Action@=X | @Action@=B | @Action@=I', AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8761 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=290, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1269 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=300, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1268 +; + +-- Aug 6, 2014 1:21:23 AM ICT +UPDATE AD_Field SET SeqNo=310, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8766 +; + +-- Aug 6, 2014 1:21:24 AM ICT +UPDATE AD_Field SET SeqNo=320, AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=2578 +; + +-- Aug 6, 2014 1:21:24 AM ICT +UPDATE AD_Field SET DisplayLogic='@Action@=C | @Action@=W | @Action@=X | @Action@=B | @Action@=I', AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10920 +; + +-- Aug 6, 2014 1:21:24 AM ICT +UPDATE AD_Field SET DisplayLogic='@Action@=C | @Action@=W | @Action@=X | @Action@=B | @Action@=I', AD_Org_ID=0, AD_Client_ID=0,Updated=TO_TIMESTAMP('2014-08-06 01:21:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10921 +; +SELECT register_migration_script('201406081604_IDEMPIERE-1926.sql') FROM dual +; diff --git a/migration/i4.1z/postgresql/201708020730_IDEMPIERE-2353.sql b/migration/i4.1z/postgresql/201708020730_IDEMPIERE-2353.sql new file mode 100644 index 0000000000..ca6d88b0f7 --- /dev/null +++ b/migration/i4.1z/postgresql/201708020730_IDEMPIERE-2353.sql @@ -0,0 +1,116 @@ +-- IDEMPIERE-2353 Please, add to WLocationDialog & C_Location new field Address5 +-- 23.07.2017 11:06:25 MSK +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203117,0,0,'Y',TO_TIMESTAMP('2017-07-23 11:06:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-23 11:06:24','YYYY-MM-DD HH24:MI:SS'),100,'Address5','Address 5','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.','Address 5','D','3b1f35e1-30e1-4bc6-b108-6a1c9da54f51') +; + +-- 23.07.2017 11:06:51 MSK +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,IsToolbarButton,IsSecure) VALUES (213141,1,'Address 5','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',162,'Address5',60,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2017-07-23 11:06:50','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-23 11:06:50','YYYY-MM-DD HH24:MI:SS'),100,203117,'N','N','D','N','N','N','Y','680e8d95-5b70-4d81-a4bb-b9b7f54a3cce','Y','N','N') +; + +-- 23.07.2017 11:08:15 MSK +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,IsToolbarButton,IsSecure) VALUES (213142,1,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',162,'Comments',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_TIMESTAMP('2017-07-23 11:08:15','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-23 11:08:15','YYYY-MM-DD HH24:MI:SS'),100,230,'Y','N','D','N','N','N','Y','79d8ffc6-6885-43a1-bc9e-9fbd73771f52','Y','N','N') +; + +-- 23.07.2017 11:10:55 MSK +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 (205137,'Address 5','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',154,213141,'Y',60,190,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-07-23 11:10:54','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-23 11:10:54','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','U','11698caa-47e0-44f2-a319-31185fc081d7','Y',70,1,5,1,'N','N','N') +; + +-- 23.07.2017 11:11:02 MSK +UPDATE AD_Field SET EntityType='D', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:11:58 MSK +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 (205138,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',154,213142,'Y',60,200,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-07-23 11:11:57','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-23 11:11:57','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','84a69cfb-ae19-4379-8427-69e017a6d480','Y',70,1,5,1,'N','N','N') +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=545 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=550 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=547 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6297 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=548 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202473 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202474 +; + +-- 23.07.2017 11:13:32 MSK +UPDATE AD_Field SET SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202475 +; + +-- 23.07.2017 11:13:33 MSK +UPDATE AD_Field SET SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202476 +; + +-- 23.07.2017 11:13:33 MSK +UPDATE AD_Field SET SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:13:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205138 +; + +-- 23.07.2017 11:14:17 MSK +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:14:17 MSK +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=546 +; + +-- 23.07.2017 11:14:17 MSK +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=5754 +; + +-- 23.07.2017 11:18:35 MSK +UPDATE C_Country SET CaptureSequence='@CO@ @R@ @A1@ @C@ @P@ @A2@ @A3@ @A4@ @A5@',Updated=TO_TIMESTAMP('2017-07-23 11:18:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=286 +; + +-- 23.07.2017 11:20:04 MSK +ALTER TABLE C_Location ADD COLUMN Address5 VARCHAR(60) DEFAULT NULL +; + +-- 23.07.2017 11:20:19 MSK +ALTER TABLE C_Location ADD COLUMN Comments VARCHAR(2000) DEFAULT NULL +; + +-- 23.07.2017 11:21:03 MSK +UPDATE AD_Field SET SeqNo=80, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:21:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=546 +; + +-- 23.07.2017 11:21:03 MSK +UPDATE AD_Field SET SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:21:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5754 +; + +-- 23.07.2017 11:21:03 MSK +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-23 11:21:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205137 +; + +-- 23.07.2017 11:22:13 MSK +UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2017-07-23 11:22:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213141 +; + +-- 23.07.2017 11:31:57 MSK +UPDATE C_Country SET CaptureSequence='@CO@ @R@ @A1@ @C@ @P@ @A2@ @A3@ @A4@ @A5@ @Com@',Updated=TO_TIMESTAMP('2017-07-23 11:31:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE C_Country_ID=286 +; + +SELECT register_migration_script('201708020730_IDEMPIERE-2353.sql') FROM dual +; + diff --git a/migration/i4.1z/postgresql/201708020731_IDEMPIERE-2353.sql b/migration/i4.1z/postgresql/201708020731_IDEMPIERE-2353.sql new file mode 100644 index 0000000000..f3b593859a --- /dev/null +++ b/migration/i4.1z/postgresql/201708020731_IDEMPIERE-2353.sql @@ -0,0 +1,64 @@ +-- IDEMPIERE-2353 Please, add to WLocationDialog & C_Location new field Address5 +-- 24.07.2017 20:26:19 MSK +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,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213143,1,'Flat/Office','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',200102,'Address5',60,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2017-07-24 20:26:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-24 20:26:19','YYYY-MM-DD HH24:MI:SS'),100,203117,'Y','N','D','N','N','N','Y','1d76a532-ff6f-4a10-a6f8-f09a4cf881e5','Y','N','N','N') +; + +-- 24.07.2017 20:27:20 MSK +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure) VALUES (213144,0,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',200102,'Comments',2000,'N','N','N','N','N',0,'N',14,0,0,'Y',TO_TIMESTAMP('2017-07-24 20:27:19','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-24 20:27:19','YYYY-MM-DD HH24:MI:SS'),100,230,'Y','N','D','N','N','N','Y','40cdc476-a73a-4822-bc8a-c17937bc9078','Y',0,'N','N') +; + +-- 24.07.2017 20:27:27 MSK +ALTER TABLE C_AddressTransaction ADD COLUMN Comments VARCHAR(2000) DEFAULT NULL +; + +-- 24.07.2017 20:27:43 MSK +ALTER TABLE C_AddressTransaction ADD COLUMN Address5 VARCHAR(60) DEFAULT NULL +; + +-- 24.07.2017 20:29:51 MSK +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 (205139,'Flat/Office','Address Line 5 for the location','The Address 5 provides additional address information for an entity. It can be used for building location, apartment number or similar information.',200111,213143,'Y',22,160,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-07-24 20:29:51','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-24 20:29:51','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','274fb6ef-ff02-4d8f-aabd-06f2c0165640','Y',70,1,2,1,'N','N','N') +; + +-- 24.07.2017 20:30:52 MSK +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205140,'Comments','Comments or additional information','The Comments field allows for free form entry of additional information.',200111,213144,'Y',0,170,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2017-07-24 20:30:51','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2017-07-24 20:30:51','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9dd4eef9-4dac-4d13-9862-390ca03ea8e0','Y',160,1,1,1,'N','N','N') +; + +-- 24.07.2017 20:32:17 MSK +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205139 +; + +-- 24.07.2017 20:32:17 MSK +UPDATE AD_Field SET SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202460 +; + +-- 24.07.2017 20:32:17 MSK +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202459 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202468 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202464 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202463 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202465 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202462 +; + +-- 24.07.2017 20:32:18 MSK +UPDATE AD_Field SET SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=5, NumLines=3, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2017-07-24 20:32:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205140 +; + +SELECT register_migration_script('201708020731_IDEMPIERE-2353.sql') FROM dual +; + 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 d937cafebc..e8b3f4f666 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 @@ -326,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); @@ -563,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); @@ -844,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 8600179ba8..7cc24c63aa 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; @@ -798,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); @@ -1094,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); @@ -1423,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/com/akunagroup/uk/postcode/AddressInterface.java b/org.adempiere.base/src/com/akunagroup/uk/postcode/AddressInterface.java index de5b33f066..c15ea38dac 100644 --- a/org.adempiere.base/src/com/akunagroup/uk/postcode/AddressInterface.java +++ b/org.adempiere.base/src/com/akunagroup/uk/postcode/AddressInterface.java @@ -43,6 +43,10 @@ public interface AddressInterface public void setStreet3(String newStreet3); public String getStreet4(); public void setStreet4(String newStreet4); + public String getStreet5(); + public void setStreet5(String newStreet5); + public String getComments(); + public void setComments(String newComments); public String getCity(); public void setCity(String newCity); public String getRegion(); diff --git a/org.adempiere.base/src/com/akunagroup/uk/postcode/Postcode.java b/org.adempiere.base/src/com/akunagroup/uk/postcode/Postcode.java index a6d97bafb6..4d85ecbb09 100644 --- a/org.adempiere.base/src/com/akunagroup/uk/postcode/Postcode.java +++ b/org.adempiere.base/src/com/akunagroup/uk/postcode/Postcode.java @@ -34,6 +34,8 @@ public class Postcode implements AddressInterface private String Street2; private String Street3; private String Street4; + private String Street5; + private String Comments; private String City; private String Region; private String Postcode; @@ -97,6 +99,24 @@ public class Postcode implements AddressInterface { Street4 = newStreet4; } + public String getStreet5() + { + return Street5; + } + + public void setStreet5(String newStreet5) + { + Street4 = newStreet5; + } + public String getComments() + { + return Comments; + } + + public void setComments(String newComments) + { + Street4 = newComments; + } public String getCity() { diff --git a/org.adempiere.base/src/org/adempiere/base/event/EventManager.java b/org.adempiere.base/src/org/adempiere/base/event/EventManager.java index acdbc79d31..25d6e98c29 100644 --- a/org.adempiere.base/src/org/adempiere/base/event/EventManager.java +++ b/org.adempiere.base/src/org/adempiere/base/event/EventManager.java @@ -72,7 +72,7 @@ public class EventManager implements IEventManager { */ public static IEventManager getInstance() { synchronized (mutex) { - if (instance == null) { + while (instance == null) { try { mutex.wait(10000); } catch (InterruptedException e) { 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; diff --git a/org.adempiere.base/src/org/adempiere/exceptions/NegativeInventoryDisallowedException.java b/org.adempiere.base/src/org/adempiere/exceptions/NegativeInventoryDisallowedException.java new file mode 100644 index 0000000000..da49059d85 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/exceptions/NegativeInventoryDisallowedException.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (C) 2017 Trek Global Inc. * + * Copyright (C) 2017 Low Heng Sin * + * 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. * + *******************************************************************************/ +package org.adempiere.exceptions; + +import java.math.BigDecimal; +import java.util.Properties; + +import org.compiere.model.MAttributeSetInstance; +import org.compiere.model.MLocator; +import org.compiere.model.MProduct; +import org.compiere.model.MSysConfig; +import org.compiere.model.MWarehouse; +import org.compiere.util.Env; +import org.compiere.util.Msg; + +/** + * + * @author hengsin + * + */ +public class NegativeInventoryDisallowedException extends AdempiereException +{ + /** + * + */ + private static final long serialVersionUID = 253224414462489886L; + + private int M_Warehouse_ID; + private int M_Product_ID; + private int M_AttributeSetInstance_ID; + private int M_Locator_ID; + private BigDecimal QtyOnHand; + private BigDecimal MovementQty; + + public NegativeInventoryDisallowedException(Properties ctx, int M_Warehouse_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_Locator_ID, + BigDecimal QtyOnHand, BigDecimal MovementQty) + { + super(Msg.getMsg(ctx, "NegativeInventoryDisallowedInfo", new Object[] { + MWarehouse.get(ctx, M_Warehouse_ID).getName(), + MProduct.get(ctx, M_Product_ID).getValue() + MSysConfig.getValue(MSysConfig.IDENTIFIER_SEPARATOR, "_", Env.getAD_Client_ID(ctx)) + MProduct.get(ctx, M_Product_ID).getName(), + M_AttributeSetInstance_ID > 0 ? MAttributeSetInstance.get(ctx, M_AttributeSetInstance_ID, M_Product_ID).getDescription() : "0", + M_Locator_ID > 0 ? MLocator.get(ctx, M_Locator_ID).getValue() : "0", MovementQty.subtract(QtyOnHand) + + })); + + this.M_Warehouse_ID = M_Warehouse_ID; + this.M_Product_ID = M_Product_ID; + this.M_AttributeSetInstance_ID = M_AttributeSetInstance_ID; + this.M_Locator_ID = M_Locator_ID; + this.QtyOnHand = QtyOnHand; + this.MovementQty = MovementQty; + } + + public int getM_Warehouse_ID() { + return M_Warehouse_ID; + } + + public int getM_Product_ID() { + return M_Product_ID; + } + + public int getM_AttributeSetInstance_ID() { + return M_AttributeSetInstance_ID; + } + + public int getM_Locator_ID() { + return M_Locator_ID; + } + + public BigDecimal getQtyOnHand() { + return QtyOnHand; + } + + public BigDecimal getMovementQty() { + return MovementQty; + } +} diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVExporter.java index 86aed3782e..b074057fd1 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,10 +480,14 @@ 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) { + 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]"); diff --git a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java index e35ce4819c..58404d246f 100644 --- a/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java +++ b/org.adempiere.base/src/org/adempiere/impexp/GridTabCSVImporter.java @@ -1326,6 +1326,8 @@ public class GridTabCSVImporter implements IGridTabImporter return (new Optional(new ParseBigDecimal(new DecimalFormatSymbols(Language.getLoginLanguage().getLocale())))); } else if (DisplayType.YesNo == field.getDisplayType()) { return (new Optional(new ParseBool("y", "n"))); + } else if (DisplayType.TextLong == field.getDisplayType()) { + return (new Optional(new StrMinMax(1, Long.MAX_VALUE))); } else if (DisplayType.isText(field.getDisplayType())) { return (new Optional(new StrMinMax(1, field.getFieldLength()))); } else { // optional lookups and text diff --git a/org.adempiere.base/src/org/compiere/acct/Doc.java b/org.adempiere.base/src/org/compiere/acct/Doc.java index 6364029fe1..1bc38d49ce 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc.java @@ -555,6 +555,12 @@ public abstract class Doc p_Error = loadDocumentDetails(); if (p_Error != null) return p_Error; + if (isDeferPosting()) + { + unlock(); + p_Status = STATUS_NotPosted; + return null; + } Trx trx = Trx.get(getTrxName(), true); // Delete existing Accounting @@ -2304,4 +2310,11 @@ public abstract class Doc public ArrayList getFacts() { return m_fact; } + + /** + * Return document whether need to defer posting or not + */ + public boolean isDeferPosting() { + return false; + } } // Doc diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java index 1d271a6b48..87a48da28b 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java @@ -77,6 +77,7 @@ public class Doc_MatchPO extends Doc private ProductCost m_pc; private int m_M_AttributeSetInstance_ID = 0; private MMatchPO m_matchPO; + private boolean m_deferPosting = false; /** * Load Specific Document Details @@ -102,7 +103,25 @@ public class Doc_MatchPO extends Doc // m_pc = new ProductCost (Env.getCtx(), getM_Product_ID(), m_M_AttributeSetInstance_ID, getTrxName()); - m_pc.setQty(getQty()); + m_pc.setQty(getQty()); + + if (m_M_InOutLine_ID == 0) + { + MMatchPO[] matchPOs = MMatchPO.getOrderLine(getCtx(), m_oLine.getC_OrderLine_ID(), getTrxName()); + for (MMatchPO matchPO : matchPOs) + { + if (matchPO.getM_InOutLine_ID() > 0 && matchPO.getC_InvoiceLine_ID() == 0) + { + m_M_InOutLine_ID = matchPO.getM_InOutLine_ID(); + break; + } + } + } + + if (m_M_InOutLine_ID == 0) // Defer posting if not matched to Shipment + { + m_deferPosting = true; + } return null; } // loadDocumentDetails @@ -487,4 +506,11 @@ public class Doc_MatchPO extends Doc return null; } + + @Override + public boolean isDeferPosting() { + return m_deferPosting; + } + + } // Doc_MatchPO diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_ProjectIssue.java b/org.adempiere.base/src/org/compiere/acct/Doc_ProjectIssue.java index 31752cda01..512a8d120e 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_ProjectIssue.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_ProjectIssue.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.logging.Level; import org.compiere.model.MAcctSchema; +import org.compiere.model.MCostDetail; import org.compiere.model.MProduct; import org.compiere.model.MProject; import org.compiere.model.MProjectIssue; @@ -157,6 +158,20 @@ public class Doc_ProjectIssue extends Doc cr.setM_Locator_ID(m_line.getM_Locator_ID()); cr.setLocationFromLocator(m_line.getM_Locator_ID(), true); // from Loc // + if (product != null && product.get_ID() > 0 && !product.isService() && product.isStocked()) { + BigDecimal costDetailQty = m_line.getQty(); + BigDecimal costDetailAmt = cost; + if (!MCostDetail.createProjectIssue(as, m_line.getAD_Org_ID(), + m_line.getM_Product_ID(), m_line.getM_AttributeSetInstance_ID(), + m_line.get_ID(), 0, + costDetailAmt, costDetailQty, + m_line.getDescription(), getTrxName())) + { + p_Error = "Failed to create cost detail record"; + return null; + } + } + // ArrayList facts = new ArrayList(); facts.add(fact); return facts; @@ -203,6 +218,8 @@ public class Doc_ProjectIssue extends Doc DB.close(rs, pstmt); pstmt = null; rs = null; } + if (retValue != null) + retValue = retValue.multiply(m_line.getQty()); return retValue; } // getPOCost(); 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.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/I_AD_WF_Node.java b/org.adempiere.base/src/org/compiere/model/I_AD_WF_Node.java index 66e33837d7..74a09ff455 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_WF_Node.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_WF_Node.java @@ -118,6 +118,21 @@ public interface I_AD_WF_Node public org.compiere.model.I_AD_Image getAD_Image() throws RuntimeException; + /** Column name AD_InfoWindow_ID */ + public static final String COLUMNNAME_AD_InfoWindow_ID = "AD_InfoWindow_ID"; + + /** Set Info Window. + * Info and search/select Window + */ + public void setAD_InfoWindow_ID (int AD_InfoWindow_ID); + + /** Get Info Window. + * Info and search/select Window + */ + public int getAD_InfoWindow_ID(); + + public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException; + /** Column name AD_Org_ID */ public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/I_C_AddressTransaction.java b/org.adempiere.base/src/org/compiere/model/I_C_AddressTransaction.java index ca0f1c636f..cc0617fdfc 100644 --- a/org.adempiere.base/src/org/compiere/model/I_C_AddressTransaction.java +++ b/org.adempiere.base/src/org/compiere/model/I_C_AddressTransaction.java @@ -101,6 +101,19 @@ public interface I_C_AddressTransaction */ public String getAddress4(); + /** Column name Address5 */ + public static final String COLUMNNAME_Address5 = "Address5"; + + /** Set Address 5. + * Address Line 5 for the location + */ + public void setAddress5 (String Address5); + + /** Get Address 5. + * Address Line 5 for the location + */ + public String getAddress5(); + /** Column name AD_Org_ID */ public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; @@ -171,6 +184,19 @@ public interface I_C_AddressTransaction public I_C_Location getC_Location() throws RuntimeException; + /** Column name Comments */ + public static final String COLUMNNAME_Comments = "Comments"; + + /** Set Comments. + * Comments or additional information + */ + public void setComments (String Comments); + + /** Get Comments. + * Comments or additional information + */ + public String getComments(); + /** Column name Country */ public static final String COLUMNNAME_Country = "Country"; diff --git a/org.adempiere.base/src/org/compiere/model/I_C_Location.java b/org.adempiere.base/src/org/compiere/model/I_C_Location.java index 6d37c10623..13de6e3f70 100644 --- a/org.adempiere.base/src/org/compiere/model/I_C_Location.java +++ b/org.adempiere.base/src/org/compiere/model/I_C_Location.java @@ -101,6 +101,19 @@ public interface I_C_Location */ public String getAddress4(); + /** Column name Address5 */ + public static final String COLUMNNAME_Address5 = "Address5"; + + /** Set Address 5. + * Address Line 5 for the location + */ + public void setAddress5 (String Address5); + + /** Get Address 5. + * Address Line 5 for the location + */ + public String getAddress5(); + /** Column name AD_Org_ID */ public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; @@ -190,6 +203,19 @@ public interface I_C_Location /** Get C_Location_UU */ public String getC_Location_UU(); + /** Column name Comments */ + public static final String COLUMNNAME_Comments = "Comments"; + + /** Set Comments. + * Comments or additional information + */ + public void setComments (String Comments); + + /** Get Comments. + * Comments or additional information + */ + public String getComments(); + /** Column name Created */ public static final String COLUMNNAME_Created = "Created"; 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/MCostDetail.java b/org.adempiere.base/src/org/compiere/model/MCostDetail.java index 4cc2aa662c..5c0f126e4d 100644 --- a/org.adempiere.base/src/org/compiere/model/MCostDetail.java +++ b/org.adempiere.base/src/org/compiere/model/MCostDetail.java @@ -529,6 +529,70 @@ public class MCostDetail extends X_M_CostDetail return ok; } // createMatchInvoice + /** + * Create Cost Detail for Project Issue. + * Called from Doc_ProjectIssue + * @param as accounting schema + * @param AD_Org_ID org + * @param M_Product_ID product + * @param M_AttributeSetInstance_ID asi + * @param C_ProjectIssue_ID project issue line + * @param M_CostElement_ID optional cost element + * @param Amt amt total amount + * @param Qty qty + * @param Description optional description + * @param trxName transaction + * @return true if no error + */ + public static boolean createProjectIssue(MAcctSchema as, int AD_Org_ID, + int M_Product_ID, int M_AttributeSetInstance_ID, + int C_ProjectIssue_ID, int M_CostElement_ID, + BigDecimal Amt, BigDecimal Qty, + String Description, String trxName) + { + MCostDetail cd = get (as.getCtx(), "C_ProjectIssue_ID=? AND Coalesce(M_CostElement_ID,0)="+M_CostElement_ID, + C_ProjectIssue_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); + // + if (cd == null) // createNew + { + cd = new MCostDetail (as, AD_Org_ID, + M_Product_ID, M_AttributeSetInstance_ID, + M_CostElement_ID, + Amt, Qty, Description, trxName); + cd.setC_ProjectIssue_ID(C_ProjectIssue_ID); + } + else + { + if (cd.isProcessed()) + { + cd.setDeltaAmt(Amt.subtract(cd.getAmt())); + cd.setDeltaQty(Qty.subtract(cd.getQty())); + } + else + { + cd.setDeltaAmt(BigDecimal.ZERO); + cd.setDeltaQty(BigDecimal.ZERO); + cd.setAmt(Amt); + cd.setQty(Qty); + } + if (cd.isDelta()) + { + cd.setProcessed(false); + cd.setAmt(Amt); + cd.setQty(Qty); + } + else if (cd.isProcessed()) + return true; // nothing to do + } + boolean ok = cd.save(); + if (ok && !cd.isProcessed()) + { + ok = cd.process(); + } + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); + return ok; + } // createProjectIssue + /************************************************************************** * Get Cost Detail * @param ctx context @@ -1319,10 +1383,14 @@ public class MCostDetail extends X_M_CostDetail log.warning("Unknown Type: " + toString()); return false; } - setCurrentCostPrice(cost.getCurrentCostPrice()); - setCurrentQty(cost.getCurrentQty()); - setCumulatedAmt(cost.getCumulatedAmt()); - setCumulatedQty(cost.getCumulatedQty()); + + //Should only update cost detail with value from as costing method + if(as.getCostingMethod().equals(ce.getCostingMethod())) { + setCurrentCostPrice(cost.getCurrentCostPrice()); + setCurrentQty(cost.getCurrentQty()); + setCumulatedAmt(cost.getCumulatedAmt()); + setCumulatedQty(cost.getCumulatedQty()); + } //update history history.setNewQty(cost.getCurrentQty()); 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); diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index d8c0627596..35768187e1 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -26,6 +26,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.NegativeInventoryDisallowedException; import org.adempiere.exceptions.PeriodClosedException; import org.compiere.print.MPrintFormat; import org.compiere.print.ReportEngine; @@ -1286,6 +1287,7 @@ public class MInOut extends X_M_InOut implements DocAction if (log.isLoggable(Level.INFO)) log.info(toString()); StringBuilder info = new StringBuilder(); + StringBuilder errors = new StringBuilder(); // For all lines MInOutLine[] lines = getLines(false); for (int lineIndex = 0; lineIndex < lines.length; lineIndex++) @@ -1293,353 +1295,326 @@ public class MInOut extends X_M_InOut implements DocAction MInOutLine sLine = lines[lineIndex]; MProduct product = sLine.getProduct(); - // Qty & Type - String MovementType = getMovementType(); - BigDecimal Qty = sLine.getMovementQty(); - if (MovementType.charAt(1) == '-') // C- Customer Shipment - V- Vendor Return - Qty = Qty.negate(); - - // Update Order Line - MOrderLine oLine = null; - if (sLine.getC_OrderLine_ID() != 0) + try { - oLine = new MOrderLine (getCtx(), sLine.getC_OrderLine_ID(), get_TrxName()); - if (log.isLoggable(Level.FINE)) log.fine("OrderLine - Reserved=" + oLine.getQtyReserved() - + ", Delivered=" + oLine.getQtyDelivered()); - } - - - // Load RMA Line - MRMALine rmaLine = null; - - if (sLine.getM_RMALine_ID() != 0) - { - rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName()); - } - - if (log.isLoggable(Level.INFO)) log.info("Line=" + sLine.getLine() + " - Qty=" + sLine.getMovementQty()); - - // Stock Movement - Counterpart MOrder.reserveStock - if (product != null - && product.isStocked() ) - { - //Ignore the Material Policy when is Reverse Correction - if(!isReversal()) + // Qty & Type + String MovementType = getMovementType(); + BigDecimal Qty = sLine.getMovementQty(); + if (MovementType.charAt(1) == '-') // C- Customer Shipment - V- Vendor Return + Qty = Qty.negate(); + + // Update Order Line + MOrderLine oLine = null; + if (sLine.getC_OrderLine_ID() != 0) { - BigDecimal movementQty = sLine.getMovementQty(); - BigDecimal qtyOnLineMA = MInOutLineMA.getManualQty(sLine.getM_InOutLine_ID(), get_TrxName()); - - if ( (movementQty.signum() != 0 && qtyOnLineMA.signum() != 0 && movementQty.signum() != qtyOnLineMA.signum()) // must have same sign - || (qtyOnLineMA.abs().compareTo(movementQty.abs())>0)) { // compare absolute values - // More then line qty on attribute tab for line 10 - m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + sLine.getLine(); - return DOCSTATUS_Invalid; - } - - checkMaterialPolicy(sLine,movementQty.subtract(qtyOnLineMA)); + oLine = new MOrderLine (getCtx(), sLine.getC_OrderLine_ID(), get_TrxName()); + if (log.isLoggable(Level.FINE)) log.fine("OrderLine - Reserved=" + oLine.getQtyReserved() + + ", Delivered=" + oLine.getQtyDelivered()); } - - log.fine("Material Transaction"); - MTransaction mtrx = null; - - // - BigDecimal overReceipt = BigDecimal.ZERO; - if (!isReversal()) + + + // Load RMA Line + MRMALine rmaLine = null; + + if (sLine.getM_RMALine_ID() != 0) + { + rmaLine = new MRMALine(getCtx(), sLine.getM_RMALine_ID(), get_TrxName()); + } + + if (log.isLoggable(Level.INFO)) log.info("Line=" + sLine.getLine() + " - Qty=" + sLine.getMovementQty()); + + // Stock Movement - Counterpart MOrder.reserveStock + if (product != null + && product.isStocked() ) { - if (oLine != null) + //Ignore the Material Policy when is Reverse Correction + if(!isReversal()) { - BigDecimal toDelivered = oLine.getQtyOrdered() - .subtract(oLine.getQtyDelivered()); - if (toDelivered.signum() < 0) // IDEMPIERE-2889 - toDelivered = Env.ZERO; - if (sLine.getMovementQty().compareTo(toDelivered) > 0) - overReceipt = sLine.getMovementQty().subtract( - toDelivered); - if (overReceipt.signum() != 0) - { - sLine.setQtyOverReceipt(overReceipt); - sLine.saveEx(); + BigDecimal movementQty = sLine.getMovementQty(); + BigDecimal qtyOnLineMA = MInOutLineMA.getManualQty(sLine.getM_InOutLine_ID(), get_TrxName()); + + if ( (movementQty.signum() != 0 && qtyOnLineMA.signum() != 0 && movementQty.signum() != qtyOnLineMA.signum()) // must have same sign + || (qtyOnLineMA.abs().compareTo(movementQty.abs())>0)) { // compare absolute values + // More then line qty on attribute tab for line 10 + m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + sLine.getLine(); + return DOCSTATUS_Invalid; } + + checkMaterialPolicy(sLine,movementQty.subtract(qtyOnLineMA)); } - } - else - { - overReceipt = sLine.getQtyOverReceipt(); - } - BigDecimal orderedQtyToUpdate = sLine.getMovementQty().subtract(overReceipt); - // - if (sLine.getM_AttributeSetInstance_ID() == 0) - { - MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), - sLine.getM_InOutLine_ID(), get_TrxName()); - for (int j = 0; j < mas.length; j++) + + log.fine("Material Transaction"); + MTransaction mtrx = null; + + // + BigDecimal overReceipt = BigDecimal.ZERO; + if (!isReversal()) { - MInOutLineMA ma = mas[j]; - BigDecimal QtyMA = ma.getMovementQty(); - if (MovementType.charAt(1) == '-') // C- Customer Shipment - V- Vendor Return - QtyMA = QtyMA.negate(); - - // Update Storage - see also VMatch.createMatchRecord + if (oLine != null) + { + BigDecimal toDelivered = oLine.getQtyOrdered() + .subtract(oLine.getQtyDelivered()); + if (toDelivered.signum() < 0) // IDEMPIERE-2889 + toDelivered = Env.ZERO; + if (sLine.getMovementQty().compareTo(toDelivered) > 0) + overReceipt = sLine.getMovementQty().subtract( + toDelivered); + if (overReceipt.signum() != 0) + { + sLine.setQtyOverReceipt(overReceipt); + sLine.saveEx(); + } + } + } + else + { + overReceipt = sLine.getQtyOverReceipt(); + } + BigDecimal orderedQtyToUpdate = sLine.getMovementQty().subtract(overReceipt); + // + if (sLine.getM_AttributeSetInstance_ID() == 0) + { + MInOutLineMA mas[] = MInOutLineMA.get(getCtx(), + sLine.getM_InOutLine_ID(), get_TrxName()); + for (int j = 0; j < mas.length; j++) + { + MInOutLineMA ma = mas[j]; + BigDecimal QtyMA = ma.getMovementQty(); + if (MovementType.charAt(1) == '-') // C- Customer Shipment - V- Vendor Return + QtyMA = QtyMA.negate(); + + // Update Storage - see also VMatch.createMatchRecord + if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(), + sLine.getM_Locator_ID(), + sLine.getM_Product_ID(), + ma.getM_AttributeSetInstance_ID(), + QtyMA,ma.getDateMaterialPolicy(), + get_TrxName())) + { + String lastError = CLogger.retrieveErrorString(""); + m_processMsg = "Cannot correct Inventory OnHand (MA) [" + product.getValue() + "] - " + lastError; + return DocAction.STATUS_Invalid; + } + + // Create Transaction + mtrx = new MTransaction (getCtx(), sLine.getAD_Org_ID(), + MovementType, sLine.getM_Locator_ID(), + sLine.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), + QtyMA, getMovementDate(), get_TrxName()); + mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID()); + if (!mtrx.save()) + { + m_processMsg = "Could not create Material Transaction (MA) [" + product.getValue() + "]"; + return DocAction.STATUS_Invalid; + } + } + + if (oLine!=null && mtrx!=null && oLine.getQtyOrdered().signum() > 0) + { + if (sLine.getC_OrderLine_ID() != 0) + { + if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(), + sLine.getM_Product_ID(), + oLine.getM_AttributeSetInstance_ID(), + orderedQtyToUpdate.negate(), + isSOTrx(), + get_TrxName())) + { + String lastError = CLogger.retrieveErrorString(""); + m_processMsg = "Cannot correct Inventory " + (isSOTrx()? "Reserved" : "Ordered") + " (MA) - [" + product.getValue() + "] - " + lastError; + return DocAction.STATUS_Invalid; + } + } + } + + } + // sLine.getM_AttributeSetInstance_ID() != 0 + if (mtrx == null) + { + Timestamp dateMPolicy= null; + MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), 0, + sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null, + MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, + sLine.getM_Locator_ID(), get_TrxName()); + for (MStorageOnHand storage : storages) { + if (storage.getQtyOnHand().compareTo(sLine.getMovementQty()) >= 0) { + dateMPolicy = storage.getDateMaterialPolicy(); + break; + } + } + + if (dateMPolicy == null && storages.length > 0) + dateMPolicy = storages[0].getDateMaterialPolicy(); + + if(dateMPolicy==null) + dateMPolicy = getMovementDate(); + + // Fallback: Update Storage - see also VMatch.createMatchRecord if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(), sLine.getM_Locator_ID(), sLine.getM_Product_ID(), - ma.getM_AttributeSetInstance_ID(), - QtyMA,ma.getDateMaterialPolicy(), - get_TrxName())) + sLine.getM_AttributeSetInstance_ID(), + Qty,dateMPolicy,get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory OnHand (MA) [" + product.getValue() + "] - " + lastError; - return DocAction.STATUS_Invalid; - } - - // Create Transaction - mtrx = new MTransaction (getCtx(), sLine.getAD_Org_ID(), - MovementType, sLine.getM_Locator_ID(), - sLine.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), - QtyMA, getMovementDate(), get_TrxName()); - mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID()); - if (!mtrx.save()) - { - m_processMsg = "Could not create Material Transaction (MA) [" + product.getValue() + "]"; + m_processMsg = "Cannot correct Inventory OnHand [" + product.getValue() + "] - " + lastError; return DocAction.STATUS_Invalid; } - } - - if (oLine!=null && mtrx!=null && oLine.getQtyOrdered().signum() > 0) - { - if (sLine.getC_OrderLine_ID() != 0) + if (oLine!=null && oLine.getQtyOrdered().signum() > 0) { if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(), sLine.getM_Product_ID(), oLine.getM_AttributeSetInstance_ID(), - orderedQtyToUpdate.negate(), - isSOTrx(), - get_TrxName())) + orderedQtyToUpdate.negate(), isSOTrx(), get_TrxName())) { - String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory " + (isSOTrx()? "Reserved" : "Ordered") + " (MA) - [" + product.getValue() + "] - " + lastError; + m_processMsg = "Cannot correct Inventory Reserved " + (isSOTrx()? "Reserved [" :"Ordered [") + product.getValue() + "]"; return DocAction.STATUS_Invalid; } } - } - - } - // sLine.getM_AttributeSetInstance_ID() != 0 - if (mtrx == null) - { - Timestamp dateMPolicy= null; - MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), 0, - sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), null, - MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, - sLine.getM_Locator_ID(), get_TrxName()); - for (MStorageOnHand storage : storages) { - if (storage.getQtyOnHand().compareTo(sLine.getMovementQty()) >= 0) { - dateMPolicy = storage.getDateMaterialPolicy(); - break; - } - } - - if (dateMPolicy == null && storages.length > 0) - dateMPolicy = storages[0].getDateMaterialPolicy(); - - if(dateMPolicy==null) - dateMPolicy = getMovementDate(); - - // Fallback: Update Storage - see also VMatch.createMatchRecord - if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(), - sLine.getM_Locator_ID(), - sLine.getM_Product_ID(), - sLine.getM_AttributeSetInstance_ID(), - Qty,dateMPolicy,get_TrxName())) - { - String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory OnHand [" + product.getValue() + "] - " + lastError; - return DocAction.STATUS_Invalid; - } - if (oLine!=null && oLine.getQtyOrdered().signum() > 0) - { - if (!MStorageReservation.add(getCtx(), oLine.getM_Warehouse_ID(), - sLine.getM_Product_ID(), - oLine.getM_AttributeSetInstance_ID(), - orderedQtyToUpdate.negate(), isSOTrx(), get_TrxName())) + + // FallBack: Create Transaction + mtrx = new MTransaction (getCtx(), sLine.getAD_Org_ID(), + MovementType, sLine.getM_Locator_ID(), + sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), + Qty, getMovementDate(), get_TrxName()); + mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID()); + if (!mtrx.save()) { - m_processMsg = "Cannot correct Inventory Reserved " + (isSOTrx()? "Reserved [" :"Ordered [") + product.getValue() + "]"; + m_processMsg = CLogger.retrieveErrorString("Could not create Material Transaction [" + product.getValue() + "]"); return DocAction.STATUS_Invalid; } } - - // FallBack: Create Transaction - mtrx = new MTransaction (getCtx(), sLine.getAD_Org_ID(), - MovementType, sLine.getM_Locator_ID(), - sLine.getM_Product_ID(), sLine.getM_AttributeSetInstance_ID(), - Qty, getMovementDate(), get_TrxName()); - mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID()); - if (!mtrx.save()) + } // stock movement + + // Correct Order Line + if (product != null && oLine != null) // other in VMatch.createMatchRecord + { + oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty().subtract(sLine.getQtyOverReceipt()))); + } + + // Update Sales Order Line + if (oLine != null) + { + if (isSOTrx() // PO is done by Matching + || sLine.getM_Product_ID() == 0) // PO Charges, empty lines { - m_processMsg = CLogger.retrieveErrorString("Could not create Material Transaction [" + product.getValue() + "]"); + if (isSOTrx()) + oLine.setQtyDelivered(oLine.getQtyDelivered().subtract(Qty)); + else + oLine.setQtyDelivered(oLine.getQtyDelivered().add(Qty)); + oLine.setDateDelivered(getMovementDate()); // overwrite=last + } + if (!oLine.save()) + { + m_processMsg = "Could not update Order Line"; return DocAction.STATUS_Invalid; } - } - } // stock movement - - // Correct Order Line - if (product != null && oLine != null) // other in VMatch.createMatchRecord - { - oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty().subtract(sLine.getQtyOverReceipt()))); - } - - // Update Sales Order Line - if (oLine != null) - { - if (isSOTrx() // PO is done by Matching - || sLine.getM_Product_ID() == 0) // PO Charges, empty lines - { - if (isSOTrx()) - oLine.setQtyDelivered(oLine.getQtyDelivered().subtract(Qty)); else - oLine.setQtyDelivered(oLine.getQtyDelivered().add(Qty)); - oLine.setDateDelivered(getMovementDate()); // overwrite=last + if (log.isLoggable(Level.FINE)) log.fine("OrderLine -> Reserved=" + oLine.getQtyReserved() + + ", Delivered=" + oLine.getQtyReserved()); } - if (!oLine.save()) + // Update RMA Line Qty Delivered + else if (rmaLine != null) + { + if (isSOTrx()) + { + rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().add(Qty)); + } + else + { + rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().subtract(Qty)); + } + if (!rmaLine.save()) + { + m_processMsg = "Could not update RMA Line"; + return DocAction.STATUS_Invalid; + } + } + + // Create Asset for SO + if (product != null + && isSOTrx() + && product.isCreateAsset() + && !product.getM_Product_Category().getA_Asset_Group().isFixedAsset() + && sLine.getMovementQty().signum() > 0 + && !isReversal()) { - m_processMsg = "Could not update Order Line"; - return DocAction.STATUS_Invalid; - } - else - if (log.isLoggable(Level.FINE)) log.fine("OrderLine -> Reserved=" + oLine.getQtyReserved() - + ", Delivered=" + oLine.getQtyReserved()); - } - // Update RMA Line Qty Delivered - else if (rmaLine != null) - { - if (isSOTrx()) - { - rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().add(Qty)); - } - else - { - rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().subtract(Qty)); - } - if (!rmaLine.save()) - { - m_processMsg = "Could not update RMA Line"; - return DocAction.STATUS_Invalid; - } - } - - // Create Asset for SO - if (product != null - && isSOTrx() - && product.isCreateAsset() - && !product.getM_Product_Category().getA_Asset_Group().isFixedAsset() - && sLine.getMovementQty().signum() > 0 - && !isReversal()) - { - log.fine("Asset"); - info.append("@A_Asset_ID@: "); - int noAssets = sLine.getMovementQty().intValue(); - if (!product.isOneAssetPerUOM()) - noAssets = 1; - for (int i = 0; i < noAssets; i++) - { - if (i > 0) - info.append(" - "); - int deliveryCount = i+1; + log.fine("Asset"); + info.append("@A_Asset_ID@: "); + int noAssets = sLine.getMovementQty().intValue(); if (!product.isOneAssetPerUOM()) - deliveryCount = 0; - MAsset asset = new MAsset (this, sLine, deliveryCount); - if (!asset.save(get_TrxName())) + noAssets = 1; + for (int i = 0; i < noAssets; i++) { - m_processMsg = "Could not create Asset"; - return DocAction.STATUS_Invalid; - } - info.append(asset.getValue()); - } - } // Asset - - - // Matching - if (!isSOTrx() - && sLine.getM_Product_ID() != 0 - && !isReversal()) - { - BigDecimal matchQty = sLine.getMovementQty(); - // Invoice - Receipt Match (requires Product) - MInvoiceLine iLine = MInvoiceLine.getOfInOutLine (sLine); - if (iLine != null && iLine.getM_Product_ID() != 0) - { - if (matchQty.compareTo(iLine.getQtyInvoiced())>0) - matchQty = iLine.getQtyInvoiced(); - - MMatchInv[] matches = MMatchInv.get(getCtx(), - sLine.getM_InOutLine_ID(), iLine.getC_InvoiceLine_ID(), get_TrxName()); - if (matches == null || matches.length == 0) - { - MMatchInv inv = new MMatchInv (iLine, getMovementDate(), matchQty); - if (sLine.getM_AttributeSetInstance_ID() != iLine.getM_AttributeSetInstance_ID()) + if (i > 0) + info.append(" - "); + int deliveryCount = i+1; + if (!product.isOneAssetPerUOM()) + deliveryCount = 0; + MAsset asset = new MAsset (this, sLine, deliveryCount); + if (!asset.save(get_TrxName())) { - iLine.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); - iLine.saveEx(); // update matched invoice with ASI - inv.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); - } - if (!inv.save(get_TrxName())) - { - m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching"); + m_processMsg = "Could not create Asset"; return DocAction.STATUS_Invalid; } - addDocsPostProcess(inv); + info.append(asset.getValue()); } - } - - // Link to Order - if (sLine.getC_OrderLine_ID() != 0) + } // Asset + + + // Matching + if (!isSOTrx() + && sLine.getM_Product_ID() != 0 + && !isReversal()) { - log.fine("PO Matching"); - // Ship - PO - MMatchPO po = MMatchPO.create (null, sLine, getMovementDate(), matchQty); - if (po != null) { - if (!po.save(get_TrxName())) + BigDecimal matchQty = sLine.getMovementQty(); + // Invoice - Receipt Match (requires Product) + MInvoiceLine iLine = MInvoiceLine.getOfInOutLine (sLine); + if (iLine != null && iLine.getM_Product_ID() != 0) + { + if (matchQty.compareTo(iLine.getQtyInvoiced())>0) + matchQty = iLine.getQtyInvoiced(); + + MMatchInv[] matches = MMatchInv.get(getCtx(), + sLine.getM_InOutLine_ID(), iLine.getC_InvoiceLine_ID(), get_TrxName()); + if (matches == null || matches.length == 0) { - m_processMsg = "Could not create PO Matching"; - return DocAction.STATUS_Invalid; - } - if (!po.isPosted()) - addDocsPostProcess(po); - MMatchInv matchInvCreated = po.getMatchInvCreated(); - if (matchInvCreated != null) { - addDocsPostProcess(matchInvCreated); + MMatchInv inv = new MMatchInv (iLine, getMovementDate(), matchQty); + if (sLine.getM_AttributeSetInstance_ID() != iLine.getM_AttributeSetInstance_ID()) + { + iLine.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); + iLine.saveEx(); // update matched invoice with ASI + inv.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); + } + if (!inv.save(get_TrxName())) + { + m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching"); + return DocAction.STATUS_Invalid; + } + addDocsPostProcess(inv); } } - // Update PO with ASI - if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0 - && sLine.getMovementQty().compareTo(oLine.getQtyOrdered()) == 0) // just if full match [ 1876965 ] + + // Link to Order + if (sLine.getC_OrderLine_ID() != 0) { - oLine.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); - oLine.saveEx(get_TrxName()); - } - } - else // No Order - Try finding links via Invoice - { - // Invoice has an Order Link - if (iLine != null && iLine.getC_OrderLine_ID() != 0) - { - // Invoice is created before Shipment - log.fine("PO(Inv) Matching"); - // Ship - Invoice - MMatchPO po = MMatchPO.create (iLine, sLine, - getMovementDate(), matchQty); + log.fine("PO Matching"); + // Ship - PO + MMatchPO po = MMatchPO.create (null, sLine, getMovementDate(), matchQty); if (po != null) { if (!po.save(get_TrxName())) { - m_processMsg = "Could not create PO(Inv) Matching"; + m_processMsg = "Could not create PO Matching"; return DocAction.STATUS_Invalid; } if (!po.isPosted()) addDocsPostProcess(po); + MMatchInv matchInvCreated = po.getMatchInvCreated(); + if (matchInvCreated != null) { + addDocsPostProcess(matchInvCreated); + } } - // Update PO with ASI - oLine = new MOrderLine (getCtx(), iLine.getC_OrderLine_ID(), get_TrxName()); if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0 && sLine.getMovementQty().compareTo(oLine.getQtyOrdered()) == 0) // just if full match [ 1876965 ] { @@ -1647,11 +1622,52 @@ public class MInOut extends X_M_InOut implements DocAction oLine.saveEx(get_TrxName()); } } - } // No Order - } // PO Matching - + else // No Order - Try finding links via Invoice + { + // Invoice has an Order Link + if (iLine != null && iLine.getC_OrderLine_ID() != 0) + { + // Invoice is created before Shipment + log.fine("PO(Inv) Matching"); + // Ship - Invoice + MMatchPO po = MMatchPO.create (iLine, sLine, + getMovementDate(), matchQty); + if (po != null) { + if (!po.save(get_TrxName())) + { + m_processMsg = "Could not create PO(Inv) Matching"; + return DocAction.STATUS_Invalid; + } + if (!po.isPosted()) + addDocsPostProcess(po); + } + + // Update PO with ASI + oLine = new MOrderLine (getCtx(), iLine.getC_OrderLine_ID(), get_TrxName()); + if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0 + && sLine.getMovementQty().compareTo(oLine.getQtyOrdered()) == 0) // just if full match [ 1876965 ] + { + oLine.setM_AttributeSetInstance_ID(sLine.getM_AttributeSetInstance_ID()); + oLine.saveEx(get_TrxName()); + } + } + } // No Order + } // PO Matching + } + catch (NegativeInventoryDisallowedException e) + { + log.severe(e.getMessage()); + errors.append(Msg.getElement(getCtx(), "Line")).append(" ").append(sLine.getLine()).append(": "); + errors.append(e.getMessage()).append("\n"); + } } // for all lines + if (errors.toString().length() > 0) + { + m_processMsg = errors.toString(); + return DocAction.STATUS_Invalid; + } + // Counter Documents MInOut counter = createCounterDoc(); if (counter != null) diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index 77f01c2526..4cd75b68e0 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.NegativeInventoryDisallowedException; import org.adempiere.exceptions.PeriodClosedException; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; @@ -435,6 +436,7 @@ public class MInventory extends X_M_Inventory implements DocAction approveIt(); if (log.isLoggable(Level.INFO)) log.info(toString()); + StringBuilder errors = new StringBuilder(); MInventoryLine[] lines = getLines(false); for (MInventoryLine line : lines) { @@ -442,98 +444,159 @@ public class MInventory extends X_M_Inventory implements DocAction continue; MProduct product = line.getProduct(); - - BigDecimal qtyDiff = Env.ZERO; - if (MDocType.DOCSUBTYPEINV_InternalUseInventory.equals(docSubTypeInv)) - qtyDiff = line.getQtyInternalUse().negate(); - else if (MDocType.DOCSUBTYPEINV_PhysicalInventory.equals(docSubTypeInv)) - qtyDiff = line.getQtyCount().subtract(line.getQtyBook()); - else if (MDocType.DOCSUBTYPEINV_CostAdjustment.equals(docSubTypeInv)) + try { - if (!isReversal()) + BigDecimal qtyDiff = Env.ZERO; + if (MDocType.DOCSUBTYPEINV_InternalUseInventory.equals(docSubTypeInv)) + qtyDiff = line.getQtyInternalUse().negate(); + else if (MDocType.DOCSUBTYPEINV_PhysicalInventory.equals(docSubTypeInv)) + qtyDiff = line.getQtyCount().subtract(line.getQtyBook()); + else if (MDocType.DOCSUBTYPEINV_CostAdjustment.equals(docSubTypeInv)) { - BigDecimal currentCost = line.getCurrentCostPrice(); - MClient client = MClient.get(getCtx(), getAD_Client_ID()); - MAcctSchema as = client.getAcctSchema(); - MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(getCtx(), client.get_ID()); - - if (as.getC_Currency_ID() != getC_Currency_ID()) + if (!isReversal()) { - for (int i = 0; i < ass.length ; i ++) + BigDecimal currentCost = line.getCurrentCostPrice(); + MClient client = MClient.get(getCtx(), getAD_Client_ID()); + MAcctSchema as = client.getAcctSchema(); + MAcctSchema[] ass = MAcctSchema.getClientAcctSchema(getCtx(), client.get_ID()); + + if (as.getC_Currency_ID() != getC_Currency_ID()) { - MAcctSchema a = ass[i]; - if (a.getC_Currency_ID() == getC_Currency_ID()) - as = a ; + for (int i = 0; i < ass.length ; i ++) + { + MAcctSchema a = ass[i]; + if (a.getC_Currency_ID() == getC_Currency_ID()) + as = a ; + } + } + + MCost cost = product.getCostingRecord(as, getAD_Org_ID(), line.getM_AttributeSetInstance_ID(), getCostingMethod()); + if (cost != null && cost.getCurrentCostPrice().compareTo(currentCost) != 0) + { + m_processMsg = "Current Cost for Line " + line.getLine() + " have changed."; + return DocAction.STATUS_Invalid; } } - - MCost cost = product.getCostingRecord(as, getAD_Org_ID(), line.getM_AttributeSetInstance_ID(), getCostingMethod()); - if (cost != null && cost.getCurrentCostPrice().compareTo(currentCost) != 0) - { - m_processMsg = "Current Cost for Line " + line.getLine() + " have changed."; - return DocAction.STATUS_Invalid; - } } - } - - //If Quantity Count minus Quantity Book = Zero, then no change in Inventory - if (qtyDiff.signum() == 0) - continue; - - //Ignore the Material Policy when is Reverse Correction - if(!isReversal()){ - BigDecimal qtyOnLineMA = MInventoryLineMA.getManualQty(line.getM_InventoryLine_ID(), get_TrxName()); - - if(qtyDiff.signum()<0){ - if(qtyOnLineMA.compareTo(qtyDiff)<0){ - m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + line.getLine(); - return DOCSTATUS_Invalid; - } - }else{ - if(qtyOnLineMA.compareTo(qtyDiff)>0){ - m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + line.getLine(); - return DOCSTATUS_Invalid; + + //If Quantity Count minus Quantity Book = Zero, then no change in Inventory + if (qtyDiff.signum() == 0) + continue; + + //Ignore the Material Policy when is Reverse Correction + if(!isReversal()){ + BigDecimal qtyOnLineMA = MInventoryLineMA.getManualQty(line.getM_InventoryLine_ID(), get_TrxName()); + + if(qtyDiff.signum()<0){ + if(qtyOnLineMA.compareTo(qtyDiff)<0){ + m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + line.getLine(); + return DOCSTATUS_Invalid; + } + }else{ + if(qtyOnLineMA.compareTo(qtyDiff)>0){ + m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + line.getLine(); + return DOCSTATUS_Invalid; + } } + checkMaterialPolicy(line, qtyDiff.subtract(qtyOnLineMA)); } - checkMaterialPolicy(line, qtyDiff.subtract(qtyOnLineMA)); - } - // Stock Movement - Counterpart MOrder.reserveStock - if (product != null - && product.isStocked() ) - { - log.fine("Material Transaction"); - MTransaction mtrx = null; - - //If AttributeSetInstance = Zero then create new AttributeSetInstance use Inventory Line MA else use current AttributeSetInstance - if (line.getM_AttributeSetInstance_ID() == 0 || qtyDiff.compareTo(Env.ZERO) == 0) + // Stock Movement - Counterpart MOrder.reserveStock + if (product != null + && product.isStocked() ) { - MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), - line.getM_InventoryLine_ID(), get_TrxName()); - - for (int j = 0; j < mas.length; j++) + log.fine("Material Transaction"); + MTransaction mtrx = null; + + //If AttributeSetInstance = Zero then create new AttributeSetInstance use Inventory Line MA else use current AttributeSetInstance + if (line.getM_AttributeSetInstance_ID() == 0 || qtyDiff.compareTo(Env.ZERO) == 0) { - MInventoryLineMA ma = mas[j]; - BigDecimal QtyMA = ma.getMovementQty(); - BigDecimal QtyNew = QtyMA.add(qtyDiff); - if (log.isLoggable(Level.FINE)) log.fine("Diff=" + qtyDiff - + " - Instance OnHand=" + QtyMA + "->" + QtyNew); - + MInventoryLineMA mas[] = MInventoryLineMA.get(getCtx(), + line.getM_InventoryLine_ID(), get_TrxName()); + + for (int j = 0; j < mas.length; j++) + { + MInventoryLineMA ma = mas[j]; + BigDecimal QtyMA = ma.getMovementQty(); + BigDecimal QtyNew = QtyMA.add(qtyDiff); + if (log.isLoggable(Level.FINE)) log.fine("Diff=" + qtyDiff + + " - Instance OnHand=" + QtyMA + "->" + QtyNew); + + if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(), + line.getM_Locator_ID(), + line.getM_Product_ID(), + ma.getM_AttributeSetInstance_ID(), + QtyMA.negate(),ma.getDateMaterialPolicy(), get_TrxName())) + { + String lastError = CLogger.retrieveErrorString(""); + m_processMsg = "Cannot correct Inventory (MA) - " + lastError; + return DocAction.STATUS_Invalid; + } + + // Only Update Date Last Inventory if is a Physical Inventory + if (MDocType.DOCSUBTYPEINV_PhysicalInventory.equals(docSubTypeInv)) + { + MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(), + line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),ma.getDateMaterialPolicy(),get_TrxName()); + storage.setDateLastInventory(getMovementDate()); + if (!storage.save(get_TrxName())) + { + m_processMsg = "Storage not updated(2)"; + return DocAction.STATUS_Invalid; + } + } + + String m_MovementType =null; + if(QtyMA.negate().compareTo(Env.ZERO) > 0 ) + m_MovementType = MTransaction.MOVEMENTTYPE_InventoryIn; + else + m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut; + // Transaction + mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType, + line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), + QtyMA.negate(), getMovementDate(), get_TrxName()); + + mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); + if (!mtrx.save()) + { + m_processMsg = "Transaction not inserted(2)"; + return DocAction.STATUS_Invalid; + } + + qtyDiff = QtyNew; + + } + } + + //sLine.getM_AttributeSetInstance_ID() != 0 + // Fallback + if (mtrx == null) + { + Timestamp dateMPolicy= qtyDiff.signum() > 0 ? getMovementDate() : null; + if (line.getM_AttributeSetInstance_ID() > 0) + { + Timestamp t = MStorageOnHand.getDateMaterialPolicy(line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), line.get_TrxName()); + if (t != null) + dateMPolicy = t; + } + + //Fallback: Update Storage - see also VMatch.createMatchRecord if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(), line.getM_Locator_ID(), line.getM_Product_ID(), - ma.getM_AttributeSetInstance_ID(), - QtyMA.negate(),ma.getDateMaterialPolicy(), get_TrxName())) + line.getM_AttributeSetInstance_ID(), + qtyDiff,dateMPolicy,get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory (MA) - " + lastError; + m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; return DocAction.STATUS_Invalid; } - + // Only Update Date Last Inventory if is a Physical Inventory if (MDocType.DOCSUBTYPEINV_PhysicalInventory.equals(docSubTypeInv)) { MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(), - line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(),ma.getDateMaterialPolicy(),get_TrxName()); + line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),dateMPolicy, get_TrxName()); + storage.setDateLastInventory(getMovementDate()); if (!storage.save(get_TrxName())) { @@ -541,87 +604,40 @@ public class MInventory extends X_M_Inventory implements DocAction return DocAction.STATUS_Invalid; } } - - String m_MovementType =null; - if(QtyMA.negate().compareTo(Env.ZERO) > 0 ) + + String m_MovementType = null; + if(qtyDiff.compareTo(Env.ZERO) > 0 ) m_MovementType = MTransaction.MOVEMENTTYPE_InventoryIn; else m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut; // Transaction mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType, - line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), - QtyMA.negate(), getMovementDate(), get_TrxName()); - - mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); - if (!mtrx.save()) - { - m_processMsg = "Transaction not inserted(2)"; - return DocAction.STATUS_Invalid; - } - - qtyDiff = QtyNew; - - } - } - - //sLine.getM_AttributeSetInstance_ID() != 0 - // Fallback - if (mtrx == null) - { - Timestamp dateMPolicy= qtyDiff.signum() > 0 ? getMovementDate() : null; - if (line.getM_AttributeSetInstance_ID() > 0) - { - Timestamp t = MStorageOnHand.getDateMaterialPolicy(line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), line.get_TrxName()); - if (t != null) - dateMPolicy = t; - } - - //Fallback: Update Storage - see also VMatch.createMatchRecord - if (!MStorageOnHand.add(getCtx(), getM_Warehouse_ID(), - line.getM_Locator_ID(), - line.getM_Product_ID(), - line.getM_AttributeSetInstance_ID(), - qtyDiff,dateMPolicy,get_TrxName())) - { - String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; - return DocAction.STATUS_Invalid; - } - - // Only Update Date Last Inventory if is a Physical Inventory - if (MDocType.DOCSUBTYPEINV_PhysicalInventory.equals(docSubTypeInv)) - { - MStorageOnHand storage = MStorageOnHand.get(getCtx(), line.getM_Locator_ID(), - line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(),dateMPolicy, get_TrxName()); - - storage.setDateLastInventory(getMovementDate()); - if (!storage.save(get_TrxName())) + line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), + qtyDiff, getMovementDate(), get_TrxName()); + mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); + if (!mtrx.save()) { - m_processMsg = "Storage not updated(2)"; + m_processMsg = "Transaction not inserted(2)"; return DocAction.STATUS_Invalid; - } - } - - String m_MovementType = null; - if(qtyDiff.compareTo(Env.ZERO) > 0 ) - m_MovementType = MTransaction.MOVEMENTTYPE_InventoryIn; - else - m_MovementType = MTransaction.MOVEMENTTYPE_InventoryOut; - // Transaction - mtrx = new MTransaction (getCtx(), line.getAD_Org_ID(), m_MovementType, - line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), - qtyDiff, getMovementDate(), get_TrxName()); - mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); - if (!mtrx.save()) - { - m_processMsg = "Transaction not inserted(2)"; - return DocAction.STATUS_Invalid; - } - } // Fallback - } // stock movement + } + } // Fallback + } // stock movement + } + catch (NegativeInventoryDisallowedException e) + { + log.severe(e.getMessage()); + errors.append(Msg.getElement(getCtx(), "Line")).append(" ").append(line.getLine()).append(": "); + errors.append(e.getMessage()).append("\n"); + } } // for all lines + if (errors.toString().length() > 0) + { + m_processMsg = errors.toString(); + return DocAction.STATUS_Invalid; + } + // User Validation String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); if (valid != null) @@ -710,7 +726,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; diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index c48ce7252d..5f4f3d34c5 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/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/MLocation.java b/org.adempiere.base/src/org/compiere/model/MLocation.java index 81aa539e53..dc1c07da68 100644 --- a/org.adempiere.base/src/org/compiere/model/MLocation.java +++ b/org.adempiere.base/src/org/compiere/model/MLocation.java @@ -538,6 +538,8 @@ public class MLocation extends X_C_Location implements Comparator { // City, Region, Postal retStr.append(", ").append(parseCRP (getCountry())); + if (getAddress5() != null && getAddress5().length() > 0) + retStr.append(", ").append(getAddress5()); if (getAddress4() != null && getAddress4().length() > 0) retStr.append(", ").append(getAddress4()); if (getAddress3() != null && getAddress3().length() > 0) @@ -557,6 +559,8 @@ public class MLocation extends X_C_Location implements Comparator retStr.append(", ").append(getAddress3()); if (getAddress4() != null && getAddress4().length() > 0) retStr.append(", ").append(getAddress4()); + if (getAddress5() != null && getAddress5().length() > 0) + retStr.append(", ").append(getAddress5()); // City, Region, Postal retStr.append(", ").append(parseCRP (getCountry())); // Add Country would come here @@ -575,6 +579,8 @@ public class MLocation extends X_C_Location implements Comparator { // City, Region, Postal retStr.append(parseCRP (getCountry())); + if (getAddress5() != null && getAddress5().length() > 0) + retStr.append("\n").append(getAddress5()); if (getAddress4() != null && getAddress4().length() > 0) retStr.append("\n").append(getAddress4()); if (getAddress3() != null && getAddress3().length() > 0) @@ -594,6 +600,8 @@ public class MLocation extends X_C_Location implements Comparator retStr.append("\n").append(getAddress3()); if (getAddress4() != null && getAddress4().length() > 0) retStr.append("\n").append(getAddress4()); + if (getAddress5() != null && getAddress5().length() > 0) + retStr.append("\n").append(getAddress5()); // City, Region, Postal retStr.append("\n").append(parseCRP (getCountry())); // Add Country would come here @@ -731,6 +739,7 @@ public class MLocation extends X_C_Location implements Comparator StringBuilder address = new StringBuilder(); address.append((getAddress1() != null ? getAddress1() + ", " : "")); address.append((getAddress2() != null ? getAddress2() + ", " : "")); + address.append((getAddress3() != null ? getAddress3() + ", " : "")); address.append((getCity() != null ? getCity() + ", " : "")); address.append((region.getName() != null ? region.getName() + ", " : "")); address.append((getCountryName() != null ? getCountryName() : "")); @@ -826,6 +835,8 @@ public class MLocation extends X_C_Location implements Comparator at.setAddress2(location.getAddress2()); at.setAddress3(location.getAddress3()); at.setAddress4(location.getAddress4()); + at.setAddress5(location.getAddress5()); + at.setComments(location.getComments()); at.setC_AddressValidation_ID(C_AddressValidation_ID); at.setC_Location_ID(location.getC_Location_ID()); at.setCity(location.getCity()); diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index a56cfd7268..d84c0d717f 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.NegativeInventoryDisallowedException; import org.adempiere.exceptions.PeriodClosedException; import org.compiere.process.DocAction; import org.compiere.process.DocumentEngine; @@ -416,6 +417,7 @@ public class MMovement extends X_M_Movement implements DocAction approveIt(); if (log.isLoggable(Level.INFO)) log.info(toString()); + StringBuilder errors = new StringBuilder(); // MMovementLine[] lines = getLines(false); for (int i = 0; i < lines.length; i++) @@ -425,174 +427,190 @@ public class MMovement extends X_M_Movement implements DocAction //Stock Movement - Counterpart MOrder.reserveStock MProduct product = line.getProduct(); - if (product != null - && product.isStocked() ) + try { - //Ignore the Material Policy when is Reverse Correction - if(!isReversal()){ - BigDecimal qtyOnLineMA = MMovementLineMA.getManualQty(line.getM_MovementLine_ID(), get_TrxName()); - BigDecimal movementQty = line.getMovementQty(); - - if(qtyOnLineMA.compareTo(movementQty)>0) - { - // More then line qty on attribute tab for line 10 - m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + line.getLine(); - return DOCSTATUS_Invalid; - } - - checkMaterialPolicy(line,movementQty.subtract(qtyOnLineMA)); - } - - - if (line.getM_AttributeSetInstance_ID() == 0) + if (product != null + && product.isStocked() ) { - MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), - line.getM_MovementLine_ID(), get_TrxName()); - for (int j = 0; j < mas.length; j++) + //Ignore the Material Policy when is Reverse Correction + if(!isReversal()){ + BigDecimal qtyOnLineMA = MMovementLineMA.getManualQty(line.getM_MovementLine_ID(), get_TrxName()); + BigDecimal movementQty = line.getMovementQty(); + + if(qtyOnLineMA.compareTo(movementQty)>0) + { + // More then line qty on attribute tab for line 10 + m_processMsg = "@Over_Qty_On_Attribute_Tab@ " + line.getLine(); + return DOCSTATUS_Invalid; + } + + checkMaterialPolicy(line,movementQty.subtract(qtyOnLineMA)); + } + + + if (line.getM_AttributeSetInstance_ID() == 0) { - MMovementLineMA ma = mas[j]; - // + MMovementLineMA mas[] = MMovementLineMA.get(getCtx(), + line.getM_MovementLine_ID(), get_TrxName()); + for (int j = 0; j < mas.length; j++) + { + MMovementLineMA ma = mas[j]; + // + MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName()); + //Update Storage + if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), + line.getM_Locator_ID(), + line.getM_Product_ID(), + ma.getM_AttributeSetInstance_ID(), + ma.getMovementQty().negate(),ma.getDateMaterialPolicy(), get_TrxName())) + { + String lastError = CLogger.retrieveErrorString(""); + m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; + return DocAction.STATUS_Invalid; + } + + int M_AttributeSetInstanceTo_ID = line.getM_AttributeSetInstanceTo_ID(); + //only can be same asi if locator is different + if (M_AttributeSetInstanceTo_ID == 0 && line.getM_Locator_ID() != line.getM_LocatorTo_ID()) + { + M_AttributeSetInstanceTo_ID = ma.getM_AttributeSetInstance_ID(); + } + //Update Storage + MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); + if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), + line.getM_LocatorTo_ID(), + line.getM_Product_ID(), + M_AttributeSetInstanceTo_ID, + ma.getMovementQty(),ma.getDateMaterialPolicy(), get_TrxName())) + { + String lastError = CLogger.retrieveErrorString(""); + m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; + return DocAction.STATUS_Invalid; + } + + // + trxFrom = new MTransaction (getCtx(), line.getAD_Org_ID(), + MTransaction.MOVEMENTTYPE_MovementFrom, + line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), + ma.getMovementQty().negate(), getMovementDate(), get_TrxName()); + trxFrom.setM_MovementLine_ID(line.getM_MovementLine_ID()); + if (!trxFrom.save()) + { + m_processMsg = "Transaction From not inserted (MA)"; + return DocAction.STATUS_Invalid; + } + // + MTransaction trxTo = new MTransaction (getCtx(), line.getAD_Org_ID(), + MTransaction.MOVEMENTTYPE_MovementTo, + line.getM_LocatorTo_ID(), line.getM_Product_ID(), M_AttributeSetInstanceTo_ID, + ma.getMovementQty(), getMovementDate(), get_TrxName()); + trxTo.setM_MovementLine_ID(line.getM_MovementLine_ID()); + if (!trxTo.save()) + { + m_processMsg = "Transaction To not inserted (MA)"; + return DocAction.STATUS_Invalid; + } + } + } + // Fallback - We have ASI + if (trxFrom == null) + { + Timestamp dateMPolicy= null; + MStorageOnHand[] storages = null; + if (line.getMovementQty().compareTo(Env.ZERO) > 0) { + // Find Date Material Policy bases on ASI + storages = MStorageOnHand.getWarehouse(getCtx(), 0, + line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), null, + MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, + line.getM_Locator_ID(), get_TrxName()); + } else { + //Case of reversal + storages = MStorageOnHand.getWarehouse(getCtx(), 0, + line.getM_Product_ID(), line.getM_AttributeSetInstanceTo_ID(), null, + MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, + line.getM_LocatorTo_ID(), get_TrxName()); + } + for (MStorageOnHand storage : storages) { + if (storage.getQtyOnHand().compareTo(line.getMovementQty()) >= 0) { + dateMPolicy = storage.getDateMaterialPolicy(); + break; + } + } + + if (dateMPolicy == null && storages.length > 0) + dateMPolicy = storages[0].getDateMaterialPolicy(); + MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName()); //Update Storage + Timestamp effDateMPolicy = dateMPolicy; + if (dateMPolicy == null && line.getMovementQty().negate().signum() > 0) + effDateMPolicy = getMovementDate(); if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), line.getM_Locator_ID(), line.getM_Product_ID(), - ma.getM_AttributeSetInstance_ID(), - ma.getMovementQty().negate(),ma.getDateMaterialPolicy(), get_TrxName())) + line.getM_AttributeSetInstance_ID(), + line.getMovementQty().negate(),effDateMPolicy, get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; return DocAction.STATUS_Invalid; } - - int M_AttributeSetInstanceTo_ID = line.getM_AttributeSetInstanceTo_ID(); - //only can be same asi if locator is different - if (M_AttributeSetInstanceTo_ID == 0 && line.getM_Locator_ID() != line.getM_LocatorTo_ID()) - { - M_AttributeSetInstanceTo_ID = ma.getM_AttributeSetInstance_ID(); - } - //Update Storage + + //Update Storage + effDateMPolicy = dateMPolicy; + if (dateMPolicy == null && line.getMovementQty().signum() > 0) + effDateMPolicy = getMovementDate(); MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), line.getM_LocatorTo_ID(), line.getM_Product_ID(), - M_AttributeSetInstanceTo_ID, - ma.getMovementQty(),ma.getDateMaterialPolicy(), get_TrxName())) + line.getM_AttributeSetInstanceTo_ID(), + line.getMovementQty(),effDateMPolicy, get_TrxName())) { String lastError = CLogger.retrieveErrorString(""); m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; return DocAction.STATUS_Invalid; } - + // trxFrom = new MTransaction (getCtx(), line.getAD_Org_ID(), MTransaction.MOVEMENTTYPE_MovementFrom, - line.getM_Locator_ID(), line.getM_Product_ID(), ma.getM_AttributeSetInstance_ID(), - ma.getMovementQty().negate(), getMovementDate(), get_TrxName()); + line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), + line.getMovementQty().negate(), getMovementDate(), get_TrxName()); trxFrom.setM_MovementLine_ID(line.getM_MovementLine_ID()); if (!trxFrom.save()) { - m_processMsg = "Transaction From not inserted (MA)"; + m_processMsg = "Transaction From not inserted"; return DocAction.STATUS_Invalid; } // MTransaction trxTo = new MTransaction (getCtx(), line.getAD_Org_ID(), MTransaction.MOVEMENTTYPE_MovementTo, - line.getM_LocatorTo_ID(), line.getM_Product_ID(), M_AttributeSetInstanceTo_ID, - ma.getMovementQty(), getMovementDate(), get_TrxName()); + line.getM_LocatorTo_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstanceTo_ID(), + line.getMovementQty(), getMovementDate(), get_TrxName()); trxTo.setM_MovementLine_ID(line.getM_MovementLine_ID()); if (!trxTo.save()) { - m_processMsg = "Transaction To not inserted (MA)"; + m_processMsg = "Transaction To not inserted"; return DocAction.STATUS_Invalid; } - } - } - // Fallback - We have ASI - if (trxFrom == null) - { - Timestamp dateMPolicy= null; - MStorageOnHand[] storages = null; - if (line.getMovementQty().compareTo(Env.ZERO) > 0) { - // Find Date Material Policy bases on ASI - storages = MStorageOnHand.getWarehouse(getCtx(), 0, - line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), null, - MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, - line.getM_Locator_ID(), get_TrxName()); - } else { - //Case of reversal - storages = MStorageOnHand.getWarehouse(getCtx(), 0, - line.getM_Product_ID(), line.getM_AttributeSetInstanceTo_ID(), null, - MClient.MMPOLICY_FiFo.equals(product.getMMPolicy()), false, - line.getM_LocatorTo_ID(), get_TrxName()); - } - for (MStorageOnHand storage : storages) { - if (storage.getQtyOnHand().compareTo(line.getMovementQty()) >= 0) { - dateMPolicy = storage.getDateMaterialPolicy(); - break; - } - } - - if (dateMPolicy == null && storages.length > 0) - dateMPolicy = storages[0].getDateMaterialPolicy(); - - MLocator locator = new MLocator (getCtx(), line.getM_Locator_ID(), get_TrxName()); - //Update Storage - Timestamp effDateMPolicy = dateMPolicy; - if (dateMPolicy == null && line.getMovementQty().negate().signum() > 0) - effDateMPolicy = getMovementDate(); - if (!MStorageOnHand.add(getCtx(),locator.getM_Warehouse_ID(), - line.getM_Locator_ID(), - line.getM_Product_ID(), - line.getM_AttributeSetInstance_ID(), - line.getMovementQty().negate(),effDateMPolicy, get_TrxName())) - { - String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; - return DocAction.STATUS_Invalid; - } - - //Update Storage - effDateMPolicy = dateMPolicy; - if (dateMPolicy == null && line.getMovementQty().signum() > 0) - effDateMPolicy = getMovementDate(); - MLocator locatorTo = new MLocator (getCtx(), line.getM_LocatorTo_ID(), get_TrxName()); - if (!MStorageOnHand.add(getCtx(),locatorTo.getM_Warehouse_ID(), - line.getM_LocatorTo_ID(), - line.getM_Product_ID(), - line.getM_AttributeSetInstanceTo_ID(), - line.getMovementQty(),effDateMPolicy, get_TrxName())) - { - String lastError = CLogger.retrieveErrorString(""); - m_processMsg = "Cannot correct Inventory OnHand (MA) - " + lastError; - return DocAction.STATUS_Invalid; - } - - // - trxFrom = new MTransaction (getCtx(), line.getAD_Org_ID(), - MTransaction.MOVEMENTTYPE_MovementFrom, - line.getM_Locator_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstance_ID(), - line.getMovementQty().negate(), getMovementDate(), get_TrxName()); - trxFrom.setM_MovementLine_ID(line.getM_MovementLine_ID()); - if (!trxFrom.save()) - { - m_processMsg = "Transaction From not inserted"; - return DocAction.STATUS_Invalid; - } - // - MTransaction trxTo = new MTransaction (getCtx(), line.getAD_Org_ID(), - MTransaction.MOVEMENTTYPE_MovementTo, - line.getM_LocatorTo_ID(), line.getM_Product_ID(), line.getM_AttributeSetInstanceTo_ID(), - line.getMovementQty(), getMovementDate(), get_TrxName()); - trxTo.setM_MovementLine_ID(line.getM_MovementLine_ID()); - if (!trxTo.save()) - { - m_processMsg = "Transaction To not inserted"; - return DocAction.STATUS_Invalid; - } - } // Fallback - } // product stock + } // Fallback + } // product stock + } + catch (NegativeInventoryDisallowedException e) + { + log.severe(e.getMessage()); + errors.append(Msg.getElement(getCtx(), "Line")).append(" ").append(line.getLine()).append(": "); + errors.append(e.getMessage()).append("\n"); + } } // for all lines + + if (errors.toString().length() > 0) + { + m_processMsg = errors.toString(); + return DocAction.STATUS_Invalid; + } + // User Validation String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); if (valid != null) diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index ed7a0e1021..afb98078fa 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 @@ -2454,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; 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/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)); diff --git a/org.adempiere.base/src/org/compiere/model/MPInstancePara.java b/org.adempiere.base/src/org/compiere/model/MPInstancePara.java index 2510e73c8a..08f3b1199b 100644 --- a/org.adempiere.base/src/org/compiere/model/MPInstancePara.java +++ b/org.adempiere.base/src/org/compiere/model/MPInstancePara.java @@ -232,4 +232,19 @@ public class MPInstancePara extends X_AD_PInstance_Para } return -1; } + + /** + * Get existing AD_PInstance_Para record or create a new one if not found + * @param ctx + * @param AD_PInstance_ID + * @param SeqNo + */ + public static MPInstancePara getOrCreate(Properties ctx, int AD_PInstance_ID, int SeqNo) + { + Query query = new Query(ctx, Table_Name, "AD_PInstance_ID=? AND SeqNo=?", null); + MPInstancePara para = query.setParameters(AD_PInstance_ID, SeqNo).first(); + if (para == null) + para = new MPInstancePara(ctx, AD_PInstance_ID, SeqNo); + return para; + } } // MPInstance_Para diff --git a/org.adempiere.base/src/org/compiere/model/MProductPricing.java b/org.adempiere.base/src/org/compiere/model/MProductPricing.java index da08e5ecc8..b49cd5357e 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductPricing.java +++ b/org.adempiere.base/src/org/compiere/model/MProductPricing.java @@ -35,6 +35,33 @@ import org.compiere.util.Trace; */ public class MProductPricing { + + 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; + } + /** * Constructor @@ -42,19 +69,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 +187,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 +306,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 +387,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 +468,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 +591,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 +676,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 +775,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 ()) diff --git a/org.adempiere.base/src/org/compiere/model/MProjectIssue.java b/org.adempiere.base/src/org/compiere/model/MProjectIssue.java index 729a8c122d..80243a9e92 100644 --- a/org.adempiere.base/src/org/compiere/model/MProjectIssue.java +++ b/org.adempiere.base/src/org/compiere/model/MProjectIssue.java @@ -22,8 +22,11 @@ import java.sql.Timestamp; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.NegativeInventoryDisallowedException; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Msg; /** * Project Issue Model @@ -172,9 +175,57 @@ public class MProjectIssue extends X_C_ProjectIssue dateMPolicy = t; } - if (MStorageOnHand.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(), - getM_Product_ID(), getM_AttributeSetInstance_ID(), - getMovementQty().negate(),dateMPolicy, get_TrxName())) + boolean ok = true; + try + { + if (getMovementQty().negate().signum() < 0) + { + String MMPolicy = product.getMMPolicy(); + Timestamp minGuaranteeDate = getMovementDate(); + int M_Warehouse_ID = getM_Locator_ID() > 0 ? getM_Locator().getM_Warehouse_ID() : getC_Project().getM_Warehouse_ID(); + MStorageOnHand[] storages = MStorageOnHand.getWarehouse(getCtx(), M_Warehouse_ID, getM_Product_ID(), getM_AttributeSetInstance_ID(), + minGuaranteeDate, MClient.MMPOLICY_FiFo.equals(MMPolicy), true, getM_Locator_ID(), get_TrxName(), true); + BigDecimal qtyToIssue = getMovementQty(); + for (MStorageOnHand storage: storages) + { + if (storage.getQtyOnHand().compareTo(qtyToIssue) >= 0) + { + storage.addQtyOnHand(qtyToIssue.negate()); + qtyToIssue = BigDecimal.ZERO; + } + else + { + qtyToIssue = qtyToIssue.subtract(storage.getQtyOnHand()); + storage.addQtyOnHand(storage.getQtyOnHand().negate()); + } + + if (qtyToIssue.signum() == 0) + break; + } + if (qtyToIssue.signum() > 0) + { + ok = MStorageOnHand.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(), + getM_Product_ID(), getM_AttributeSetInstance_ID(), + qtyToIssue.negate(),dateMPolicy, get_TrxName()); + } + } + else + { + ok = MStorageOnHand.add(getCtx(), loc.getM_Warehouse_ID(), getM_Locator_ID(), + getM_Product_ID(), getM_AttributeSetInstance_ID(), + getMovementQty().negate(),dateMPolicy, get_TrxName()); + } + } + catch (NegativeInventoryDisallowedException e) + { + log.severe(e.getMessage()); + StringBuilder error = new StringBuilder(); + error.append(Msg.getElement(getCtx(), "Line")).append(" ").append(getLine()).append(": "); + error.append(e.getMessage()).append("\n"); + throw new AdempiereException(error.toString()); + } + + if (ok) { if (mTrx.save(get_TrxName())) { 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()); // diff --git a/org.adempiere.base/src/org/compiere/model/MSequence.java b/org.adempiere.base/src/org/compiere/model/MSequence.java index a16fc8fbe9..a63e23aef3 100644 --- a/org.adempiere.base/src/org/compiere/model/MSequence.java +++ b/org.adempiere.base/src/org/compiere/model/MSequence.java @@ -1328,6 +1328,7 @@ public class MSequence extends X_AD_Sequence "AD_PINSTANCE", "AD_PINSTANCE_LOG", "AD_PINSTANCE_PARA", + "AD_PREFERENCE", "AD_RECENTITEM", "AD_REPLICATION_LOG", "AD_SCHEDULERLOG", diff --git a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java index c20f5284d2..677522cfe4 100644 --- a/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java +++ b/org.adempiere.base/src/org/compiere/model/MStorageOnHand.java @@ -27,11 +27,10 @@ import java.util.List; import java.util.Properties; import java.util.logging.Level; -import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.NegativeInventoryDisallowedException; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; -import org.compiere.util.Msg; import org.compiere.util.Util; /** @@ -735,7 +734,8 @@ public class MStorageOnHand extends X_M_StorageOnHand if (getQtyOnHand().signum() == -1) { MWarehouse wh = MWarehouse.get(Env.getCtx(), getM_Warehouse_ID()); if (wh.isDisallowNegativeInv()) { - throw new AdempiereException(Msg.getMsg(Env.getCtx(), "NegativeInventoryDisallowed")); + throw new NegativeInventoryDisallowedException(getCtx(), getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(), getM_Locator_ID(), + getQtyOnHand().subtract(addition), addition.negate()); } } } @@ -899,13 +899,15 @@ public class MStorageOnHand extends X_M_StorageOnHand if (getQtyOnHand().compareTo(BigDecimal.ZERO) < 0 || QtyOnHand.compareTo(Env.ZERO) < 0) { - log.saveError("Error", Msg.getMsg(getCtx(), "NegativeInventoryDisallowed")); + log.saveError("Error", new NegativeInventoryDisallowedException(getCtx(), getM_Warehouse_ID(), getM_Product_ID(), + getM_AttributeSetInstance_ID(), getM_Locator_ID(), QtyOnHand.subtract(getQtyOnHand()), getQtyOnHand().negate())); return false; } if (getM_AttributeSetInstance_ID() > 0 && getQtyOnHand().signum() < 0) { - log.saveError("Error", Msg.getMsg(getCtx(), "NegativeInventoryDisallowed")); + log.saveError("Error", new NegativeInventoryDisallowedException(getCtx(), getM_Warehouse_ID(), getM_Product_ID(), + getM_AttributeSetInstance_ID(), getM_Locator_ID(), QtyOnHand.subtract(getQtyOnHand()), getQtyOnHand().negate())); return false; } } 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.base/src/org/compiere/model/MTreeNode.java b/org.adempiere.base/src/org/compiere/model/MTreeNode.java index 98ded4562f..766968416f 100644 --- a/org.adempiere.base/src/org/compiere/model/MTreeNode.java +++ b/org.adempiere.base/src/org/compiere/model/MTreeNode.java @@ -268,7 +268,8 @@ public class MTreeNode extends DefaultMutableTreeNode if (imageIndicator == null) ; else if (imageIndicator.equals(MWFNode.ACTION_UserWindow) // Window - || imageIndicator.equals(MWFNode.ACTION_UserForm)) + || imageIndicator.equals(MWFNode.ACTION_UserForm) + || imageIndicator.equals(MWFNode.ACTION_UserInfo)) imageIndex = TYPE_WINDOW; else if (imageIndicator.equals(MWFNode.ACTION_AppsReport)) // Report imageIndex = TYPE_REPORT; 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/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 5f28c379b7..3dffa469ab 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/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_Node.java b/org.adempiere.base/src/org/compiere/model/X_AD_WF_Node.java index 280e41ca63..d31558d022 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_WF_Node.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_WF_Node.java @@ -33,7 +33,7 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent /** * */ - private static final long serialVersionUID = 20161030L; + private static final long serialVersionUID = 20170919L; /** Standard Constructor */ public X_AD_WF_Node (Properties ctx, int AD_WF_Node_ID, String trxName) @@ -48,7 +48,7 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent setCost (Env.ZERO); setDuration (0); setEntityType (null); -// 'U' +// @SQL=select get_sysconfig('DEFAULT_ENTITYTYPE','U',0,0) from dual setIsCentrallyMaintained (true); // Y setJoinElement (null); @@ -118,6 +118,8 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent public static final String ACTION_EMail = "M"; /** User Workbench = B */ public static final String ACTION_UserWorkbench = "B"; + /** User Info = I */ + public static final String ACTION_UserInfo = "I"; /** Set Action. @param Action Indicates the Action to be performed @@ -245,6 +247,34 @@ public class X_AD_WF_Node extends PO implements I_AD_WF_Node, I_Persistent return ii.intValue(); } + public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException + { + return (org.compiere.model.I_AD_InfoWindow)MTable.get(getCtx(), org.compiere.model.I_AD_InfoWindow.Table_Name) + .getPO(getAD_InfoWindow_ID(), get_TrxName()); } + + /** Set Info Window. + @param AD_InfoWindow_ID + Info and search/select Window + */ + public void setAD_InfoWindow_ID (int AD_InfoWindow_ID) + { + if (AD_InfoWindow_ID < 1) + set_Value (COLUMNNAME_AD_InfoWindow_ID, null); + else + set_Value (COLUMNNAME_AD_InfoWindow_ID, Integer.valueOf(AD_InfoWindow_ID)); + } + + /** Get Info Window. + @return Info and search/select Window + */ + public int getAD_InfoWindow_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_InfoWindow_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException { return (org.compiere.model.I_AD_Process)MTable.get(getCtx(), org.compiere.model.I_AD_Process.Table_Name) 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/model/X_C_AddressTransaction.java b/org.adempiere.base/src/org/compiere/model/X_C_AddressTransaction.java index 9b71383afd..cb490f75f6 100644 --- a/org.adempiere.base/src/org/compiere/model/X_C_AddressTransaction.java +++ b/org.adempiere.base/src/org/compiere/model/X_C_AddressTransaction.java @@ -30,7 +30,7 @@ public class X_C_AddressTransaction extends PO implements I_C_AddressTransaction /** * */ - private static final long serialVersionUID = 20161030L; + private static final long serialVersionUID = 20170908L; /** Standard Constructor */ public X_C_AddressTransaction (Properties ctx, int C_AddressTransaction_ID, String trxName) @@ -143,6 +143,23 @@ public class X_C_AddressTransaction extends PO implements I_C_AddressTransaction return (String)get_Value(COLUMNNAME_Address4); } + /** Set Address 5. + @param Address5 + Address Line 5 for the location + */ + public void setAddress5 (String Address5) + { + set_Value (COLUMNNAME_Address5, Address5); + } + + /** Get Address 5. + @return Address Line 5 for the location + */ + public String getAddress5 () + { + return (String)get_Value(COLUMNNAME_Address5); + } + /** Set Address Transaction. @param C_AddressTransaction_ID Address Transaction */ public void setC_AddressTransaction_ID (int C_AddressTransaction_ID) @@ -255,6 +272,23 @@ public class X_C_AddressTransaction extends PO implements I_C_AddressTransaction return ii.intValue(); } + /** Set Comments. + @param Comments + Comments or additional information + */ + public void setComments (String Comments) + { + set_Value (COLUMNNAME_Comments, Comments); + } + + /** Get Comments. + @return Comments or additional information + */ + public String getComments () + { + return (String)get_Value(COLUMNNAME_Comments); + } + /** Set Country. @param Country Country */ public void setCountry (String Country) diff --git a/org.adempiere.base/src/org/compiere/model/X_C_Location.java b/org.adempiere.base/src/org/compiere/model/X_C_Location.java index 8c95676c1d..d4b1fc44df 100644 --- a/org.adempiere.base/src/org/compiere/model/X_C_Location.java +++ b/org.adempiere.base/src/org/compiere/model/X_C_Location.java @@ -30,7 +30,7 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent /** * */ - private static final long serialVersionUID = 20161030L; + private static final long serialVersionUID = 20170908L; /** Standard Constructor */ public X_C_Location (Properties ctx, int C_Location_ID, String trxName) @@ -139,6 +139,23 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent return (String)get_Value(COLUMNNAME_Address4); } + /** Set Address 5. + @param Address5 + Address Line 5 for the location + */ + public void setAddress5 (String Address5) + { + set_Value (COLUMNNAME_Address5, Address5); + } + + /** Get Address 5. + @return Address Line 5 for the location + */ + public String getAddress5 () + { + return (String)get_Value(COLUMNNAME_Address5); + } + public org.compiere.model.I_C_AddressValidation getC_AddressValidation() throws RuntimeException { return (org.compiere.model.I_C_AddressValidation)MTable.get(getCtx(), org.compiere.model.I_C_AddressValidation.Table_Name) @@ -282,6 +299,23 @@ public class X_C_Location extends PO implements I_C_Location, I_Persistent return (String)get_Value(COLUMNNAME_C_Location_UU); } + /** Set Comments. + @param Comments + Comments or additional information + */ + public void setComments (String Comments) + { + set_Value (COLUMNNAME_Comments, Comments); + } + + /** Get Comments. + @return Comments or additional information + */ + public String getComments () + { + return (String)get_Value(COLUMNNAME_Comments); + } + public org.compiere.model.I_C_Region getC_Region() throws RuntimeException { return (org.compiere.model.I_C_Region)MTable.get(getCtx(), org.compiere.model.I_C_Region.Table_Name) 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 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('@'); } diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index 8ffe7f0637..ffb0efe452 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 ] diff --git a/org.adempiere.base/src/org/compiere/wf/MWFActivity.java b/org.adempiere.base/src/org/compiere/wf/MWFActivity.java index 206566f2e4..954bd49eed 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; @@ -49,14 +51,15 @@ 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.*; 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; @@ -1218,6 +1221,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); @@ -1247,6 +1261,12 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable if (log.isLoggable(Level.FINE)) log.fine("Window:AD_Window_ID=" + m_node.getAD_Window_ID()); return false; } + /****** User Info ******/ + else if (MWFNode.ACTION_UserInfo.equals(action)) + { + if (log.isLoggable(Level.FINE)) log.fine("InfoWindow:AD_InfoWindow_ID=" + m_node.getAD_InfoWindow_ID()); + return false; + } // throw new IllegalArgumentException("Invalid Action (Not Implemented) =" + action); } // performWork @@ -1274,9 +1294,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/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; diff --git a/org.adempiere.base/src/org/compiere/wf/MWFNode.java b/org.adempiere.base/src/org/compiere/wf/MWFNode.java index 92d09ae777..34c1824201 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; @@ -359,6 +360,8 @@ public class MWFNode extends X_AD_WF_Node return "Form:AD_Form_ID=" + getAD_Form_ID(); else if (ACTION_UserWindow.equals(action)) return "Window:AD_Window_ID=" + getAD_Window_ID(); + else if (ACTION_UserInfo.equals(action)) + return "Window:AD_InfoWindow_ID=" + getAD_InfoWindow_ID(); else if (ACTION_WaitSleep.equals(action)) return "Sleep:WaitTime=" + getWaitTime(); return "??"; @@ -425,6 +428,7 @@ public class MWFNode extends X_AD_WF_Node { if (ACTION_UserForm.equals(getAction()) || ACTION_UserWindow.equals(getAction()) + || ACTION_UserInfo.equals(getAction()) /*|| ACTION_UserWorkbench.equals(getAction())*/) return true; return false; @@ -603,6 +607,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)) { @@ -636,6 +650,14 @@ public class MWFNode extends X_AD_WF_Node return false; } } + else if (action.equals(ACTION_UserInfo)) + { + if (getAD_InfoWindow_ID() == 0) + { + log.saveError("FillMandatory", Msg.getElement(getCtx(), "AD_InfoWindow_ID")); + return false; + } + } // else if (action.equals(ACTION_UserWorkbench)) // { // && getAD_Workbench_ID() == 0) 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(); 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.base/src/org/eevolution/model/MDDOrder.java b/org.adempiere.base/src/org/eevolution/model/MDDOrder.java index abc0e43dd1..ef01e324ba 100644 --- a/org.adempiere.base/src/org/eevolution/model/MDDOrder.java +++ b/org.adempiere.base/src/org/eevolution/model/MDDOrder.java @@ -27,6 +27,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.NegativeInventoryDisallowedException; import org.compiere.model.MBPartner; import org.compiere.model.MBPartnerLocation; import org.compiere.model.MDocType; @@ -847,6 +848,7 @@ public class MDDOrder extends X_DD_Order implements DocAction BigDecimal Volume = Env.ZERO; BigDecimal Weight = Env.ZERO; + StringBuilder errors = new StringBuilder(); // Always check and (un) Reserve Inventory for (MDDOrderLine line : lines) { @@ -874,35 +876,47 @@ public class MDDOrder extends X_DD_Order implements DocAction MProduct product = line.getProduct(); if (product != null) { - if (product.isStocked()) + try { - // Update Storage - if (!MStorageOnHand.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(), - line.getM_Product_ID(), - line.getM_AttributeSetInstance_ID(), - Env.ZERO,null, get_TrxName())) + if (product.isStocked()) { - throw new AdempiereException(); - } - - if (!MStorageOnHand.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(), - line.getM_Product_ID(), - line.getM_AttributeSetInstanceTo_ID(), - Env.ZERO,null, get_TrxName())) - { - throw new AdempiereException(); - } - - } // stockec - // update line - line.setQtyReserved(line.getQtyReserved().add(reserved_ordered)); - line.saveEx(); - // - Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered())); - Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered())); + // Update Storage + if (!MStorageOnHand.add(getCtx(), locator_to.getM_Warehouse_ID(), locator_to.getM_Locator_ID(), + line.getM_Product_ID(), + line.getM_AttributeSetInstance_ID(), + Env.ZERO,null, get_TrxName())) + { + throw new AdempiereException(); + } + + if (!MStorageOnHand.add(getCtx(), locator_from.getM_Warehouse_ID(), locator_from.getM_Locator_ID(), + line.getM_Product_ID(), + line.getM_AttributeSetInstanceTo_ID(), + Env.ZERO,null, get_TrxName())) + { + throw new AdempiereException(); + } + + } // stockec + // update line + line.setQtyReserved(line.getQtyReserved().add(reserved_ordered)); + line.saveEx(); + // + Volume = Volume.add(product.getVolume().multiply(line.getQtyOrdered())); + Weight = Weight.add(product.getWeight().multiply(line.getQtyOrdered())); + } + catch (NegativeInventoryDisallowedException e) + { + log.severe(e.getMessage()); + errors.append(Msg.getElement(getCtx(), "Line")).append(" ").append(line.getLine()).append(": "); + errors.append(e.getMessage()).append("\n"); + } } // product } // reverse inventory + if (errors.toString().length() > 0) + throw new AdempiereException(errors.toString()); + setVolume(Volume); setWeight(Weight); } // reserveStock 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.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")); diff --git a/org.adempiere.server-feature/build.xml b/org.adempiere.server-feature/build.xml index 4e9b23445a..e2b016f880 100644 --- a/org.adempiere.server-feature/build.xml +++ b/org.adempiere.server-feature/build.xml @@ -1,7 +1,7 @@ - + - + @@ -52,6 +52,8 @@ + + @@ -110,6 +112,6 @@ + description="Setup iDempiere"> \ No newline at end of file diff --git a/org.adempiere.server-feature/idempiere-server.bat b/org.adempiere.server-feature/idempiere-server.bat index 7f3e4427eb..216310fdef 100644 --- a/org.adempiere.server-feature/idempiere-server.bat +++ b/org.adempiere.server-feature/idempiere-server.bat @@ -17,5 +17,21 @@ 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.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 +@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..1891706b18 100644 --- a/org.adempiere.server-feature/idempiere-server.sh +++ b/org.adempiere.server-feature/idempiere-server.sh @@ -18,5 +18,19 @@ 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.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 +-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/jettyhome/etc/jetty-template.xml b/org.adempiere.server-feature/jettyhome/etc/jetty-template.xml index dd53d92ba3..2f4e8bf4e4 100644 --- a/org.adempiere.server-feature/jettyhome/etc/jetty-template.xml +++ b/org.adempiere.server-feature/jettyhome/etc/jetty-template.xml @@ -159,4 +159,5 @@ org.eclipse.jetty.server.Request.maxFormContentSize 1048576 + false 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 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.adempiere.server/src/main/server/org/compiere/server/AcctProcessor.java b/org.adempiere.server/src/main/server/org/compiere/server/AcctProcessor.java index c1c4b22876..09b27b5238 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/AcctProcessor.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/AcctProcessor.java @@ -34,6 +34,7 @@ import org.compiere.model.MClient; import org.compiere.model.MCost; import org.compiere.model.MOrgInfo; import org.compiere.model.MRole; +import org.compiere.model.MTable; import org.compiere.model.MUser; import org.compiere.util.DB; import org.compiere.util.Env; @@ -224,7 +225,6 @@ public class AcctProcessor extends AdempiereServer rs = pstmt.executeQuery(); while (!isInterrupted() && rs.next()) { - count[i]++; boolean ok = true; try { @@ -238,6 +238,17 @@ public class AcctProcessor extends AdempiereServer } if (!ok) countError[i]++; + else // only count the posted record. + { + MTable table = MTable.get(Env.getCtx(), AD_Table_ID); + int Record_ID = rs.getInt(table.getKeyColumns()[0]); + sql = new StringBuffer("SELECT COUNT(*) FROM ").append(table.getTableName()); + sql.append(" WHERE Posted='Y' AND ").append(table.getTableName()).append("_ID=").append(Record_ID); + int no = DB.getSQLValue(null, sql.toString()); + if (no > 0 ) + count[i]++; + + } } } catch (Exception e) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessParameterPanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessParameterPanel.java index 58c9088e62..19b440fe3b 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ProcessParameterPanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ProcessParameterPanel.java @@ -207,7 +207,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe + "p.AD_Reference_ID, p.AD_Process_Para_ID, " + "p.FieldLength, p.IsMandatory, p.IsRange, p.ColumnName, " + "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, " - + "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, p.ReadOnlyLogic, p.DisplayLogic, p.IsEncrypted, NULL AS FormatPattern " + + "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, p.ReadOnlyLogic, p.DisplayLogic, p.IsEncrypted, NULL AS FormatPattern, p.MandatoryLogic " + "FROM AD_Process_Para p" + " LEFT OUTER JOIN AD_Val_Rule vr ON (p.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) " + "WHERE p.AD_Process_ID=?" // 1 @@ -218,7 +218,7 @@ public class ProcessParameterPanel extends CPanel implements VetoableChangeListe + "p.AD_Reference_ID, p.AD_Process_Para_ID, " + "p.FieldLength, p.IsMandatory, p.IsRange, p.ColumnName, " + "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, " - + "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, p.ReadOnlyLogic, p.DisplayLogic, p.IsEncrypted, NULL AS FormatPattern " + + "p.SeqNo, p.AD_Reference_Value_ID, vr.Code AS ValidationCode, p.ReadOnlyLogic, p.DisplayLogic, p.IsEncrypted, NULL AS FormatPattern, p.MandatoryLogic " + "FROM AD_Process_Para p" + " INNER JOIN AD_Process_Para_Trl t ON (p.AD_Process_Para_ID=t.AD_Process_Para_ID)" + " LEFT OUTER JOIN AD_Val_Rule vr ON (p.AD_Val_Rule_ID=vr.AD_Val_Rule_ID) " diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java index d64f44a860..9687e12e9e 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/ed/VLocationDialog.java @@ -180,6 +180,8 @@ public class VLocationDialog extends CDialog private CLabel lAddress2 = new CLabel(Msg.getElement(Env.getCtx(), "Address2")); private CLabel lAddress3 = new CLabel(Msg.getElement(Env.getCtx(), "Address3")); private CLabel lAddress4 = new CLabel(Msg.getElement(Env.getCtx(), "Address4")); + private CLabel lAddress5 = new CLabel(Msg.getElement(Env.getCtx(), "Address5")); + private CLabel lComments = new CLabel(Msg.getElement(Env.getCtx(), "Comments")); private CLabel lCity = new CLabel(Msg.getMsg(Env.getCtx(), "City")); private CLabel lCountry = new CLabel(Msg.getMsg(Env.getCtx(), "Country")); private CLabel lRegion = new CLabel(Msg.getMsg(Env.getCtx(), "Region")); @@ -190,6 +192,8 @@ public class VLocationDialog extends CDialog private CTextField fAddress2 = new CTextField(20); // length=60 private CTextField fAddress3 = new CTextField(20); // length=60 private CTextField fAddress4 = new CTextField(20); // length=60 + private CTextField fAddress5 = new CTextField(20); // length=60 + private CTextField fComments = new CTextField(20); // length=2000 private CTextField fCity = new CTextField(20); // length=60 private CityAutoCompleter fCityAutoCompleter; private CComboBoxEditable fCountry; @@ -208,6 +212,8 @@ public class VLocationDialog extends CDialog private boolean isAddress2Mandatory = false; private boolean isAddress3Mandatory = false; private boolean isAddress4Mandatory = false; + private boolean isAddress5Mandatory = false; + private boolean isCommentsMandatory = false; private boolean isPostalMandatory = false; private boolean isPostalAddMandatory = false; @@ -337,6 +343,8 @@ public class VLocationDialog extends CDialog isAddress2Mandatory = false; isAddress3Mandatory = false; isAddress4Mandatory = false; + isAddress5Mandatory = false; + isCommentsMandatory = false; isPostalMandatory = false; isPostalAddMandatory = false; StringTokenizer st = new StringTokenizer(ds, "@", false); @@ -350,6 +358,9 @@ public class VLocationDialog extends CDialog if (m_location.getCountry().isPostcodeLookup()) { addLine(line++, lOnline, fOnline); } + } else if (s.startsWith("Com")) { + addLine(line++, lComments, fComments); + isCommentsMandatory = s.endsWith("!"); } else if (s.startsWith("A1")) { addLine(line++, lAddress1, fAddress1); isAddress1Mandatory = s.endsWith("!"); @@ -362,6 +373,9 @@ public class VLocationDialog extends CDialog } else if (s.startsWith("A4")) { addLine(line++, lAddress4, fAddress4); isAddress4Mandatory = s.endsWith("!"); + } else if (s.startsWith("A5")) { + addLine(line++, lAddress5, fAddress5); + isAddress5Mandatory = s.endsWith("!"); } else if (s.startsWith("C")) { addLine(line++, lCity, fCity); isCityMandatory = s.endsWith("!"); @@ -384,6 +398,8 @@ public class VLocationDialog extends CDialog fAddress2.setText(m_location.getAddress2()); fAddress3.setText(m_location.getAddress3()); fAddress4.setText(m_location.getAddress4()); + fAddress5.setText(m_location.getAddress5()); + fComments.setText(m_location.getComments()); fCity.setText(m_location.getCity()); fPostal.setText(m_location.getPostal()); fPostalAdd.setText(m_location.getPostal_Add()); @@ -643,6 +659,8 @@ public class VLocationDialog extends CDialog m_location.setAddress2(fAddress2.getText()); m_location.setAddress3(fAddress3.getText()); m_location.setAddress4(fAddress4.getText()); + m_location.setAddress5(fAddress5.getText()); + m_location.setComments(fComments.getText()); m_location.setCity(fCity.getText()); m_location.setC_City_ID(fCityAutoCompleter.getC_City_ID()); m_location.setPostal(fPostal.getText()); @@ -704,6 +722,12 @@ public class VLocationDialog extends CDialog if (isAddress4Mandatory && fAddress4.getText().trim().length() == 0) { fields = fields + " " + "@Address4@, "; } + if (isAddress5Mandatory && fAddress5.getText().trim().length() == 0) { + fields = fields + " " + "@Address5@, "; + } + if (isCommentsMandatory && fComments.getText().trim().length() == 0) { + fields = fields + " " + "@Comments@, "; + } if (isCityMandatory && fCity.getText().trim().length() == 0) { fields = fields + " " + "@C_City_ID@, "; } @@ -734,6 +758,8 @@ public class VLocationDialog extends CDialog m_location.setAddress2(fAddress2.getText()); m_location.setAddress3(fAddress3.getText()); m_location.setAddress4(fAddress4.getText()); + m_location.setAddress5(fAddress5.getText()); + m_location.setComments(fComments.getText()); m_location.setCity(fCity.getText()); m_location.setC_City_ID(fCityAutoCompleter.getC_City_ID()); m_location.setPostal(fPostal.getText()); @@ -863,9 +889,13 @@ public class VLocationDialog extends CDialog private void fillLocation(HashMap postcodeData, MCountry country) { // If it's not empty warn the user. - if (fAddress1 != null || fAddress2 != null + if (fAddress1 != null + || fAddress2 != null || fAddress3 != null - || fAddress4 != null || fCity != null) { + || fAddress4 != null + || fAddress5 != null + || fComments != null + || fCity != null) { String warningMsg = "Existing address information will be overwritten. Proceed?"; String warningTitle = "Warning"; int response = JOptionPane.showConfirmDialog(null, warningMsg, @@ -902,6 +932,8 @@ public class VLocationDialog extends CDialog fAddress2.setText(values.getStreet2()); fAddress3.setText(values.getStreet3()); fAddress4.setText(values.getStreet4()); + fAddress5.setText(values.getStreet5()); + fComments.setText(values.getComments()); fCity.setText(values.getCity()); fPostal.setText(values.getPostcode()); @@ -964,6 +996,8 @@ public class VLocationDialog extends CDialog String address = ""; address = address + (fAddress1.getText() != null ? fAddress1.getText() + ", " : ""); address = address + (fAddress2.getText() != null ? fAddress2.getText() + ", " : ""); + address = address + (fAddress3.getText() != null ? fAddress3.getText() + ", " : ""); + address = address + (fAddress4.getText() != null ? fAddress4.getText() + ", " : ""); address = address + (fCity.getText() != null ? fCity.getText() + ", " : ""); if (region != null) address = address + (region.getName() != null ? region.getName() + ", " : ""); 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 a8bf29deeb..32d38f75af 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()); @@ -455,7 +448,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb String ua = Servlets.getUserAgent((ServletRequest) Executions.getCurrent().getNativeRequest()); clientInfo.userAgent = ua; ua = ua.toLowerCase(); - clientInfo.tablet = ua.indexOf("ipad") >= 0 || ua.indexOf("iphone") >= 0 || ua.indexOf("android") >= 0; + clientInfo.tablet = Executions.getCurrent().getBrowser("mobile") !=null; if (getDesktop() != null && getDesktop().getSession() != null) { getDesktop().getSession().setAttribute(CLIENT_INFO, clientInfo); } @@ -463,6 +456,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb Env.setContext(Env.getCtx(), "#clientInfo_desktopWidth", clientInfo.desktopWidth); Env.setContext(Env.getCtx(), "#clientInfo_desktopHeight", clientInfo.desktopHeight); Env.setContext(Env.getCtx(), "#clientInfo_orientation", clientInfo.orientation); + Env.setContext(Env.getCtx(), "#clientInfo_mobile", clientInfo.tablet); } } @@ -508,7 +502,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/WLogin.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java index ac3a08cde4..c123d9e34f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java @@ -17,24 +17,21 @@ package org.adempiere.webui; import java.util.Locale; import java.util.Properties; -import javax.servlet.ServletRequest; - import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.window.LoginWindow; -import org.zkoss.web.servlet.Servlets; import org.zkoss.zhtml.Text; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.metainfo.PageDefinition; import org.zkoss.zul.Borderlayout; +import org.zkoss.zul.Div; import org.zkoss.zul.East; import org.zkoss.zul.North; import org.zkoss.zul.South; import org.zkoss.zul.West; -import org.zkoss.zul.Div; import org.zkoss.zul.Window; /** @@ -82,15 +79,13 @@ public class WLogin extends AbstractUIPart browserWarningWindow.doOverlapped(); } - String ua = Servlets.getUserAgent((ServletRequest) Executions.getCurrent().getNativeRequest()); - ua = ua.toLowerCase(); - boolean mobile = ua.indexOf("ipad") >= 0 || ua.indexOf("iphone") >= 0 || ua.indexOf("android") >= 0; - + boolean mobile = Executions.getCurrent().getBrowser("mobile") !=null; West west = layout.getWest(); if (west.getFirstChild() != null && west.getFirstChild().getFirstChild() != null) { + west.setCollapsible(true); + west.setSplittable(true); if (mobile) { - west.setCollapsible(true); west.setOpen(false); } } else { 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); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java index 40b1e6db52..99dea34eb2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AbstractProcessDialog.java @@ -644,6 +644,8 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI saveReportOptionToInstance(savedParams.get(i)); savedParams.get(i).saveEx(); + + getProcessInfo().setAD_PInstance_ID(0); } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java index a12dfaa695..f5da8c2809 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessParameterPanel.java @@ -520,7 +520,7 @@ public class ProcessParameterPanel extends Panel implements result2 = editor2.getValue(); // Create Parameter - MPInstancePara para = new MPInstancePara(Env.getCtx(), + MPInstancePara para = MPInstancePara.getOrCreate(Env.getCtx(), m_processInfo.getAD_PInstance_ID(), i); GridField mField = (GridField) m_mFields.get(i); para.setParameterName(mField.getColumnName()); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java index 440b7c08ce..53a7f31b4f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java @@ -272,9 +272,11 @@ public class WPaySelect extends PaySelect */ private void loadBankInfo() { - BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem().getValue(); - if (bi == null) + if (fieldBankAccount.getItemCount() == 0) return; + + BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem().getValue(); + labelCurrency.setText(bi.Currency); labelBalance.setText(m_format.format(bi.Balance)); @@ -301,7 +303,13 @@ public class WPaySelect extends PaySelect miniTable.setColorCompare(payDate); if (log.isLoggable(Level.CONFIG)) log.config("PayDate=" + payDate); - BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem().getValue(); + if (fieldBankAccount.getItemCount() == 0) { + FDialog.error(m_WindowNo, form, "VPaySelectNoBank"); + return; + } + + + BankInfo bi = fieldBankAccount.getSelectedItem().getValue(); ValueNamePair paymentRule = (ValueNamePair) fieldPaymentRule.getSelectedItem().getValue(); KeyNamePair bpartner = (KeyNamePair) fieldBPartner.getSelectedItem().getValue(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java index 76e919efe3..812e64e8db 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java @@ -600,6 +600,8 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL ADForm form = ADForm.openForm(AD_Form_ID); form.setAttribute(Window.MODE_KEY, form.getWindowMode()); AEnv.showWindow(form); + }else if (MWFNode.ACTION_UserInfo.equals(m_node.getAction())){ + SessionManager.getAppDesktop().openInfo(m_node.getAD_InfoWindow_ID()); } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java index 26b3e6ed83..142c6dad39 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java @@ -291,6 +291,8 @@ public class WFPanel extends Borderlayout implements EventListener, IHelp SessionManager.getAppDesktop().openTask(wfn.getAD_Task_ID()); } else if (MWFNode.ACTION_SubWorkflow.equals(action) && wfn.getWorkflow_ID() > 0) { SessionManager.getAppDesktop().openWorkflow(wfn.getWorkflow_ID()); + }else if (wfn.getAD_InfoWindow_ID() > 0) { + SessionManager.getAppDesktop().openInfo(wfn.getAD_InfoWindow_ID()); } } 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..8d1f8d8d78 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 @@ -38,6 +38,7 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WSearchEditor; import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.StatusBarPanel; +import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.window.FDialog; @@ -329,7 +330,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 +380,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 +453,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; } @@ -551,7 +557,8 @@ public class WWFActivity extends ADForm implements EventListener } // -- else if (MWFNode.ACTION_UserWindow.equals(node.getAction()) - || MWFNode.ACTION_UserForm.equals(node.getAction())) + || MWFNode.ACTION_UserForm.equals(node.getAction()) + || MWFNode.ACTION_UserInfo.equals(node.getAction())) { fAnswerButton.setLabel(node.getName()); fAnswerButton.setTooltiptext(node.getDescription()); @@ -606,6 +613,8 @@ public class WWFActivity extends ADForm implements EventListener ADForm form = ADForm.openForm(AD_Form_ID); form.setAttribute(Window.MODE_KEY, form.getWindowMode()); AEnv.showWindow(form); + }else if (MWFNode.ACTION_UserInfo.equals(node.getAction())){ + SessionManager.getAppDesktop().openInfo(node.getAD_InfoWindow_ID()); } else log.log(Level.SEVERE, "No User Action:" + node.getAction()); 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() { @Override @@ -293,6 +300,11 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria helpController.render(e, this); + if (mobile) { + e.setVisible(false); + e.setOpen(false); + } + Center windowArea = layout.getCenter(); windowContainer.createPart(windowArea); 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 e3d85d98ee..9457e4117a 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 @@ -125,7 +125,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; 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() { 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..3699b0dfbb 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()) { @@ -365,10 +365,11 @@ public class LoginPanel extends Window 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); @@ -567,8 +568,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/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) { 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 diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 854521b354..041308777a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -76,6 +76,7 @@ import org.adempiere.webui.util.ZKUpdateUtil; import org.compiere.model.GridField; import org.compiere.model.GridFieldVO; import org.compiere.model.GridTab; +import org.compiere.model.Lookup; import org.compiere.model.MColumn; import org.compiere.model.MLookup; import org.compiere.model.MLookupFactory; @@ -92,9 +93,11 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.SecureEngine; +import org.compiere.util.Util; import org.compiere.util.ValueNamePair; import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Components; import org.zkoss.zk.ui.HtmlBasedComponent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -122,10 +125,14 @@ import org.zkoss.zul.Vlayout; */ public class FindWindow extends Window implements EventListener, ValueChangeListener, DialogEvents { + private static final String FIND_ROW_EDITOR = "find.row.editor"; + + private static final String FIND_ROW_EDITOR_TO = "find.row.editor.to"; + /** * */ - private static final long serialVersionUID = -5747652133096022993L; + private static final long serialVersionUID = -4461202150492732658L; // values and label for history combo private static final String HISTORY_DAY_ALL = "All"; @@ -221,7 +228,8 @@ public class FindWindow extends Window implements EventListener, ValueCha private Combobox historyCombo = new Combobox(); - private Properties m_findCtx; + private Properties m_simpleCtx; + private Properties m_advanceCtx; private static final String ON_POST_VISIBLE_ATTR = "onPostVisible.Event.Posted"; @@ -251,7 +259,8 @@ public class FindWindow extends Window implements EventListener, ValueCha m_minRecords = minRecords; m_isCancel = true; // - m_findCtx = new Properties(Env.getCtx()); + m_simpleCtx = new Properties(Env.getCtx()); + m_advanceCtx = new Properties(Env.getCtx()); this.setBorder("normal"); this.setShadow(false); @@ -634,7 +643,7 @@ public class FindWindow extends Window implements EventListener, ValueCha if (mField.getVO().displayType == DisplayType.YesNo) { // Make Yes-No searchable as list GridFieldVO vo = mField.getVO(); - GridFieldVO ynvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); + GridFieldVO ynvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); ynvo.IsDisplayed = true; ynvo.displayType = DisplayType.List; ynvo.AD_Reference_Value_ID = REFERENCE_YESNO; @@ -642,6 +651,7 @@ public class FindWindow extends Window implements EventListener, ValueCha ynvo.lookupInfo = MLookupFactory.getLookupInfo (ynvo.ctx, ynvo.WindowNo, ynvo.AD_Column_ID, ynvo.displayType, Env.getLanguage(ynvo.ctx), ynvo.ColumnName, ynvo.AD_Reference_Value_ID, ynvo.IsParent, ynvo.ValidationCode); + ynvo.lookupInfo.tabNo = TABNO; GridField ynfield = new GridField(ynvo); @@ -653,13 +663,14 @@ public class FindWindow extends Window implements EventListener, ValueCha GridFieldVO vo = mField.getVO(); if ( vo.AD_Reference_Value_ID > 0 ) { - GridFieldVO postedvo = vo.clone(vo.ctx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); + GridFieldVO postedvo = vo.clone(m_simpleCtx, vo.WindowNo, vo.TabNo, vo.AD_Window_ID, vo.AD_Tab_ID, vo.tabReadOnly); postedvo.IsDisplayed = true; postedvo.displayType = DisplayType.List; postedvo.lookupInfo = MLookupFactory.getLookupInfo (postedvo.ctx, postedvo.WindowNo, postedvo.AD_Column_ID, postedvo.displayType, Env.getLanguage(postedvo.ctx), postedvo.ColumnName, postedvo.AD_Reference_Value_ID, postedvo.IsParent, postedvo.ValidationCode); + postedvo.lookupInfo.tabNo = TABNO; GridField postedfield = new GridField(postedvo); @@ -669,7 +680,15 @@ public class FindWindow extends Window implements EventListener, ValueCha } } else { // clone the field and clean gridtab - IDEMPIERE-1105 - GridField findField = (GridField) mField.clone(m_findCtx); + GridField findField = (GridField) mField.clone(m_simpleCtx); + if (findField.isLookup()) { + Lookup lookup = findField.getLookup(); + if (lookup != null && lookup instanceof MLookup) { + MLookup mLookup = (MLookup) lookup; + mLookup.getLookupInfo().ctx = m_simpleCtx; + mLookup.getLookupInfo().tabNo = TABNO; + } + } findField.setGridTab(null); m_findFields[i] = findField; mField = findField; @@ -1058,6 +1077,7 @@ public class FindWindow extends Window implements EventListener, ValueCha editor.setMandatory(false); editor.setReadWrite(true); editor.dynamicDisplay(); + editor.addValueChangeListener(this); Label label = editor.getLabel(); Component fieldEditor = editor.getComponent(); @@ -1075,6 +1095,7 @@ public class FindWindow extends Window implements EventListener, ValueCha editorTo.setMandatory(false); editorTo.setReadWrite(true); editorTo.dynamicDisplay(); + editorTo.addValueChangeListener(this); // if (displayLength > 0) // set it back mField.setDisplayLength(displayLength); @@ -1916,7 +1937,7 @@ public class FindWindow extends Window implements EventListener, ValueCha GridField field = getTargetMField(columnName); if(field == null) return new Label(""); - GridField findField = (GridField) field.clone(m_findCtx); + GridField findField = (GridField) field.clone(m_advanceCtx); findField.setGridTab(null); WEditor editor = null; if (findField.isKey() @@ -1928,6 +1949,7 @@ public class FindWindow extends Window implements EventListener, ValueCha { if (findField.getAD_Reference_Value_ID() > 0) { MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), findField.getAD_Reference_Value_ID()); + info.tabNo = TABNO; MLookup mLookup = new MLookup(info, 0); editor = new WTableDirEditor(columnName, false,false, true, mLookup); findField.addPropertyChangeListener(editor); @@ -1945,7 +1967,13 @@ public class FindWindow extends Window implements EventListener, ValueCha //reload lookupinfo for find window if (DisplayType.isLookup(findField.getDisplayType()) ) { - findField.loadLookupNoValidate(); + findField.loadLookupNoValidate(); + Lookup lookup = findField.getLookup(); + if (lookup != null && lookup instanceof MLookup) + { + MLookup mLookup = (MLookup) lookup; + mLookup.getLookupInfo().tabNo = TABNO; + } editor = WebEditorFactory.getEditor(findField, true); findField.addPropertyChangeListener(editor); } @@ -1970,6 +1998,10 @@ public class FindWindow extends Window implements EventListener, ValueCha ((WPaymentEditor)editor).getComponent().setEnabled(true, false); } // + if (to) + row.setAttribute(FIND_ROW_EDITOR_TO, editor); + else + row.setAttribute(FIND_ROW_EDITOR, editor); return editor.getComponent(); } // getTableCellEditorComponent @@ -2358,20 +2390,92 @@ public class FindWindow extends Window implements EventListener, ValueCha { WEditor editor = (WEditor)evt.getSource(); // Editor component - Component component = editor.getComponent(); - ListCell listcell = (ListCell)component.getParent(); - listcell.setAttribute("value", evt.getNewValue()); - if (evt.getNewValue() == null) - Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), ""); - else if (evt.getNewValue() instanceof Boolean) - Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), (Boolean)evt.getNewValue()); - else if (evt.getNewValue() instanceof Timestamp) - Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), (Timestamp)evt.getNewValue()); + ListCell listcell = null; + Properties ctx = null; + if (winMain.getComponent().getSelectedIndex() == 1) + { + Component component = editor.getComponent(); + listcell = (ListCell)component.getParent(); + listcell.setAttribute("value", evt.getNewValue()); + ctx = m_advanceCtx; + } else - Env.setContext(m_findCtx, m_targetWindowNo, editor.getColumnName(), evt.getNewValue().toString()); + { + ctx = m_simpleCtx; + } + if (evt.getNewValue() == null) + { + Env.setContext(ctx, m_targetWindowNo, editor.getColumnName(), ""); + Env.setContext(ctx, m_targetWindowNo, TABNO, editor.getColumnName(), ""); + } + else if (evt.getNewValue() instanceof Boolean) + { + Env.setContext(ctx, m_targetWindowNo, editor.getColumnName(), (Boolean)evt.getNewValue()); + Env.setContext(ctx, m_targetWindowNo, TABNO, editor.getColumnName(), (Boolean)evt.getNewValue()); + } + else if (evt.getNewValue() instanceof Timestamp) + { + Env.setContext(ctx, m_targetWindowNo, editor.getColumnName(), (Timestamp)evt.getNewValue()); + Env.setContext(ctx, m_targetWindowNo, TABNO + "|" + editor.getColumnName(), (Timestamp)evt.getNewValue()); + } + else + { + Env.setContext(ctx, m_targetWindowNo, editor.getColumnName(), evt.getNewValue().toString()); + Env.setContext(ctx, m_targetWindowNo, TABNO, editor.getColumnName(), evt.getNewValue().toString()); + } + + dynamicDisplay(editor, listcell); } } + private void dynamicDisplay(WEditor editor, ListCell listcell) { + if (winMain.getComponent().getSelectedIndex() == 1) + { + List rowList = advancedPanel.getChildren(); + + for (int rowIndex = 1; rowIndex < rowList.size() ; rowIndex++) + { + // Column + ListItem row = (ListItem)rowList.get(rowIndex); + if (Components.isAncestor(row, listcell)) + continue; + WEditor other = (WEditor) row.getAttribute(FIND_ROW_EDITOR); + if (other != null && other.getGridField() != null && other.getGridField().isLookup()) + { + Lookup lookup = other.getGridField().getLookup(); + if (!Util.isEmpty(lookup.getValidation())) + { + other.dynamicDisplay(); + other = (WEditor) row.getAttribute(FIND_ROW_EDITOR_TO); + if (other != null) + other.dynamicDisplay(); + } + } + } + } + else + { + for (int i = 0; i < m_sEditors.size(); i++) + { + WEditor wed = (WEditor)m_sEditors.get(i); + if (wed == editor) + continue; + if (wed.getGridField() != null && wed.getGridField().isLookup()) + { + Lookup lookup = wed.getGridField().getLookup(); + if (!Util.isEmpty(lookup.getValidation())) + { + wed.dynamicDisplay(); + wed = m_sEditorsTo.get(i); + if (wed != null && wed != editor) + wed.dynamicDisplay(); + } + } + + } + } + } + public void OnPostVisible() { removeAttribute(ON_POST_VISIBLE_ATTR); if (m_sEditors.size() > 0) @@ -2410,7 +2514,7 @@ public class FindWindow extends Window implements EventListener, ValueCha private boolean isSearchLike(GridField field) { - return DisplayType.isText(field.getDisplayType()) + return DisplayType.isText(field.getDisplayType()) && !field.isVirtualColumn() && (field.isSelectionColumn() || MColumn.isSuggestSelectionColumn(field.getColumnName(), true)); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java index f096c9e5e7..728344debc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java @@ -99,6 +99,8 @@ public class WLocationDialog extends Window implements EventListener private Label lblAddress2; private Label lblAddress3; private Label lblAddress4; + private Label lblAddress5; + private Label lblComments; private Label lblCity; private Label lblZip; private Label lblRegion; @@ -110,6 +112,8 @@ public class WLocationDialog extends Window implements EventListener private Textbox txtAddress2; private Textbox txtAddress3; private Textbox txtAddress4; + private Textbox txtAddress5; + private Textbox txtComments; private WAutoCompleterCity txtCity; private Textbox txtPostal; private Textbox txtPostalAdd; @@ -132,6 +136,8 @@ public class WLocationDialog extends Window implements EventListener private boolean isAddress2Mandatory = false; private boolean isAddress3Mandatory = false; private boolean isAddress4Mandatory = false; + private boolean isAddress5Mandatory = false; + private boolean isCommentsMandatory = false; private boolean isPostalMandatory = false; private boolean isPostalAddMandatory = false; @@ -199,8 +205,8 @@ public class WLocationDialog extends Window implements EventListener setRegion(); initLocation(); // - ZKUpdateUtil.setWidth(this, "350px"); - ZKUpdateUtil.setHeight(this, "360px"); // required fixed height for ZK to auto adjust the position based on available space + ZKUpdateUtil.setWidth(this, "380px"); + ZKUpdateUtil.setHeight(this, "420px"); // required fixed height for ZK to auto adjust the position based on available space this.setSclass("popup-dialog"); this.setClosable(true); this.setBorder("normal"); @@ -218,6 +224,10 @@ public class WLocationDialog extends Window implements EventListener lblAddress3.setStyle(LABEL_STYLE); lblAddress4 = new Label(Msg.getElement(Env.getCtx(), "Address4")); lblAddress4.setStyle(LABEL_STYLE); + lblAddress5 = new Label(Msg.getElement(Env.getCtx(), "Address5")); + lblAddress5.setStyle(LABEL_STYLE); + lblComments = new Label(Msg.getElement(Env.getCtx(), "Comments")); + lblComments.setStyle(LABEL_STYLE); lblCity = new Label(Msg.getMsg(Env.getCtx(), "City")); lblCity.setStyle(LABEL_STYLE); lblZip = new Label(Msg.getMsg(Env.getCtx(), "Postal")); @@ -243,6 +253,12 @@ public class WLocationDialog extends Window implements EventListener txtAddress4 = new Textbox(); txtAddress4.setCols(20); txtAddress4.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address4)); + txtAddress5 = new Textbox(); + txtAddress5.setCols(20); + txtAddress5.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Address5)); + txtComments = new Textbox(); + txtComments.setCols(20); + txtComments.setMaxlength(MLocation.getFieldLength(MLocation.COLUMNNAME_Comments)); //autocomplete City txtCity = new WAutoCompleterCity(m_WindowNo); @@ -335,6 +351,16 @@ public class WLocationDialog extends Window implements EventListener pnlAddress4.appendChild(txtAddress4); ZKUpdateUtil.setHflex(txtAddress4, "1"); + Row pnlAddress5 = new Row(); + pnlAddress5.appendChild(lblAddress5.rightAlign()); + pnlAddress5.appendChild(txtAddress5); + ZKUpdateUtil.setHflex(txtAddress5, "1"); + + Row pnlComments = new Row(); + pnlComments.appendChild(lblComments.rightAlign()); + pnlComments.appendChild(txtComments); + ZKUpdateUtil.setHflex(txtComments, "1"); + Row pnlCity = new Row(); pnlCity.appendChild(lblCity.rightAlign()); pnlCity.appendChild(txtCity); @@ -540,6 +566,8 @@ public class WLocationDialog extends Window implements EventListener isAddress2Mandatory = false; isAddress3Mandatory = false; isAddress4Mandatory = false; + isAddress5Mandatory = false; + isCommentsMandatory = false; isPostalMandatory = false; isPostalAddMandatory = false; StringTokenizer st = new StringTokenizer(ds, "@", false); @@ -553,6 +581,9 @@ public class WLocationDialog extends Window implements EventListener // if (m_location.getCountry().isPostcodeLookup()) { // addLine(line++, lOnline, fOnline); // } + } else if (s.startsWith("Com")) { + addComponents((Row)txtComments.getParent()); + isCommentsMandatory = s.endsWith("!"); } else if (s.startsWith("A1")) { addComponents((Row)txtAddress1.getParent()); isAddress1Mandatory = s.endsWith("!"); @@ -565,6 +596,9 @@ public class WLocationDialog extends Window implements EventListener } else if (s.startsWith("A4")) { addComponents((Row)txtAddress4.getParent()); isAddress4Mandatory = s.endsWith("!"); + } else if (s.startsWith("A5")) { + addComponents((Row)txtAddress5.getParent()); + isAddress5Mandatory = s.endsWith("!"); } else if (s.startsWith("C")) { addComponents((Row)txtCity.getParent()); isCityMandatory = s.endsWith("!"); @@ -587,6 +621,8 @@ public class WLocationDialog extends Window implements EventListener txtAddress2.setText(m_location.getAddress2()); txtAddress3.setText(m_location.getAddress3()); txtAddress4.setText(m_location.getAddress4()); + txtAddress5.setText(m_location.getAddress5()); + txtComments.setText(m_location.getComments()); txtCity.setText(m_location.getCity()); txtPostal.setText(m_location.getPostal()); txtPostalAdd.setText(m_location.getPostal_Add()); @@ -770,6 +806,8 @@ public class WLocationDialog extends Window implements EventListener m_location.setAddress2(txtAddress2.getValue()); m_location.setAddress3(txtAddress3.getValue()); m_location.setAddress4(txtAddress4.getValue()); + m_location.setAddress5(txtAddress5.getValue()); + m_location.setComments(txtComments.getValue()); m_location.setC_City_ID(txtCity.getC_City_ID()); m_location.setCity(txtCity.getValue()); m_location.setPostal(txtPostal.getValue()); @@ -890,6 +928,12 @@ public class WLocationDialog extends Window implements EventListener if (isAddress4Mandatory && txtAddress4.getText().trim().length() == 0) { fields = fields + " " + "@Address4@, "; } + if (isAddress5Mandatory && txtAddress5.getText().trim().length() == 0) { + fields = fields + " " + "@Address5@, "; + } + if (isCommentsMandatory && txtComments.getText().trim().length() == 0) { + fields = fields + " " + "@Comments@, "; + } if (isCityMandatory && txtCity.getValue().trim().length() == 0) { fields = fields + " " + "@C_City_ID@, "; } @@ -921,6 +965,8 @@ public class WLocationDialog extends Window implements EventListener m_location.setAddress2(txtAddress2.getValue()); m_location.setAddress3(txtAddress3.getValue()); m_location.setAddress4(txtAddress4.getValue()); + m_location.setAddress5(txtAddress5.getValue()); + m_location.setComments(txtComments.getValue()); m_location.setC_City_ID(txtCity.getC_City_ID()); m_location.setCity(txtCity.getValue()); m_location.setPostal(txtPostal.getValue()); @@ -1020,6 +1066,8 @@ public class WLocationDialog extends Window implements EventListener String address = ""; address = address + (txtAddress1.getText() != null ? txtAddress1.getText() + ", " : ""); address = address + (txtAddress2.getText() != null ? txtAddress2.getText() + ", " : ""); + address = address + (txtAddress3.getText() != null ? txtAddress3.getText() + ", " : ""); + address = address + (txtAddress4.getText() != null ? txtAddress4.getText() + ", " : ""); address = address + (txtCity.getText() != null ? txtCity.getText() + ", " : ""); if (region != null) address = address + (region.getName() != null ? region.getName() + ", " : ""); diff --git a/org.adempiere.ui.zk/theme/default/css/fragment/desktop.css.dsp b/org.adempiere.ui.zk/theme/default/css/fragment/desktop.css.dsp index 329e554d56..af7360176a 100644 --- a/org.adempiere.ui.zk/theme/default/css/fragment/desktop.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/fragment/desktop.css.dsp @@ -231,3 +231,25 @@ height: 16px; padding: 3px 3px; } +@media screen and (min-width: 720px) { + .desktop-header > .z-hlayout-inner { + width: 50%; + height: 100%; + } +} +@media screen and (max-width: 720px) { + .desktop-header { + width: 100%; + height: 100%; + + } + .desktop-user-panel { + float: none; + } + .desktop-header > .z-hlayout-inner { + width: 100%; + height: 40%; + display: block; + } + +} diff --git a/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul b/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul index 7df7a93103..ef83edb555 100644 --- a/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul +++ b/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul @@ -1,19 +1,15 @@