Merge with 5c0d84b4b50732776e41a30c15cc21a2615b1a86

This commit is contained in:
Heng Sin Low 2012-10-10 07:40:44 +08:00
commit 09397e24a6
423 changed files with 27809 additions and 10703 deletions

View File

@ -16,16 +16,15 @@ CREATE OR REPLACE PROCEDURE nextID
* Title: Get Next ID - no Commit * Title: Get Next ID - no Commit
* Description: * Description:
* Test via * Test via
DECLARE
v_NextID NUMBER;
BEGIN
nextID(2, 'Y', v_NextID);
DBMS_OUTPUT.PUT_LINE(v_NextID);
END;
* *
************************************************************************/ ************************************************************************/
AS AS
Isnativeseqon NVARCHAR2(1);
Tablename Nvarchar2(60);
sqlcmd VARCHAR2(200);
BEGIN BEGIN
IF (p_System = 'Y') THEN IF (p_System = 'Y') THEN
SELECT CurrentNextSys SELECT CurrentNextSys
INTO o_NextID INTO o_NextID
@ -37,15 +36,32 @@ BEGIN
SET CurrentNextSys = CurrentNextSys + IncrementNo SET CurrentNextSys = CurrentNextSys + IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID; WHERE AD_Sequence_ID=p_AD_Sequence_ID;
ELSE ELSE
Isnativeseqon := get_Sysconfig('SYSTEM_NATIVE_SEQUENCE','N',0,0);
IF Isnativeseqon = 'Y' THEN
SELECT Name
INTO tablename
FROM Ad_Sequence
WHERE Ad_Sequence_Id=P_Ad_Sequence_Id;
--
Sqlcmd := 'SELECT '||Tablename||'_SQ.Nextval FROM DUAL';
--
Execute Immediate Sqlcmd Into O_Nextid;
--
ELSE
SELECT CurrentNext SELECT CurrentNext
INTO o_NextID INTO o_NextID
FROM AD_Sequence FROM AD_Sequence
WHERE AD_Sequence_ID=p_AD_Sequence_ID WHERE AD_Sequence_ID=p_AD_Sequence_ID
FOR UPDATE OF CurrentNext; FOR UPDATE OF CurrentNext;
-- --
UPDATE AD_Sequence UPDATE Ad_Sequence
SET CurrentNext = CurrentNext + IncrementNo SET Currentnext = Currentnext + Incrementno
WHERE AD_Sequence_ID=p_AD_Sequence_ID; WHERE Ad_Sequence_Id=P_Ad_Sequence_Id;
--
END IF;
END IF; END IF;
-- --
EXCEPTION EXCEPTION

View File

@ -21,7 +21,9 @@ CREATE OR REPLACE FUNCTION nextid(
* select * from nextid((select ad_sequence_id from ad_sequence where name = 'Test')::Integer, 'Y'::Varchar); * select * from nextid((select ad_sequence_id from ad_sequence where name = 'Test')::Integer, 'Y'::Varchar);
* *
************************************************************************/ ************************************************************************/
DECLARE
Isnativeseqon VARCHAR(1);
tablename VARCHAR(60);
BEGIN BEGIN
IF (p_System = 'Y') THEN IF (p_System = 'Y') THEN
RAISE NOTICE 'system'; RAISE NOTICE 'system';
@ -34,6 +36,17 @@ BEGIN
SET CurrentNextSys = CurrentNextSys + IncrementNo SET CurrentNextSys = CurrentNextSys + IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID; WHERE AD_Sequence_ID=p_AD_Sequence_ID;
ELSE ELSE
Isnativeseqon := get_Sysconfig('SYSTEM_NATIVE_SEQUENCE','N',0,0);
IF Isnativeseqon = 'Y' THEN
SELECT Name
INTO tablename
FROM Ad_Sequence
WHERE Ad_Sequence_Id=P_Ad_Sequence_Id;
--
EXECUTE 'SELECT nextval('''||tablename||'_sq'''||')' INTO o_NextID;
--
ELSE
SELECT CurrentNext SELECT CurrentNext
INTO o_NextID INTO o_NextID
FROM AD_Sequence FROM AD_Sequence
@ -43,6 +56,7 @@ BEGIN
SET CurrentNext = CurrentNext + IncrementNo SET CurrentNext = CurrentNext + IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID; WHERE AD_Sequence_ID=p_AD_Sequence_ID;
END IF; END IF;
END IF;
-- --
EXCEPTION EXCEPTION
WHEN OTHERS THEN WHEN OTHERS THEN
@ -51,5 +65,3 @@ END;
$body$ LANGUAGE plpgsql; $body$ LANGUAGE plpgsql;

View File

@ -0,0 +1,368 @@
-- Sep 4, 2012 10:34:50 AM COT
-- Element Master Role
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsMasterRole',200117,'D','MasterRole','MasterRole','4bad6035-f81b-4e25-81d9-bbf55b099113',0,TO_DATE('2012-09-04 10:34:49','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-04 10:34:49','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Sep 4, 2012 10:34:50 AM COT
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200117 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Sep 4, 2012 10:36:19 AM COT
-- Column master Role
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection,DefaultValue) VALUES (0,156,200410,'D','Y','N','N',0,'N',1,'N',20,'N','N',200117,'N','Y','5ec60b3e-f1a7-447c-a7ea-f3575dcb24d4','N','Y','N','IsMasterRole','MasterRole','Y',100,TO_DATE('2012-09-04 10:36:18','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-09-04 10:36:18','YYYY-MM-DD HH24:MI:SS'),100,0,0,'N')
;
-- Sep 4, 2012 10:36:19 AM COT
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200410 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Sep 4, 2012 10:37:58 AM COT
-- Field Master Role
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsDisplayed,IsFieldOnly,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',119,1,'N','N',200410,'Y',200411,'N','D','MasterRole','Y','N','b57a3894-98be-44fa-a834-6883c8824d92',100,0,TO_DATE('2012-09-04 10:37:58','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-09-04 10:37:58','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Sep 4, 2012 10:37:58 AM COT
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200411 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Sep 4, 2012 10:38:27 AM COT
-- seq
UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=200411
;
-- Sep 4, 2012 10:38:40 AM COT
-- Position web
UPDATE AD_Field SET XPosition=2,Updated=TO_DATE('2012-09-04 10:38:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200411
;
-- Sep 4, 2012 4:12:10 PM COT
-- Validation for just Master Role in included roles
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,AD_Client_ID,IsActive,AD_Org_ID) VALUES ('AD_Role.IsMasterRole=''Y''',200006,'D','MasterRoles','S','5d5fa599-0937-4e88-905b-b0814fc7fc84',100,100,TO_DATE('2012-09-04 16:12:08','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-04 16:12:08','YYYY-MM-DD HH24:MI:SS'),0,'Y',0)
;
-- Sep 4, 2012 4:13:06 PM COT
UPDATE AD_Column SET AD_Val_Rule_ID=200006, IsUpdateable='N',Updated=TO_DATE('2012-09-04 16:13:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=57949
;
-- Sep 4, 2012 4:55:32 PM COT
-- Display Logic Window Role
UPDATE AD_Tab SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-04 16:55:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=351
;
-- Sep 4, 2012 4:55:40 PM COT
-- Display Logic Window Role
UPDATE AD_Tab SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-04 16:55:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=120
;
-- Sep 4, 2012 4:55:53 PM COT
-- Display Logic Window Role
UPDATE AD_Tab SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-04 16:55:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53240
;
-- Sep 5, 2012 2:26:43 PM COT
-- Roles are manual for default
UPDATE AD_Column SET DefaultValue='Y',Updated=TO_DATE('2012-09-05 14:26:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9593
;
-- Sep 11, 2012 6:56:24 PM COT
ALTER TABLE AD_Role ADD IsMasterRole CHAR(1) DEFAULT 'N' CHECK (IsMasterRole IN ('Y','N')) NOT NULL
;
-- Sep 11, 2012 6:56:46 PM COT
ALTER TABLE AD_Role MODIFY IsManual CHAR(1) DEFAULT 'Y'
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=200411
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=930
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=931
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=59592
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=59591
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=10126
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=52018
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=8740
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=5227
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=11006
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11003
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=11002
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=8311
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=10813
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=11256
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=11257
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=8313
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=8314
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=8312
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=8310
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=12367
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=12368
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=12641
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=200071
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=50168
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=50169
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=50170
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=50171
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=50172
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50173
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=50174
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=50175
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=50176
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=50177
;
-- Sep 11, 2012 8:39:23 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=50178
;
-- Sep 11, 2012 8:39:23 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=55432
;
-- Sep 11, 2012 8:39:23 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=55433
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Element SET Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', PrintName='Master Role',Updated=TO_DATE('2012-09-11 20:43:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=200117
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=200117
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Column SET ColumnName='IsMasterRole', Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL WHERE AD_Element_ID=200117
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Process_Para SET ColumnName='IsMasterRole', Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL, AD_Element_ID=200117 WHERE UPPER(ColumnName)='ISMASTERROLE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Process_Para SET ColumnName='IsMasterRole', Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL WHERE AD_Element_ID=200117 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=200117) AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_PrintFormatItem pi SET PrintName='Master Role', Name='Master Role' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=200117)
;
-- Sep 11, 2012 10:48:11 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLJ'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-11 22:48:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=102
;
-- Sep 12, 2012 11:38:13 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:38:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=124
;
-- Sep 12, 2012 11:40:18 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLD'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:40:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=121
;
-- Sep 12, 2012 11:41:16 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:41:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=173
;
-- Sep 12, 2012 11:41:30 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMI'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:41:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=209
;
-- Sep 12, 2012 11:41:39 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'') AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:41:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52054
;
-- Sep 12, 2012 11:41:55 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'') AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:41:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=125
;
-- Sep 12, 2012 11:42:02 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMM'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:42:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=201
;
-- Sep 12, 2012 11:42:08 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''DOO'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:42:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52004
;
-- Sep 12, 2012 11:42:16 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_DATE('2012-09-12 11:42:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52066
;
-- Sep 12, 2012 6:20:08 PM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMI'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-12 18:20:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=209
;
-- Sep 12, 2012 6:28:44 PM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARR'', ''APP'') AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-12 18:28:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=149
;
UPDATE AD_System
SET LastMigrationScriptApplied='899_IDEMPIERE_366.sql'
WHERE LastMigrationScriptApplied<'899_IDEMPIERE_366.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,62 @@
-- Sep 11, 2012 8:42:54 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Invoice Processed: ',200060,'U','3c06a457-be2c-4e54-a197-ac5b5646143f','InvoiceProcessed','Y',TO_DATE('2012-09-11 20:42:53','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 20:42:53','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:42:55 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200060 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 8:49:40 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Payment Allocated: ',200061,'U','2d9d4e87-b308-4643-9046-a2730a95cb9b','PaymentAllocated','Y',TO_DATE('2012-09-11 20:49:39','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 20:49:39','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:49:40 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200061 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 8:52:47 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Allocation Processed: ',200062,'U','5e6e24fc-a609-4424-9aa4-f30f13fa03ac','AllocationProcessed','Y',TO_DATE('2012-09-11 20:52:46','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 20:52:46','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:52:47 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200062 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 8:54:59 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Shipment Processed: ',200063,'U','1de82564-7da4-468e-955d-7451a304844d','ShipmentProcessed','Y',TO_DATE('2012-09-11 20:54:58','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 20:54:58','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:54:59 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200063 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 9:00:52 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Order Created: ',200064,'U','0e54bec9-9529-4ac8-b453-b36b201b5149','OrderCreated','Y',TO_DATE('2012-09-11 21:00:51','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 21:00:51','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 9:00:52 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200064 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 9:05:34 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Generated PO: ',200065,'U','f0135f4a-27e6-499c-9c7e-851631a10a4f','GeneratedPO','Y',TO_DATE('2012-09-11 21:05:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-11 21:05:33','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 9:05:34 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200065 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('908_Process_Message.sql') FROM dual
;

View File

@ -0,0 +1,36 @@
-- Sep 12, 2012 6:56:41 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name) VALUES (200020,'D','S','Y','New password must differs from the old password','13b5a576-7b91-471b-8b40-05589dd585f7',TO_DATE('2012-09-12 18:56:39','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-12 18:56:39','YYYY-MM-DD HH24:MI:SS'),0,0,100,'Y',100,'CHANGE_PASSWORD_MUST_DIFFER')
;
-- Sep 12, 2012 6:57:05 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
UPDATE AD_Column SET FieldLength=1024,Updated=TO_DATE('2012-09-12 18:57:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200457
;
-- Sep 12, 2012 6:57:13 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
ALTER TABLE AD_User MODIFY SecurityQuestion NVARCHAR2(1024) DEFAULT NULL
;
-- Sep 12, 2012 6:58:41 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','New Password must differ from Old Password',200066,'U','0d873a03-0980-4725-8a4f-a6954e4ee59e','NewPasswordMustDiffer','Y',TO_DATE('2012-09-12 18:58:40','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-12 18:58:40','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 12, 2012 6:58:41 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200066 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 12, 2012 6:58:45 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
UPDATE AD_Message SET EntityType='D',Updated=TO_DATE('2012-09-12 18:58:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200066
;
UPDATE AD_User u SET SecurityQuestion = (
SELECT MAX(m.MsgText) FROM AD_Message m WHERE m.Value = u.SecurityQuestion)
WHERE u.SecurityQuestion IS NOT NULL;
SELECT register_migration_script('910_IDEMPIERE-375.sql') FROM dual
;

View File

@ -0,0 +1,36 @@
-- Sep 17, 2012 5:24:55 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:24:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=124
;
-- Sep 17, 2012 5:25:09 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLD'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:25:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=121
;
-- Sep 17, 2012 5:25:14 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:25:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=173
;
-- Sep 17, 2012 5:25:30 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'') AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:25:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=52054
;
-- Sep 17, 2012 5:25:38 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'') AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:25:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=125
;
-- Sep 17, 2012 5:25:44 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMM'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=201
;
-- Sep 17, 2012 5:25:49 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''DOO'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:25:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=52004
;
-- Sep 17, 2012 5:26:19 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_DATE('2012-09-17 17:26:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=52066
;
SELECT register_migration_script('911_IDEMPIERE-366.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,202 @@
-- Sep 18, 2012 2:38:36 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Form (AccessLevel,Classname,AD_Form_ID,Help,IsBetaFunctionality,EntityType,AD_Form_UU,Description,Name,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('1','org.compiere.apps.form.VResetPassword',200001,NULL,'N','D','e2db983d-c11a-46f7-a4f5-fca8167c8d6c','Reset Password','Reset Password',0,100,100,TO_DATE('2012-09-18 14:38:34','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-09-18 14:38:34','YYYY-MM-DD HH24:MI:SS'),0,'Y')
;
-- Sep 18, 2012 2:38:38 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200001 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID)
;
-- Sep 18, 2012 2:39:13 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Menu (AD_Menu_ID,IsSummary,IsSOTrx,IsReadOnly,AD_Form_ID,EntityType,IsCentrallyMaintained,Name,Description,Action,AD_Menu_UU,IsActive,AD_Client_ID,CreatedBy,Updated,AD_Org_ID,Created,UpdatedBy) VALUES (200017,'N','N','N',200001,'D','Y','Reset Password','Reset Passwords for User','X','c9aa4c76-894d-4a72-97de-38d0345fd477','Y',0,100,TO_DATE('2012-09-18 14:39:12','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2012-09-18 14:39:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Sep 18, 2012 2:39:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Menu_Trl_UU ) SELECT l.AD_Language,t.AD_Menu_ID, t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=200017 AND NOT EXISTS (SELECT * FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID)
;
-- Sep 18, 2012 2:39:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', SysDate, 100, SysDate, 100,t.AD_Tree_ID, 200017, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200017)
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200002
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=147
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53246
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200017
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=487
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200012
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=150
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=495
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=50007
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=362
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200001
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=475
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=366
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=483
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=368
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=508
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53348
;
-- Sep 18, 2012 2:39:32 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
DELETE FROM AD_Menu_Trl WHERE AD_Menu_ID=487
;
-- Sep 18, 2012 2:39:33 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
DELETE FROM AD_Menu WHERE AD_Menu_ID=487
;
-- Sep 18, 2012 2:39:33 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
DELETE FROM AD_TreeNodeMM n WHERE Node_ID=487 AND EXISTS (SELECT * FROM AD_Tree t WHERE t.AD_Tree_ID=n.AD_Tree_ID AND t.TreeType='MM')
;
-- Sep 18, 2012 2:48:49 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_Form SET AccessLevel='7',Updated=TO_DATE('2012-09-18 14:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=200001
;
-- Sep 18, 2012 4:32:53 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','User is Mandatory',NULL,200067,'D','40544a9e-776d-4f96-8ef1-f38de2237027','UserMandatory','Y',TO_DATE('2012-09-18 16:32:51','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:32:51','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:32:53 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200067 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:35:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','New EMail does not match the Confirm New EMail',200068,'D','5046c7a0-0846-4f09-b130-d8280a043775','NewEmailNotMatch','Y',TO_DATE('2012-09-18 16:35:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:35:13','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:35:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200068 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:35:51 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Confirm New EMail is Mandatory',200069,'D','c9e44d6f-af2e-4306-bb84-2df8258ad79c','NewEmailConfirmMandatory','Y',TO_DATE('2012-09-18 16:35:50','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:35:50','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:35:51 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200069 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:37:44 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Confirm New EMail',200070,'D','41282b1f-672c-43e0-b823-439b87fa0544','New EMail Confirm','Y',TO_DATE('2012-09-18 16:37:43','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:37:43','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:37:44 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200070 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:38:20 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New EMail',200071,'D','6a228718-3a23-46d3-8e0c-97a6511acc50','New EMail','Y',TO_DATE('2012-09-18 16:38:19','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:38:19','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:38:20 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200071 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:38:36 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New EMail User',200072,'D','3bf5a60b-20a1-484d-a5f0-11dbe95fcbce','New EMail User','Y',TO_DATE('2012-09-18 16:38:35','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:38:35','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:38:36 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200072 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:39:03 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New EMail User Password',200073,'D','cfe2fcb8-81cc-4df5-b187-f1df99f8f842','New EMail User Password','Y',TO_DATE('2012-09-18 16:38:59','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2012-09-18 16:38:59','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:39:03 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200073 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('913_IDEMPIERE-374.sql') FROM dual
;

View File

@ -0,0 +1,742 @@
-- Sep 17, 2012 5:20:18 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:20:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=295
;
-- Sep 17, 2012 5:20:26 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:20:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=226
;
-- Sep 17, 2012 5:20:57 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=300
;
-- Sep 17, 2012 5:21:11 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:21:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=231
;
-- Sep 17, 2012 5:23:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=499
;
-- Sep 17, 2012 5:23:57 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-17 17:23:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=308
;
-- Sep 17, 2012 5:24:38 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:24:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53090
;
-- Sep 17, 2012 5:24:44 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-17 17:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=53070
;
-- Sep 17, 2012 5:24:44 PM COT
UPDATE AD_Menu SET Name='Prepare Migration Scripts', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-17 17:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53090
;
-- Sep 17, 2012 5:24:44 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53090
;
-- Sep 17, 2012 5:25:38 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:25:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=448
;
-- Sep 17, 2012 5:25:42 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:25:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=317
;
-- Sep 17, 2012 5:26:20 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:26:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=449
;
-- Sep 17, 2012 5:26:25 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:26:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=316
;
-- Sep 17, 2012 5:35:04 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:35:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=310
;
-- Sep 17, 2012 5:35:04 PM COT
UPDATE AD_Menu SET Name='Auction Buyer', Description='Maintain Auction Buyer Information', IsActive='N',Updated=TO_DATE('2012-09-17 17:35:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=442
;
-- Sep 17, 2012 5:39:52 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:39:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=309
;
-- Sep 17, 2012 5:39:52 PM COT
UPDATE AD_Menu SET Name='Auction Seller', Description='Maintain Auction Seller Information', IsActive='N',Updated=TO_DATE('2012-09-17 17:39:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=443
;
-- Sep 17, 2012 5:40:54 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:40:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=447
;
-- Sep 17, 2012 5:41:00 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:41:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=307
;
-- Sep 17, 2012 5:41:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:41:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=453
;
-- Sep 17, 2012 5:41:56 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:41:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=308
;
-- Sep 17, 2012 5:45:35 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:45:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52000
;
-- Sep 17, 2012 5:46:02 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-17 17:46:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=52003
;
-- Sep 17, 2012 5:46:02 PM COT
UPDATE AD_Menu SET Name='Update Role Menu', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-17 17:46:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52000
;
-- Sep 17, 2012 5:46:02 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=52000
;
-- Sep 17, 2012 5:51:42 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:51:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52002
;
-- Sep 17, 2012 5:51:51 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:51:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52000
;
-- Sep 17, 2012 5:58:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:58:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52003
;
-- Sep 17, 2012 5:58:57 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:58:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52001
;
-- Sep 17, 2012 5:59:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 17:59:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52004
;
-- Sep 17, 2012 5:59:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 17:59:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52002
;
-- Sep 17, 2012 6:00:47 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 18:00:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52005
;
-- Sep 17, 2012 6:00:52 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 18:00:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52003
;
-- Sep 17, 2012 6:01:46 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 18:01:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53013
;
-- Sep 17, 2012 6:01:51 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-17 18:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=53002
;
-- Sep 17, 2012 6:01:51 PM COT
UPDATE AD_Menu SET Name='Setup Web POS', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-17 18:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53013
;
-- Sep 17, 2012 6:01:51 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53013
;
-- Sep 17, 2012 6:02:44 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-17 18:02:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53196
;
-- Sep 17, 2012 6:02:49 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-17 18:02:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53065
;
-- Sep 17, 2012 6:02:49 PM COT
UPDATE AD_Menu SET Name='Web POS Terminal', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-17 18:02:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53196
;
-- Sep 17, 2012 6:02:49 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53196
;
-- Sep 18, 2012 2:17:00 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 14:17:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=392
;
-- Sep 18, 2012 2:17:59 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 14:17:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=389
;
-- Sep 18, 2012 2:18:04 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 14:18:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=287
;
-- Sep 18, 2012 2:18:55 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 14:18:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=390
;
-- Sep 18, 2012 2:19:00 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 14:19:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=290
;
-- Sep 18, 2012 5:29:19 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:29:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=391
;
-- Sep 18, 2012 5:29:29 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:29:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=289
;
-- Sep 18, 2012 5:30:50 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:30:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=590
;
-- Sep 18, 2012 5:30:55 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:30:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=386
;
-- Sep 18, 2012 5:31:26 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:31:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=591
;
-- Sep 18, 2012 5:31:30 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:31:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=387
;
-- Sep 18, 2012 5:32:23 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:32:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=592
;
-- Sep 18, 2012 5:32:27 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=388
;
-- Sep 18, 2012 5:34:02 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:34:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=593
;
-- Sep 18, 2012 5:34:09 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 17:34:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=350
;
-- Sep 18, 2012 5:34:09 PM COT
UPDATE AD_Menu SET Name='Rebuild Index', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-18 17:34:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=593
;
-- Sep 18, 2012 5:34:09 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=593
;
-- Sep 18, 2012 5:52:15 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:52:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=573
;
-- Sep 18, 2012 5:52:20 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:52:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=379
;
-- Sep 18, 2012 5:53:08 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:53:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=574
;
-- Sep 18, 2012 5:53:14 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:53:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=376
;
-- Sep 18, 2012 5:54:07 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:54:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=576
;
-- Sep 18, 2012 5:54:11 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:54:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=375
;
-- Sep 18, 2012 5:58:59 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:58:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=579
;
-- Sep 18, 2012 5:59:05 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 17:59:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=373
;
-- Sep 18, 2012 5:59:45 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 17:59:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=584
;
-- Sep 18, 2012 5:59:50 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 17:59:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=345
;
-- Sep 18, 2012 6:00:23 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:00:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=587
;
-- Sep 18, 2012 6:00:28 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:00:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=383
;
-- Sep 18, 2012 6:01:07 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:01:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=588
;
-- Sep 18, 2012 6:01:11 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:01:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=384
;
-- Sep 18, 2012 6:07:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:07:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52001
;
-- Sep 18, 2012 6:07:49 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:07:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=460
;
-- Sep 18, 2012 6:10:10 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:10:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53264
;
-- Sep 18, 2012 6:10:15 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:10:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53109
;
-- Sep 18, 2012 6:10:15 PM COT
UPDATE AD_Menu SET Name='Import Product Planning', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-18 18:10:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53264
;
-- Sep 18, 2012 6:10:15 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53264
;
-- Sep 18, 2012 6:17:14 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:17:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=371
;
-- Sep 18, 2012 6:17:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:17:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=269
;
-- Sep 18, 2012 6:20:15 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:20:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=375
;
-- Sep 18, 2012 6:20:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:20:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=273
;
-- Sep 18, 2012 6:20:50 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:20:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=380
;
-- Sep 18, 2012 6:20:56 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:20:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=274
;
-- Sep 18, 2012 6:21:33 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:21:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=415
;
-- Sep 18, 2012 6:21:37 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 18:21:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=239
;
-- Sep 18, 2012 6:22:07 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:22:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=416
;
-- Sep 18, 2012 6:22:16 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 18:22:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=240
;
-- Sep 18, 2012 6:22:37 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:22:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=372
;
-- Sep 18, 2012 6:23:27 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:23:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=559
;
-- Sep 18, 2012 6:23:31 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:23:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=367
;
-- Sep 18, 2012 6:24:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:24:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=560
;
-- Sep 18, 2012 6:24:07 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:24:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=368
;
-- Sep 18, 2012 6:24:45 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:24:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=561
;
-- Sep 18, 2012 6:24:49 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:24:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=369
;
-- Sep 18, 2012 6:25:23 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:25:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=562
;
-- Sep 18, 2012 6:25:27 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:25:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=370
;
-- Sep 18, 2012 6:26:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:26:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=563
;
-- Sep 18, 2012 6:26:08 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:26:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=371
;
-- Sep 18, 2012 6:26:54 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:26:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=564
;
-- Sep 18, 2012 6:26:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:26:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=372
;
-- Sep 18, 2012 6:31:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:31:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=488
;
-- Sep 18, 2012 6:31:07 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:31:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=335
;
-- Sep 18, 2012 6:31:49 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:31:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=489
;
-- Sep 18, 2012 6:31:53 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:31:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=336
;
-- Sep 18, 2012 6:32:54 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:32:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=241
;
-- Sep 18, 2012 6:32:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:32:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=198
;
-- Sep 18, 2012 6:35:18 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:35:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=288
;
-- Sep 18, 2012 6:35:24 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 18:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=170
;
-- Sep 18, 2012 6:36:45 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:36:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53132
;
-- Sep 18, 2012 6:36:50 PM COT
UPDATE AD_Form SET IsActive='N',Updated=TO_DATE('2012-09-18 18:36:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Form_ID=53010
;
-- Sep 18, 2012 6:39:43 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:39:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=187
;
-- Sep 18, 2012 6:39:49 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:39:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=175
;
-- Sep 18, 2012 6:40:25 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:40:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=358
;
-- Sep 18, 2012 6:40:31 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:40:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=261
;
-- Sep 18, 2012 6:41:15 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:41:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=477
;
-- Sep 18, 2012 6:41:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:41:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=329
;
-- Sep 18, 2012 6:42:01 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:42:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=504
;
-- Sep 18, 2012 6:42:05 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 18:42:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=311
;
-- Sep 18, 2012 6:42:46 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:42:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=360
;
-- Sep 18, 2012 6:42:52 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:42:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=262
;
-- Sep 18, 2012 6:43:26 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:43:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=498
;
-- Sep 18, 2012 6:43:32 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=340
;
-- Sep 18, 2012 6:44:09 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:44:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=532
;
-- Sep 18, 2012 6:44:12 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:44:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=353
;
-- Sep 18, 2012 6:45:08 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:45:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53187
;
-- Sep 18, 2012 6:45:11 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2012-09-18 18:45:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=53152
;
-- Sep 18, 2012 6:45:11 PM COT
UPDATE AD_Menu SET Name='Immediate Bank Transfer', Description=NULL, IsActive='N',Updated=TO_DATE('2012-09-18 18:45:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53187
;
-- Sep 18, 2012 6:45:11 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53187
;
-- Sep 18, 2012 6:45:48 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:45:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53256
;
-- Sep 18, 2012 6:45:53 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:45:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53104
;
-- Sep 18, 2012 6:46:37 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:46:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=173
;
-- Sep 18, 2012 6:46:43 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:46:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=160
;
-- Sep 18, 2012 6:47:44 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:47:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=284
;
-- Sep 18, 2012 6:47:48 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:47:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=220
;
-- Sep 18, 2012 6:48:25 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:48:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=344
;
-- Sep 18, 2012 6:48:30 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:48:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=253
;
-- Sep 18, 2012 6:51:14 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:51:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=547
;
-- Sep 18, 2012 6:51:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:51:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=359
;
-- Sep 18, 2012 6:51:50 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:51:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=550
;
-- Sep 18, 2012 6:51:54 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:51:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=361
;
-- Sep 18, 2012 6:52:26 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:52:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=551
;
-- Sep 18, 2012 6:52:30 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-18 18:52:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=362
;
-- Sep 18, 2012 6:55:48 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-18 18:55:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53169
;
-- Sep 19, 2012 10:29:42 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:29:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=54416
;
-- Sep 19, 2012 10:37:37 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:37:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=9286
;
-- Sep 19, 2012 10:41:21 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:41:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11517
;
-- Sep 19, 2012 10:41:38 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:41:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11520
;
-- Sep 19, 2012 10:41:44 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:41:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11521
;
-- Sep 19, 2012 10:41:48 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:41:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11519
;
-- Sep 19, 2012 10:41:53 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:41:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11516
;
-- Sep 19, 2012 10:41:56 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:41:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11518
;
-- Sep 19, 2012 10:42:05 AM COT
UPDATE AD_Tab SET IsActive='N',Updated=TO_DATE('2012-09-19 10:42:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=707
;
-- Sep 19, 2012 10:43:29 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1494
;
-- Sep 19, 2012 10:43:36 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:43:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2074
;
-- Sep 19, 2012 10:43:41 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:43:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1597
;
-- Sep 19, 2012 10:43:45 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:43:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1492
;
-- Sep 19, 2012 10:43:49 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:43:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1495
;
-- Sep 19, 2012 10:43:56 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:43:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2611
;
-- Sep 19, 2012 10:44:00 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:44:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2612
;
-- Sep 19, 2012 10:44:08 AM COT
UPDATE AD_Tab SET IsActive='N',Updated=TO_DATE('2012-09-19 10:44:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=214
;
-- Sep 19, 2012 10:50:54 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-19 10:50:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=12360
;
-- Sep 19, 2012 10:52:39 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_DATE('2012-09-19 10:52:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=229
;
-- Sep 19, 2012 10:52:56 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_DATE('2012-09-19 10:52:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=312
;
-- Sep 19, 2012 10:53:44 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_DATE('2012-09-19 10:53:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53015
;
-- Sep 19, 2012 10:54:05 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_DATE('2012-09-19 10:54:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53016
;
-- Sep 20, 2012 6:12:15 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 18:12:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=288
;
-- Sep 20, 2012 6:12:15 PM COT
UPDATE AD_Menu SET Name='Knowledge Base', Description='Maintain Knowledge Base', IsActive='N',Updated=TO_DATE('2012-09-20 18:12:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=388
;
-- Sep 20, 2012 6:13:16 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-20 18:13:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=55432
;
-- Sep 20, 2012 6:13:24 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-20 18:13:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=55433
;
-- Sep 20, 2012 6:13:44 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-20 18:13:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50171
;
-- Sep 20, 2012 6:14:47 PM COT
UPDATE AD_Column SET DefaultValue='N',Updated=TO_DATE('2012-09-20 18:14:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=50201
;
-- Sep 20, 2012 6:14:51 PM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2012-09-20 18:14:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=50201
;
-- Sep 20, 2012 6:15:15 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-20 18:15:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50171
;
-- Sep 20, 2012 6:15:24 PM COT
UPDATE AD_Column SET DefaultValue='N',Updated=TO_DATE('2012-09-20 18:15:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55333
;
-- Sep 20, 2012 6:15:26 PM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2012-09-20 18:15:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55333
;
-- Sep 20, 2012 6:15:38 PM COT
UPDATE AD_Column SET DefaultValue='N',Updated=TO_DATE('2012-09-20 18:15:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55332
;
-- Sep 20, 2012 6:15:41 PM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2012-09-20 18:15:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55332
;
-- Sep 20, 2012 6:16:02 PM COT
ALTER TABLE AD_Role MODIFY Allow_Info_MRP CHAR(1) DEFAULT 'N'
;
-- Sep 20, 2012 6:16:03 PM COT
UPDATE AD_Role SET Allow_Info_MRP='N' WHERE Allow_Info_MRP IS NULL
;
-- Sep 20, 2012 6:16:33 PM COT
ALTER TABLE AD_Role MODIFY Allow_Info_CRP CHAR(1) DEFAULT 'N'
;
-- Sep 20, 2012 6:16:34 PM COT
UPDATE AD_Role SET Allow_Info_CRP='N' WHERE Allow_Info_CRP IS NULL
;
-- Sep 20, 2012 6:17:03 PM COT
ALTER TABLE AD_Role MODIFY Allow_Info_CashJournal CHAR(1) DEFAULT 'N'
;
UPDATE AD_Role SET Allow_Info_CashJournal='N', Allow_Info_MRP='N', Allow_Info_CRP='N'
;
SELECT register_migration_script('914_IDEMPIERE-362.sql') FROM dual
;

View File

@ -0,0 +1,259 @@
-- IDEMPIERE-362 Hide things that don't work on iDempiere
-- Sep 19, 2012 4:36:27 PM COT
UPDATE AD_Column SET IsActive='N' WHERE AD_Column_ID IN (
4862, -- C_AcctSchema_Default.B_Expense_Acct
4868, -- C_AcctSchema_Default.B_RevaluationGain_Acct
4869, -- C_AcctSchema_Default.B_RevaluationLoss_Acct
4866, -- C_AcctSchema_Default.B_SettlementGain_Acct
4867, -- C_AcctSchema_Default.B_SettlementLoss_Acct
4865, -- C_AcctSchema_Default.B_Unidentified_Acct
3449, -- C_AcctSchema_Default.E_Expense_Acct
3450, -- C_AcctSchema_Default.E_Prepayment_Acct
4873, -- C_AcctSchema_Default.NotInvoicedReceivables_Acct
4840, -- C_AcctSchema_Default.NotInvoicedRevenue_Acct
56545, -- C_AcctSchema_Default.P_Burden_Acct
56543, -- C_AcctSchema_Default.P_CostOfProduction_Acct
56542, -- C_AcctSchema_Default.P_FloorStock_Acct
56544, -- C_AcctSchema_Default.P_Labor_Acct
56538, -- C_AcctSchema_Default.P_MethodChangeVariance_Acct
56541, -- C_AcctSchema_Default.P_MixVariance_Acct
56546, -- C_AcctSchema_Default.P_OutsideProcessing_Acct
56567, -- C_AcctSchema_Default.P_Overhead_Acct
56568, -- C_AcctSchema_Default.P_Scrap_Acct
56539, -- C_AcctSchema_Default.P_UsageVariance_Acct
56537, -- C_AcctSchema_Default.P_WIP_Acct
4856, -- C_AcctSchema_Default.T_Liability_Acct
4857, -- C_AcctSchema_Default.T_Receivables_Acct
6114, -- C_AcctSchema_Default.W_InvActualAdjust_Acct
3443, -- C_AcctSchema_Default.W_Inventory_Acct
4853, -- C_AcctSchema_Default.Withholding_Acct
4843, -- C_AcctSchema_Default.W_Revaluation_Acct
2501, -- C_AcctSchema_GL.IncomeSummary_Acct
2500, -- C_AcctSchema_GL.RetainedEarning_Acct
2493, -- C_AcctSchema_GL.SuspenseError_Acct
4901, -- C_BankAccount_Acct.B_Expense_Acct
4907, -- C_BankAccount_Acct.B_RevaluationGain_Acct
4908, -- C_BankAccount_Acct.B_RevaluationLoss_Acct
4905, -- C_BankAccount_Acct.B_SettlementGain_Acct
4906, -- C_BankAccount_Acct.B_SettlementLoss_Acct
4904, -- C_BankAccount_Acct.B_Unidentified_Acct
3381, -- C_BP_Employee_Acct.E_Expense_Acct
3382, -- C_BP_Employee_Acct.E_Prepayment_Acct
4999, -- C_BP_Group_Acct.NotInvoicedReceivables_Acct
4998, -- C_BP_Group_Acct.NotInvoicedRevenue_Acct
10287, -- C_Currency_Acct.RealizedGain_Acct
10289, -- C_Currency_Acct.RealizedLoss_Acct
10279, -- C_Currency_Acct.UnrealizedGain_Acct
10290, -- C_Currency_Acct.UnrealizedLoss_Acct
5085, -- C_Tax_Acct.T_Liability_Acct
5087, -- C_Tax_Acct.T_Receivables_Acct
56565, -- M_Product_Acct.P_Burden_Acct
56563, -- M_Product_Acct.P_CostOfProduction_Acct
56562, -- M_Product_Acct.P_FloorStock_Acct
56564, -- M_Product_Acct.P_Labor_Acct
56558, -- M_Product_Acct.P_MethodChangeVariance_Acct
56561, -- M_Product_Acct.P_MixVariance_Acct
56566, -- M_Product_Acct.P_OutsideProcessing_Acct
56571, -- M_Product_Acct.P_Overhead_Acct
56572, -- M_Product_Acct.P_Scrap_Acct
56559, -- M_Product_Acct.P_UsageVariance_Acct
56557, -- M_Product_Acct.P_WIP_Acct
56555, -- M_Product_Category_Acct.P_Burden_Acct
56553, -- M_Product_Category_Acct.P_CostOfProduction_Acct
56547, -- M_Product_Category_Acct.P_FloorStock_Acct
56554, -- M_Product_Category_Acct.P_Labor_Acct
56549, -- M_Product_Category_Acct.P_MethodChangeVariance_Acct
56552, -- M_Product_Category_Acct.P_MixVariance_Acct
56556, -- M_Product_Category_Acct.P_OutsideProcessing_Acct
56569, -- M_Product_Category_Acct.P_Overhead_Acct
56570, -- M_Product_Category_Acct.P_Scrap_Acct
56550, -- M_Product_Category_Acct.P_UsageVariance_Acct
56548, -- M_Product_Category_Acct.P_WIP_Acct
6124, -- M_Warehouse_Acct.W_InvActualAdjust_Acct
3386, -- M_Warehouse_Acct.W_Inventory_Acct
5133 -- M_Warehouse_Acct.W_Revaluation_Acct
)
;
--
UPDATE AD_Field SET IsActive='N' WHERE AD_Column_ID IN (
4862, -- C_AcctSchema_Default.B_Expense_Acct
4868, -- C_AcctSchema_Default.B_RevaluationGain_Acct
4869, -- C_AcctSchema_Default.B_RevaluationLoss_Acct
4866, -- C_AcctSchema_Default.B_SettlementGain_Acct
4867, -- C_AcctSchema_Default.B_SettlementLoss_Acct
4865, -- C_AcctSchema_Default.B_Unidentified_Acct
3449, -- C_AcctSchema_Default.E_Expense_Acct
3450, -- C_AcctSchema_Default.E_Prepayment_Acct
4873, -- C_AcctSchema_Default.NotInvoicedReceivables_Acct
4840, -- C_AcctSchema_Default.NotInvoicedRevenue_Acct
56545, -- C_AcctSchema_Default.P_Burden_Acct
56543, -- C_AcctSchema_Default.P_CostOfProduction_Acct
56542, -- C_AcctSchema_Default.P_FloorStock_Acct
56544, -- C_AcctSchema_Default.P_Labor_Acct
56538, -- C_AcctSchema_Default.P_MethodChangeVariance_Acct
56541, -- C_AcctSchema_Default.P_MixVariance_Acct
56546, -- C_AcctSchema_Default.P_OutsideProcessing_Acct
56567, -- C_AcctSchema_Default.P_Overhead_Acct
56568, -- C_AcctSchema_Default.P_Scrap_Acct
56539, -- C_AcctSchema_Default.P_UsageVariance_Acct
56537, -- C_AcctSchema_Default.P_WIP_Acct
4856, -- C_AcctSchema_Default.T_Liability_Acct
4857, -- C_AcctSchema_Default.T_Receivables_Acct
6114, -- C_AcctSchema_Default.W_InvActualAdjust_Acct
3443, -- C_AcctSchema_Default.W_Inventory_Acct
4853, -- C_AcctSchema_Default.Withholding_Acct
4843, -- C_AcctSchema_Default.W_Revaluation_Acct
2501, -- C_AcctSchema_GL.IncomeSummary_Acct
2500, -- C_AcctSchema_GL.RetainedEarning_Acct
2493, -- C_AcctSchema_GL.SuspenseError_Acct
4901, -- C_BankAccount_Acct.B_Expense_Acct
4907, -- C_BankAccount_Acct.B_RevaluationGain_Acct
4908, -- C_BankAccount_Acct.B_RevaluationLoss_Acct
4905, -- C_BankAccount_Acct.B_SettlementGain_Acct
4906, -- C_BankAccount_Acct.B_SettlementLoss_Acct
4904, -- C_BankAccount_Acct.B_Unidentified_Acct
3381, -- C_BP_Employee_Acct.E_Expense_Acct
3382, -- C_BP_Employee_Acct.E_Prepayment_Acct
4999, -- C_BP_Group_Acct.NotInvoicedReceivables_Acct
4998, -- C_BP_Group_Acct.NotInvoicedRevenue_Acct
10287, -- C_Currency_Acct.RealizedGain_Acct
10289, -- C_Currency_Acct.RealizedLoss_Acct
10279, -- C_Currency_Acct.UnrealizedGain_Acct
10290, -- C_Currency_Acct.UnrealizedLoss_Acct
5085, -- C_Tax_Acct.T_Liability_Acct
5087, -- C_Tax_Acct.T_Receivables_Acct
56565, -- M_Product_Acct.P_Burden_Acct
56563, -- M_Product_Acct.P_CostOfProduction_Acct
56562, -- M_Product_Acct.P_FloorStock_Acct
56564, -- M_Product_Acct.P_Labor_Acct
56558, -- M_Product_Acct.P_MethodChangeVariance_Acct
56561, -- M_Product_Acct.P_MixVariance_Acct
56566, -- M_Product_Acct.P_OutsideProcessing_Acct
56571, -- M_Product_Acct.P_Overhead_Acct
56572, -- M_Product_Acct.P_Scrap_Acct
56559, -- M_Product_Acct.P_UsageVariance_Acct
56557, -- M_Product_Acct.P_WIP_Acct
56555, -- M_Product_Category_Acct.P_Burden_Acct
56553, -- M_Product_Category_Acct.P_CostOfProduction_Acct
56547, -- M_Product_Category_Acct.P_FloorStock_Acct
56554, -- M_Product_Category_Acct.P_Labor_Acct
56549, -- M_Product_Category_Acct.P_MethodChangeVariance_Acct
56552, -- M_Product_Category_Acct.P_MixVariance_Acct
56556, -- M_Product_Category_Acct.P_OutsideProcessing_Acct
56569, -- M_Product_Category_Acct.P_Overhead_Acct
56570, -- M_Product_Category_Acct.P_Scrap_Acct
56550, -- M_Product_Category_Acct.P_UsageVariance_Acct
56548, -- M_Product_Category_Acct.P_WIP_Acct
6124, -- M_Warehouse_Acct.W_InvActualAdjust_Acct
3386, -- M_Warehouse_Acct.W_Inventory_Acct
5133 -- M_Warehouse_Acct.W_Revaluation_Acct
)
;
---
UPDATE AD_PrintFormatItem SET IsActive='N' WHERE AD_Column_ID IN (
4862, -- C_AcctSchema_Default.B_Expense_Acct
4868, -- C_AcctSchema_Default.B_RevaluationGain_Acct
4869, -- C_AcctSchema_Default.B_RevaluationLoss_Acct
4866, -- C_AcctSchema_Default.B_SettlementGain_Acct
4867, -- C_AcctSchema_Default.B_SettlementLoss_Acct
4865, -- C_AcctSchema_Default.B_Unidentified_Acct
3449, -- C_AcctSchema_Default.E_Expense_Acct
3450, -- C_AcctSchema_Default.E_Prepayment_Acct
4873, -- C_AcctSchema_Default.NotInvoicedReceivables_Acct
4840, -- C_AcctSchema_Default.NotInvoicedRevenue_Acct
56545, -- C_AcctSchema_Default.P_Burden_Acct
56543, -- C_AcctSchema_Default.P_CostOfProduction_Acct
56542, -- C_AcctSchema_Default.P_FloorStock_Acct
56544, -- C_AcctSchema_Default.P_Labor_Acct
56538, -- C_AcctSchema_Default.P_MethodChangeVariance_Acct
56541, -- C_AcctSchema_Default.P_MixVariance_Acct
56546, -- C_AcctSchema_Default.P_OutsideProcessing_Acct
56567, -- C_AcctSchema_Default.P_Overhead_Acct
56568, -- C_AcctSchema_Default.P_Scrap_Acct
56539, -- C_AcctSchema_Default.P_UsageVariance_Acct
56537, -- C_AcctSchema_Default.P_WIP_Acct
4856, -- C_AcctSchema_Default.T_Liability_Acct
4857, -- C_AcctSchema_Default.T_Receivables_Acct
6114, -- C_AcctSchema_Default.W_InvActualAdjust_Acct
3443, -- C_AcctSchema_Default.W_Inventory_Acct
4853, -- C_AcctSchema_Default.Withholding_Acct
4843, -- C_AcctSchema_Default.W_Revaluation_Acct
2501, -- C_AcctSchema_GL.IncomeSummary_Acct
2500, -- C_AcctSchema_GL.RetainedEarning_Acct
2493, -- C_AcctSchema_GL.SuspenseError_Acct
4901, -- C_BankAccount_Acct.B_Expense_Acct
4907, -- C_BankAccount_Acct.B_RevaluationGain_Acct
4908, -- C_BankAccount_Acct.B_RevaluationLoss_Acct
4905, -- C_BankAccount_Acct.B_SettlementGain_Acct
4906, -- C_BankAccount_Acct.B_SettlementLoss_Acct
4904, -- C_BankAccount_Acct.B_Unidentified_Acct
3381, -- C_BP_Employee_Acct.E_Expense_Acct
3382, -- C_BP_Employee_Acct.E_Prepayment_Acct
4999, -- C_BP_Group_Acct.NotInvoicedReceivables_Acct
4998, -- C_BP_Group_Acct.NotInvoicedRevenue_Acct
10287, -- C_Currency_Acct.RealizedGain_Acct
10289, -- C_Currency_Acct.RealizedLoss_Acct
10279, -- C_Currency_Acct.UnrealizedGain_Acct
10290, -- C_Currency_Acct.UnrealizedLoss_Acct
5085, -- C_Tax_Acct.T_Liability_Acct
5087, -- C_Tax_Acct.T_Receivables_Acct
56565, -- M_Product_Acct.P_Burden_Acct
56563, -- M_Product_Acct.P_CostOfProduction_Acct
56562, -- M_Product_Acct.P_FloorStock_Acct
56564, -- M_Product_Acct.P_Labor_Acct
56558, -- M_Product_Acct.P_MethodChangeVariance_Acct
56561, -- M_Product_Acct.P_MixVariance_Acct
56566, -- M_Product_Acct.P_OutsideProcessing_Acct
56571, -- M_Product_Acct.P_Overhead_Acct
56572, -- M_Product_Acct.P_Scrap_Acct
56559, -- M_Product_Acct.P_UsageVariance_Acct
56557, -- M_Product_Acct.P_WIP_Acct
56555, -- M_Product_Category_Acct.P_Burden_Acct
56553, -- M_Product_Category_Acct.P_CostOfProduction_Acct
56547, -- M_Product_Category_Acct.P_FloorStock_Acct
56554, -- M_Product_Category_Acct.P_Labor_Acct
56549, -- M_Product_Category_Acct.P_MethodChangeVariance_Acct
56552, -- M_Product_Category_Acct.P_MixVariance_Acct
56556, -- M_Product_Category_Acct.P_OutsideProcessing_Acct
56569, -- M_Product_Category_Acct.P_Overhead_Acct
56570, -- M_Product_Category_Acct.P_Scrap_Acct
56550, -- M_Product_Category_Acct.P_UsageVariance_Acct
56548, -- M_Product_Category_Acct.P_WIP_Acct
6124, -- M_Warehouse_Acct.W_InvActualAdjust_Acct
3386, -- M_Warehouse_Acct.W_Inventory_Acct
5133 -- M_Warehouse_Acct.W_Revaluation_Acct
)
;
-- Sep 27, 2012 11:08:01 AM COT
UPDATE AD_Tab SET IsActive='N',Updated=TO_DATE('2012-09-27 11:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=214
;
-- Sep 28, 2012 1:14:51 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2012-09-28 13:14:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1370
;
-- Sep 28, 2012 1:15:22 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Tab SET IsActive='N',Updated=TO_DATE('2012-09-28 13:15:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=569
;
-- Sep 28, 2012 1:20:15 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_DATE('2012-09-28 13:20:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56547
;
-- Sep 28, 2012 1:20:51 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_DATE('2012-09-28 13:20:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56537
;
SELECT register_migration_script('915_IDEMPIERE-362.sql') FROM dual
;

View File

@ -0,0 +1,388 @@
-- IDEMPIERE-362 Hide things that don't work on iDempiere
-- Hide Payroll to be managed as extension
-- Sep 20, 2012 7:59:44 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-20 19:59:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53114
;
-- Sep 20, 2012 8:01:41 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53036
;
-- Sep 20, 2012 8:01:41 PM COT
UPDATE AD_Menu SET Name='Payroll Concept Catalog', Description='Maintain Payroll Concept Catalog', IsActive='N',Updated=TO_DATE('2012-09-20 20:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53115
;
-- Sep 20, 2012 8:01:41 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50084
;
-- Sep 20, 2012 8:01:48 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:01:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53039
;
-- Sep 20, 2012 8:01:48 PM COT
UPDATE AD_Menu SET Name='Payroll Concept Category', Description='Maintain Payroll Concept Category', IsActive='N',Updated=TO_DATE('2012-09-20 20:01:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53118
;
-- Sep 20, 2012 8:01:48 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:01:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50075
;
-- Sep 20, 2012 8:01:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53032
;
-- Sep 20, 2012 8:01:59 PM COT
UPDATE AD_Menu SET Name='Payroll Contract', Description='Maintain Payroll Contract', IsActive='N',Updated=TO_DATE('2012-09-20 20:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53110
;
-- Sep 20, 2012 8:01:59 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50076
;
-- Sep 20, 2012 8:02:04 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53038
;
-- Sep 20, 2012 8:02:04 PM COT
UPDATE AD_Menu SET Name='Payroll Definition', Description='In a company, payroll is the sum of all financial records of salaries, wages, bonuses, and deductions.', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53117
;
-- Sep 20, 2012 8:02:04 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50074
;
-- Sep 20, 2012 8:02:08 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53034
;
-- Sep 20, 2012 8:02:08 PM COT
UPDATE AD_Menu SET Name='Payroll Department', Description='Maintain Payroll Department', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53112
;
-- Sep 20, 2012 8:02:08 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50079
;
-- Sep 20, 2012 8:02:13 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53033
;
-- Sep 20, 2012 8:02:13 PM COT
UPDATE AD_Menu SET Name='Payroll Employee', Description='Maintain Payroll Employee', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53111
;
-- Sep 20, 2012 8:02:13 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50080
;
-- Sep 20, 2012 8:02:18 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53035
;
-- Sep 20, 2012 8:02:18 PM COT
UPDATE AD_Menu SET Name='Payroll Job', Description='Maintain Payroll Job', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53113
;
-- Sep 20, 2012 8:02:18 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50083
;
-- Sep 20, 2012 8:02:42 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53042
;
-- Sep 20, 2012 8:02:42 PM COT
UPDATE AD_Menu SET Name='Payroll Movement', Description='History of Payroll Movement', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53121
;
-- Sep 20, 2012 8:02:48 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53037
;
-- Sep 20, 2012 8:02:48 PM COT
UPDATE AD_Menu SET Name='Payroll Process', Description='Payroll Process', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53127
;
-- Sep 20, 2012 8:02:48 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50077
;
-- Sep 20, 2012 8:02:55 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53041
;
-- Sep 20, 2012 8:02:55 PM COT
UPDATE AD_Menu SET Name='Payroll Table', Description='Maintain Payroll Table', IsActive='N',Updated=TO_DATE('2012-09-20 20:02:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53120
;
-- Sep 20, 2012 8:02:55 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:02:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50078
;
-- Sep 20, 2012 8:03:03 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_DATE('2012-09-20 20:03:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53040
;
-- Sep 20, 2012 8:03:03 PM COT
UPDATE AD_Menu SET Name='Payroll Table Type', Description='Maintain Payroll Table Type', IsActive='N',Updated=TO_DATE('2012-09-20 20:03:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53119
;
-- Sep 20, 2012 8:03:03 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_DATE('2012-09-20 20:03:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50082
;
-- Sep 28, 2012 1:07:59 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-28 13:07:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53124
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53124
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=530
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53109
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53114
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=266
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=232
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=190
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=127
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=133
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=172
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=173
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53256
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=110
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=394
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=544
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=512
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=506
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=420
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=451
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=186
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=473
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=531
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53124
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53109
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53114
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=266
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=232
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=190
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=127
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=133
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=172
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=173
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53256
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=110
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=394
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=544
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=512
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=506
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=420
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=451
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=186
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=473
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=531
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=530
;
-- Sep 28, 2012 1:11:02 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-28 13:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53123
;
-- Sep 28, 2012 1:11:11 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-28 13:11:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53116
;
-- Sep 28, 2012 1:11:15 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-28 13:11:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53122
;
-- Sep 28, 2012 1:11:28 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-28 13:11:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53109
;
-- Sep 28, 2012 1:11:33 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_DATE('2012-09-28 13:11:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53108
;
SELECT register_migration_script('916_IDEMPIERE-362.sql') FROM dual
;

View File

@ -0,0 +1,63 @@
-- Sep 21, 2012 8:07:08 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND IsSOTrx=''N''',Updated=TO_DATE('2012-09-21 20:07:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52066
;
-- Sep 21, 2012 8:07:15 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARR'', ''APP'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:07:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=149
;
-- Sep 21, 2012 8:07:20 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''DOO'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:07:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52004
;
-- Sep 21, 2012 8:07:24 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:07:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=201
;
-- Sep 21, 2012 8:07:28 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:07:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=125
;
-- Sep 21, 2012 8:07:42 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'') AND C_DocType.IsSOTrx=''N'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:07:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52054
;
-- Sep 21, 2012 8:08:05 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND C_DocType.IsSOTrx=''N''',Updated=TO_DATE('2012-09-21 20:08:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52066
;
-- Sep 21, 2012 8:08:26 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMI'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:08:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=209
;
-- Sep 21, 2012 8:08:30 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLJ'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:08:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=102
;
-- Sep 21, 2012 8:08:36 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:08:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=173
;
-- Sep 21, 2012 8:08:41 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLD'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:08:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=121
;
-- Sep 21, 2012 8:08:47 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_DATE('2012-09-21 20:08:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=124
;
SELECT register_migration_script('917_IDEMPIERE-366.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
-- Sep 27, 2012 12:32:31 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message SET MsgText='Reached the maximum number of login attempts, user account ({0}) is locked',Updated=TO_DATE('2012-09-27 12:32:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200033
;
-- Sep 27, 2012 12:32:31 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200033
;
-- Sep 27, 2012 12:32:59 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message SET MsgText='User account ({0}) is locked, please contact the system administrator',Updated=TO_DATE('2012-09-27 12:32:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200032
;
-- Sep 27, 2012 12:32:59 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200032
;
SELECT register_migration_script('919_IDEMPIERE-373_User_Locking.sql') FROM dual
;

View File

@ -0,0 +1,178 @@
-- Sep 25, 2012 1:46:23 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=930
;
-- Sep 25, 2012 1:46:30 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=931
;
-- Sep 25, 2012 1:46:35 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59592
;
-- Sep 25, 2012 1:46:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59591
;
-- Sep 25, 2012 1:46:46 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10126
;
-- Sep 25, 2012 1:46:52 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52018
;
-- Sep 25, 2012 1:46:57 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8740
;
-- Sep 25, 2012 1:47:04 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:47:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5227
;
-- Sep 25, 2012 1:47:10 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11006
;
-- Sep 25, 2012 1:47:16 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:47:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11003
;
-- Sep 25, 2012 1:47:23 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:47:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11002
;
-- Sep 25, 2012 1:47:30 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:47:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8311
;
-- Sep 25, 2012 1:49:28 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:49:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10813
;
-- Sep 25, 2012 1:49:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N and @IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:49:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256
;
-- Sep 25, 2012 1:49:50 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N and @IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:49:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257
;
-- Sep 25, 2012 1:49:56 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:49:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8313
;
-- Sep 25, 2012 1:50:01 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8314
;
-- Sep 25, 2012 1:50:06 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8312
;
-- Sep 25, 2012 1:50:22 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8310
;
-- Sep 25, 2012 1:50:26 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12367
;
-- Sep 25, 2012 1:50:31 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12368
;
-- Sep 25, 2012 1:50:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200071
;
-- Sep 25, 2012 1:50:45 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:50:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50168
;
-- Sep 25, 2012 1:51:14 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169
;
-- Sep 25, 2012 1:51:19 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170
;
-- Sep 25, 2012 1:51:35 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172
;
-- Sep 25, 2012 1:51:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173
;
-- Sep 25, 2012 1:51:45 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174
;
-- Sep 25, 2012 1:51:50 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175
;
-- Sep 25, 2012 1:51:55 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:51:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176
;
-- Sep 25, 2012 1:52:00 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:52:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177
;
-- Sep 25, 2012 1:52:04 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_DATE('2012-09-25 13:52:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178
;
-- Sep 25, 2012 1:58:27 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Column SET ReadOnlyLogic=NULL,DefaultValue=NULL,Updated=TO_DATE('2012-09-25 13:58:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=534
;
-- Sep 25, 2012 2:19:54 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N & @IsMasterRole@=N',Updated=TO_DATE('2012-09-25 14:19:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256
;
-- Sep 25, 2012 2:20:02 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N & @IsMasterRole@=N',Updated=TO_DATE('2012-09-25 14:20:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257
;
SELECT register_migration_script('920_IDEMPIERE_366.sql') FROM dual
;

View File

@ -0,0 +1,87 @@
CREATE OR REPLACE PROCEDURE nextID
(
p_AD_Sequence_ID IN NUMBER,
p_System IN CHAR,
o_NextID OUT NUMBER
)
/*************************************************************************
* The contents of this file are subject to the Adempiere License. You may
* obtain a copy of the License at http://www.adempiere.org/license.html
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for details. Code: Adempiere ERP+CRM
* Copyright (C) 1999-2005 Jorg Janke, ComPiere, Inc. All Rights Reserved.
*************************************************************************
* $Id: nextID.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $
***
* Title: Get Next ID - no Commit
* Description:
* Test via
*
************************************************************************/
AS
Isnativeseqon NVARCHAR2(1);
Tablename Nvarchar2(60);
sqlcmd VARCHAR2(200);
BEGIN
IF (p_System = 'Y') THEN
SELECT CurrentNextSys
INTO o_NextID
FROM AD_Sequence
WHERE AD_Sequence_ID=p_AD_Sequence_ID
FOR UPDATE OF CurrentNextSys;
--
UPDATE AD_Sequence
SET CurrentNextSys = CurrentNextSys + IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
ELSE
Isnativeseqon := get_Sysconfig('SYSTEM_NATIVE_SEQUENCE','N',0,0);
IF Isnativeseqon = 'Y' THEN
SELECT Name
INTO tablename
FROM Ad_Sequence
WHERE Ad_Sequence_Id=P_Ad_Sequence_Id;
--
Sqlcmd := 'SELECT '||Tablename||'_SQ.Nextval FROM DUAL';
--
Execute Immediate Sqlcmd Into O_Nextid;
--
ELSE
SELECT CurrentNext
INTO o_NextID
FROM AD_Sequence
WHERE AD_Sequence_ID=p_AD_Sequence_ID
FOR UPDATE OF CurrentNext;
--
UPDATE Ad_Sequence
SET Currentnext = Currentnext + Incrementno
WHERE Ad_Sequence_Id=P_Ad_Sequence_Id;
--
END IF;
END IF;
--
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END nextID;
/
DROP SEQUENCE ad_error_seq
;
DROP SEQUENCE ad_pinstance_seq
;
DROP SEQUENCE t_spool_seq
;
DROP SEQUENCE w_basket_seq
;
SELECT register_migration_script('921_IDEMPIERE-422_NativeSequence.sql') FROM dual
;

View File

@ -0,0 +1,75 @@
-- IDEMPIERE-362 Hide things that don't work on iDempiere
ALTER TABLE c_acctschema_default MODIFY ( b_expense_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( b_revaluationgain_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( b_revaluationloss_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( b_settlementgain_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( b_settlementloss_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( b_unidentified_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( e_expense_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( e_prepayment_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( notinvoicedreceivables_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( notinvoicedrevenue_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( t_liability_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( t_receivables_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( w_invactualadjust_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( w_inventory_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( w_revaluation_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_default MODIFY ( withholding_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_gl MODIFY ( incomesummary_acct NUMBER(10) NULL );
ALTER TABLE c_acctschema_gl MODIFY ( retainedearning_acct NUMBER(10) NULL );
ALTER TABLE c_bankaccount_acct MODIFY ( b_expense_acct NUMBER(10) NULL );
ALTER TABLE c_bankaccount_acct MODIFY ( b_revaluationgain_acct NUMBER(10) NULL );
ALTER TABLE c_bankaccount_acct MODIFY ( b_revaluationloss_acct NUMBER(10) NULL );
ALTER TABLE c_bankaccount_acct MODIFY ( b_settlementgain_acct NUMBER(10) NULL );
ALTER TABLE c_bankaccount_acct MODIFY ( b_settlementloss_acct NUMBER(10) NULL );
ALTER TABLE c_bankaccount_acct MODIFY ( b_unidentified_acct NUMBER(10) NULL );
ALTER TABLE c_bp_group_acct MODIFY ( notinvoicedreceivables_acct NUMBER(10) NULL );
ALTER TABLE c_bp_group_acct MODIFY ( notinvoicedrevenue_acct NUMBER(10) NULL );
ALTER TABLE c_currency_acct MODIFY ( realizedgain_acct NUMBER(10) NULL );
ALTER TABLE c_currency_acct MODIFY ( realizedloss_acct NUMBER(10) NULL );
ALTER TABLE c_currency_acct MODIFY ( unrealizedgain_acct NUMBER(10) NULL );
ALTER TABLE c_currency_acct MODIFY ( unrealizedloss_acct NUMBER(10) NULL );
ALTER TABLE c_tax_acct MODIFY ( t_liability_acct NUMBER(10) NULL );
ALTER TABLE c_tax_acct MODIFY ( t_receivables_acct NUMBER(10) NULL );
ALTER TABLE m_warehouse_acct MODIFY ( w_invactualadjust_acct NUMBER(10) NULL );
ALTER TABLE m_warehouse_acct MODIFY ( w_inventory_acct NUMBER(10) NULL );
ALTER TABLE m_warehouse_acct MODIFY ( w_revaluation_acct NUMBER(10) NULL );
SELECT register_migration_script('922_IDEMPIERE-362.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,365 @@
-- Sep 4, 2012 10:34:50 AM COT
-- Element Master Role
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('IsMasterRole',200117,'D','MasterRole','MasterRole','4bad6035-f81b-4e25-81d9-bbf55b099113',0,TO_TIMESTAMP('2012-09-04 10:34:49','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-04 10:34:49','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
;
-- Sep 4, 2012 10:34:50 AM COT
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Name,Description,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Name,t.Description,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200117 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Sep 4, 2012 10:36:19 AM COT
-- Column master Role
INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection,DefaultValue) VALUES (0,156,200410,'D','Y','N','N',0,'N',1,'N',20,'N','N',200117,'N','Y','5ec60b3e-f1a7-447c-a7ea-f3575dcb24d4','N','Y','N','IsMasterRole','MasterRole','Y',100,TO_TIMESTAMP('2012-09-04 10:36:18','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-09-04 10:36:18','YYYY-MM-DD HH24:MI:SS'),100,0,0,'N')
;
-- Sep 4, 2012 10:36:19 AM COT
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=200410 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Sep 4, 2012 10:37:58 AM COT
-- Field Master Role
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsDisplayed,IsFieldOnly,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',119,1,'N','N',200410,'Y',200411,'N','D','MasterRole','Y','N','b57a3894-98be-44fa-a834-6883c8824d92',100,0,TO_TIMESTAMP('2012-09-04 10:37:58','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-09-04 10:37:58','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Sep 4, 2012 10:37:58 AM COT
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200411 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Sep 4, 2012 10:38:27 AM COT
-- seq
UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=200411
;
-- Sep 4, 2012 10:38:40 AM COT
-- Position web
UPDATE AD_Field SET XPosition=2,Updated=TO_TIMESTAMP('2012-09-04 10:38:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200411
;
-- Sep 4, 2012 4:12:10 PM COT
-- Validation for just Master Role in included roles
INSERT INTO AD_Val_Rule (Code,AD_Val_Rule_ID,EntityType,Name,Type,AD_Val_Rule_UU,CreatedBy,UpdatedBy,Updated,Created,AD_Client_ID,IsActive,AD_Org_ID) VALUES ('AD_Role.IsMasterRole=''Y''',200006,'D','MasterRoles','S','5d5fa599-0937-4e88-905b-b0814fc7fc84',100,100,TO_TIMESTAMP('2012-09-04 16:12:08','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-04 16:12:08','YYYY-MM-DD HH24:MI:SS'),0,'Y',0)
;
-- Sep 4, 2012 4:13:06 PM COT
UPDATE AD_Column SET AD_Val_Rule_ID=200006, IsUpdateable='N',Updated=TO_TIMESTAMP('2012-09-04 16:13:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=57949
;
-- Sep 4, 2012 4:55:32 PM COT
-- Display Logic Window Role
UPDATE AD_Tab SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-04 16:55:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=351
;
-- Sep 4, 2012 4:55:40 PM COT
-- Display Logic Window Role
UPDATE AD_Tab SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-04 16:55:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=120
;
-- Sep 4, 2012 4:55:53 PM COT
-- Display Logic Window Role
UPDATE AD_Tab SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-04 16:55:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=53240
;
-- Sep 5, 2012 2:26:43 PM COT
-- Roles are manual for default
UPDATE AD_Column SET DefaultValue='Y',Updated=TO_TIMESTAMP('2012-09-05 14:26:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=9593
;
-- Sep 11, 2012 6:56:24 PM COT
ALTER TABLE AD_Role ADD COLUMN IsMasterRole CHAR(1) DEFAULT 'N' CHECK (IsMasterRole IN ('Y','N')) NOT NULL
;
-- Sep 11, 2012 6:56:46 PM COT
INSERT INTO t_alter_column values('ad_role','IsManual','CHAR(1)','not null','Y')
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=200411
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=930
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=931
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=59592
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=59591
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=10126
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=52018
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=8740
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=5227
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=11006
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11003
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=11002
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=8311
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=10813
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=11256
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=11257
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=8313
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=8314
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=8312
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=8310
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=280,IsDisplayed='Y' WHERE AD_Field_ID=12367
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=290,IsDisplayed='Y' WHERE AD_Field_ID=12368
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=300,IsDisplayed='Y' WHERE AD_Field_ID=12641
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=310,IsDisplayed='Y' WHERE AD_Field_ID=200071
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=320,IsDisplayed='Y' WHERE AD_Field_ID=50168
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=330,IsDisplayed='Y' WHERE AD_Field_ID=50169
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=340,IsDisplayed='Y' WHERE AD_Field_ID=50170
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=350,IsDisplayed='Y' WHERE AD_Field_ID=50171
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=360,IsDisplayed='Y' WHERE AD_Field_ID=50172
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=370,IsDisplayed='Y' WHERE AD_Field_ID=50173
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=380,IsDisplayed='Y' WHERE AD_Field_ID=50174
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=390,IsDisplayed='Y' WHERE AD_Field_ID=50175
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=400,IsDisplayed='Y' WHERE AD_Field_ID=50176
;
-- Sep 11, 2012 8:39:22 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=410,IsDisplayed='Y' WHERE AD_Field_ID=50177
;
-- Sep 11, 2012 8:39:23 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=420,IsDisplayed='Y' WHERE AD_Field_ID=50178
;
-- Sep 11, 2012 8:39:23 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=430,IsDisplayed='Y' WHERE AD_Field_ID=55432
;
-- Sep 11, 2012 8:39:23 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET SeqNo=440,IsDisplayed='Y' WHERE AD_Field_ID=55433
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Element SET Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', PrintName='Master Role',Updated=TO_TIMESTAMP('2012-09-11 20:43:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=200117
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=200117
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Column SET ColumnName='IsMasterRole', Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL WHERE AD_Element_ID=200117
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Process_Para SET ColumnName='IsMasterRole', Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL, AD_Element_ID=200117 WHERE UPPER(ColumnName)='ISMASTERROLE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Process_Para SET ColumnName='IsMasterRole', Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL WHERE AD_Element_ID=200117 AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Field SET Name='Master Role', Description='A master role cannot be assigned to users, it is intended to define access to menu option and documents and inherit to other roles', Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=200117) AND IsCentrallyMaintained='Y'
;
-- Sep 11, 2012 8:43:59 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_PrintFormatItem SET PrintName='Master Role', Name='Master Role' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=200117)
;
-- Sep 11, 2012 10:48:11 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLJ'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-11 22:48:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=102
;
-- Sep 12, 2012 11:38:13 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:38:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=124
;
-- Sep 12, 2012 11:40:18 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLD'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:40:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=121
;
-- Sep 12, 2012 11:41:16 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:41:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=173
;
-- Sep 12, 2012 11:41:30 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMI'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:41:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=209
;
-- Sep 12, 2012 11:41:39 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'') AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:41:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52054
;
-- Sep 12, 2012 11:41:55 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'') AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:41:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=125
;
-- Sep 12, 2012 11:42:02 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMM'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:42:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=201
;
-- Sep 12, 2012 11:42:08 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''DOO'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:42:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52004
;
-- Sep 12, 2012 11:42:16 AM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@''',Updated=TO_TIMESTAMP('2012-09-12 11:42:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52066
;
-- Sep 12, 2012 6:20:08 PM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMI'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-12 18:20:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=209
;
-- Sep 12, 2012 6:28:44 PM COT
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARR'', ''APP'') AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-12 18:28:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=149
;
UPDATE AD_System
SET LastMigrationScriptApplied='899_IDEMPIERE_366.sql'
WHERE LastMigrationScriptApplied<'899_IDEMPIERE_366.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,62 @@
-- Sep 11, 2012 8:42:54 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Invoice Processed: ',200060,'U','3c06a457-be2c-4e54-a197-ac5b5646143f','InvoiceProcessed','Y',TO_TIMESTAMP('2012-09-11 20:42:53','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 20:42:53','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:42:55 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200060 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 8:49:40 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Payment Allocated: ',200061,'U','2d9d4e87-b308-4643-9046-a2730a95cb9b','PaymentAllocated','Y',TO_TIMESTAMP('2012-09-11 20:49:39','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 20:49:39','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:49:40 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200061 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 8:52:47 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Allocation Processed: ',200062,'U','5e6e24fc-a609-4424-9aa4-f30f13fa03ac','AllocationProcessed','Y',TO_TIMESTAMP('2012-09-11 20:52:46','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 20:52:46','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:52:47 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200062 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 8:54:59 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Shipment Processed: ',200063,'U','1de82564-7da4-468e-955d-7451a304844d','ShipmentProcessed','Y',TO_TIMESTAMP('2012-09-11 20:54:58','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 20:54:58','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 8:54:59 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200063 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 9:00:52 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Order Created: ',200064,'U','0e54bec9-9529-4ac8-b453-b36b201b5149','OrderCreated','Y',TO_TIMESTAMP('2012-09-11 21:00:51','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 21:00:51','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 9:00:52 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200064 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 11, 2012 9:05:34 PM IST
-- Adding i18n messages
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Generated PO: ',200065,'U','f0135f4a-27e6-499c-9c7e-851631a10a4f','GeneratedPO','Y',TO_TIMESTAMP('2012-09-11 21:05:33','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-11 21:05:33','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 11, 2012 9:05:34 PM IST
-- Adding i18n messages
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200065 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('908_Process_Message.sql') FROM dual
;

View File

@ -0,0 +1,36 @@
-- Sep 12, 2012 6:56:41 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO AD_SysConfig (AD_SysConfig_ID,EntityType,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Client_ID,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name) VALUES (200020,'D','S','Y','New password must differs from the old password','13b5a576-7b91-471b-8b40-05589dd585f7',TO_TIMESTAMP('2012-09-12 18:56:39','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-12 18:56:39','YYYY-MM-DD HH24:MI:SS'),0,0,100,'Y',100,'CHANGE_PASSWORD_MUST_DIFFER')
;
-- Sep 12, 2012 6:57:05 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
UPDATE AD_Column SET FieldLength=1024,Updated=TO_TIMESTAMP('2012-09-12 18:57:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200457
;
-- Sep 12, 2012 6:57:13 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO t_alter_column values('ad_user','SecurityQuestion','VARCHAR(1024)',null,'NULL')
;
-- Sep 12, 2012 6:58:41 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','New Password must differ from Old Password',200066,'U','0d873a03-0980-4725-8a4f-a6954e4ee59e','NewPasswordMustDiffer','Y',TO_TIMESTAMP('2012-09-12 18:58:40','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-12 18:58:40','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 12, 2012 6:58:41 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200066 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 12, 2012 6:58:45 PM SGT
-- IDEMPIERE-375 Implement Forgot my Password
UPDATE AD_Message SET EntityType='D',Updated=TO_TIMESTAMP('2012-09-12 18:58:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200066
;
UPDATE AD_User u SET SecurityQuestion = (
SELECT MAX(m.MsgText) FROM AD_Message m WHERE m.Value = u.SecurityQuestion)
WHERE u.SecurityQuestion IS NOT NULL;
SELECT register_migration_script('910_IDEMPIERE-375.sql') FROM dual
;

View File

@ -0,0 +1,36 @@
-- Sep 17, 2012 5:24:55 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:24:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=124
;
-- Sep 17, 2012 5:25:09 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLD'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:25:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=121
;
-- Sep 17, 2012 5:25:14 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:25:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=173
;
-- Sep 17, 2012 5:25:30 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'') AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:25:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=52054
;
-- Sep 17, 2012 5:25:38 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'') AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:25:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=125
;
-- Sep 17, 2012 5:25:44 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMM'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:25:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=201
;
-- Sep 17, 2012 5:25:49 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''DOO'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:25:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=52004
;
-- Sep 17, 2012 5:26:19 PM COT
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND IsSOTrx=''N'' AND AD_Client_ID=@AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-17 17:26:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Val_Rule_ID=52066
;
SELECT register_migration_script('911_IDEMPIERE-366.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,202 @@
-- Sep 18, 2012 2:38:36 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Form (AccessLevel,Classname,AD_Form_ID,Help,IsBetaFunctionality,EntityType,AD_Form_UU,Description,Name,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('1','org.compiere.apps.form.VResetPassword',200001,NULL,'N','D','e2db983d-c11a-46f7-a4f5-fca8167c8d6c','Reset Password','Reset Password',0,100,100,TO_TIMESTAMP('2012-09-18 14:38:34','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-09-18 14:38:34','YYYY-MM-DD HH24:MI:SS'),0,'Y')
;
-- Sep 18, 2012 2:38:38 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200001 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID)
;
-- Sep 18, 2012 2:39:13 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Menu (AD_Menu_ID,IsSummary,IsSOTrx,IsReadOnly,AD_Form_ID,EntityType,IsCentrallyMaintained,Name,Description,"action",AD_Menu_UU,IsActive,AD_Client_ID,CreatedBy,Updated,AD_Org_ID,Created,UpdatedBy) VALUES (200017,'N','N','N',200001,'D','Y','Reset Password','Reset Passwords for User','X','c9aa4c76-894d-4a72-97de-38d0345fd477','Y',0,100,TO_TIMESTAMP('2012-09-18 14:39:12','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2012-09-18 14:39:12','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Sep 18, 2012 2:39:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Menu_Trl (AD_Language,AD_Menu_ID, Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Menu_Trl_UU ) SELECT l.AD_Language,t.AD_Menu_ID, t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Menu t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Menu_ID=200017 AND NOT EXISTS (SELECT * FROM AD_Menu_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Menu_ID=t.AD_Menu_ID)
;
-- Sep 18, 2012 2:39:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_TreeNodeMM (AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, AD_Tree_ID, Node_ID, Parent_ID, SeqNo, AD_TreeNodeMM_UU) SELECT t.AD_Client_ID, 0, 'Y', CURRENT_TIMESTAMP, 100, CURRENT_TIMESTAMP, 100,t.AD_Tree_ID, 200017, 0, 999, Generate_UUID() FROM AD_Tree t WHERE t.AD_Client_ID=0 AND t.IsActive='Y' AND t.IsAllNodes='Y' AND t.TreeType='MM' AND NOT EXISTS (SELECT * FROM AD_TreeNodeMM e WHERE e.AD_Tree_ID=t.AD_Tree_ID AND Node_ID=200017)
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=0, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=200002
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=1, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=147
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=2, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53246
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=3, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=200017
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=4, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=487
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=5, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=200012
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=6, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=150
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=7, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=495
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=8, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=50007
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=9, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=362
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=10, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=200001
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=11, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=475
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=12, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=366
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=13, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=483
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=14, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=368
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=15, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=508
;
-- Sep 18, 2012 2:39:24 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_TreeNodeMM SET Parent_ID=367, SeqNo=16, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53348
;
-- Sep 18, 2012 2:39:32 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
DELETE FROM AD_Menu_Trl WHERE AD_Menu_ID=487
;
-- Sep 18, 2012 2:39:33 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
DELETE FROM AD_Menu WHERE AD_Menu_ID=487
;
-- Sep 18, 2012 2:39:33 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
DELETE FROM AD_TreeNodeMM WHERE Node_ID=487 AND EXISTS (SELECT * FROM AD_Tree t WHERE t.AD_Tree_ID=AD_TreeNodeMM.AD_Tree_ID AND t.TreeType='MM')
;
-- Sep 18, 2012 2:48:49 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
UPDATE AD_Form SET AccessLevel='7',Updated=TO_TIMESTAMP('2012-09-18 14:48:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=200001
;
-- Sep 18, 2012 4:32:53 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,MsgTip,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','User is Mandatory',NULL,200067,'D','40544a9e-776d-4f96-8ef1-f38de2237027','UserMandatory','Y',TO_TIMESTAMP('2012-09-18 16:32:51','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:32:51','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:32:53 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200067 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:35:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','New EMail does not match the Confirm New EMail',200068,'D','5046c7a0-0846-4f09-b130-d8280a043775','NewEmailNotMatch','Y',TO_TIMESTAMP('2012-09-18 16:35:13','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:35:13','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:35:14 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200068 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:35:51 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Confirm New EMail is Mandatory',200069,'D','c9e44d6f-af2e-4306-bb84-2df8258ad79c','NewEmailConfirmMandatory','Y',TO_TIMESTAMP('2012-09-18 16:35:50','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:35:50','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:35:51 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200069 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:37:44 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','Confirm New EMail',200070,'D','41282b1f-672c-43e0-b823-439b87fa0544','New EMail Confirm','Y',TO_TIMESTAMP('2012-09-18 16:37:43','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:37:43','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:37:44 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200070 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:38:20 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New EMail',200071,'D','6a228718-3a23-46d3-8e0c-97a6511acc50','New EMail','Y',TO_TIMESTAMP('2012-09-18 16:38:19','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:38:19','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:38:20 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200071 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:38:36 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New EMail User',200072,'D','3bf5a60b-20a1-484d-a5f0-11dbe95fcbce','New EMail User','Y',TO_TIMESTAMP('2012-09-18 16:38:35','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:38:35','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:38:36 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200072 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
-- Sep 18, 2012 4:39:03 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('I','New EMail User Password',200073,'D','cfe2fcb8-81cc-4df5-b187-f1df99f8f842','New EMail User Password','Y',TO_TIMESTAMP('2012-09-18 16:38:59','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2012-09-18 16:38:59','YYYY-MM-DD HH24:MI:SS'))
;
-- Sep 18, 2012 4:39:03 PM SGT
-- IDEMPIERE-374 Change password must be changed to be a form instead of a process
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200073 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('913_IDEMPIERE-374.sql') FROM dual
;

View File

@ -0,0 +1,742 @@
-- Sep 17, 2012 5:20:18 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:20:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=295
;
-- Sep 17, 2012 5:20:26 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:20:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=226
;
-- Sep 17, 2012 5:20:57 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:20:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=300
;
-- Sep 17, 2012 5:21:11 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:21:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=231
;
-- Sep 17, 2012 5:23:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:23:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=499
;
-- Sep 17, 2012 5:23:57 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:23:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=308
;
-- Sep 17, 2012 5:24:38 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:24:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53090
;
-- Sep 17, 2012 5:24:44 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=53070
;
-- Sep 17, 2012 5:24:44 PM COT
UPDATE AD_Menu SET Name='Prepare Migration Scripts', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:24:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53090
;
-- Sep 17, 2012 5:24:44 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53090
;
-- Sep 17, 2012 5:25:38 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:25:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=448
;
-- Sep 17, 2012 5:25:42 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:25:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=317
;
-- Sep 17, 2012 5:26:20 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:26:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=449
;
-- Sep 17, 2012 5:26:25 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:26:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=316
;
-- Sep 17, 2012 5:35:04 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:35:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=310
;
-- Sep 17, 2012 5:35:04 PM COT
UPDATE AD_Menu SET Name='Auction Buyer', Description='Maintain Auction Buyer Information', IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:35:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=442
;
-- Sep 17, 2012 5:39:52 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:39:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=309
;
-- Sep 17, 2012 5:39:52 PM COT
UPDATE AD_Menu SET Name='Auction Seller', Description='Maintain Auction Seller Information', IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:39:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=443
;
-- Sep 17, 2012 5:40:54 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:40:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=447
;
-- Sep 17, 2012 5:41:00 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:41:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=307
;
-- Sep 17, 2012 5:41:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:41:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=453
;
-- Sep 17, 2012 5:41:56 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:41:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=308
;
-- Sep 17, 2012 5:45:35 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:45:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52000
;
-- Sep 17, 2012 5:46:02 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:46:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=52003
;
-- Sep 17, 2012 5:46:02 PM COT
UPDATE AD_Menu SET Name='Update Role Menu', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:46:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52000
;
-- Sep 17, 2012 5:46:02 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=52000
;
-- Sep 17, 2012 5:51:42 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:51:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52002
;
-- Sep 17, 2012 5:51:51 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:51:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52000
;
-- Sep 17, 2012 5:58:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:58:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52003
;
-- Sep 17, 2012 5:58:57 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:58:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52001
;
-- Sep 17, 2012 5:59:52 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:59:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52004
;
-- Sep 17, 2012 5:59:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 17:59:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52002
;
-- Sep 17, 2012 6:00:47 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:00:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52005
;
-- Sep 17, 2012 6:00:52 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:00:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=52003
;
-- Sep 17, 2012 6:01:46 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:01:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53013
;
-- Sep 17, 2012 6:01:51 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=53002
;
-- Sep 17, 2012 6:01:51 PM COT
UPDATE AD_Menu SET Name='Setup Web POS', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:01:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53013
;
-- Sep 17, 2012 6:01:51 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53013
;
-- Sep 17, 2012 6:02:44 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:02:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53196
;
-- Sep 17, 2012 6:02:49 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:02:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53065
;
-- Sep 17, 2012 6:02:49 PM COT
UPDATE AD_Menu SET Name='Web POS Terminal', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-17 18:02:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53196
;
-- Sep 17, 2012 6:02:49 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53196
;
-- Sep 18, 2012 2:17:00 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 14:17:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=392
;
-- Sep 18, 2012 2:17:59 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 14:17:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=389
;
-- Sep 18, 2012 2:18:04 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 14:18:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=287
;
-- Sep 18, 2012 2:18:55 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 14:18:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=390
;
-- Sep 18, 2012 2:19:00 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 14:19:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=290
;
-- Sep 18, 2012 5:29:19 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:29:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=391
;
-- Sep 18, 2012 5:29:29 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:29:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=289
;
-- Sep 18, 2012 5:30:50 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:30:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=590
;
-- Sep 18, 2012 5:30:55 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:30:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=386
;
-- Sep 18, 2012 5:31:26 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:31:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=591
;
-- Sep 18, 2012 5:31:30 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:31:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=387
;
-- Sep 18, 2012 5:32:23 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:32:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=592
;
-- Sep 18, 2012 5:32:27 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:32:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=388
;
-- Sep 18, 2012 5:34:02 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:34:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=593
;
-- Sep 18, 2012 5:34:09 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:34:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=350
;
-- Sep 18, 2012 5:34:09 PM COT
UPDATE AD_Menu SET Name='Rebuild Index', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:34:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=593
;
-- Sep 18, 2012 5:34:09 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=593
;
-- Sep 18, 2012 5:52:15 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:52:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=573
;
-- Sep 18, 2012 5:52:20 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:52:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=379
;
-- Sep 18, 2012 5:53:08 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:53:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=574
;
-- Sep 18, 2012 5:53:14 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:53:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=376
;
-- Sep 18, 2012 5:54:07 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:54:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=576
;
-- Sep 18, 2012 5:54:11 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:54:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=375
;
-- Sep 18, 2012 5:58:59 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:58:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=579
;
-- Sep 18, 2012 5:59:05 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:59:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=373
;
-- Sep 18, 2012 5:59:45 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:59:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=584
;
-- Sep 18, 2012 5:59:50 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 17:59:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=345
;
-- Sep 18, 2012 6:00:23 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:00:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=587
;
-- Sep 18, 2012 6:00:28 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:00:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=383
;
-- Sep 18, 2012 6:01:07 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:01:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=588
;
-- Sep 18, 2012 6:01:11 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:01:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=384
;
-- Sep 18, 2012 6:07:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:07:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=52001
;
-- Sep 18, 2012 6:07:49 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:07:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=460
;
-- Sep 18, 2012 6:10:10 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:10:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53264
;
-- Sep 18, 2012 6:10:15 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:10:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53109
;
-- Sep 18, 2012 6:10:15 PM COT
UPDATE AD_Menu SET Name='Import Product Planning', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:10:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53264
;
-- Sep 18, 2012 6:10:15 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53264
;
-- Sep 18, 2012 6:17:14 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:17:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=371
;
-- Sep 18, 2012 6:17:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:17:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=269
;
-- Sep 18, 2012 6:20:15 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:20:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=375
;
-- Sep 18, 2012 6:20:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:20:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=273
;
-- Sep 18, 2012 6:20:50 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:20:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=380
;
-- Sep 18, 2012 6:20:56 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:20:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=274
;
-- Sep 18, 2012 6:21:33 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:21:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=415
;
-- Sep 18, 2012 6:21:37 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:21:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=239
;
-- Sep 18, 2012 6:22:07 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:22:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=416
;
-- Sep 18, 2012 6:22:16 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:22:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=240
;
-- Sep 18, 2012 6:22:37 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:22:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=372
;
-- Sep 18, 2012 6:23:27 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:23:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=559
;
-- Sep 18, 2012 6:23:31 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:23:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=367
;
-- Sep 18, 2012 6:24:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:24:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=560
;
-- Sep 18, 2012 6:24:07 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:24:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=368
;
-- Sep 18, 2012 6:24:45 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:24:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=561
;
-- Sep 18, 2012 6:24:49 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:24:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=369
;
-- Sep 18, 2012 6:25:23 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:25:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=562
;
-- Sep 18, 2012 6:25:27 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:25:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=370
;
-- Sep 18, 2012 6:26:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:26:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=563
;
-- Sep 18, 2012 6:26:08 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:26:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=371
;
-- Sep 18, 2012 6:26:54 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:26:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=564
;
-- Sep 18, 2012 6:26:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:26:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=372
;
-- Sep 18, 2012 6:31:03 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:31:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=488
;
-- Sep 18, 2012 6:31:07 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:31:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=335
;
-- Sep 18, 2012 6:31:49 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:31:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=489
;
-- Sep 18, 2012 6:31:53 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:31:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=336
;
-- Sep 18, 2012 6:32:54 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:32:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=241
;
-- Sep 18, 2012 6:32:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:32:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=198
;
-- Sep 18, 2012 6:35:18 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:35:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=288
;
-- Sep 18, 2012 6:35:24 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:35:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=170
;
-- Sep 18, 2012 6:36:45 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:36:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53132
;
-- Sep 18, 2012 6:36:50 PM COT
UPDATE AD_Form SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:36:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Form_ID=53010
;
-- Sep 18, 2012 6:39:43 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:39:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=187
;
-- Sep 18, 2012 6:39:49 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:39:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=175
;
-- Sep 18, 2012 6:40:25 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:40:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=358
;
-- Sep 18, 2012 6:40:31 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:40:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=261
;
-- Sep 18, 2012 6:41:15 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:41:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=477
;
-- Sep 18, 2012 6:41:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:41:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=329
;
-- Sep 18, 2012 6:42:01 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:42:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=504
;
-- Sep 18, 2012 6:42:05 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:42:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=311
;
-- Sep 18, 2012 6:42:46 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:42:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=360
;
-- Sep 18, 2012 6:42:52 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:42:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=262
;
-- Sep 18, 2012 6:43:26 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:43:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=498
;
-- Sep 18, 2012 6:43:32 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:43:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=340
;
-- Sep 18, 2012 6:44:09 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:44:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=532
;
-- Sep 18, 2012 6:44:12 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:44:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=353
;
-- Sep 18, 2012 6:45:08 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:45:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53187
;
-- Sep 18, 2012 6:45:11 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:45:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=53152
;
-- Sep 18, 2012 6:45:11 PM COT
UPDATE AD_Menu SET Name='Immediate Bank Transfer', Description=NULL, IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:45:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53187
;
-- Sep 18, 2012 6:45:11 PM COT
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53187
;
-- Sep 18, 2012 6:45:48 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:45:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53256
;
-- Sep 18, 2012 6:45:53 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:45:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53104
;
-- Sep 18, 2012 6:46:37 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:46:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=173
;
-- Sep 18, 2012 6:46:43 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:46:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=160
;
-- Sep 18, 2012 6:47:44 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:47:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=284
;
-- Sep 18, 2012 6:47:48 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:47:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=220
;
-- Sep 18, 2012 6:48:25 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:48:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=344
;
-- Sep 18, 2012 6:48:30 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:48:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=253
;
-- Sep 18, 2012 6:51:14 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:51:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=547
;
-- Sep 18, 2012 6:51:19 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:51:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=359
;
-- Sep 18, 2012 6:51:50 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:51:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=550
;
-- Sep 18, 2012 6:51:54 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:51:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=361
;
-- Sep 18, 2012 6:52:26 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:52:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=551
;
-- Sep 18, 2012 6:52:30 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:52:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=362
;
-- Sep 18, 2012 6:55:48 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-18 18:55:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53169
;
-- Sep 19, 2012 10:29:42 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:29:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=54416
;
-- Sep 19, 2012 10:37:37 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:37:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=9286
;
-- Sep 19, 2012 10:41:21 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:41:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11517
;
-- Sep 19, 2012 10:41:38 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:41:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11520
;
-- Sep 19, 2012 10:41:44 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:41:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11521
;
-- Sep 19, 2012 10:41:48 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:41:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11519
;
-- Sep 19, 2012 10:41:53 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:41:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11516
;
-- Sep 19, 2012 10:41:56 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:41:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11518
;
-- Sep 19, 2012 10:42:05 AM COT
UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:42:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=707
;
-- Sep 19, 2012 10:43:29 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:43:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1494
;
-- Sep 19, 2012 10:43:36 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:43:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2074
;
-- Sep 19, 2012 10:43:41 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:43:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1597
;
-- Sep 19, 2012 10:43:45 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:43:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1492
;
-- Sep 19, 2012 10:43:49 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:43:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=1495
;
-- Sep 19, 2012 10:43:56 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:43:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2611
;
-- Sep 19, 2012 10:44:00 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:44:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=2612
;
-- Sep 19, 2012 10:44:08 AM COT
UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:44:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=214
;
-- Sep 19, 2012 10:50:54 AM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-19 10:50:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=12360
;
-- Sep 19, 2012 10:52:39 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_TIMESTAMP('2012-09-19 10:52:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=229
;
-- Sep 19, 2012 10:52:56 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_TIMESTAMP('2012-09-19 10:52:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=312
;
-- Sep 19, 2012 10:53:44 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_TIMESTAMP('2012-09-19 10:53:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53015
;
-- Sep 19, 2012 10:54:05 AM COT
UPDATE AD_Window SET IsBetaFunctionality='N',Updated=TO_TIMESTAMP('2012-09-19 10:54:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53016
;
-- Sep 20, 2012 6:12:15 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:12:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=288
;
-- Sep 20, 2012 6:12:15 PM COT
UPDATE AD_Menu SET Name='Knowledge Base', Description='Maintain Knowledge Base', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:12:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=388
;
-- Sep 20, 2012 6:13:16 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:13:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=55432
;
-- Sep 20, 2012 6:13:24 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:13:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=55433
;
-- Sep 20, 2012 6:13:44 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:13:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50171
;
-- Sep 20, 2012 6:14:47 PM COT
UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2012-09-20 18:14:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=50201
;
-- Sep 20, 2012 6:14:51 PM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:14:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=50201
;
-- Sep 20, 2012 6:15:15 PM COT
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:15:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50171
;
-- Sep 20, 2012 6:15:24 PM COT
UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2012-09-20 18:15:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55333
;
-- Sep 20, 2012 6:15:26 PM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:15:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55333
;
-- Sep 20, 2012 6:15:38 PM COT
UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2012-09-20 18:15:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55332
;
-- Sep 20, 2012 6:15:41 PM COT
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 18:15:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=55332
;
-- Sep 20, 2012 6:16:02 PM COT
INSERT INTO t_alter_column values('ad_role','Allow_Info_MRP','CHAR(1)',null,'N')
;
-- Sep 20, 2012 6:16:03 PM COT
UPDATE AD_Role SET Allow_Info_MRP='N' WHERE Allow_Info_MRP IS NULL
;
-- Sep 20, 2012 6:16:33 PM COT
INSERT INTO t_alter_column values('ad_role','Allow_Info_CRP','CHAR(1)',null,'N')
;
-- Sep 20, 2012 6:16:34 PM COT
UPDATE AD_Role SET Allow_Info_CRP='N' WHERE Allow_Info_CRP IS NULL
;
-- Sep 20, 2012 6:17:03 PM COT
INSERT INTO t_alter_column values('ad_role','Allow_Info_CashJournal','CHAR(1)',null,'N')
;
UPDATE AD_Role SET Allow_Info_CashJournal='N', Allow_Info_MRP='N', Allow_Info_CRP='N'
;
SELECT register_migration_script('914_IDEMPIERE-362.sql') FROM dual
;

View File

@ -0,0 +1,261 @@
-- IDEMPIERE-362 Hide things that don't work on iDempiere
-- Sep 19, 2012 4:36:27 PM COT
UPDATE AD_Column SET IsActive='N' WHERE AD_Column_ID IN (
4862, -- C_AcctSchema_Default.B_Expense_Acct
4868, -- C_AcctSchema_Default.B_RevaluationGain_Acct
4869, -- C_AcctSchema_Default.B_RevaluationLoss_Acct
4866, -- C_AcctSchema_Default.B_SettlementGain_Acct
4867, -- C_AcctSchema_Default.B_SettlementLoss_Acct
4865, -- C_AcctSchema_Default.B_Unidentified_Acct
3449, -- C_AcctSchema_Default.E_Expense_Acct
3450, -- C_AcctSchema_Default.E_Prepayment_Acct
4873, -- C_AcctSchema_Default.NotInvoicedReceivables_Acct
4840, -- C_AcctSchema_Default.NotInvoicedRevenue_Acct
56545, -- C_AcctSchema_Default.P_Burden_Acct
56543, -- C_AcctSchema_Default.P_CostOfProduction_Acct
56542, -- C_AcctSchema_Default.P_FloorStock_Acct
56544, -- C_AcctSchema_Default.P_Labor_Acct
56538, -- C_AcctSchema_Default.P_MethodChangeVariance_Acct
56541, -- C_AcctSchema_Default.P_MixVariance_Acct
56546, -- C_AcctSchema_Default.P_OutsideProcessing_Acct
56567, -- C_AcctSchema_Default.P_Overhead_Acct
56568, -- C_AcctSchema_Default.P_Scrap_Acct
56539, -- C_AcctSchema_Default.P_UsageVariance_Acct
56537, -- C_AcctSchema_Default.P_WIP_Acct
4856, -- C_AcctSchema_Default.T_Liability_Acct
4857, -- C_AcctSchema_Default.T_Receivables_Acct
6114, -- C_AcctSchema_Default.W_InvActualAdjust_Acct
3443, -- C_AcctSchema_Default.W_Inventory_Acct
4853, -- C_AcctSchema_Default.Withholding_Acct
4843, -- C_AcctSchema_Default.W_Revaluation_Acct
2501, -- C_AcctSchema_GL.IncomeSummary_Acct
2500, -- C_AcctSchema_GL.RetainedEarning_Acct
2493, -- C_AcctSchema_GL.SuspenseError_Acct
4901, -- C_BankAccount_Acct.B_Expense_Acct
4907, -- C_BankAccount_Acct.B_RevaluationGain_Acct
4908, -- C_BankAccount_Acct.B_RevaluationLoss_Acct
4905, -- C_BankAccount_Acct.B_SettlementGain_Acct
4906, -- C_BankAccount_Acct.B_SettlementLoss_Acct
4904, -- C_BankAccount_Acct.B_Unidentified_Acct
3381, -- C_BP_Employee_Acct.E_Expense_Acct
3382, -- C_BP_Employee_Acct.E_Prepayment_Acct
4999, -- C_BP_Group_Acct.NotInvoicedReceivables_Acct
4998, -- C_BP_Group_Acct.NotInvoicedRevenue_Acct
10287, -- C_Currency_Acct.RealizedGain_Acct
10289, -- C_Currency_Acct.RealizedLoss_Acct
10279, -- C_Currency_Acct.UnrealizedGain_Acct
10290, -- C_Currency_Acct.UnrealizedLoss_Acct
5085, -- C_Tax_Acct.T_Liability_Acct
5087, -- C_Tax_Acct.T_Receivables_Acct
56565, -- M_Product_Acct.P_Burden_Acct
56563, -- M_Product_Acct.P_CostOfProduction_Acct
56562, -- M_Product_Acct.P_FloorStock_Acct
56564, -- M_Product_Acct.P_Labor_Acct
56558, -- M_Product_Acct.P_MethodChangeVariance_Acct
56561, -- M_Product_Acct.P_MixVariance_Acct
56566, -- M_Product_Acct.P_OutsideProcessing_Acct
56571, -- M_Product_Acct.P_Overhead_Acct
56572, -- M_Product_Acct.P_Scrap_Acct
56559, -- M_Product_Acct.P_UsageVariance_Acct
56557, -- M_Product_Acct.P_WIP_Acct
56555, -- M_Product_Category_Acct.P_Burden_Acct
56553, -- M_Product_Category_Acct.P_CostOfProduction_Acct
56547, -- M_Product_Category_Acct.P_FloorStock_Acct
56554, -- M_Product_Category_Acct.P_Labor_Acct
56549, -- M_Product_Category_Acct.P_MethodChangeVariance_Acct
56552, -- M_Product_Category_Acct.P_MixVariance_Acct
56556, -- M_Product_Category_Acct.P_OutsideProcessing_Acct
56569, -- M_Product_Category_Acct.P_Overhead_Acct
56570, -- M_Product_Category_Acct.P_Scrap_Acct
56550, -- M_Product_Category_Acct.P_UsageVariance_Acct
56548, -- M_Product_Category_Acct.P_WIP_Acct
6124, -- M_Warehouse_Acct.W_InvActualAdjust_Acct
3386, -- M_Warehouse_Acct.W_Inventory_Acct
5133 -- M_Warehouse_Acct.W_Revaluation_Acct
)
;
--
UPDATE AD_Field SET IsActive='N' WHERE AD_Column_ID IN (
4862, -- C_AcctSchema_Default.B_Expense_Acct
4868, -- C_AcctSchema_Default.B_RevaluationGain_Acct
4869, -- C_AcctSchema_Default.B_RevaluationLoss_Acct
4866, -- C_AcctSchema_Default.B_SettlementGain_Acct
4867, -- C_AcctSchema_Default.B_SettlementLoss_Acct
4865, -- C_AcctSchema_Default.B_Unidentified_Acct
3449, -- C_AcctSchema_Default.E_Expense_Acct
3450, -- C_AcctSchema_Default.E_Prepayment_Acct
4873, -- C_AcctSchema_Default.NotInvoicedReceivables_Acct
4840, -- C_AcctSchema_Default.NotInvoicedRevenue_Acct
56545, -- C_AcctSchema_Default.P_Burden_Acct
56543, -- C_AcctSchema_Default.P_CostOfProduction_Acct
56542, -- C_AcctSchema_Default.P_FloorStock_Acct
56544, -- C_AcctSchema_Default.P_Labor_Acct
56538, -- C_AcctSchema_Default.P_MethodChangeVariance_Acct
56541, -- C_AcctSchema_Default.P_MixVariance_Acct
56546, -- C_AcctSchema_Default.P_OutsideProcessing_Acct
56567, -- C_AcctSchema_Default.P_Overhead_Acct
56568, -- C_AcctSchema_Default.P_Scrap_Acct
56539, -- C_AcctSchema_Default.P_UsageVariance_Acct
56537, -- C_AcctSchema_Default.P_WIP_Acct
4856, -- C_AcctSchema_Default.T_Liability_Acct
4857, -- C_AcctSchema_Default.T_Receivables_Acct
6114, -- C_AcctSchema_Default.W_InvActualAdjust_Acct
3443, -- C_AcctSchema_Default.W_Inventory_Acct
4853, -- C_AcctSchema_Default.Withholding_Acct
4843, -- C_AcctSchema_Default.W_Revaluation_Acct
2501, -- C_AcctSchema_GL.IncomeSummary_Acct
2500, -- C_AcctSchema_GL.RetainedEarning_Acct
2493, -- C_AcctSchema_GL.SuspenseError_Acct
4901, -- C_BankAccount_Acct.B_Expense_Acct
4907, -- C_BankAccount_Acct.B_RevaluationGain_Acct
4908, -- C_BankAccount_Acct.B_RevaluationLoss_Acct
4905, -- C_BankAccount_Acct.B_SettlementGain_Acct
4906, -- C_BankAccount_Acct.B_SettlementLoss_Acct
4904, -- C_BankAccount_Acct.B_Unidentified_Acct
3381, -- C_BP_Employee_Acct.E_Expense_Acct
3382, -- C_BP_Employee_Acct.E_Prepayment_Acct
4999, -- C_BP_Group_Acct.NotInvoicedReceivables_Acct
4998, -- C_BP_Group_Acct.NotInvoicedRevenue_Acct
10287, -- C_Currency_Acct.RealizedGain_Acct
10289, -- C_Currency_Acct.RealizedLoss_Acct
10279, -- C_Currency_Acct.UnrealizedGain_Acct
10290, -- C_Currency_Acct.UnrealizedLoss_Acct
5085, -- C_Tax_Acct.T_Liability_Acct
5087, -- C_Tax_Acct.T_Receivables_Acct
56565, -- M_Product_Acct.P_Burden_Acct
56563, -- M_Product_Acct.P_CostOfProduction_Acct
56562, -- M_Product_Acct.P_FloorStock_Acct
56564, -- M_Product_Acct.P_Labor_Acct
56558, -- M_Product_Acct.P_MethodChangeVariance_Acct
56561, -- M_Product_Acct.P_MixVariance_Acct
56566, -- M_Product_Acct.P_OutsideProcessing_Acct
56571, -- M_Product_Acct.P_Overhead_Acct
56572, -- M_Product_Acct.P_Scrap_Acct
56559, -- M_Product_Acct.P_UsageVariance_Acct
56557, -- M_Product_Acct.P_WIP_Acct
56555, -- M_Product_Category_Acct.P_Burden_Acct
56553, -- M_Product_Category_Acct.P_CostOfProduction_Acct
56547, -- M_Product_Category_Acct.P_FloorStock_Acct
56554, -- M_Product_Category_Acct.P_Labor_Acct
56549, -- M_Product_Category_Acct.P_MethodChangeVariance_Acct
56552, -- M_Product_Category_Acct.P_MixVariance_Acct
56556, -- M_Product_Category_Acct.P_OutsideProcessing_Acct
56569, -- M_Product_Category_Acct.P_Overhead_Acct
56570, -- M_Product_Category_Acct.P_Scrap_Acct
56550, -- M_Product_Category_Acct.P_UsageVariance_Acct
56548, -- M_Product_Category_Acct.P_WIP_Acct
6124, -- M_Warehouse_Acct.W_InvActualAdjust_Acct
3386, -- M_Warehouse_Acct.W_Inventory_Acct
5133 -- M_Warehouse_Acct.W_Revaluation_Acct
)
;
---
UPDATE AD_PrintFormatItem SET IsActive='N' WHERE AD_Column_ID IN (
4862, -- C_AcctSchema_Default.B_Expense_Acct
4868, -- C_AcctSchema_Default.B_RevaluationGain_Acct
4869, -- C_AcctSchema_Default.B_RevaluationLoss_Acct
4866, -- C_AcctSchema_Default.B_SettlementGain_Acct
4867, -- C_AcctSchema_Default.B_SettlementLoss_Acct
4865, -- C_AcctSchema_Default.B_Unidentified_Acct
3449, -- C_AcctSchema_Default.E_Expense_Acct
3450, -- C_AcctSchema_Default.E_Prepayment_Acct
4873, -- C_AcctSchema_Default.NotInvoicedReceivables_Acct
4840, -- C_AcctSchema_Default.NotInvoicedRevenue_Acct
56545, -- C_AcctSchema_Default.P_Burden_Acct
56543, -- C_AcctSchema_Default.P_CostOfProduction_Acct
56542, -- C_AcctSchema_Default.P_FloorStock_Acct
56544, -- C_AcctSchema_Default.P_Labor_Acct
56538, -- C_AcctSchema_Default.P_MethodChangeVariance_Acct
56541, -- C_AcctSchema_Default.P_MixVariance_Acct
56546, -- C_AcctSchema_Default.P_OutsideProcessing_Acct
56567, -- C_AcctSchema_Default.P_Overhead_Acct
56568, -- C_AcctSchema_Default.P_Scrap_Acct
56539, -- C_AcctSchema_Default.P_UsageVariance_Acct
56537, -- C_AcctSchema_Default.P_WIP_Acct
4856, -- C_AcctSchema_Default.T_Liability_Acct
4857, -- C_AcctSchema_Default.T_Receivables_Acct
6114, -- C_AcctSchema_Default.W_InvActualAdjust_Acct
3443, -- C_AcctSchema_Default.W_Inventory_Acct
4853, -- C_AcctSchema_Default.Withholding_Acct
4843, -- C_AcctSchema_Default.W_Revaluation_Acct
2501, -- C_AcctSchema_GL.IncomeSummary_Acct
2500, -- C_AcctSchema_GL.RetainedEarning_Acct
2493, -- C_AcctSchema_GL.SuspenseError_Acct
4901, -- C_BankAccount_Acct.B_Expense_Acct
4907, -- C_BankAccount_Acct.B_RevaluationGain_Acct
4908, -- C_BankAccount_Acct.B_RevaluationLoss_Acct
4905, -- C_BankAccount_Acct.B_SettlementGain_Acct
4906, -- C_BankAccount_Acct.B_SettlementLoss_Acct
4904, -- C_BankAccount_Acct.B_Unidentified_Acct
3381, -- C_BP_Employee_Acct.E_Expense_Acct
3382, -- C_BP_Employee_Acct.E_Prepayment_Acct
4999, -- C_BP_Group_Acct.NotInvoicedReceivables_Acct
4998, -- C_BP_Group_Acct.NotInvoicedRevenue_Acct
10287, -- C_Currency_Acct.RealizedGain_Acct
10289, -- C_Currency_Acct.RealizedLoss_Acct
10279, -- C_Currency_Acct.UnrealizedGain_Acct
10290, -- C_Currency_Acct.UnrealizedLoss_Acct
5085, -- C_Tax_Acct.T_Liability_Acct
5087, -- C_Tax_Acct.T_Receivables_Acct
56565, -- M_Product_Acct.P_Burden_Acct
56563, -- M_Product_Acct.P_CostOfProduction_Acct
56562, -- M_Product_Acct.P_FloorStock_Acct
56564, -- M_Product_Acct.P_Labor_Acct
56558, -- M_Product_Acct.P_MethodChangeVariance_Acct
56561, -- M_Product_Acct.P_MixVariance_Acct
56566, -- M_Product_Acct.P_OutsideProcessing_Acct
56571, -- M_Product_Acct.P_Overhead_Acct
56572, -- M_Product_Acct.P_Scrap_Acct
56559, -- M_Product_Acct.P_UsageVariance_Acct
56557, -- M_Product_Acct.P_WIP_Acct
56555, -- M_Product_Category_Acct.P_Burden_Acct
56553, -- M_Product_Category_Acct.P_CostOfProduction_Acct
56547, -- M_Product_Category_Acct.P_FloorStock_Acct
56554, -- M_Product_Category_Acct.P_Labor_Acct
56549, -- M_Product_Category_Acct.P_MethodChangeVariance_Acct
56552, -- M_Product_Category_Acct.P_MixVariance_Acct
56556, -- M_Product_Category_Acct.P_OutsideProcessing_Acct
56569, -- M_Product_Category_Acct.P_Overhead_Acct
56570, -- M_Product_Category_Acct.P_Scrap_Acct
56550, -- M_Product_Category_Acct.P_UsageVariance_Acct
56548, -- M_Product_Category_Acct.P_WIP_Acct
6124, -- M_Warehouse_Acct.W_InvActualAdjust_Acct
3386, -- M_Warehouse_Acct.W_Inventory_Acct
5133 -- M_Warehouse_Acct.W_Revaluation_Acct
)
;
-- Sep 27, 2012 11:08:01 AM COT
UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-27 11:08:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=214
;
-- Sep 28, 2012 1:14:51 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:14:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1370
;
-- Sep 28, 2012 1:15:22 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Tab SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:15:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Tab_ID=569
;
-- Sep 28, 2012 1:20:15 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_TIMESTAMP('2012-09-28 13:20:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56547
;
-- Sep 28, 2012 1:20:51 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_TIMESTAMP('2012-09-28 13:20:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56537
;
SELECT register_migration_script('915_IDEMPIERE-362.sql') FROM dual
;

View File

@ -0,0 +1,388 @@
-- IDEMPIERE-362 Hide things that don't work on iDempiere
-- Hide Payroll to be managed as extension
-- Sep 20, 2012 7:59:44 PM COT
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 19:59:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53114
;
-- Sep 20, 2012 8:01:41 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53036
;
-- Sep 20, 2012 8:01:41 PM COT
UPDATE AD_Menu SET Name='Payroll Concept Catalog', Description='Maintain Payroll Concept Catalog', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53115
;
-- Sep 20, 2012 8:01:41 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50084
;
-- Sep 20, 2012 8:01:48 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53039
;
-- Sep 20, 2012 8:01:48 PM COT
UPDATE AD_Menu SET Name='Payroll Concept Category', Description='Maintain Payroll Concept Category', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53118
;
-- Sep 20, 2012 8:01:48 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50075
;
-- Sep 20, 2012 8:01:59 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53032
;
-- Sep 20, 2012 8:01:59 PM COT
UPDATE AD_Menu SET Name='Payroll Contract', Description='Maintain Payroll Contract', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53110
;
-- Sep 20, 2012 8:01:59 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:01:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50076
;
-- Sep 20, 2012 8:02:04 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53038
;
-- Sep 20, 2012 8:02:04 PM COT
UPDATE AD_Menu SET Name='Payroll Definition', Description='In a company, payroll is the sum of all financial records of salaries, wages, bonuses, and deductions.', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53117
;
-- Sep 20, 2012 8:02:04 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50074
;
-- Sep 20, 2012 8:02:08 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53034
;
-- Sep 20, 2012 8:02:08 PM COT
UPDATE AD_Menu SET Name='Payroll Department', Description='Maintain Payroll Department', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53112
;
-- Sep 20, 2012 8:02:08 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50079
;
-- Sep 20, 2012 8:02:13 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53033
;
-- Sep 20, 2012 8:02:13 PM COT
UPDATE AD_Menu SET Name='Payroll Employee', Description='Maintain Payroll Employee', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53111
;
-- Sep 20, 2012 8:02:13 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50080
;
-- Sep 20, 2012 8:02:18 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53035
;
-- Sep 20, 2012 8:02:18 PM COT
UPDATE AD_Menu SET Name='Payroll Job', Description='Maintain Payroll Job', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53113
;
-- Sep 20, 2012 8:02:18 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50083
;
-- Sep 20, 2012 8:02:42 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53042
;
-- Sep 20, 2012 8:02:42 PM COT
UPDATE AD_Menu SET Name='Payroll Movement', Description='History of Payroll Movement', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53121
;
-- Sep 20, 2012 8:02:48 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53037
;
-- Sep 20, 2012 8:02:48 PM COT
UPDATE AD_Menu SET Name='Payroll Process', Description='Payroll Process', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53127
;
-- Sep 20, 2012 8:02:48 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:48','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50077
;
-- Sep 20, 2012 8:02:55 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53041
;
-- Sep 20, 2012 8:02:55 PM COT
UPDATE AD_Menu SET Name='Payroll Table', Description='Maintain Payroll Table', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53120
;
-- Sep 20, 2012 8:02:55 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:02:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50078
;
-- Sep 20, 2012 8:03:03 PM COT
UPDATE AD_Window SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:03:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Window_ID=53040
;
-- Sep 20, 2012 8:03:03 PM COT
UPDATE AD_Menu SET Name='Payroll Table Type', Description='Maintain Payroll Table Type', IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:03:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53119
;
-- Sep 20, 2012 8:03:03 PM COT
UPDATE AD_WF_Node SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-20 20:03:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_WF_Node_ID=50082
;
-- Sep 28, 2012 1:07:59 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:07:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53124
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=0, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53124
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=1, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=530
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=2, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53109
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=3, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53114
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=0, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=266
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=1, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=232
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=2, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=190
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=3, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=127
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=4, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=133
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=5, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=172
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=6, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=173
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=7, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53256
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=8, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=110
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=9, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=394
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=10, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=544
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=11, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=512
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=12, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=506
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=13, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=420
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=14, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=451
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=15, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=186
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=16, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=473
;
-- Sep 28, 2012 1:08:54 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=17, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=531
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=0, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53124
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=1, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53109
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=53108, SeqNo=2, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53114
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=0, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=266
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=1, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=232
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=2, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=190
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=3, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=127
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=4, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=133
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=5, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=172
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=6, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=173
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=7, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=53256
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=8, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=110
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=9, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=394
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=10, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=544
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=11, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=512
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=12, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=506
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=13, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=420
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=14, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=451
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=15, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=186
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=16, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=473
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=17, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=531
;
-- Sep 28, 2012 1:08:58 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_TreeNodeMM SET Parent_ID=165, SeqNo=18, Updated=CURRENT_TIMESTAMP WHERE AD_Tree_ID=10 AND Node_ID=530
;
-- Sep 28, 2012 1:11:02 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:11:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53123
;
-- Sep 28, 2012 1:11:11 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:11:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53116
;
-- Sep 28, 2012 1:11:15 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:11:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53122
;
-- Sep 28, 2012 1:11:28 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:11:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53109
;
-- Sep 28, 2012 1:11:33 PM COT
-- IDEMPIERE-362 Hide things that don't work on iDempiere
UPDATE AD_Menu SET IsActive='N',Updated=TO_TIMESTAMP('2012-09-28 13:11:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Menu_ID=53108
;
SELECT register_migration_script('916_IDEMPIERE-362.sql') FROM dual
;

View File

@ -0,0 +1,63 @@
-- Sep 21, 2012 8:07:08 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND IsSOTrx=''N''',Updated=TO_TIMESTAMP('2012-09-21 20:07:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52066
;
-- Sep 21, 2012 8:07:15 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARR'', ''APP'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:07:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=149
;
-- Sep 21, 2012 8:07:20 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''DOO'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:07:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52004
;
-- Sep 21, 2012 8:07:24 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:07:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=201
;
-- Sep 21, 2012 8:07:28 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'', ''MMS'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:07:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=125
;
-- Sep 21, 2012 8:07:42 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''MMR'') AND C_DocType.IsSOTrx=''N'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:07:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52054
;
-- Sep 21, 2012 8:08:05 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''SOO'', ''POO'') AND C_DocType.DocSubTypeSO=''RM'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@ AND C_DocType.IsSOTrx=''N''',Updated=TO_TIMESTAMP('2012-09-21 20:08:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52066
;
-- Sep 21, 2012 8:08:26 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''MMI'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:08:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=209
;
-- Sep 21, 2012 8:08:30 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLJ'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:08:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=102
;
-- Sep 21, 2012 8:08:36 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:08:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=173
;
-- Sep 21, 2012 8:08:41 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType=''GLD'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:08:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=121
;
-- Sep 21, 2012 8:08:47 PM COT
-- IDEMPIERE-366 Improve Role Inheritance
UPDATE AD_Val_Rule SET Code='C_DocType.DocBaseType IN (''ARI'', ''API'',''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',Updated=TO_TIMESTAMP('2012-09-21 20:08:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=124
;
SELECT register_migration_script('917_IDEMPIERE-366.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
-- Sep 27, 2012 12:32:31 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message SET MsgText='Reached the maximum number of login attempts, user account ({0}) is locked',Updated=TO_TIMESTAMP('2012-09-27 12:32:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200033
;
-- Sep 27, 2012 12:32:31 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200033
;
-- Sep 27, 2012 12:32:59 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message SET MsgText='User account ({0}) is locked, please contact the system administrator',Updated=TO_TIMESTAMP('2012-09-27 12:32:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=200032
;
-- Sep 27, 2012 12:32:59 PM SGT
-- IDEMPIERE-373 Implement User Locking
UPDATE AD_Message_Trl SET IsTranslated='N' WHERE AD_Message_ID=200032
;
SELECT register_migration_script('919_IDEMPIERE-373_User_Locking.sql') FROM dual
;

View File

@ -0,0 +1,179 @@
-- Sep 25, 2012 1:46:23 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=930
;
-- Sep 25, 2012 1:46:30 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=931
;
-- Sep 25, 2012 1:46:35 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59592
;
-- Sep 25, 2012 1:46:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59591
;
-- Sep 25, 2012 1:46:46 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10126
;
-- Sep 25, 2012 1:46:52 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52018
;
-- Sep 25, 2012 1:46:57 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:46:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8740
;
-- Sep 25, 2012 1:47:04 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:47:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5227
;
-- Sep 25, 2012 1:47:10 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:47:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11006
;
-- Sep 25, 2012 1:47:16 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:47:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11003
;
-- Sep 25, 2012 1:47:23 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:47:23','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11002
;
-- Sep 25, 2012 1:47:30 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:47:30','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8311
;
-- Sep 25, 2012 1:49:28 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:49:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10813
;
-- Sep 25, 2012 1:49:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N and @IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:49:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256
;
-- Sep 25, 2012 1:49:50 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N and @IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:49:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257
;
-- Sep 25, 2012 1:49:56 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:49:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8313
;
-- Sep 25, 2012 1:50:01 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8314
;
-- Sep 25, 2012 1:50:06 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8312
;
-- Sep 25, 2012 1:50:22 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8310
;
-- Sep 25, 2012 1:50:26 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12367
;
-- Sep 25, 2012 1:50:31 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12368
;
-- Sep 25, 2012 1:50:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200071
;
-- Sep 25, 2012 1:50:45 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:50:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50168
;
-- Sep 25, 2012 1:51:14 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169
;
-- Sep 25, 2012 1:51:19 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170
;
-- Sep 25, 2012 1:51:35 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172
;
-- Sep 25, 2012 1:51:40 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173
;
-- Sep 25, 2012 1:51:45 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174
;
-- Sep 25, 2012 1:51:50 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175
;
-- Sep 25, 2012 1:51:55 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:51:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176
;
-- Sep 25, 2012 1:52:00 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:52:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177
;
-- Sep 25, 2012 1:52:04 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 13:52:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178
;
-- Sep 25, 2012 1:58:27 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Column SET ReadOnlyLogic=NULL,DefaultValue=NULL,Updated=TO_TIMESTAMP('2012-09-25 13:58:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=534
;
-- Sep 25, 2012 2:19:54 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N & @IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 14:19:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256
;
-- Sep 25, 2012 2:20:02 PM COT
-- IDEMPIERE-391 Scheduler improvements
UPDATE AD_Field SET DisplayLogic='@IsAccessAllOrgs@=N & @IsMasterRole@=N',Updated=TO_TIMESTAMP('2012-09-25 14:20:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257
;
SELECT register_migration_script('920_IDEMPIERE_366.sql') FROM dual
;

View File

@ -0,0 +1,82 @@
CREATE OR REPLACE FUNCTION nextid(
p_AD_Sequence_ID IN INTEGER,
p_System IN VARCHAR,
o_NextID OUT INTEGER
)
RETURNS INTEGER AS $body$
/*************************************************************************
* The contents of this file are subject to the Compiere License. You may
* obtain a copy of the License at http://www.compiere.org/license.html
* Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for details. Code: Compiere ERP+CRM
* Copyright (C) 1999-2005 Jorg Janke, ComPiere, Inc. All Rights Reserved.
*
* converted to postgreSQL by Karsten Thiemann (Schaeffer AG),
* kthiemann@adempiere.org
*************************************************************************
***
* Title: Get Next ID - no Commit
* Description: Returns the next id of the sequence.
* Test:
* select * from nextid((select ad_sequence_id from ad_sequence where name = 'Test')::Integer, 'Y'::Varchar);
*
************************************************************************/
DECLARE
Isnativeseqon VARCHAR(1);
tablename VARCHAR(60);
BEGIN
IF (p_System = 'Y') THEN
RAISE NOTICE 'system';
SELECT CurrentNextSys
INTO o_NextID
FROM AD_Sequence
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
--
UPDATE AD_Sequence
SET CurrentNextSys = CurrentNextSys + IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
ELSE
Isnativeseqon := get_Sysconfig('SYSTEM_NATIVE_SEQUENCE','N',0,0);
IF Isnativeseqon = 'Y' THEN
SELECT Name
INTO tablename
FROM Ad_Sequence
WHERE Ad_Sequence_Id=P_Ad_Sequence_Id;
--
EXECUTE 'SELECT nextval('''||tablename||'_sq'''||')' INTO o_NextID;
--
ELSE
SELECT CurrentNext
INTO o_NextID
FROM AD_Sequence
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
--
UPDATE AD_Sequence
SET CurrentNext = CurrentNext + IncrementNo
WHERE AD_Sequence_ID=p_AD_Sequence_ID;
END IF;
END IF;
--
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE '%',SQLERRM;
END;
$body$ LANGUAGE plpgsql;
DROP SEQUENCE ad_error_seq
;
DROP SEQUENCE ad_pinstance_seq
;
DROP SEQUENCE t_spool_seq
;
DROP SEQUENCE w_basket_seq
;
SELECT register_migration_script('921_IDEMPIERE-422_NativeSequence.sql') FROM dual
;

View File

@ -0,0 +1,75 @@
-- IDEMPIERE-362 Hide things that don't work on iDempiere
ALTER TABLE c_acctschema_default ALTER b_expense_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER b_revaluationgain_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER b_revaluationloss_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER b_settlementgain_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER b_settlementloss_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER b_unidentified_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER e_expense_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER e_prepayment_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER notinvoicedreceivables_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER notinvoicedrevenue_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER t_liability_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER t_receivables_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER w_invactualadjust_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER w_inventory_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER w_revaluation_acct DROP NOT NULL;
ALTER TABLE c_acctschema_default ALTER withholding_acct DROP NOT NULL;
ALTER TABLE c_acctschema_gl ALTER incomesummary_acct DROP NOT NULL;
ALTER TABLE c_acctschema_gl ALTER retainedearning_acct DROP NOT NULL;
ALTER TABLE c_bankaccount_acct ALTER b_expense_acct DROP NOT NULL;
ALTER TABLE c_bankaccount_acct ALTER b_revaluationgain_acct DROP NOT NULL;
ALTER TABLE c_bankaccount_acct ALTER b_revaluationloss_acct DROP NOT NULL;
ALTER TABLE c_bankaccount_acct ALTER b_settlementgain_acct DROP NOT NULL;
ALTER TABLE c_bankaccount_acct ALTER b_settlementloss_acct DROP NOT NULL;
ALTER TABLE c_bankaccount_acct ALTER b_unidentified_acct DROP NOT NULL;
ALTER TABLE c_bp_group_acct ALTER notinvoicedreceivables_acct DROP NOT NULL;
ALTER TABLE c_bp_group_acct ALTER notinvoicedrevenue_acct DROP NOT NULL;
ALTER TABLE c_currency_acct ALTER realizedgain_acct DROP NOT NULL;
ALTER TABLE c_currency_acct ALTER realizedloss_acct DROP NOT NULL;
ALTER TABLE c_currency_acct ALTER unrealizedgain_acct DROP NOT NULL;
ALTER TABLE c_currency_acct ALTER unrealizedloss_acct DROP NOT NULL;
ALTER TABLE c_tax_acct ALTER t_liability_acct DROP NOT NULL;
ALTER TABLE c_tax_acct ALTER t_receivables_acct DROP NOT NULL;
ALTER TABLE m_warehouse_acct ALTER w_invactualadjust_acct DROP NOT NULL;
ALTER TABLE m_warehouse_acct ALTER w_inventory_acct DROP NOT NULL;
ALTER TABLE m_warehouse_acct ALTER w_revaluation_acct DROP NOT NULL;
SELECT register_migration_script('922_IDEMPIERE-362.sql') FROM dual
;

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,9 @@ DECLARE
currentnextsys NUMBER (10); currentnextsys NUMBER (10);
currentnext NUMBER (10); currentnext NUMBER (10);
currentseqsys NUMBER (10); currentseqsys NUMBER (10);
currentseq NUMBER (10); Currentseq Number (10);
Isnativeseqon Varchar2(1);
sqlcmd VARCHAR2(200);
BEGIN BEGIN
DBMS_OUTPUT.PUT_LINE ('Start'); DBMS_OUTPUT.PUT_LINE ('Start');
@ -40,14 +42,15 @@ BEGIN
GOTO next_iteration; GOTO next_iteration;
END; END;
Isnativeseqon := get_Sysconfig('SYSTEM_NATIVE_SEQUENCE','N',0,0);
IF currentnextsys IS NULL IF currentnextsys IS NULL
THEN THEN
currentnextsys := 0; currentnextsys := 0;
END IF; END IF;
SELECT DECODE (SIGN (currentnextsys - 50000), SELECT DECODE (SIGN (currentnextsys - 200000),
-1, 50000, -1, 200000,
NVL (currentnextsys + 1, 50000) NVL (currentnextsys + 1, 200000)
) )
INTO currentnextsys INTO currentnextsys
FROM DUAL; FROM DUAL;
@ -76,16 +79,26 @@ BEGIN
INTO currentnext INTO currentnext
FROM DUAL; FROM DUAL;
If Isnativeseqon ='Y' Then
Cmdseq :=
'SELECT '||R.Tablename||'_SQ.Nextval as currentnext,
currentnextsys
FROM AD_Sequence '
|| 'WHERE Name = '''
|| r.Tablename
|| ''' AND istableid = ''Y''';
ELSE
cmdseq := cmdseq :=
'SELECT currentnext, currentnextsys FROM AD_Sequence ' 'SELECT currentnext, currentnextsys FROM AD_Sequence '
|| 'WHERE Name = ''' || 'WHERE Name = '''
|| r.tablename || r.tablename
|| ''' AND istableid = ''Y'''; || ''' AND istableid = ''Y''';
END IF;
EXECUTE IMMEDIATE cmdseq EXECUTE IMMEDIATE cmdseq
INTO currentseq, currentseqsys; INTO currentseq, currentseqsys;
IF currentnextsys <> currentseqsys OR currentnext <> currentseq IF currentnextsys <> currentseqsys OR (currentnext <> currentseq AND Isnativeseqon ='N')
THEN THEN
DBMS_OUTPUT.PUT_LINE ( r.tablename DBMS_OUTPUT.PUT_LINE ( r.tablename
|| ' sys=' || ' sys='
@ -108,8 +121,16 @@ BEGIN
DBMS_OUTPUT.PUT_LINE (cmdupd); DBMS_OUTPUT.PUT_LINE (cmdupd);
EXECUTE IMMEDIATE cmdupd; EXECUTE IMMEDIATE cmdupd;
END IF; End If;
If Currentseq < Currentnext And Isnativeseqon ='Y' Then
Sqlcmd := 'SELECT '||R.Tablename||'_SQ.Nextval FROM DUAL';
DBMS_OUTPUT.PUT_LINE (Sqlcmd);
While Not Currentseq >= (currentnext-1) Loop
Execute Immediate Sqlcmd
Into currentseq;
End Loop;
END IF;
<<next_iteration>> <<next_iteration>>
NULL; NULL;
END LOOP; END LOOP;

View File

@ -11,6 +11,7 @@ DECLARE
currentseq NUMERIC (10); currentseq NUMERIC (10);
ok BOOLEAN; ok BOOLEAN;
r RECORD; r RECORD;
isnativeseqon VARCHAR (1);
BEGIN BEGIN
FOR r IN (SELECT tablename FOR r IN (SELECT tablename
@ -41,14 +42,15 @@ BEGIN
END; END;
IF ok THEN IF ok THEN
isnativeseqon := get_Sysconfig('SYSTEM_NATIVE_SEQUENCE','N',0,0);
IF currentnextsys IS NULL IF currentnextsys IS NULL
THEN THEN
currentnextsys := 0; currentnextsys := 0;
END IF; END IF;
SELECT INTO currentnextsys CASE SIGN (currentnextsys - 50000) SELECT INTO currentnextsys CASE SIGN (currentnextsys - 200000)
WHEN -1 THEN 50000 WHEN -1 THEN 200000
ELSE coalesce (currentnextsys + 1, 50000) ELSE coalesce (currentnextsys + 1, 200000)
END; END;
cmdnosys := cmdnosys :=
@ -72,15 +74,25 @@ BEGIN
ELSE coalesce (currentnext + 1, 1000000) ELSE coalesce (currentnext + 1, 1000000)
END ; END ;
IF isnativeseqon ='Y' THEN
cmdseq :=
'SELECT nextval('''||trim(r.tablename)||'_sq'''||') as currentnext,
currentnextsys
FROM AD_Sequence '
|| 'WHERE Name = '''
|| r.tablename
|| ''' AND istableid = ''Y''';
ELSE
cmdseq := cmdseq :=
'SELECT currentnext, currentnextsys FROM AD_Sequence ' 'SELECT currentnext, currentnextsys FROM AD_Sequence '
|| 'WHERE Name = ''' || 'WHERE Name = '''
|| r.tablename || r.tablename
|| ''' AND istableid = ''Y'''; || ''' AND istableid = ''Y''';
END IF;
EXECUTE cmdseq INTO currentseq, currentseqsys; EXECUTE cmdseq INTO currentseq, currentseqsys;
IF currentnextsys <> currentseqsys OR currentnext <> currentseq IF currentnextsys <> currentseqsys OR (currentnext <> currentseq AND isnativeseqon ='N')
THEN THEN
cmdupd := cmdupd :=
'update ad_sequence set currentnextsys = ' 'update ad_sequence set currentnextsys = '
@ -93,8 +105,12 @@ BEGIN
EXECUTE cmdupd; EXECUTE cmdupd;
END IF; END IF;
IF currentseq < currentnext AND isnativeseqon ='Y' THEN
WHILE NOT currentseq >= (currentnext-1) LOOP
EXECUTE 'SELECT nextval('''||trim(r.tablename)||'_sq'''||')' INTO currentseq;
END LOOP;
END IF;
END IF; END IF;
END LOOP; END LOOP;
END; END;
$func$ LANGUAGE plpgsql; $func$ LANGUAGE plpgsql;

View File

@ -57,7 +57,7 @@ public class CalloutAssignment extends CalloutEngine
return ""; return "";
int M_Product_ID = 0; int M_Product_ID = 0;
String Name = null; StringBuilder Name = null;
String Description = null; String Description = null;
BigDecimal Qty = null; BigDecimal Qty = null;
String sql = "SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty " String sql = "SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty "
@ -74,7 +74,7 @@ public class CalloutAssignment extends CalloutEngine
if (rs.next()) if (rs.next())
{ {
M_Product_ID = rs.getInt (1); M_Product_ID = rs.getInt (1);
Name = rs.getString(2); Name = new StringBuilder(rs.getString(2));
Description = rs.getString(3); Description = rs.getString(3);
Qty = rs.getBigDecimal(4); Qty = rs.getBigDecimal(4);
} }
@ -94,9 +94,9 @@ public class CalloutAssignment extends CalloutEngine
{ {
mTab.setValue ("M_Product_ID", new Integer (M_Product_ID)); mTab.setValue ("M_Product_ID", new Integer (M_Product_ID));
if (Description != null) if (Description != null)
Name += " (" + Description + ")"; Name.append(" (").append(Description).append(")");
if (!".".equals(Name)) if (!".".equals(Name.toString()))
mTab.setValue("Description", Name); mTab.setValue("Description", Name.toString());
// //
String variable = "Qty"; // TimeExpenseLine String variable = "Qty"; // TimeExpenseLine
if (mTab.getTableName().startsWith("C_Order")) if (mTab.getTableName().startsWith("C_Order"))

View File

@ -1317,8 +1317,9 @@ public class CalloutOrder extends CalloutEngine
BigDecimal total = available.subtract(notReserved); BigDecimal total = available.subtract(notReserved);
if (total.compareTo(QtyOrdered) < 0) if (total.compareTo(QtyOrdered) < 0)
{ {
String info = Msg.parseTranslation(ctx, "@QtyAvailable@=" + available StringBuilder msgpts = new StringBuilder("@QtyAvailable@=").append(available)
+ " - @QtyNotReserved@=" + notReserved + " = " + total); .append(" - @QtyNotReserved@=").append(notReserved).append(" = ").append(total);
String info = Msg.parseTranslation(ctx, msgpts.toString());
mTab.fireDataStatusEEvent ("InsufficientQtyAvailable", mTab.fireDataStatusEEvent ("InsufficientQtyAvailable",
info, false); info, false);
} }

View File

@ -89,9 +89,9 @@ public class ASPGenerateFields extends SvrProcess
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("ASP_Status=" + p_ASP_Status StringBuilder msglog = new StringBuilder("ASP_Status=").append(p_ASP_Status)
+ ", ASP_Tab_ID=" + p_ASP_Tab_ID .append(", ASP_Tab_ID=").append(p_ASP_Tab_ID);
); log.info(msglog.toString());
X_ASP_Tab asptab = new X_ASP_Tab(getCtx(), p_ASP_Tab_ID, get_TrxName()); X_ASP_Tab asptab = new X_ASP_Tab(getCtx(), p_ASP_Tab_ID, get_TrxName());
p_ASP_Level_ID = asptab.getASP_Window().getASP_Level_ID(); p_ASP_Level_ID = asptab.getASP_Window().getASP_Level_ID();

View File

@ -107,10 +107,10 @@ public class ASPGenerateLevel extends SvrProcess
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("ASP_Status=" + p_ASP_Status StringBuilder msglog = new StringBuilder("ASP_Status=").append(p_ASP_Status)
+ ", AD_Menu_ID=" + p_AD_Menu_ID .append(", AD_Menu_ID=").append(p_AD_Menu_ID)
+ ", IsGenerateFields=" + p_IsGenerateFields .append(", IsGenerateFields=").append(p_IsGenerateFields);
); log.info(msglog.toString());
MClientInfo clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName()); MClientInfo clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
int AD_Tree_ID = clientInfo.getAD_Tree_Menu_ID(); int AD_Tree_ID = clientInfo.getAD_Tree_Menu_ID();

View File

@ -51,16 +51,16 @@ public class ApplyMigrationScripts extends SvrProcess {
protected String doIt() throws Exception { protected String doIt() throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
log.info("Applying migrations scripts"); log.info("Applying migrations scripts");
String sql = "select ad_migrationscript_id, script, name from ad_migrationscript where isApply = 'Y' and status = 'IP' order by name, created"; StringBuilder sql = new StringBuilder()
PreparedStatement pstmt = DB.prepareStatement(sql, this.get_TrxName()); .append("select ad_migrationscript_id, script, name from ad_migrationscript where isApply = 'Y' and status = 'IP' order by name, created");
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), this.get_TrxName());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
byte[] scriptArray = rs.getBytes(2); byte[] scriptArray = rs.getBytes(2);
int seqID = rs.getInt(1); int seqID = rs.getInt(1);
boolean execOk = true; boolean execOk = true;
try { try {
StringBuffer tmpSql = new StringBuffer(); StringBuilder tmpSql = new StringBuilder(new String(scriptArray));
tmpSql = new StringBuffer(new String(scriptArray));
if (tmpSql.length() > 0) { if (tmpSql.length() > 0) {
log.info("Executing script " + rs.getString(3)); log.info("Executing script " + rs.getString(3));
@ -70,12 +70,12 @@ public class ApplyMigrationScripts extends SvrProcess {
} catch (SQLException e) { } catch (SQLException e) {
execOk = false; execOk = false;
e.printStackTrace(); e.printStackTrace();
log.saveError("Error", "Script: " + rs.getString(3) + " - " StringBuilder msglog = new StringBuilder("Script: ").append(rs.getString(3)).append(" - ").append(e.getMessage());
+ e.getMessage()); log.saveError("Error", msglog.toString());
log.severe(e.getMessage()); log.severe(e.getMessage());
} finally { } finally {
sql = "UPDATE ad_migrationscript SET status = ? , isApply = 'N' WHERE ad_migrationscript_id = ? "; sql = new StringBuilder("UPDATE ad_migrationscript SET status = ? , isApply = 'N' WHERE ad_migrationscript_id = ? ");
pstmt = DB.prepareStatement(sql, this.get_TrxName()); pstmt = DB.prepareStatement(sql.toString(), this.get_TrxName());
if (execOk) { if (execOk) {
pstmt.setString(1, "CO"); pstmt.setString(1, "CO");
pstmt.setInt(2, seqID); pstmt.setInt(2, seqID);
@ -91,8 +91,8 @@ public class ApplyMigrationScripts extends SvrProcess {
} }
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
log.saveError("Error", "Script: " + rs.getString(3) + " - " StringBuilder msglog = new StringBuilder("Script: ").append(rs.getString(3)).append(" - ").append(e.getMessage());
+ e.getMessage()); log.saveError("Error", msglog.toString());
log.severe(e.getMessage()); log.severe(e.getMessage());
} }
} }
@ -110,7 +110,7 @@ public class ApplyMigrationScripts extends SvrProcess {
public boolean executeScript(String sql, String fileName) { public boolean executeScript(String sql, String fileName) {
BufferedReader reader = new BufferedReader(new StringReader(sql)); BufferedReader reader = new BufferedReader(new StringReader(sql));
StringBuffer sqlBuf = new StringBuffer(); StringBuilder sqlBuf = new StringBuilder();
String line; String line;
boolean statementReady = false; boolean statementReady = false;
boolean execOk = true; boolean execOk = true;
@ -151,8 +151,9 @@ public class ApplyMigrationScripts extends SvrProcess {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
execOk = false; execOk = false;
log.saveError("Error", "Script: " + fileName + " - " StringBuilder msglog = new StringBuilder("Script: ").append(fileName).append(" - ")
+ e.getMessage() + ". The line that caused the error is the following ==> " + sqlBuf); .append(e.getMessage()).append(". The line that caused the error is the following ==> ").append(sqlBuf);
log.saveError("Error", msglog.toString());
log.severe(e.getMessage()); log.severe(e.getMessage());
} finally { } finally {
stmt.close(); stmt.close();

View File

@ -96,7 +96,8 @@ public class ClientAcctProcessor extends SvrProcess
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("C_AcctSchema_ID=" + p_C_AcctSchema_ID + ", AD_Table_ID=" + p_AD_Table_ID); StringBuilder msglog = new StringBuilder("C_AcctSchema_ID=").append(p_C_AcctSchema_ID).append(", AD_Table_ID=").append(p_AD_Table_ID);
log.info(msglog.toString());
if (! MClient.isClientAccounting()) if (! MClient.isClientAccounting())
throw new AdempiereUserError(Msg.getMsg(getCtx(), "ClientAccountingNotEnabled")); throw new AdempiereUserError(Msg.getMsg(getCtx(), "ClientAccountingNotEnabled"));
@ -145,7 +146,7 @@ public class ClientAcctProcessor extends SvrProcess
&& p_AD_Table_ID != AD_Table_ID) && p_AD_Table_ID != AD_Table_ID)
continue; continue;
StringBuffer sql = new StringBuffer ("SELECT DISTINCT ProcessedOn FROM ").append(TableName) StringBuilder sql = new StringBuilder("SELECT DISTINCT ProcessedOn FROM ").append(TableName)
.append(" WHERE AD_Client_ID=? AND ProcessedOn<?") .append(" WHERE AD_Client_ID=? AND ProcessedOn<?")
.append(" AND Processed='Y' AND Posted='N' AND IsActive='Y'"); .append(" AND Processed='Y' AND Posted='N' AND IsActive='Y'");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -195,7 +196,7 @@ public class ClientAcctProcessor extends SvrProcess
&& p_AD_Table_ID != AD_Table_ID) && p_AD_Table_ID != AD_Table_ID)
continue; continue;
// SELECT * FROM table // SELECT * FROM table
StringBuffer sql = new StringBuffer ("SELECT * FROM ").append(TableName) StringBuilder sql = new StringBuilder("SELECT * FROM ").append(TableName)
.append(" WHERE AD_Client_ID=? AND (ProcessedOn"); .append(" WHERE AD_Client_ID=? AND (ProcessedOn");
if (processedOn.compareTo(Env.ZERO) != 0) if (processedOn.compareTo(Env.ZERO) != 0)
sql.append("=?"); sql.append("=?");
@ -263,10 +264,14 @@ public class ClientAcctProcessor extends SvrProcess
if (countError[i] > 0) if (countError[i] > 0)
m_summary.append("(Errors=").append(countError[i]).append(")"); m_summary.append("(Errors=").append(countError[i]).append(")");
m_summary.append(" - "); m_summary.append(" - ");
log.finer(getName() + ": " + m_summary.toString()); StringBuilder msglog = new StringBuilder(getName()).append(": ").append(m_summary.toString());
log.finer(msglog.toString());
} }
else else
log.finer(getName() + ": " + TableName + " - no work"); {
StringBuilder msglog = new StringBuilder(getName()).append(": ").append(TableName).append(" - no work");
log.finer(msglog.toString());
}
} }
} // postSession } // postSession

View File

@ -224,9 +224,9 @@ public class ExpenseTypesFromAccounts extends SvrProcess {
} }
} }
String returnStr = addCount + " products added."; StringBuilder returnStr = new StringBuilder().append(addCount).append(" products added.");
if (skipCount>0) returnStr += " " + skipCount + " products skipped."; if (skipCount>0) returnStr.append(" ").append(skipCount).append(" products skipped.");
return(returnStr); return(returnStr.toString());
} }

View File

@ -102,7 +102,7 @@ public class Export extends SvrProcess
AD_Table_ID = getTable_ID(); AD_Table_ID = getTable_ID();
// C_Invoice; AD_Table_ID = 318 // C_Invoice; AD_Table_ID = 318
StringBuffer sb = new StringBuffer ("AD_Table_ID=").append(AD_Table_ID); StringBuilder sb = new StringBuilder("AD_Table_ID=").append(AD_Table_ID);
sb.append("; Record_ID=").append(getRecord_ID()); sb.append("; Record_ID=").append(getRecord_ID());
// Parameter // Parameter
ProcessInfoParameter[] para = getParameter(); ProcessInfoParameter[] para = getParameter();
@ -154,7 +154,7 @@ public class Export extends SvrProcess
} }
MEXPFormat exportFormat = new MEXPFormat(getCtx(), EXP_Format_ID, get_TrxName()); MEXPFormat exportFormat = new MEXPFormat(getCtx(), EXP_Format_ID, get_TrxName());
StringBuffer sql = new StringBuffer("SELECT * ") StringBuilder sql = new StringBuilder("SELECT * ")
.append("FROM ").append(table.getTableName()).append(" ") .append("FROM ").append(table.getTableName()).append(" ")
.append("WHERE ").append(po.get_KeyColumns()[0]).append("=?") .append("WHERE ").append(po.get_KeyColumns()[0]).append("=?")
; ;
@ -270,7 +270,8 @@ public class Export extends SvrProcess
} }
} }
}*/ }*/
log.info("EXP Field - column=["+column.getColumnName()+"]; value=" + value); StringBuilder msglog = new StringBuilder("EXP Field - column=[").append(column.getColumnName()).append("]; value=").append(value);
log.info(msglog.toString());
if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) { if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) {
Text newText = outDocument.createTextNode(valueString); Text newText = outDocument.createTextNode(valueString);
newElement.appendChild(newText); newElement.appendChild(newText);
@ -331,7 +332,8 @@ public class Export extends SvrProcess
} }
} }
}*/ }*/
log.info("EXP Field - column=["+column.getColumnName()+"]; value=" + value); StringBuilder msglog = new StringBuilder("EXP Field - column=[").append(column.getColumnName()).append("]; value=").append(value);
log.info(msglog.toString());
if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) { if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) {
rootElement.setAttribute(formatLine.getValue(), valueString); rootElement.setAttribute(formatLine.getValue(), valueString);
elementHasValue = true; elementHasValue = true;
@ -348,7 +350,7 @@ public class Export extends SvrProcess
MTable tableEmbedded = MTable.get(getCtx(), embeddedFormat.getAD_Table_ID()); MTable tableEmbedded = MTable.get(getCtx(), embeddedFormat.getAD_Table_ID());
log.info("Table Embedded = " + tableEmbedded); log.info("Table Embedded = " + tableEmbedded);
StringBuffer sql = new StringBuffer("SELECT * ") StringBuilder sql = new StringBuilder("SELECT * ")
.append("FROM ").append(tableEmbedded.getTableName()).append(" ") .append("FROM ").append(tableEmbedded.getTableName()).append(" ")
.append("WHERE ").append(masterPO.get_KeyColumns()[0]).append("=?") .append("WHERE ").append(masterPO.get_KeyColumns()[0]).append("=?")
//+ "WHERE " + po.get_WhereClause(false) //+ "WHERE " + po.get_WhereClause(false)

View File

@ -83,10 +83,10 @@ public class HouseKeeping extends SvrProcess{
int nodel = 0; int nodel = 0;
if (houseKeeping.isSaveInHistoric()){ if (houseKeeping.isSaveInHistoric()){
String sql = "INSERT INTO hst_"+tableName + " SELECT * FROM " + tableName; StringBuilder sql = new StringBuilder("INSERT INTO hst_").append(tableName).append(" SELECT * FROM ").append(tableName);
if (whereClause != null && whereClause.length() > 0) if (whereClause != null && whereClause.length() > 0)
sql = sql + " WHERE " + whereClause; sql.append(" WHERE ").append(whereClause);
noins = DB.executeUpdate(sql, get_TrxName()); noins = DB.executeUpdate(sql.toString(), get_TrxName());
if (noins == -1) if (noins == -1)
throw new AdempiereSystemError("Cannot insert into hst_"+tableName); throw new AdempiereSystemError("Cannot insert into hst_"+tableName);
addLog("@Inserted@ " + noins); addLog("@Inserted@ " + noins);
@ -98,15 +98,15 @@ public class HouseKeeping extends SvrProcess{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateString = dateFormat.format(date); String dateString = dateFormat.format(date);
FileWriter file = new FileWriter(pathFile+File.separator+tableName+dateString+".xml"); FileWriter file = new FileWriter(pathFile+File.separator+tableName+dateString+".xml");
String sql = "SELECT * FROM " + tableName; StringBuilder sql = new StringBuilder("SELECT * FROM ").append(tableName);
if (whereClause != null && whereClause.length() > 0) if (whereClause != null && whereClause.length() > 0)
sql = sql + " WHERE " + whereClause; sql.append(" WHERE ").append(whereClause);
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
StringBuffer linexml = null; StringBuffer linexml = null;
try try
{ {
pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
GenericPO po = new GenericPO(tableName, getCtx(), rs, get_TrxName()); GenericPO po = new GenericPO(tableName, getCtx(), rs, get_TrxName());
@ -130,10 +130,10 @@ public class HouseKeeping extends SvrProcess{
addLog("@Exported@ " + noexp); addLog("@Exported@ " + noexp);
}//XmlExport }//XmlExport
String sql = "DELETE FROM " + tableName; StringBuilder sql = new StringBuilder("DELETE FROM ").append(tableName);
if (whereClause != null && whereClause.length() > 0) if (whereClause != null && whereClause.length() > 0)
sql = sql + " WHERE " + whereClause; sql.append(" WHERE ").append(whereClause);
nodel = DB.executeUpdate(sql, get_TrxName()); nodel = DB.executeUpdate(sql.toString(), get_TrxName());
if (nodel == -1) if (nodel == -1)
throw new AdempiereSystemError("Cannot delete from " + tableName); throw new AdempiereSystemError("Cannot delete from " + tableName);
Timestamp time = new Timestamp(date.getTime()); Timestamp time = new Timestamp(date.getTime());
@ -141,7 +141,7 @@ public class HouseKeeping extends SvrProcess{
houseKeeping.setLastDeleted(nodel); houseKeeping.setLastDeleted(nodel);
houseKeeping.saveEx(); houseKeeping.saveEx();
addLog("@Deleted@ " + nodel); addLog("@Deleted@ " + nodel);
String msg = Msg.getElement(getCtx(), tableName + "_ID") + " #" + nodel; StringBuilder msg = new StringBuilder(Msg.getElement(getCtx(), tableName + "_ID")).append(" #").append(nodel);
return msg; return msg.toString();
}//doIt }//doIt
} }

View File

@ -114,10 +114,11 @@ public class ImmediateBankTransfer extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
log.info("From Bank="+p_From_C_BankAccount_ID+" - To Bank="+p_To_C_BankAccount_ID StringBuilder msglog = new StringBuilder("From Bank=").append(p_From_C_BankAccount_ID).append(" - To Bank=").append(p_To_C_BankAccount_ID)
+ " - C_CashBook_ID="+p_C_CashBook_ID+" - Amount="+p_Amount+" - Name="+p_Name .append(" - C_CashBook_ID=").append(p_C_CashBook_ID).append(" - Amount=").append(p_Amount).append(" - Name=").append(p_Name)
+ " - Description="+p_Description+ " - Statement Date="+p_StatementDate+ .append(" - Description=").append(p_Description).append(" - Statement Date=").append(p_StatementDate)
" - Date Account="+p_DateAcct); .append(" - Date Account=").append(p_DateAcct);
log.info(msglog.toString());
if (p_To_C_BankAccount_ID == 0 || p_From_C_BankAccount_ID == 0) if (p_To_C_BankAccount_ID == 0 || p_From_C_BankAccount_ID == 0)
throw new IllegalArgumentException("Banks required"); throw new IllegalArgumentException("Banks required");
@ -248,17 +249,18 @@ public class ImmediateBankTransfer extends SvrProcess
MCash cash = createCash(); MCash cash = createCash();
MCashLine cashLines[]= createCashLines(cash); MCashLine cashLines[]= createCashLines(cash);
StringBuffer processMsg = new StringBuffer(cash.getDocumentNo()); StringBuilder processMsg = new StringBuilder(cash.getDocumentNo());
cash.setDocAction(p_docAction); cash.setDocAction(p_docAction);
if (!cash.processIt(p_docAction)) if (!cash.processIt(p_docAction))
{ {
processMsg.append(" (NOT Processed)"); processMsg.append(" (NOT Processed)");
log.warning("Cash Processing failed: " + cash + " - " + cash.getProcessMsg()); StringBuilder msglog = new StringBuilder("Cash Processing failed: ").append(cash).append(" - ").append(cash.getProcessMsg());
addLog(cash.getC_Cash_ID(), cash.getStatementDate(), null, log.warning(msglog.toString());
"Cash Processing failed: " + cash + " - " msglog = new StringBuilder("Cash Processing failed: ").append(cash).append(" - ")
+ cash.getProcessMsg() .append(cash.getProcessMsg())
+ " / please complete it manually"); .append(" / please complete it manually");
addLog(cash.getC_Cash_ID(), cash.getStatementDate(), null,msglog.toString());
throw new IllegalStateException("Cash Processing failed: " + cash + " - " + cash.getProcessMsg()); throw new IllegalStateException("Cash Processing failed: " + cash + " - " + cash.getProcessMsg());
} }
if (!cash.save()) if (!cash.save())

View File

@ -88,9 +88,9 @@ public class ImportPriceList extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
int m_discountschema_id = DB.getSQLValue(get_TrxName(), int m_discountschema_id = DB.getSQLValue(get_TrxName(),
"SELECT MIN(M_DiscountSchema_ID) FROM M_DiscountSchema WHERE DiscountType='P' AND IsActive='Y' AND AD_Client_ID=?", "SELECT MIN(M_DiscountSchema_ID) FROM M_DiscountSchema WHERE DiscountType='P' AND IsActive='Y' AND AD_Client_ID=?",
@ -103,81 +103,81 @@ public class ImportPriceList extends SvrProcess
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_PriceList " sql = new StringBuilder("DELETE I_PriceList "
+ "WHERE I_IsImported='Y'").append(clientCheck); + "WHERE I_IsImported='Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Delete Old Impored =" + no); log.info("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated, EnforcePriceLimit, IsSOPriceList, IsTaxIncluded, PricePrecision // Set Client, Org, IsActive, Created/Updated, EnforcePriceLimit, IsSOPriceList, IsTaxIncluded, PricePrecision
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder("UPDATE I_PriceList ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append(")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID, 0)," .append(" AD_Org_ID = COALESCE (AD_Org_ID, 0),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " EnforcePriceLimit = COALESCE (EnforcePriceLimit, 'N')," .append(" EnforcePriceLimit = COALESCE (EnforcePriceLimit, 'N'),")
+ " IsSOPriceList = COALESCE (IsSOPriceList, 'N')," .append(" IsSOPriceList = COALESCE (IsSOPriceList, 'N'),")
+ " IsTaxIncluded = COALESCE (IsTaxIncluded, 'N')," .append(" IsTaxIncluded = COALESCE (IsTaxIncluded, 'N'),")
+ " PricePrecision = COALESCE (PricePrecision, 2)," .append(" PricePrecision = COALESCE (PricePrecision, 2),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Reset=" + no); log.info("Reset=" + no);
// Set Optional BPartner // Set Optional BPartner
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p" .append("SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p")
+ " WHERE I_PriceList.BPartner_Value=p.Value AND I_PriceList.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE I_PriceList.BPartner_Value=p.Value AND I_PriceList.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartner_Value IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartner_Value IS NOT NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("BPartner=" + no); log.info("BPartner=" + no);
// //
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner,' ")
+ "WHERE C_BPartner_ID IS NULL AND BPartner_Value IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartner_Value IS NOT NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid BPartner=" + no); log.warning("Invalid BPartner=" + no);
// Product // Product
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder("UPDATE I_PriceList ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE I_PriceList.ProductValue=p.Value AND I_PriceList.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE I_PriceList.ProductValue=p.Value AND I_PriceList.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, ' ")
+ "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL)" .append("WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Product=" + no); log.warning ("Invalid Product=" + no);
// **** Find Price List // **** Find Price List
// Name // Name
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p" .append("SET M_PriceList_ID=(SELECT M_PriceList_ID FROM M_PriceList p")
+ " WHERE I_PriceList.Name=p.Name AND I_PriceList.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE I_PriceList.Name=p.Name AND I_PriceList.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL" .append("WHERE M_PriceList_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Price List Existing Value=" + no); log.info("Price List Existing Value=" + no);
// **** Find Price List Version // **** Find Price List Version
// List Name (ID) + ValidFrom // List Name (ID) + ValidFrom
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET M_PriceList_Version_ID=(SELECT M_PriceList_Version_ID FROM M_PriceList_Version p" .append("SET M_PriceList_Version_ID=(SELECT M_PriceList_Version_ID FROM M_PriceList_Version p")
+ " WHERE I_PriceList.ValidFrom=p.ValidFrom AND I_PriceList.M_PriceList_ID=p.M_PriceList_ID) " .append(" WHERE I_PriceList.ValidFrom=p.ValidFrom AND I_PriceList.M_PriceList_ID=p.M_PriceList_ID) ")
+ "WHERE M_PriceList_ID IS NOT NULL AND M_PriceList_Version_ID IS NULL" .append("WHERE M_PriceList_ID IS NOT NULL AND M_PriceList_Version_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Price List Version Existing Value=" + no); log.info("Price List Version Existing Value=" + no);
@ -208,55 +208,55 @@ public class ImportPriceList extends SvrProcess
*/ */
// Set Currency // Set Currency
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder("UPDATE I_PriceList ")
+ "SET ISO_Code=(SELECT ISO_Code FROM C_Currency c" .append("SET ISO_Code=(SELECT ISO_Code FROM C_Currency c")
+ " INNER JOIN C_AcctSchema a ON (a.C_Currency_ID=c.C_Currency_ID)" .append(" INNER JOIN C_AcctSchema a ON (a.C_Currency_ID=c.C_Currency_ID)")
+ " INNER JOIN AD_ClientInfo ci ON (a.C_AcctSchema_ID=ci.C_AcctSchema1_ID)" .append(" INNER JOIN AD_ClientInfo ci ON (a.C_AcctSchema_ID=ci.C_AcctSchema1_ID)")
+ " WHERE ci.AD_Client_ID=I_PriceList.AD_Client_ID) " .append(" WHERE ci.AD_Client_ID=I_PriceList.AD_Client_ID) ")
+ "WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL" .append("WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency Default=" + no); log.fine("Set Currency Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c")
+ " WHERE I_PriceList.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,I_PriceList.AD_Client_ID)) " .append(" WHERE I_PriceList.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,I_PriceList.AD_Client_ID)) ")
+ "WHERE C_Currency_ID IS NULL" .append("WHERE C_Currency_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("doIt- Set Currency=" + no); log.info("doIt- Set Currency=" + no);
// //
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Currency,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Currency,' ")
+ "WHERE C_Currency_ID IS NULL" .append("WHERE C_Currency_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid Currency=" + no); log.warning("Invalid Currency=" + no);
// Mandatory Name or PriceListID // Mandatory Name or PriceListID
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Mandatory Name or PriceListID,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Mandatory Name or PriceListID,' ")
+ "WHERE Name IS NULL AND M_PriceList_ID IS NULL" .append("WHERE Name IS NULL AND M_PriceList_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No Mandatory Name=" + no); log.warning("No Mandatory Name=" + no);
// Mandatory ValidFrom or PriceListVersionID // Mandatory ValidFrom or PriceListVersionID
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Mandatory ValidFrom or PriceListVersionID,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Mandatory ValidFrom or PriceListVersionID,' ")
+ "WHERE ValidFrom IS NULL AND M_PriceList_Version_ID IS NULL" .append("WHERE ValidFrom IS NULL AND M_PriceList_Version_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No Mandatory ValidFrom=" + no); log.warning("No Mandatory ValidFrom=" + no);
// Mandatory BreakValue if BPartner set // Mandatory BreakValue if BPartner set
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Mandatory BreakValue,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Mandatory BreakValue,' ")
+ "WHERE BreakValue IS NULL AND (C_BPartner_ID IS NOT NULL OR BPartner_Value IS NOT NULL)" .append("WHERE BreakValue IS NULL AND (C_BPartner_ID IS NOT NULL OR BPartner_Value IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No Mandatory BreakValue=" + no); log.warning("No Mandatory BreakValue=" + no);
@ -273,7 +273,7 @@ public class ImportPriceList extends SvrProcess
// Go through Records // Go through Records
log.fine("start inserting/updating ..."); log.fine("start inserting/updating ...");
sql = new StringBuffer ("SELECT * FROM I_PriceList WHERE I_IsImported='N'") sql = new StringBuilder ("SELECT * FROM I_PriceList WHERE I_IsImported='N'")
.append(clientCheck); .append(clientCheck);
PreparedStatement pstmt_setImported = null; PreparedStatement pstmt_setImported = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -300,7 +300,8 @@ public class ImportPriceList extends SvrProcess
M_PriceList_ID = 0; M_PriceList_ID = 0;
} }
boolean newPriceList = M_PriceList_ID == 0; boolean newPriceList = M_PriceList_ID == 0;
log.fine("I_PriceList_ID=" + I_PriceList_ID + ", M_PriceList_ID=" + M_PriceList_ID); StringBuilder msglog = new StringBuilder("I_PriceList_ID=").append(I_PriceList_ID).append(", M_PriceList_ID=").append(M_PriceList_ID);
log.fine(msglog.toString());
MPriceList pricelist = null; MPriceList pricelist = null;
// PriceList // PriceList
@ -315,8 +316,8 @@ public class ImportPriceList extends SvrProcess
} }
else else
{ {
StringBuffer sql0 = new StringBuffer ("UPDATE I_PriceList i " StringBuilder sql0 = new StringBuilder ("UPDATE I_PriceList i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Price List failed")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Price List failed"))
.append("WHERE I_PriceList_ID=").append(I_PriceList_ID); .append("WHERE I_PriceList_ID=").append(I_PriceList_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -334,7 +335,8 @@ public class ImportPriceList extends SvrProcess
M_PriceList_Version_ID = 0; M_PriceList_Version_ID = 0;
} }
boolean newPriceListVersion = M_PriceList_Version_ID == 0; boolean newPriceListVersion = M_PriceList_Version_ID == 0;
log.fine("I_PriceList_ID=" + I_PriceList_ID + ", M_PriceList_Version_ID=" + M_PriceList_Version_ID); msglog = new StringBuilder("I_PriceList_ID=").append(I_PriceList_ID).append(", M_PriceList_Version_ID=").append(M_PriceList_Version_ID);
log.fine(msglog.toString());
MPriceListVersion pricelistversion = null; MPriceListVersion pricelistversion = null;
// PriceListVersion // PriceListVersion
@ -352,8 +354,8 @@ public class ImportPriceList extends SvrProcess
} }
else else
{ {
StringBuffer sql0 = new StringBuffer ("UPDATE I_PriceList i " StringBuilder sql0 = new StringBuilder ("UPDATE I_PriceList i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Price List Version failed")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Price List Version failed"))
.append("WHERE I_PriceList_ID=").append(I_PriceList_ID); .append("WHERE I_PriceList_ID=").append(I_PriceList_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -401,8 +403,8 @@ public class ImportPriceList extends SvrProcess
} }
else else
{ {
StringBuffer sql0 = new StringBuffer ("UPDATE I_PriceList i " StringBuilder sql0 = new StringBuilder ("UPDATE I_PriceList i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert/Update Product Price Vendor Break Version failed")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert/Update Product Price Vendor Break Version failed"))
.append("WHERE I_PriceList_ID=").append(I_PriceList_ID); .append("WHERE I_PriceList_ID=").append(I_PriceList_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -432,8 +434,8 @@ public class ImportPriceList extends SvrProcess
} }
else else
{ {
StringBuffer sql0 = new StringBuffer ("UPDATE I_PriceList i " StringBuilder sql0 = new StringBuilder ("UPDATE I_PriceList i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert/Update Product Price failed")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert/Update Product Price failed"))
.append("WHERE I_PriceList_ID=").append(I_PriceList_ID); .append("WHERE I_PriceList_ID=").append(I_PriceList_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -460,9 +462,9 @@ public class ImportPriceList extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_PriceList " sql = new StringBuilder ("UPDATE I_PriceList ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
addLog (0, null, new BigDecimal (noInsertpl), "@M_PriceList_ID@: @Inserted@"); addLog (0, null, new BigDecimal (noInsertpl), "@M_PriceList_ID@: @Inserted@");

View File

@ -236,8 +236,9 @@ public class InOutGenerateRMA extends SvrProcess
if (shipmentLines.length == 0) if (shipmentLines.length == 0)
{ {
log.log(Level.WARNING, "No shipment lines created: M_RMA_ID=" StringBuilder msglog = new StringBuilder("No shipment lines created: M_RMA_ID=")
+ M_RMA_ID + ", M_InOut_ID=" + shipment.get_ID()); .append(M_RMA_ID).append(", M_InOut_ID=").append(shipment.get_ID());
log.log(Level.WARNING, msglog.toString());
} }
StringBuffer processMsg = new StringBuffer(shipment.getDocumentNo()); StringBuffer processMsg = new StringBuffer(shipment.getDocumentNo());
@ -245,7 +246,8 @@ public class InOutGenerateRMA extends SvrProcess
if (!shipment.processIt(p_docAction)) if (!shipment.processIt(p_docAction))
{ {
processMsg.append(" (NOT Processed)"); processMsg.append(" (NOT Processed)");
log.warning("Shipment Processing failed: " + shipment + " - " + shipment.getProcessMsg()); StringBuilder msglog = new StringBuilder("Shipment Processing failed: ").append(shipment).append(" - ").append(shipment.getProcessMsg());
log.warning(msglog.toString());
throw new IllegalStateException("Shipment Processing failed: " + shipment + " - " + shipment.getProcessMsg()); throw new IllegalStateException("Shipment Processing failed: " + shipment + " - " + shipment.getProcessMsg());
} }

View File

@ -149,24 +149,26 @@ public class InitialClientSetup extends SvrProcess
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("InitialClientSetup"
+ ": ClientName=" + p_ClientName StringBuilder msglog = new StringBuilder("InitialClientSetup")
+ ", OrgValue=" + p_OrgValue .append(": ClientName=").append(p_ClientName)
+ ", OrgName=" + p_OrgName .append(", OrgValue=").append(p_OrgValue)
+ ", AdminUserName=" + p_AdminUserName .append(", OrgName=").append(p_OrgName)
+ ", NormalUserName=" + p_NormalUserName .append(", AdminUserName=").append(p_AdminUserName)
+ ", C_Currency_ID=" + p_C_Currency_ID .append(", NormalUserName=").append(p_NormalUserName)
+ ", C_Country_ID=" + p_C_Country_ID .append(", C_Currency_ID=").append(p_C_Currency_ID)
+ ", C_Region_ID=" + p_C_Region_ID .append(", C_Country_ID=").append(p_C_Country_ID)
+ ", CityName=" + p_CityName .append(", C_Region_ID=").append(p_C_Region_ID)
+ ", C_City_ID=" + p_C_City_ID .append(", CityName=").append(p_CityName)
+ ", IsUseBPDimension=" + p_IsUseBPDimension .append(", C_City_ID=").append(p_C_City_ID)
+ ", IsUseProductDimension=" + p_IsUseProductDimension .append(", IsUseBPDimension=").append(p_IsUseBPDimension)
+ ", IsUseProjectDimension=" + p_IsUseProjectDimension .append(", IsUseProductDimension=").append(p_IsUseProductDimension)
+ ", IsUseCampaignDimension=" + p_IsUseCampaignDimension .append(", IsUseProjectDimension=").append(p_IsUseProjectDimension)
+ ", IsUseSalesRegionDimension=" + p_IsUseSalesRegionDimension .append(", IsUseCampaignDimension=").append(p_IsUseCampaignDimension)
+ ", CoAFile=" + p_CoAFile .append(", IsUseSalesRegionDimension=").append(p_IsUseSalesRegionDimension)
); .append(", CoAFile=").append(p_CoAFile);
log.info(msglog.toString());
// Validations // Validations
@ -196,7 +198,8 @@ public class InitialClientSetup extends SvrProcess
if (p_C_City_ID > 0) { if (p_C_City_ID > 0) {
MCity city = MCity.get(getCtx(), p_C_City_ID); MCity city = MCity.get(getCtx(), p_C_City_ID);
if (! city.getName().equals(p_CityName)) { if (! city.getName().equals(p_CityName)) {
log.info("City name changed from " + p_CityName + " to " + city.getName()); msglog = new StringBuilder("City name changed from ").append(p_CityName).append(" to ").append(city.getName());
log.info(msglog.toString());
p_CityName = city.getName(); p_CityName = city.getName();
} }
} }

View File

@ -165,8 +165,9 @@ public class InvoiceGenerateRMA extends SvrProcess
{ {
if (rmaLine.getM_InOutLine_ID() == 0) if (rmaLine.getM_InOutLine_ID() == 0)
{ {
throw new IllegalStateException("No customer return line - RMA = " StringBuilder msgiste = new StringBuilder("No customer return line - RMA = ")
+ rma.getDocumentNo() + ", Line = " + rmaLine.getLine()); .append(rma.getDocumentNo()).append(", Line = ").append(rmaLine.getLine());
throw new IllegalStateException(msgiste.toString());
} }
MInvoiceLine invLine = new MInvoiceLine(invoice); MInvoiceLine invLine = new MInvoiceLine(invoice);
@ -197,17 +198,19 @@ public class InvoiceGenerateRMA extends SvrProcess
if (invoiceLines.length == 0) if (invoiceLines.length == 0)
{ {
log.log(Level.WARNING, "No invoice lines created: M_RMA_ID=" StringBuilder msglog = new StringBuilder("No invoice lines created: M_RMA_ID=")
+ M_RMA_ID + ", M_Invoice_ID=" + invoice.get_ID()); .append(M_RMA_ID).append(", M_Invoice_ID=").append(invoice.get_ID());
log.log(Level.WARNING, msglog.toString());
} }
StringBuffer processMsg = new StringBuffer(invoice.getDocumentNo()); StringBuilder processMsg = new StringBuilder(invoice.getDocumentNo());
if (!invoice.processIt(p_docAction)) if (!invoice.processIt(p_docAction))
{ {
processMsg.append(" (NOT Processed)"); processMsg.append(" (NOT Processed)");
log.warning("Invoice Processing failed: " + invoice + " - " + invoice.getProcessMsg()); StringBuilder msg = new StringBuilder("Invoice Processing failed: ").append(invoice).append(" - ").append(invoice.getProcessMsg());
throw new IllegalStateException("Invoice Processing failed: " + invoice + " - " + invoice.getProcessMsg()); log.warning(msg.toString());
throw new IllegalStateException(msg.toString());
} }
if (!invoice.save()) if (!invoice.save())
@ -216,7 +219,8 @@ public class InvoiceGenerateRMA extends SvrProcess
} }
// Add processing information to process log // Add processing information to process log
addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, processMsg.toString(),invoice.get_Table_ID(),invoice.getC_Invoice_ID()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + processMsg.toString());
addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, message, invoice.get_Table_ID(), invoice.getC_Invoice_ID());
m_created++; m_created++;
} }
} }

View File

@ -72,18 +72,19 @@ public class PrepareMigrationScripts extends SvrProcess {
}; };
dirList = dir.listFiles(filter); dirList = dir.listFiles(filter);
log.info("Searching for SQL files in the " + dir + " directory"); StringBuilder msglog = new StringBuilder("Searching for SQL files in the ").append(dir).append(" directory");
log.info(msglog.toString());
String msg = ""; StringBuilder msg = new StringBuilder();
// Get Filenames // Get Filenames
for (int i = 0; i < dirList.length; i++) { for (int i = 0; i < dirList.length; i++) {
fileName.add(dirList[i].toString() fileName.add(dirList[i].toString()
.substring(directory.length() + 1)); .substring(directory.length() + 1));
log msglog = new StringBuilder("Found file [")
.fine("Found file [" .append(fileName.get(i))
+ fileName.get(i) .append("]. Finding out if the script has or hasn't been applied yet...");
+ "]. Finding out if the script has or hasn't been applied yet..."); log.fine(msglog.toString());
try { try {
// First of all, check if the script hasn't been applied yet... // First of all, check if the script hasn't been applied yet...
String checkScript = "select ad_migrationscript_id from ad_migrationscript where name = ?"; String checkScript = "select ad_migrationscript_id from ad_migrationscript where name = ?";
@ -92,15 +93,16 @@ public class PrepareMigrationScripts extends SvrProcess {
pstmt.setString(1, fileName.get(i)); pstmt.setString(1, fileName.get(i));
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next()) {
log.warning("Script " + fileName.get(i) msglog = new StringBuilder("Script ").append(fileName.get(i))
+ " already in the database"); .append(" already in the database");
log.warning(msglog.toString());
pstmt.close(); pstmt.close();
continue; continue;
} }
pstmt.close(); pstmt.close();
// first use a Scanner to get each line // first use a Scanner to get each line
Scanner scanner = new Scanner(dirList[i]); Scanner scanner = new Scanner(dirList[i]);
StringBuffer body = new StringBuffer(); StringBuilder body = new StringBuilder();
boolean blHeader = false; boolean blHeader = false;
boolean blBody = false; boolean blBody = false;
boolean isFirstLine = true; boolean isFirstLine = true;
@ -215,8 +217,9 @@ public class PrepareMigrationScripts extends SvrProcess {
if (result > 0) if (result > 0)
log.info("Header inserted. Now inserting the script body"); log.info("Header inserted. Now inserting the script body");
else { else {
log.severe("Script " + fileName.get(i) + " failed!"); msglog = new StringBuilder("Script ").append(fileName.get(i)).append(" failed!");
msg = msg + "Script " + fileName.get(i) + " failed!"; log.severe(msglog.toString());
msg.append(msglog);
continue; continue;
} }
sql = "UPDATE AD_MigrationScript SET script = ? WHERE AD_MigrationScript_ID = ?"; sql = "UPDATE AD_MigrationScript SET script = ? WHERE AD_MigrationScript_ID = ?";
@ -228,8 +231,9 @@ public class PrepareMigrationScripts extends SvrProcess {
if (result > 0) if (result > 0)
log.info("Script Body inserted."); log.info("Script Body inserted.");
else { else {
log.severe("Script Body " + fileName.get(i) + " failed!"); msglog = new StringBuilder("Script Body ").append(fileName.get(i)).append(" failed!");
msg = msg + "Script Body " + fileName.get(i) + " failed!"; log.severe(msglog.toString());
msg.append(msglog.toString());
pstmt = DB pstmt = DB
.prepareStatement( .prepareStatement(
"DELETE FROM ad_migrationscript WHERE ad_migrationscript_id = ?", "DELETE FROM ad_migrationscript WHERE ad_migrationscript_id = ?",

View File

@ -38,9 +38,9 @@ public class UpdateRoleMenu extends SvrProcess
private MRoleMenu addUpdateRole(Properties ctx, int roleId, int menuId, boolean active, String trxName) private MRoleMenu addUpdateRole(Properties ctx, int roleId, int menuId, boolean active, String trxName)
{ {
String whereClause = "AD_Role_ID=" + roleId + " AND U_WebMenu_ID=" + menuId; StringBuilder whereClause = new StringBuilder("AD_Role_ID=").append(roleId).append(" AND U_WebMenu_ID=").append(menuId);
int roleMenuIds[] = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, whereClause, trxName); int roleMenuIds[] = MRoleMenu.getAllIDs(MRoleMenu.Table_Name, whereClause.toString(), trxName);
MRoleMenu roleMenu; MRoleMenu roleMenu;

View File

@ -108,8 +108,8 @@ public class LanguageMaintenance extends SvrProcess
m_language.saveEx(); m_language.saveEx();
} }
} }
StringBuilder msgreturn = new StringBuilder("@Deleted@=").append(deleteNo).append(" - @Inserted@=").append(insertNo);
return "@Deleted@=" + deleteNo + " - @Inserted@=" + insertNo; return msgreturn.toString();
} // doIt } // doIt

View File

@ -61,21 +61,21 @@ public class AD_PrintPaper_Default extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
StringBuffer sql = new StringBuffer(""); StringBuilder sql = new StringBuilder();
int cnt = 0; int cnt = 0;
log.info("Set Print Format"); log.info("Set Print Format");
try try
{ {
sql.append("UPDATE AD_PrintFormat pf " sql.append("UPDATE AD_PrintFormat pf ")
+ "SET AD_PrintPaper_ID = " + p_Record_ID + " " .append("SET AD_PrintPaper_ID = ").append(p_Record_ID).append(" ")
+ "WHERE EXISTS (SELECT * FROM AD_PrintPaper pp " .append("WHERE EXISTS (SELECT * FROM AD_PrintPaper pp ")
+ "WHERE pf.AD_PrintPaper_ID=pp.AD_PrintPaper_ID " .append("WHERE pf.AD_PrintPaper_ID=pp.AD_PrintPaper_ID ")
+ "AND IsLandscape = (SELECT IsLandscape FROM AD_PrintPaper " .append("AND IsLandscape = (SELECT IsLandscape FROM AD_PrintPaper ")
+ "WHERE AD_PrintPaper_ID=" + p_Record_ID + "))"); .append("WHERE AD_PrintPaper_ID=").append(p_Record_ID).append("))");
if (p_AD_Client_ID != -1) { if (p_AD_Client_ID != -1) {
sql.append(" AND AD_Client_ID = " + p_AD_Client_ID); sql.append(" AND AD_Client_ID = ").append(p_AD_Client_ID);
} }
cnt = DB.executeUpdate(sql.toString(), get_TrxName()); cnt = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Updated " + cnt + " columns"); log.info("Updated " + cnt + " columns");

View File

@ -76,7 +76,7 @@ public class AcctSchemaDefaultCopy extends SvrProcess
if (acct == null || acct.get_ID() == 0) if (acct == null || acct.get_ID() == 0)
throw new AdempiereSystemError("Default Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID); throw new AdempiereSystemError("Default Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID);
String sql = null; StringBuilder sql;
int updated = 0; int updated = 0;
int created = 0; int created = 0;
int updatedTotal = 0; int updatedTotal = 0;
@ -85,88 +85,73 @@ public class AcctSchemaDefaultCopy extends SvrProcess
// Update existing Product Category // Update existing Product Category
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE M_Product_Category_Acct pa " sql = new StringBuilder("UPDATE M_Product_Category_Acct pa ")
+ "SET P_Revenue_Acct=" + acct.getP_Revenue_Acct() .append("SET P_Revenue_Acct=").append(acct.getP_Revenue_Acct())
+ ", P_Expense_Acct=" + acct.getP_Expense_Acct() .append(", P_Expense_Acct=").append(acct.getP_Expense_Acct())
+ ", P_CostAdjustment_Acct=" + acct.getP_CostAdjustment_Acct() .append(", P_CostAdjustment_Acct=").append(acct.getP_CostAdjustment_Acct())
+ ", P_InventoryClearing_Acct=" + acct.getP_InventoryClearing_Acct() .append(", P_InventoryClearing_Acct=").append(acct.getP_InventoryClearing_Acct())
+ ", P_Asset_Acct=" + acct.getP_Asset_Acct() .append(", P_Asset_Acct=").append(acct.getP_Asset_Acct())
+ ", P_COGS_Acct=" + acct.getP_COGS_Acct() .append(", P_COGS_Acct=").append(acct.getP_COGS_Acct())
+ ", P_PurchasePriceVariance_Acct=" + acct.getP_PurchasePriceVariance_Acct() .append(", P_PurchasePriceVariance_Acct=").append(acct.getP_PurchasePriceVariance_Acct())
+ ", P_InvoicePriceVariance_Acct=" + acct.getP_InvoicePriceVariance_Acct() .append(", P_InvoicePriceVariance_Acct=").append(acct.getP_InvoicePriceVariance_Acct())
+ ", P_AverageCostVariance_Acct=" + acct.getP_AverageCostVariance_Acct() .append(", P_AverageCostVariance_Acct=").append(acct.getP_AverageCostVariance_Acct())
+ ", P_TradeDiscountRec_Acct=" + acct.getP_TradeDiscountRec_Acct() .append(", P_TradeDiscountRec_Acct=").append(acct.getP_TradeDiscountRec_Acct())
+ ", P_TradeDiscountGrant_Acct=" + acct.getP_TradeDiscountGrant_Acct() .append(", P_TradeDiscountGrant_Acct=").append(acct.getP_TradeDiscountGrant_Acct())
+ ", P_WIP_Acct=" + acct.getP_WIP_Acct() .append(", P_RateVariance_Acct=").append(acct.getP_RateVariance_Acct())
+ ", P_FloorStock_Acct=" + acct.getP_FloorStock_Acct() .append(", Updated=SysDate, UpdatedBy=0 ")
+ ", P_MethodChangeVariance_Acct=" + acct.getP_MethodChangeVariance_Acct() .append("WHERE pa.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ ", P_UsageVariance_Acct=" + acct.getP_UsageVariance_Acct() .append(" AND EXISTS (SELECT * FROM M_Product_Category p ")
+ ", P_RateVariance_Acct=" + acct.getP_RateVariance_Acct() .append("WHERE p.M_Product_Category_ID=pa.M_Product_Category_ID)");
+ ", P_MixVariance_Acct=" + acct.getP_MixVariance_Acct() updated = DB.executeUpdate(sql.toString(), get_TrxName());
+ ", P_Labor_Acct=" + acct.getP_Labor_Acct()
+ ", P_Burden_Acct=" + acct.getP_Burden_Acct()
+ ", P_CostOfProduction_Acct=" + acct.getP_CostOfProduction_Acct()
+ ", P_OutsideProcessing_Acct=" + acct.getP_OutsideProcessing_Acct()
+ ", P_Overhead_Acct=" + acct.getP_Overhead_Acct()
+ ", P_Scrap_Acct=" + acct.getP_Scrap_Acct()
+ ", Updated=SysDate, UpdatedBy=0 "
+ "WHERE pa.C_AcctSchema_ID=" + p_C_AcctSchema_ID
+ " AND EXISTS (SELECT * FROM M_Product_Category p "
+ "WHERE p.M_Product_Category_ID=pa.M_Product_Category_ID)";
updated = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @M_Product_Category_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @M_Product_Category_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Product Category // Insert new Product Category
sql = "INSERT INTO M_Product_Category_Acct " sql = new StringBuilder("INSERT INTO M_Product_Category_Acct ")
+ "(M_Product_Category_ID, C_AcctSchema_ID," .append("(M_Product_Category_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct," .append(" P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,")
+ " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct," .append(" P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,")
+ " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct," .append(" P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct," )
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct," .append(" P_RateVariance_Acct) ")
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct) " .append(" SELECT p.M_Product_Category_ID, acct.C_AcctSchema_ID,")
+ " SELECT p.M_Product_Category_ID, acct.C_AcctSchema_ID," .append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,")
+ " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct," .append(" acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,")
+ " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct," .append(" acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct,")
+ " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct," .append(" acct.P_RateVariance_Acct ")
+ " acct.P_WIP_Acct,acct.P_FloorStock_Acct,acct.P_MethodChangeVariance_Acct,acct.P_UsageVariance_Acct,acct.P_RateVariance_Acct," .append("FROM M_Product_Category p")
+ " acct.P_MixVariance_Acct,acct.P_Labor_Acct,acct.P_Burden_Acct,acct.P_CostOfProduction_Acct,acct.P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct " .append(" INNER JOIN C_AcctSchema_Default acct ON (p.AD_Client_ID=acct.AD_Client_ID) ")
+ "FROM M_Product_Category p" .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " INNER JOIN C_AcctSchema_Default acct ON (p.AD_Client_ID=acct.AD_Client_ID) " .append(" AND NOT EXISTS (SELECT * FROM M_Product_Category_Acct pa ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE pa.M_Product_Category_ID=p.M_Product_Category_ID")
+ " AND NOT EXISTS (SELECT * FROM M_Product_Category_Acct pa " .append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
+ "WHERE pa.M_Product_Category_ID=p.M_Product_Category_ID" created = DB.executeUpdate(sql.toString(), get_TrxName());
+ " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
created = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_Category_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_Category_ID@");
createdTotal += created; createdTotal += created;
if (!p_CopyOverwriteAcct) // Insert new Products if (!p_CopyOverwriteAcct) // Insert new Products
{ {
sql = "INSERT INTO M_Product_Acct " sql = new StringBuilder("INSERT INTO M_Product_Acct ")
+ "(M_Product_ID, C_AcctSchema_ID," .append("(M_Product_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct," .append(" P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,")
+ " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct," .append(" P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,")
+ " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, " .append(" P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, ")
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct," .append(" P_RateVariance_Acct) ")
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct) " .append("SELECT p.M_Product_ID, acct.C_AcctSchema_ID,")
+ "SELECT p.M_Product_ID, acct.C_AcctSchema_ID," .append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,")
+ " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct," .append(" acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,")
+ " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct," .append(" acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct,")
+ " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct," .append(" acct.P_RateVariance_Acct ")
+ " acct.P_WIP_Acct,acct.P_FloorStock_Acct,acct.P_MethodChangeVariance_Acct,acct.P_UsageVariance_Acct,acct.P_RateVariance_Acct," .append("FROM M_Product p")
+ " acct.P_MixVariance_Acct,acct.P_Labor_Acct,acct.P_Burden_Acct,acct.P_CostOfProduction_Acct,acct.P_OutsideProcessing_Acct,acct.P_Overhead_Acct,acct.P_Scrap_Acct " .append(" INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)")
+ "FROM M_Product p" .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)" .append(" AND p.M_Product_Category_ID=acct.M_Product_Category_ID")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append(" AND NOT EXISTS (SELECT * FROM M_Product_Acct pa ")
+ " AND p.M_Product_Category_ID=acct.M_Product_Category_ID" .append("WHERE pa.M_Product_ID=p.M_Product_ID")
+ " AND NOT EXISTS (SELECT * FROM M_Product_Acct pa " .append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
+ "WHERE pa.M_Product_ID=p.M_Product_ID" created = DB.executeUpdate(sql.toString(), get_TrxName());
+ " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
created = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @M_Product_ID@");
createdTotal += created; createdTotal += created;
} }
@ -175,156 +160,151 @@ public class AcctSchemaDefaultCopy extends SvrProcess
// Update Business Partner Group // Update Business Partner Group
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_BP_Group_Acct a " sql = new StringBuilder("UPDATE C_BP_Group_Acct a ")
+ "SET C_Receivable_Acct=" + acct.getC_Receivable_Acct() .append("SET C_Receivable_Acct=").append(acct.getC_Receivable_Acct())
+ ", C_Receivable_Services_Acct=" + acct.getC_Receivable_Services_Acct() .append(", C_Receivable_Services_Acct=").append(acct.getC_Receivable_Services_Acct())
+ ", C_Prepayment_Acct=" + acct.getC_Prepayment_Acct() .append(", C_Prepayment_Acct=").append(acct.getC_Prepayment_Acct())
+ ", V_Liability_Acct=" + acct.getV_Liability_Acct() .append(", V_Liability_Acct=").append(acct.getV_Liability_Acct())
+ ", V_Liability_Services_Acct=" + acct.getV_Liability_Services_Acct() .append(", V_Liability_Services_Acct=").append(acct.getV_Liability_Services_Acct())
+ ", V_Prepayment_Acct=" + acct.getV_Prepayment_Acct() .append(", V_Prepayment_Acct=").append(acct.getV_Prepayment_Acct())
+ ", PayDiscount_Exp_Acct=" + acct.getPayDiscount_Exp_Acct() .append(", PayDiscount_Exp_Acct=").append(acct.getPayDiscount_Exp_Acct())
+ ", PayDiscount_Rev_Acct=" + acct.getPayDiscount_Rev_Acct() .append(", PayDiscount_Rev_Acct=").append(acct.getPayDiscount_Rev_Acct())
+ ", WriteOff_Acct=" + acct.getWriteOff_Acct() .append(", WriteOff_Acct=").append(acct.getWriteOff_Acct())
+ ", NotInvoicedReceipts_Acct=" + acct.getNotInvoicedReceipts_Acct() .append(", NotInvoicedReceipts_Acct=").append(acct.getNotInvoicedReceipts_Acct())
+ ", UnEarnedRevenue_Acct=" + acct.getUnEarnedRevenue_Acct() .append(", UnEarnedRevenue_Acct=").append(acct.getUnEarnedRevenue_Acct())
+ ", NotInvoicedRevenue_Acct=" + acct.getNotInvoicedRevenue_Acct() .append(", Updated=SysDate, UpdatedBy=0 ")
+ ", NotInvoicedReceivables_Acct=" + acct.getNotInvoicedReceivables_Acct() .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ ", Updated=SysDate, UpdatedBy=0 " .append(" AND EXISTS (SELECT * FROM C_BP_Group_Acct x ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE x.C_BP_Group_ID=a.C_BP_Group_ID)");
+ " AND EXISTS (SELECT * FROM C_BP_Group_Acct x " updated = DB.executeUpdate(sql.toString(), get_TrxName());
+ "WHERE x.C_BP_Group_ID=a.C_BP_Group_ID)";
updated = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BP_Group_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BP_Group_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert Business Partner Group // Insert Business Partner Group
sql = "INSERT INTO C_BP_Group_Acct " sql = new StringBuilder("INSERT INTO C_BP_Group_Acct ")
+ "(C_BP_Group_ID, C_AcctSchema_ID," .append("(C_BP_Group_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct," .append(" C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct,")
+ " V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct," .append(" V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct,")
+ " PayDiscount_Exp_Acct, PayDiscount_Rev_Acct, WriteOff_Acct," .append(" PayDiscount_Exp_Acct, PayDiscount_Rev_Acct, WriteOff_Acct,")
+ " NotInvoicedReceipts_Acct, UnEarnedRevenue_Acct," .append(" NotInvoicedReceipts_Acct, UnEarnedRevenue_Acct) ")
+ " NotInvoicedRevenue_Acct, NotInvoicedReceivables_Acct) " .append("SELECT x.C_BP_Group_ID, acct.C_AcctSchema_ID,")
+ "SELECT x.C_BP_Group_ID, acct.C_AcctSchema_ID," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct,")
+ " acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct," .append(" acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct,")
+ " acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct," .append(" acct.PayDiscount_Exp_Acct, acct.PayDiscount_Rev_Acct, acct.WriteOff_Acct,")
+ " acct.PayDiscount_Exp_Acct, acct.PayDiscount_Rev_Acct, acct.WriteOff_Acct," .append(" acct.NotInvoicedReceipts_Acct, acct.UnEarnedRevenue_Acct ")
+ " acct.NotInvoicedReceipts_Acct, acct.UnEarnedRevenue_Acct," .append("FROM C_BP_Group x")
+ " acct.NotInvoicedRevenue_Acct, acct.NotInvoicedReceivables_Acct " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "FROM C_BP_Group x" .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" AND NOT EXISTS (SELECT * FROM C_BP_Group_Acct a ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE a.C_BP_Group_ID=x.C_BP_Group_ID")
+ " AND NOT EXISTS (SELECT * FROM C_BP_Group_Acct a " .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
+ "WHERE a.C_BP_Group_ID=x.C_BP_Group_ID" created = DB.executeUpdate(sql.toString(), get_TrxName());
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
created = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_BP_Group_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_BP_Group_ID@");
createdTotal += created; createdTotal += created;
//IDEMPIERE-362 Hide things that don't work on iDempiere
// Update Business Partner - Employee // Update Business Partner - Employee
/*
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_BP_Employee_Acct a " sql = new StringBuilder("UPDATE C_BP_Employee_Acct a ")
+ "SET E_Expense_Acct=" + acct.getE_Expense_Acct() .append("SET E_Expense_Acct=").append(acct.getE_Expense_Acct())
+ ", E_Prepayment_Acct=" + acct.getE_Prepayment_Acct() .append(", E_Prepayment_Acct=").append(acct.getE_Prepayment_Acct())
+ ", Updated=SysDate, UpdatedBy=0 " .append(", Updated=SysDate, UpdatedBy=0 ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND EXISTS (SELECT * FROM C_BP_Employee_Acct x " .append(" AND EXISTS (SELECT * FROM C_BP_Employee_Acct x ")
+ "WHERE x.C_BPartner_ID=a.C_BPartner_ID)"; .append("WHERE x.C_BPartner_ID=a.C_BPartner_ID)");
updated = DB.executeUpdate(sql, get_TrxName()); updated = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BPartner_ID@ @IsEmployee@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BPartner_ID@ @IsEmployee@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Business Partner - Employee // Insert new Business Partner - Employee
sql = "INSERT INTO C_BP_Employee_Acct " sql = new StringBuilder("INSERT INTO C_BP_Employee_Acct ")
+ "(C_BPartner_ID, C_AcctSchema_ID," .append("(C_BPartner_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " E_Expense_Acct, E_Prepayment_Acct) " .append(" E_Expense_Acct, E_Prepayment_Acct) ")
+ "SELECT x.C_BPartner_ID, acct.C_AcctSchema_ID," .append("SELECT x.C_BPartner_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.E_Expense_Acct, acct.E_Prepayment_Acct " .append(" acct.E_Expense_Acct, acct.E_Prepayment_Acct ")
+ "FROM C_BPartner x" .append("FROM C_BPartner x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM C_BP_Employee_Acct a " .append(" AND NOT EXISTS (SELECT * FROM C_BP_Employee_Acct a ")
+ "WHERE a.C_BPartner_ID=x.C_BPartner_ID" .append("WHERE a.C_BPartner_ID=x.C_BPartner_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsEmployee@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsEmployee@");
createdTotal += created; createdTotal += created;
*/
// //
if (!p_CopyOverwriteAcct) if (!p_CopyOverwriteAcct)
{ {
sql = "INSERT INTO C_BP_Customer_Acct " sql = new StringBuilder("INSERT INTO C_BP_Customer_Acct ")
+ "(C_BPartner_ID, C_AcctSchema_ID," .append("(C_BPartner_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct) " .append(" C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct) ")
+ "SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID," .append("SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID,")
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct " .append(" acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct ")
+ "FROM C_BPartner p" .append("FROM C_BPartner p")
+ " INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)" .append(" INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID // # .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID) // #
+ " AND p.C_BP_Group_ID=acct.C_BP_Group_ID" .append(" AND p.C_BP_Group_ID=acct.C_BP_Group_ID")
+ " AND NOT EXISTS (SELECT * FROM C_BP_Customer_Acct ca " .append(" AND NOT EXISTS (SELECT * FROM C_BP_Customer_Acct ca ")
+ "WHERE ca.C_BPartner_ID=p.C_BPartner_ID" .append("WHERE ca.C_BPartner_ID=p.C_BPartner_ID")
+ " AND ca.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND ca.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsCustomer@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsCustomer@");
createdTotal += created; createdTotal += created;
// //
sql = "INSERT INTO C_BP_Vendor_Acct " sql = new StringBuilder("INSERT INTO C_BP_Vendor_Acct ")
+ "(C_BPartner_ID, C_AcctSchema_ID," .append("(C_BPartner_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct) " .append(" V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct) ")
+ "SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID," .append("SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID,")
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct " .append(" acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct ")
+ "FROM C_BPartner p" .append("FROM C_BPartner p")
+ " INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)" .append(" INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID // # .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID) // #
+ " AND p.C_BP_Group_ID=acct.C_BP_Group_ID" .append(" AND p.C_BP_Group_ID=acct.C_BP_Group_ID")
+ " AND NOT EXISTS (SELECT * FROM C_BP_Vendor_Acct va " .append(" AND NOT EXISTS (SELECT * FROM C_BP_Vendor_Acct va ")
+ "WHERE va.C_BPartner_ID=p.C_BPartner_ID AND va.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append("WHERE va.C_BPartner_ID=p.C_BPartner_ID AND va.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsVendor@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_BPartner_ID@ @IsVendor@");
createdTotal += created; createdTotal += created;
} }
//IDEMPIERE-362 Hide things that don't work on iDempiere
// Update Warehouse // Update Warehouse
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE M_Warehouse_Acct a " sql = new StringBuilder("UPDATE M_Warehouse_Acct a ")
+ "SET W_Inventory_Acct=" + acct.getW_Inventory_Acct() .append("SET W_Differences_Acct=").append(acct.getW_Differences_Acct())
+ ", W_Differences_Acct=" + acct.getW_Differences_Acct() .append(", Updated=SysDate, UpdatedBy=0 ")
+ ", W_Revaluation_Acct=" + acct.getW_Revaluation_Acct() .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ ", W_InvActualAdjust_Acct=" + acct.getW_InvActualAdjust_Acct() .append(" AND EXISTS (SELECT * FROM M_Warehouse_Acct x ")
+ ", Updated=SysDate, UpdatedBy=0 " .append("WHERE x.M_Warehouse_ID=a.M_Warehouse_ID)");
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID updated = DB.executeUpdate(sql.toString(), get_TrxName());
+ " AND EXISTS (SELECT * FROM M_Warehouse_Acct x "
+ "WHERE x.M_Warehouse_ID=a.M_Warehouse_ID)";
updated = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @M_Warehouse_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @M_Warehouse_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Warehouse // Insert new Warehouse
sql = "INSERT INTO M_Warehouse_Acct " sql = new StringBuilder("INSERT INTO M_Warehouse_Acct ")
+ "(M_Warehouse_ID, C_AcctSchema_ID," .append("(M_Warehouse_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " W_Inventory_Acct, W_Differences_Acct, W_Revaluation_Acct, W_InvActualAdjust_Acct) " .append(" W_Differences_Acct) ")
+ "SELECT x.M_Warehouse_ID, acct.C_AcctSchema_ID," .append("SELECT x.M_Warehouse_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.W_Inventory_Acct, acct.W_Differences_Acct, acct.W_Revaluation_Acct, acct.W_InvActualAdjust_Acct " .append(" acct.W_Differences_Acct ")
+ "FROM M_Warehouse x" .append("FROM M_Warehouse x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM M_Warehouse_Acct a " .append(" AND NOT EXISTS (SELECT * FROM M_Warehouse_Acct a ")
+ "WHERE a.M_Warehouse_ID=x.M_Warehouse_ID" .append("WHERE a.M_Warehouse_ID=x.M_Warehouse_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @M_Warehouse_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @M_Warehouse_ID@");
createdTotal += created; createdTotal += created;
@ -332,68 +312,66 @@ public class AcctSchemaDefaultCopy extends SvrProcess
// Update Project // Update Project
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_Project_Acct a " sql = new StringBuilder("UPDATE C_Project_Acct a ")
+ "SET PJ_Asset_Acct=" + acct.getPJ_Asset_Acct() .append("SET PJ_Asset_Acct=").append(acct.getPJ_Asset_Acct())
+ ", PJ_WIP_Acct=" + acct.getPJ_Asset_Acct() .append(", PJ_WIP_Acct=").append(acct.getPJ_Asset_Acct())
+ ", Updated=SysDate, UpdatedBy=0 " .append(", Updated=SysDate, UpdatedBy=0 ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND EXISTS (SELECT * FROM C_Project_Acct x " .append(" AND EXISTS (SELECT * FROM C_Project_Acct x ")
+ "WHERE x.C_Project_ID=a.C_Project_ID)"; .append("WHERE x.C_Project_ID=a.C_Project_ID)");
updated = DB.executeUpdate(sql, get_TrxName()); updated = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Project_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Project_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Projects // Insert new Projects
sql = "INSERT INTO C_Project_Acct " sql = new StringBuilder("INSERT INTO C_Project_Acct ")
+ "(C_Project_ID, C_AcctSchema_ID," .append("(C_Project_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " PJ_Asset_Acct, PJ_WIP_Acct) " .append(" PJ_Asset_Acct, PJ_WIP_Acct) ")
+ "SELECT x.C_Project_ID, acct.C_AcctSchema_ID," .append("SELECT x.C_Project_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.PJ_Asset_Acct, acct.PJ_WIP_Acct " .append(" acct.PJ_Asset_Acct, acct.PJ_WIP_Acct ")
+ "FROM C_Project x" .append("FROM C_Project x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM C_Project_Acct a " .append(" AND NOT EXISTS (SELECT * FROM C_Project_Acct a ")
+ "WHERE a.C_Project_ID=x.C_Project_ID" .append("WHERE a.C_Project_ID=x.C_Project_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_Project_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_Project_ID@");
createdTotal += created; createdTotal += created;
//IDEMPIERE-362 Hide things that don't work on iDempiere
// Update Tax // Update Tax
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_Tax_Acct a " sql = new StringBuilder("UPDATE C_Tax_Acct a ")
+ "SET T_Due_Acct=" + acct.getT_Due_Acct() .append("SET T_Due_Acct=").append(acct.getT_Due_Acct())
+ ", T_Liability_Acct=" + acct.getT_Liability_Acct() .append(", T_Credit_Acct=").append(acct.getT_Credit_Acct())
+ ", T_Credit_Acct=" + acct.getT_Credit_Acct() .append(", T_Expense_Acct=").append(acct.getT_Expense_Acct())
+ ", T_Receivables_Acct=" + acct.getT_Receivables_Acct() .append(", Updated=SysDate, UpdatedBy=0 ")
+ ", T_Expense_Acct=" + acct.getT_Expense_Acct() .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ ", Updated=SysDate, UpdatedBy=0 " .append(" AND EXISTS (SELECT * FROM C_Tax_Acct x ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE x.C_Tax_ID=a.C_Tax_ID)");
+ " AND EXISTS (SELECT * FROM C_Tax_Acct x " updated = DB.executeUpdate(sql.toString(), get_TrxName());
+ "WHERE x.C_Tax_ID=a.C_Tax_ID)";
updated = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Tax_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Tax_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Tax // Insert new Tax
sql = "INSERT INTO C_Tax_Acct " sql = new StringBuilder("INSERT INTO C_Tax_Acct ")
+ "(C_Tax_ID, C_AcctSchema_ID," .append("(C_Tax_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct) " .append(" T_Due_Acct, T_Credit_Acct, T_Expense_Acct) ")
+ "SELECT x.C_Tax_ID, acct.C_AcctSchema_ID," .append("SELECT x.C_Tax_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.T_Due_Acct, acct.T_Liability_Acct, acct.T_Credit_Acct, acct.T_Receivables_Acct, acct.T_Expense_Acct " .append(" acct.T_Due_Acct, acct.T_Credit_Acct, acct.T_Expense_Acct ")
+ "FROM C_Tax x" .append("FROM C_Tax x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM C_Tax_Acct a " .append(" AND NOT EXISTS (SELECT * FROM C_Tax_Acct a ")
+ "WHERE a.C_Tax_ID=x.C_Tax_ID" .append("WHERE a.C_Tax_ID=x.C_Tax_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_Tax_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_Tax_ID@");
createdTotal += created; createdTotal += created;
@ -401,112 +379,103 @@ public class AcctSchemaDefaultCopy extends SvrProcess
// Update BankAccount // Update BankAccount
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_BankAccount_Acct a " sql = new StringBuilder("UPDATE C_BankAccount_Acct a ")
+ "SET B_InTransit_Acct=" + acct.getB_InTransit_Acct() .append("SET B_InTransit_Acct=").append(acct.getB_InTransit_Acct())
+ ", B_Asset_Acct=" + acct.getB_Asset_Acct() .append(", B_Asset_Acct=").append(acct.getB_Asset_Acct())
+ ", B_Expense_Acct=" + acct.getB_Expense_Acct() .append(", B_InterestRev_Acct=").append(acct.getB_InterestRev_Acct())
+ ", B_InterestRev_Acct=" + acct.getB_InterestRev_Acct() .append(", B_InterestExp_Acct=").append(acct.getB_InterestExp_Acct())
+ ", B_InterestExp_Acct=" + acct.getB_InterestExp_Acct() .append(", B_UnallocatedCash_Acct=").append(acct.getB_UnallocatedCash_Acct())
+ ", B_Unidentified_Acct=" + acct.getB_Unidentified_Acct() .append(", B_PaymentSelect_Acct=").append(acct.getB_PaymentSelect_Acct())
+ ", B_UnallocatedCash_Acct=" + acct.getB_UnallocatedCash_Acct() .append(", Updated=SysDate, UpdatedBy=0 ")
+ ", B_PaymentSelect_Acct=" + acct.getB_PaymentSelect_Acct() .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ ", B_SettlementGain_Acct=" + acct.getB_SettlementGain_Acct() .append(" AND EXISTS (SELECT * FROM C_BankAccount_Acct x ")
+ ", B_SettlementLoss_Acct=" + acct.getB_SettlementLoss_Acct() .append("WHERE x.C_BankAccount_ID=a.C_BankAccount_ID)");
+ ", B_RevaluationGain_Acct=" + acct.getB_RevaluationGain_Acct() updated = DB.executeUpdate(sql.toString(), get_TrxName());
+ ", B_RevaluationLoss_Acct=" + acct.getB_RevaluationLoss_Acct()
+ ", Updated=SysDate, UpdatedBy=0 "
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID
+ " AND EXISTS (SELECT * FROM C_BankAccount_Acct x "
+ "WHERE x.C_BankAccount_ID=a.C_BankAccount_ID)";
updated = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BankAccount_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_BankAccount_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new BankAccount // Insert new BankAccount
sql = "INSERT INTO C_BankAccount_Acct " sql = new StringBuilder("INSERT INTO C_BankAccount_Acct ")
+ "(C_BankAccount_ID, C_AcctSchema_ID," .append("(C_BankAccount_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " B_InTransit_Acct, B_Asset_Acct, B_Expense_Acct, B_InterestRev_Acct, B_InterestExp_Acct," .append(" B_InTransit_Acct, B_Asset_Acct, B_InterestRev_Acct, B_InterestExp_Acct,")
+ " B_Unidentified_Acct, B_UnallocatedCash_Acct, B_PaymentSelect_Acct," .append(" B_UnallocatedCash_Acct, B_PaymentSelect_Acct) ")
+ " B_SettlementGain_Acct, B_SettlementLoss_Acct," .append("SELECT x.C_BankAccount_ID, acct.C_AcctSchema_ID,")
+ " B_RevaluationGain_Acct, B_RevaluationLoss_Acct) " .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ "SELECT x.C_BankAccount_ID, acct.C_AcctSchema_ID," .append(" acct.B_InTransit_Acct, acct.B_Asset_Acct, acct.B_InterestRev_Acct, acct.B_InterestExp_Acct,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" acct.B_UnallocatedCash_Acct, acct.B_PaymentSelect_Acct ")
+ " acct.B_InTransit_Acct, acct.B_Asset_Acct, acct.B_Expense_Acct, acct.B_InterestRev_Acct, acct.B_InterestExp_Acct," .append("FROM C_BankAccount x")
+ " acct.B_Unidentified_Acct, acct.B_UnallocatedCash_Acct, acct.B_PaymentSelect_Acct," .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ " acct.B_SettlementGain_Acct, acct.B_SettlementLoss_Acct," .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " acct.B_RevaluationGain_Acct, acct.B_RevaluationLoss_Acct " .append(" AND NOT EXISTS (SELECT * FROM C_BankAccount_Acct a ")
+ "FROM C_BankAccount x" .append("WHERE a.C_BankAccount_ID=x.C_BankAccount_ID")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID created = DB.executeUpdate(sql.toString(), get_TrxName());
+ " AND NOT EXISTS (SELECT * FROM C_BankAccount_Acct a "
+ "WHERE a.C_BankAccount_ID=x.C_BankAccount_ID"
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
created = DB.executeUpdate(sql, get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_BankAccount_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_BankAccount_ID@");
createdTotal += created; createdTotal += created;
//IDEMPIERE-362 Hide things that don't work on iDempiere
// Update Withholding // Update Withholding
/*
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_Withholding_Acct a " sql = new StringBuilder("UPDATE C_Withholding_Acct a ")
+ "SET Withholding_Acct=" + acct.getWithholding_Acct() .append("SET Withholding_Acct=").append(acct.getWithholding_Acct())
+ ", Updated=SysDate, UpdatedBy=0 " .append(", Updated=SysDate, UpdatedBy=0 ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND EXISTS (SELECT * FROM C_Withholding_Acct x " .append(" AND EXISTS (SELECT * FROM C_Withholding_Acct x ")
+ "WHERE x.C_Withholding_ID=a.C_Withholding_ID)"; .append("WHERE x.C_Withholding_ID=a.C_Withholding_ID)");
updated = DB.executeUpdate(sql, get_TrxName()); updated = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Withholding_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Withholding_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Withholding // Insert new Withholding
sql = "INSERT INTO C_Withholding_Acct " sql = new StringBuilder("INSERT INTO C_Withholding_Acct ")
+ "(C_Withholding_ID, C_AcctSchema_ID," .append("(C_Withholding_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " Withholding_Acct) " .append(" Withholding_Acct) ")
+ "SELECT x.C_Withholding_ID, acct.C_AcctSchema_ID," .append("SELECT x.C_Withholding_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.Withholding_Acct " .append(" acct.Withholding_Acct ")
+ "FROM C_Withholding x" .append("FROM C_Withholding x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM C_Withholding_Acct a " .append(" AND NOT EXISTS (SELECT * FROM C_Withholding_Acct a ")
+ "WHERE a.C_Withholding_ID=x.C_Withholding_ID" .append("WHERE a.C_Withholding_ID=x.C_Withholding_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_Withholding_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_Withholding_ID@");
createdTotal += created; createdTotal += created;
*/
// Update Charge // Update Charge
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_Charge_Acct a " sql = new StringBuilder("UPDATE C_Charge_Acct a ")
+ "SET Ch_Expense_Acct=" + acct.getCh_Expense_Acct() .append("SET Ch_Expense_Acct=").append(acct.getCh_Expense_Acct())
+ ", Updated=SysDate, UpdatedBy=0 " .append(", Updated=SysDate, UpdatedBy=0 ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND EXISTS (SELECT * FROM C_Charge_Acct x " .append(" AND EXISTS (SELECT * FROM C_Charge_Acct x ")
+ "WHERE x.C_Charge_ID=a.C_Charge_ID)"; .append("WHERE x.C_Charge_ID=a.C_Charge_ID)");
updated = DB.executeUpdate(sql, get_TrxName()); updated = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Charge_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Charge_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Charge // Insert new Charge
sql = "INSERT INTO C_Charge_Acct " sql = new StringBuilder("INSERT INTO C_Charge_Acct ")
+ "(C_Charge_ID, C_AcctSchema_ID," .append("(C_Charge_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " Ch_Expense_Acct) " .append(" Ch_Expense_Acct) ")
+ "SELECT x.C_Charge_ID, acct.C_AcctSchema_ID," .append("SELECT x.C_Charge_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.Ch_Expense_Acct " .append(" acct.Ch_Expense_Acct ")
+ "FROM C_Charge x" .append("FROM C_Charge x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM C_Charge_Acct a " .append(" AND NOT EXISTS (SELECT * FROM C_Charge_Acct a ")
+ "WHERE a.C_Charge_ID=x.C_Charge_ID" .append("WHERE a.C_Charge_ID=x.C_Charge_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_Charge_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_Charge_ID@");
createdTotal += created; createdTotal += created;
@ -514,41 +483,42 @@ public class AcctSchemaDefaultCopy extends SvrProcess
// Update Cashbook // Update Cashbook
if (p_CopyOverwriteAcct) if (p_CopyOverwriteAcct)
{ {
sql = "UPDATE C_Cashbook_Acct a " sql = new StringBuilder("UPDATE C_Cashbook_Acct a ")
+ "SET CB_Asset_Acct=" + acct.getCB_Asset_Acct() .append("SET CB_Asset_Acct=").append(acct.getCB_Asset_Acct())
+ ", CB_Differences_Acct=" + acct.getCB_Differences_Acct() .append(", CB_Differences_Acct=").append(acct.getCB_Differences_Acct())
+ ", CB_CashTransfer_Acct=" + acct.getCB_CashTransfer_Acct() .append(", CB_CashTransfer_Acct=").append(acct.getCB_CashTransfer_Acct())
+ ", CB_Expense_Acct=" + acct.getCB_Expense_Acct() .append(", CB_Expense_Acct=").append(acct.getCB_Expense_Acct())
+ ", CB_Receipt_Acct=" + acct.getCB_Receipt_Acct() .append(", CB_Receipt_Acct=").append(acct.getCB_Receipt_Acct())
+ ", Updated=SysDate, UpdatedBy=0 " .append(", Updated=SysDate, UpdatedBy=0 ")
+ "WHERE a.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE a.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND EXISTS (SELECT * FROM C_Cashbook_Acct x " .append(" AND EXISTS (SELECT * FROM C_Cashbook_Acct x ")
+ "WHERE x.C_Cashbook_ID=a.C_Cashbook_ID)"; .append("WHERE x.C_Cashbook_ID=a.C_Cashbook_ID)");
updated = DB.executeUpdate(sql, get_TrxName()); updated = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Cashbook_ID@"); addLog(0, null, new BigDecimal(updated), "@Updated@ @C_Cashbook_ID@");
updatedTotal += updated; updatedTotal += updated;
} }
// Insert new Cashbook // Insert new Cashbook
sql = "INSERT INTO C_Cashbook_Acct " sql = new StringBuilder("INSERT INTO C_Cashbook_Acct ")
+ "(C_Cashbook_ID, C_AcctSchema_ID," .append("(C_Cashbook_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " CB_Asset_Acct, CB_Differences_Acct, CB_CashTransfer_Acct," .append(" CB_Asset_Acct, CB_Differences_Acct, CB_CashTransfer_Acct,")
+ " CB_Expense_Acct, CB_Receipt_Acct) " .append(" CB_Expense_Acct, CB_Receipt_Acct) ")
+ "SELECT x.C_Cashbook_ID, acct.C_AcctSchema_ID," .append("SELECT x.C_Cashbook_ID, acct.C_AcctSchema_ID,")
+ " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.CB_Asset_Acct, acct.CB_Differences_Acct, acct.CB_CashTransfer_Acct," .append(" acct.CB_Asset_Acct, acct.CB_Differences_Acct, acct.CB_CashTransfer_Acct,")
+ " acct.CB_Expense_Acct, acct.CB_Receipt_Acct " .append(" acct.CB_Expense_Acct, acct.CB_Receipt_Acct ")
+ "FROM C_Cashbook x" .append("FROM C_Cashbook x")
+ " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " .append(" INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) ")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND NOT EXISTS (SELECT * FROM C_Cashbook_Acct a " .append(" AND NOT EXISTS (SELECT * FROM C_Cashbook_Acct a ")
+ "WHERE a.C_Cashbook_ID=x.C_Cashbook_ID" .append("WHERE a.C_Cashbook_ID=x.C_Cashbook_ID")
+ " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
created = DB.executeUpdate(sql, get_TrxName()); created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@ @C_Cashbook_ID@"); addLog(0, null, new BigDecimal(created), "@Created@ @C_Cashbook_ID@");
createdTotal += created; createdTotal += created;
return "@Created@=" + createdTotal + ", @Updated@=" + updatedTotal; StringBuilder msgreturn = new StringBuilder("@Created@=").append(createdTotal).append(", @Updated@=").append(updatedTotal);
return msgreturn.toString();
} // doIt } // doIt
} // AcctSchemaDefaultCopy } // AcctSchemaDefaultCopy

View File

@ -33,6 +33,7 @@ import org.compiere.model.MPayment;
import org.compiere.util.AdempiereSystemError; import org.compiere.util.AdempiereSystemError;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg;
/** /**
* Automatic Allocation Process * Automatic Allocation Process
@ -170,7 +171,8 @@ public class AllocationAuto extends SvrProcess
} }
} }
// //
return "@Created@ #" + countBP + "/" + countAlloc; StringBuilder msgreturn = new StringBuilder("@Created@ #").append(countBP).append("/").append(countAlloc);
return msgreturn.toString();
} // doIt } // doIt
/** /**
@ -258,19 +260,19 @@ public class AllocationAuto extends SvrProcess
private MPayment[] getPayments (int C_BPartner_ID) private MPayment[] getPayments (int C_BPartner_ID)
{ {
ArrayList<MPayment> list = new ArrayList<MPayment>(); ArrayList<MPayment> list = new ArrayList<MPayment>();
String sql = "SELECT * FROM C_Payment " StringBuilder sql = new StringBuilder("SELECT * FROM C_Payment ")
+ "WHERE IsAllocated='N' AND Processed='Y' AND C_BPartner_ID=?" .append("WHERE IsAllocated='N' AND Processed='Y' AND C_BPartner_ID=?")
+ " AND IsPrepayment='N' AND C_Charge_ID IS NULL "; .append(" AND IsPrepayment='N' AND C_Charge_ID IS NULL ");
if (ONLY_AP.equals(p_APAR)) if (ONLY_AP.equals(p_APAR))
sql += "AND IsReceipt='N' "; sql.append("AND IsReceipt='N' ");
else if (ONLY_AR.equals(p_APAR)) else if (ONLY_AR.equals(p_APAR))
sql += "AND IsReceipt='Y' "; sql.append("AND IsReceipt='Y' ");
sql += "ORDER BY DateTrx"; sql.append("ORDER BY DateTrx");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
pstmt.setInt (1, C_BPartner_ID); pstmt.setInt (1, C_BPartner_ID);
rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())
@ -288,7 +290,7 @@ public class AllocationAuto extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql.toString(), e);
} }
finally finally
{ {
@ -308,18 +310,18 @@ public class AllocationAuto extends SvrProcess
private MInvoice[] getInvoices (int C_BPartner_ID) private MInvoice[] getInvoices (int C_BPartner_ID)
{ {
ArrayList<MInvoice> list = new ArrayList<MInvoice>(); ArrayList<MInvoice> list = new ArrayList<MInvoice>();
String sql = "SELECT * FROM C_Invoice " StringBuilder sql = new StringBuilder("SELECT * FROM C_Invoice ")
+ "WHERE IsPaid='N' AND Processed='Y' AND C_BPartner_ID=? "; .append("WHERE IsPaid='N' AND Processed='Y' AND C_BPartner_ID=? ");
if (ONLY_AP.equals(p_APAR)) if (ONLY_AP.equals(p_APAR))
sql += "AND IsSOTrx='N' "; sql.append("AND IsSOTrx='N' ");
else if (ONLY_AR.equals(p_APAR)) else if (ONLY_AR.equals(p_APAR))
sql += "AND IsSOTrx='Y' "; sql.append("AND IsSOTrx='Y' ");
sql += "ORDER BY DateInvoiced"; sql.append("ORDER BY DateInvoiced");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
pstmt.setInt (1, C_BPartner_ID); pstmt.setInt (1, C_BPartner_ID);
rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())
@ -336,7 +338,7 @@ public class AllocationAuto extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql.toString(), e);
} }
finally finally
{ {
@ -396,7 +398,8 @@ public class AllocationAuto extends SvrProcess
{ {
if (payment.allocateIt()) if (payment.allocateIt())
{ {
addLog(0, payment.getDateAcct(), openAmt, payment.getDocumentNo() + " [1]",payment.get_Table_ID(),payment.getC_Payment_ID()); String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [1]");
addLog(0, payment.getDateAcct(), openAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID());
count++; count++;
} }
break; break;
@ -440,7 +443,8 @@ public class AllocationAuto extends SvrProcess
{ {
if (payment.allocateIt()) if (payment.allocateIt())
{ {
addLog(0, payment.getDateAcct(), availableAmt, payment.getDocumentNo() + " [n]"); String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [n]");
addLog(0, payment.getDateAcct(), availableAmt, message);
count++; count++;
} }
} }
@ -768,8 +772,9 @@ public class AllocationAuto extends SvrProcess
if (allocatedPayments.compareTo(allocatedInvoices) != 0) if (allocatedPayments.compareTo(allocatedInvoices) != 0)
{ {
throw new AdempiereSystemError("Allocated Payments=" + allocatedPayments StringBuilder msg = new StringBuilder("Allocated Payments=").append(allocatedPayments)
+ " <> Invoices=" + allocatedInvoices); .append(" <> Invoices=").append(allocatedInvoices);
throw new AdempiereSystemError(msg.toString());
} }
processAllocation(); processAllocation();
return 1; return 1;
@ -828,12 +833,15 @@ public class AllocationAuto extends SvrProcess
if (m_allocation == null) if (m_allocation == null)
return true; return true;
boolean success = m_allocation.processIt(MAllocationHdr.DOCACTION_Complete); boolean success = m_allocation.processIt(MAllocationHdr.DOCACTION_Complete);
if (!success) if (!success){
throw new IllegalStateException("Allocation Process Failed "+ m_allocation.getDocumentNo() + StringBuilder msg = new StringBuilder("Allocation Process Failed ").append(m_allocation.getDocumentNo())
" " + m_allocation.getProcessMsg()); .append(" ").append( m_allocation.getProcessMsg());
throw new IllegalStateException(msg.toString());
}
else else
m_allocation.saveEx(); m_allocation.saveEx();
addLog(0, m_allocation.getDateAcct(), null, m_allocation.getDescription()); String message = Msg.parseTranslation(getCtx(), "@AllocationProcessed@ " + m_allocation.getDescription());
addLog(0, m_allocation.getDateAcct(), null, message);
m_allocation = null; m_allocation = null;
return success; return success;
} // processAllocation } // processAllocation

View File

@ -115,14 +115,14 @@ public class AllocationReset extends SvrProcess
} }
// Selection // Selection
StringBuffer sql = new StringBuffer("SELECT * FROM C_AllocationHdr ah " StringBuilder sql = new StringBuilder("SELECT * FROM C_AllocationHdr ah ")
+ "WHERE EXISTS (SELECT * FROM C_AllocationLine al " .append("WHERE EXISTS (SELECT * FROM C_AllocationLine al ")
+ "WHERE ah.C_AllocationHdr_ID=al.C_AllocationHdr_ID"); .append("WHERE ah.C_AllocationHdr_ID=al.C_AllocationHdr_ID");
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql.append(" AND al.C_BPartner_ID=?"); sql.append(" AND al.C_BPartner_ID=?");
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp " sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
+ "WHERE bp.C_BPartner_ID=al.C_BPartner_ID AND bp.C_BP_Group_ID=?)"); .append("WHERE bp.C_BPartner_ID=al.C_BPartner_ID AND bp.C_BP_Group_ID=?)");
else else
sql.append(" AND AD_Client_ID=?"); sql.append(" AND AD_Client_ID=?");
if (p_DateAcct_From != null) if (p_DateAcct_From != null)
@ -132,9 +132,9 @@ public class AllocationReset extends SvrProcess
// Do not delete Cash Trx // Do not delete Cash Trx
sql.append(" AND al.C_CashLine_ID IS NULL)"); sql.append(" AND al.C_CashLine_ID IS NULL)");
// Open Period // Open Period
sql.append(" AND EXISTS (SELECT * FROM C_Period p" sql.append(" AND EXISTS (SELECT * FROM C_Period p")
+ " INNER JOIN C_PeriodControl pc ON (p.C_Period_ID=pc.C_Period_ID AND pc.DocBaseType='CMA') " .append(" INNER JOIN C_PeriodControl pc ON (p.C_Period_ID=pc.C_Period_ID AND pc.DocBaseType='CMA') ")
+ "WHERE ah.DateAcct BETWEEN p.StartDate AND p.EndDate)"); .append("WHERE ah.DateAcct BETWEEN p.StartDate AND p.EndDate)");
// //
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;

View File

@ -112,10 +112,10 @@ public class AssetDelivery extends SvrProcess
return msg; return msg;
} }
// //
StringBuffer sql = new StringBuffer ("SELECT A_Asset_ID, GuaranteeDate " StringBuilder sql = new StringBuilder("SELECT A_Asset_ID, GuaranteeDate ")
+ "FROM A_Asset a" .append("FROM A_Asset a")
+ " INNER JOIN M_Product p ON (a.M_Product_ID=p.M_Product_ID) " .append(" INNER JOIN M_Product p ON (a.M_Product_ID=p.M_Product_ID) ")
+ "WHERE "); .append("WHERE ");
if (m_A_Asset_Group_ID != 0) if (m_A_Asset_Group_ID != 0)
sql.append("a.A_Asset_Group_ID=").append(m_A_Asset_Group_ID).append(" AND "); sql.append("a.A_Asset_Group_ID=").append(m_A_Asset_Group_ID).append(" AND ");
if (m_M_Product_ID != 0) if (m_M_Product_ID != 0)

View File

@ -44,17 +44,17 @@ public class BOMFlagValidate extends SvrProcess {
{ {
//Select Products where there's a BOM, and there are no lines //Select Products where there's a BOM, and there are no lines
String sql = "SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'Y' AND " + StringBuilder sql = new StringBuilder("SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'Y' AND ")
"M_Product_ID NOT IN (SELECT M_Product_ID FROM M_Product_BOM ) AND "; .append("M_Product_ID NOT IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ");
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
sql += "AD_Client_ID= ?"; sql.append("AD_Client_ID= ?");
else else
sql += "M_Product_Category_ID= ?"; sql.append("M_Product_Category_ID= ?");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
pstmt.setInt (1, Env.getAD_Client_ID(getCtx())); pstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
else else
@ -63,7 +63,8 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next()) while (rs.next())
{ {
addLog(0, null, null, rs.getString(1) + " BOM without BOM lines", MProduct.Table_ID, rs.getInt(2)); StringBuilder msglog=new StringBuilder(rs.getString(1)).append(" BOM without BOM lines");
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw e; throw e;
@ -74,13 +75,13 @@ public class BOMFlagValidate extends SvrProcess {
PreparedStatement upstmt = null; PreparedStatement upstmt = null;
try { try {
String update = "UPDATE M_Product SET IsBOM = 'N' WHERE IsBOM = 'Y' AND M_Product_ID NOT IN " + StringBuilder update = new StringBuilder("UPDATE M_Product SET IsBOM = 'N' WHERE IsBOM = 'Y' AND M_Product_ID NOT IN ")
"(SELECT M_Product_ID FROM M_Product_BOM ) AND "; .append("(SELECT M_Product_ID FROM M_Product_BOM ) AND ");
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
update += "AD_Client_ID= ?"; update.append("AD_Client_ID= ?");
else else
update += "M_Product_Category_ID= ?"; update.append("M_Product_Category_ID= ?");
upstmt = DB.prepareStatement (update, get_TrxName()); upstmt = DB.prepareStatement (update.toString(), get_TrxName());
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
upstmt.setInt (1, Env.getAD_Client_ID(getCtx())); upstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
else else
@ -99,17 +100,17 @@ public class BOMFlagValidate extends SvrProcess {
{ {
//Select Products where there's a BOM, and there are no lines //Select Products where there's a BOM, and there are no lines
String sql = "SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'N' AND " + StringBuilder sql = new StringBuilder("SELECT Name, M_Product_ID FROM M_Product WHERE IsBOM = 'N' AND ")
"M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM ) AND "; .append("M_Product_ID IN (SELECT M_Product_ID FROM M_Product_BOM ) AND ");
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
sql += "AD_Client_ID= ?"; sql.append("AD_Client_ID= ?");
else else
sql += "M_Product_Category_ID= ?"; sql.append("M_Product_Category_ID= ?");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
pstmt.setInt (1, Env.getAD_Client_ID(getCtx())); pstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
else else
@ -118,7 +119,8 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next()) while (rs.next())
{ {
addLog(0, null, null, rs.getString(1) + " not BOM with BOM lines", MProduct.Table_ID, rs.getInt(2)); StringBuilder msglog = new StringBuilder(rs.getString(1)).append(" not BOM with BOM lines");
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw e; throw e;
@ -127,15 +129,15 @@ public class BOMFlagValidate extends SvrProcess {
rs = null; pstmt = null; rs = null; pstmt = null;
} }
String update = "UPDATE M_Product SET ISBOM = 'Y' WHERE IsBOM = 'N' AND M_Product_ID IN " + StringBuilder update = new StringBuilder("UPDATE M_Product SET ISBOM = 'Y' WHERE IsBOM = 'N' AND M_Product_ID IN ")
"(SELECT M_Product_ID FROM M_Product_BOM ) AND "; .append("(SELECT M_Product_ID FROM M_Product_BOM ) AND ");
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
update += "AD_Client_ID= ?"; update.append("AD_Client_ID= ?");
else else
update += "M_Product_Category_ID= ?"; update.append("M_Product_Category_ID= ?");
PreparedStatement upstmt = null; PreparedStatement upstmt = null;
try { try {
upstmt = DB.prepareStatement (update, get_TrxName()); upstmt = DB.prepareStatement (update.toString(), get_TrxName());
if (p_M_Product_Category_ID == 0) if (p_M_Product_Category_ID == 0)
upstmt.setInt (1, Env.getAD_Client_ID(getCtx())); upstmt.setInt (1, Env.getAD_Client_ID(getCtx()));
else else

View File

@ -101,10 +101,10 @@ public class BankStatementPayment extends SvrProcess
ibs.setTrxAmt(payment.getPayAmt(true)); ibs.setTrxAmt(payment.getPayAmt(true));
ibs.saveEx(); ibs.saveEx();
// //
String retString = "@C_Payment_ID@ = " + payment.getDocumentNo(); StringBuilder retString = new StringBuilder("@C_Payment_ID@ = ").append(payment.getDocumentNo());
if (payment.getOverUnderAmt().signum() != 0) if (payment.getOverUnderAmt().signum() != 0)
retString += " - @OverUnderAmt@=" + payment.getOverUnderAmt(); retString.append(" - @OverUnderAmt@=").append(payment.getOverUnderAmt());
return retString; return retString.toString();
} // createPayment - Import } // createPayment - Import
/** /**
@ -133,10 +133,10 @@ public class BankStatementPayment extends SvrProcess
bsl.setPayment(payment); bsl.setPayment(payment);
bsl.saveEx(); bsl.saveEx();
// //
String retString = "@C_Payment_ID@ = " + payment.getDocumentNo(); StringBuilder retString = new StringBuilder("@C_Payment_ID@ = ").append(payment.getDocumentNo());
if (payment.getOverUnderAmt().signum() != 0) if (payment.getOverUnderAmt().signum() != 0)
retString += " - @OverUnderAmt@=" + payment.getOverUnderAmt(); retString.append(" - @OverUnderAmt@=").append(payment.getOverUnderAmt());
return retString; return retString.toString();
} // createPayment } // createPayment

View File

@ -146,8 +146,8 @@ public class ChangeLogProcess extends SvrProcess
} }
// final call // final call
executeStatement(); executeStatement();
StringBuilder msgreturn = new StringBuilder("@OK@: ").append(m_ok).append(" - @Errors@: ").append(m_errors).append(" - @Failed@: ").append(m_checkFailed);
return "@OK@: " + m_ok + " - @Errors@: " + m_errors + " - @Failed@: " + m_checkFailed; return msgreturn.toString();
} // doIt } // doIt
@ -369,7 +369,7 @@ public class ChangeLogProcess extends SvrProcess
// Changed Tables // Changed Tables
+ " AND EXISTS (SELECT * FROM AD_ChangeLog l " + " AND EXISTS (SELECT * FROM AD_ChangeLog l "
+ "WHERE t.AD_Table_ID=l.AD_Table_ID)"; + "WHERE t.AD_Table_ID=l.AD_Table_ID)";
StringBuffer update = null; StringBuilder update = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
@ -384,14 +384,15 @@ public class ChangeLogProcess extends SvrProcess
String columnName = tableName + "_ID"; String columnName = tableName + "_ID";
if (tableName.equals("AD_Ref_Table")) if (tableName.equals("AD_Ref_Table"))
columnName = "AD_Reference_ID"; columnName = "AD_Reference_ID";
update = new StringBuffer ("UPDATE AD_ChangeLog SET IsCustomization='Y' " update = new StringBuilder ("UPDATE AD_ChangeLog SET IsCustomization='Y' ")
+ "WHERE AD_Table_ID=").append(table.getAD_Table_ID()); .append("WHERE AD_Table_ID=").append(table.getAD_Table_ID());
update.append (" AND Record_ID IN (SELECT ") update.append (" AND Record_ID IN (SELECT ")
.append (columnName) .append (columnName)
.append (" FROM ").append(tableName) .append (" FROM ").append(tableName)
.append (" WHERE EntityType IN ('D','C'))"); .append (" WHERE EntityType IN ('D','C'))");
int no = DB.executeUpdate(update.toString(), get_TrxName()); int no = DB.executeUpdate(update.toString(), get_TrxName());
log.config(table.getTableName() + " = " + no); StringBuilder msglog = new StringBuilder(table.getTableName()).append(" = ").append(no);
log.config(msglog.toString());
updateNo += no; updateNo += no;
} }

View File

@ -129,56 +129,72 @@ public class ColumnEncryption extends SvrProcess {
} }
// Start // Start
addLog(0, null, null, "Encryption Class = " StringBuilder msglog = new StringBuilder("Encryption Class = ")
+ SecureEngine.getClassName()); .append(SecureEngine.getClassName());
addLog(0, null, null, msglog.toString());
boolean error = false; boolean error = false;
// Test Value // Test Value
if (p_TestValue != null && p_TestValue.length() > 0) { if (p_TestValue != null && p_TestValue.length() > 0) {
String encString = SecureEngine.encrypt(p_TestValue); String encString = SecureEngine.encrypt(p_TestValue);
addLog(0, null, null, "Encrypted Test Value=" + encString); msglog = new StringBuilder("Encrypted Test Value=").append(encString);
addLog(0, null, null, msglog.toString());
String clearString = SecureEngine.decrypt(encString); String clearString = SecureEngine.decrypt(encString);
if (p_TestValue.equals(clearString)) if (p_TestValue.equals(clearString)){
addLog(0, null, null, "Decrypted=" + clearString msglog = new StringBuilder("Decrypted=").append(clearString)
+ " (same as test value)"); .append(" (same as test value)");
addLog(0, null, null, msglog.toString());
}
else { else {
addLog(0, null, null, "Decrypted=" + clearString msglog = new StringBuilder("Decrypted=").append(clearString)
+ " (NOT the same as test value - check algorithm)"); .append(" (NOT the same as test value - check algorithm)");
addLog(0, null, null, msglog.toString());
error = true; error = true;
} }
int encLength = encString.length(); int encLength = encString.length();
addLog(0, null, null, "Test Length=" + p_TestValue.length() msglog = new StringBuilder("Test Length=").append(p_TestValue.length())
+ " -> " + encLength); .append(" -> ").append(encLength);
if (encLength <= column.getFieldLength()) addLog(0, null, null, msglog.toString());
addLog(0, null, null, "Encrypted Length (" + encLength if (encLength <= column.getFieldLength()){
+ ") fits into field (" + column.getFieldLength() + ")"); msglog = new StringBuilder("Encrypted Length (").append(encLength)
.append(") fits into field (").append(column.getFieldLength()).append(")");
addLog(0, null, null, msglog.toString());
}
else { else {
addLog(0, null, null, "Encrypted Length (" + encLength msglog = new StringBuilder("Encrypted Length (").append(encLength)
+ ") does NOT fit into field (" .append(") does NOT fit into field (")
+ column.getFieldLength() + ") - resize field"); .append(column.getFieldLength()).append(") - resize field");
addLog(0, null, null, msglog.toString());
error = true; error = true;
} }
} }
// Length Test // Length Test
if (p_MaxLength != 0) { if (p_MaxLength != 0) {
String testClear = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; StringBuilder testClear = new StringBuilder();
testClear.append("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
while (testClear.length() < p_MaxLength) while (testClear.length() < p_MaxLength)
testClear += testClear; testClear.append(testClear);
testClear = testClear.substring(0, p_MaxLength); testClear.delete(p_MaxLength,testClear.length());
log.config("Test=" + testClear + " (" + p_MaxLength + ")"); msglog = new StringBuilder()
.append("Test=").append(testClear.toString()).append(" (").append(p_MaxLength).append(")");
log.config(msglog.toString());
// //
String encString = SecureEngine.encrypt(testClear); String encString = SecureEngine.encrypt(testClear.toString());
int encLength = encString.length(); int encLength = encString.length();
addLog(0, null, null, "Test Max Length=" + testClear.length() msglog = new StringBuilder("Test Max Length=").append(testClear.length())
+ " -> " + encLength); .append(" -> ").append(encLength);
if (encLength <= column.getFieldLength()) addLog(0, null, null, msglog.toString());
addLog(0, null, null, "Encrypted Max Length (" + encLength if (encLength <= column.getFieldLength()){
+ ") fits into field (" + column.getFieldLength() + ")"); msglog = new StringBuilder("Encrypted Max Length (").append(encLength)
.append(") fits into field (").append(column.getFieldLength()).append(")");
addLog(0, null, null, msglog.toString());
}
else { else {
addLog(0, null, null, "Encrypted Max Length (" + encLength msglog = new StringBuilder("Encrypted Max Length (").append(encLength)
+ ") does NOT fit into field (" .append(") does NOT fit into field (")
+ column.getFieldLength() + ") - resize field"); .append(column.getFieldLength()).append(") - resize field");
addLog(0, null, null, msglog.toString());
error = true; error = true;
} }
} }
@ -223,14 +239,18 @@ public class ColumnEncryption extends SvrProcess {
} }
if (p_IsEncrypted != column.isEncrypted()) { if (p_IsEncrypted != column.isEncrypted()) {
if (error || !p_ChangeSetting) if (error || !p_ChangeSetting){
addLog(0, null, null, "Encryption NOT changed - Encryption=" msglog = new StringBuilder("Encryption NOT changed - Encryption=")
+ column.isEncrypted()); .append(column.isEncrypted());
addLog(0, null, null, msglog.toString());
}
else { else {
column.setIsEncrypted(p_IsEncrypted); column.setIsEncrypted(p_IsEncrypted);
if (column.save()) if (column.save()){
addLog(0, null, null, "Encryption CHANGED - Encryption=" msglog = new StringBuilder("Encryption CHANGED - Encryption=")
+ column.isEncrypted()); .append(column.isEncrypted());
addLog(0, null, null, msglog.toString());
}
else else
addLog(0, null, null, "Save Error"); addLog(0, null, null, "Save Error");
} }
@ -270,17 +290,17 @@ public class ColumnEncryption extends SvrProcess {
private int encryptColumnContents(String columnName, String tableName) private int encryptColumnContents(String columnName, String tableName)
throws Exception { throws Exception {
int recordsEncrypted = 0; int recordsEncrypted = 0;
String idColumnName = tableName + "_ID"; StringBuilder idColumnName = new StringBuilder(tableName).append("_ID");
StringBuffer selectSql = new StringBuffer(); StringBuilder selectSql = new StringBuilder();
selectSql.append("SELECT " + idColumnName + "," + columnName); selectSql.append("SELECT ").append(idColumnName).append(",").append(columnName);
selectSql.append(" FROM " + tableName); selectSql.append(" FROM ").append(tableName);
selectSql.append(" ORDER BY " + idColumnName); selectSql.append(" ORDER BY ").append(idColumnName);
StringBuffer updateSql = new StringBuffer(); StringBuilder updateSql = new StringBuilder();
updateSql.append("UPDATE " + tableName); updateSql.append("UPDATE ").append(tableName);
updateSql.append(" SET " + columnName + "=?"); updateSql.append(" SET ").append(columnName).append("=?");
updateSql.append(" WHERE " + idColumnName + "=?"); updateSql.append(" WHERE ").append(idColumnName).append("=?");
PreparedStatement selectStmt = null; PreparedStatement selectStmt = null;
PreparedStatement updateStmt = null; PreparedStatement updateStmt = null;
@ -321,13 +341,12 @@ public class ColumnEncryption extends SvrProcess {
* @return The length of the encrypted column. * @return The length of the encrypted column.
*/ */
private int encryptedColumnLength(int colLength) { private int encryptedColumnLength(int colLength) {
String str = ""; StringBuilder str = new StringBuilder();
for (int i = 0; i < colLength; i++) { for (int i = 0; i < colLength; i++) {
str += "1"; str.append("1");
} }
str = SecureEngine.encrypt(str); str = new StringBuilder(SecureEngine.encrypt(str.toString()));
return str.length(); return str.length();
} // encryptedColumnLength } // encryptedColumnLength
@ -347,23 +366,23 @@ public class ColumnEncryption extends SvrProcess {
int rowsEffected = -1; int rowsEffected = -1;
// Select SQL // Select SQL
StringBuffer selectSql = new StringBuffer(); StringBuilder selectSql = new StringBuilder();
selectSql.append("SELECT FieldLength"); selectSql.append("SELECT FieldLength");
selectSql.append(" FROM AD_Column"); selectSql.append(" FROM AD_Column");
selectSql.append(" WHERE AD_Column_ID=?"); selectSql.append(" WHERE AD_Column_ID=?");
// Alter SQL // Alter SQL
StringBuffer alterSql = new StringBuffer(); StringBuffer alterSql = new StringBuffer();
alterSql.append("ALTER TABLE " + tableName); alterSql.append("ALTER TABLE ").append(tableName);
alterSql.append(" MODIFY " + columnName); alterSql.append(" MODIFY ").append(columnName);
alterSql.append(" NVARCHAR2("); alterSql.append(" NVARCHAR2(");
alterSql.append(length + ") "); alterSql.append(length).append(") ");
// Update SQL // Update SQL
StringBuffer updateSql = new StringBuffer(); StringBuffer updateSql = new StringBuffer();
updateSql.append("UPDATE AD_Column"); updateSql.append("UPDATE AD_Column");
updateSql.append(" SET FieldLength=" + length); updateSql.append(" SET FieldLength=").append(length);
updateSql.append(" WHERE AD_Column_ID=" + columnID); updateSql.append(" WHERE AD_Column_ID=").append(columnID);
PreparedStatement selectStmt = null; PreparedStatement selectStmt = null;

View File

@ -140,12 +140,12 @@ public class ColumnSync extends SvrProcess
if (no == -1) if (no == -1)
{ {
String msg = "@Error@ "; StringBuilder msg = new StringBuilder("@Error@ ");
ValueNamePair pp = CLogger.retrieveError(); ValueNamePair pp = CLogger.retrieveError();
if (pp != null) if (pp != null)
msg = pp.getName() + " - "; msg = new StringBuilder(pp.getName()).append(" - ");
msg += sql; msg.append(sql);
throw new AdempiereUserError (msg); throw new AdempiereUserError (msg.toString());
} }
return sql; return sql;
} finally { } finally {

View File

@ -89,10 +89,10 @@ public class CommissionCalc extends SvrProcess
comRun.setStartDate(p_StartDate); comRun.setStartDate(p_StartDate);
// 01-Jan-2000 - 31-Jan-2001 - USD // 01-Jan-2000 - 31-Jan-2001 - USD
SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.Date); SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.Date);
String description = format.format(p_StartDate) StringBuilder description = new StringBuilder(format.format(p_StartDate))
+ " - " + format.format(m_EndDate) .append(" - ").append(format.format(m_EndDate))
+ " - " + MCurrency.getISO_Code(getCtx(), m_com.getC_Currency_ID()); .append(" - ").append(MCurrency.getISO_Code(getCtx(), m_com.getC_Currency_ID()));
comRun.setDescription(description); comRun.setDescription(description.toString());
if (!comRun.save()) if (!comRun.save())
throw new AdempiereSystemError ("Could not save Commission Run"); throw new AdempiereSystemError ("Could not save Commission Run");
@ -104,94 +104,94 @@ public class CommissionCalc extends SvrProcess
if (!comAmt.save()) if (!comAmt.save())
throw new AdempiereSystemError ("Could not save Commission Amt"); throw new AdempiereSystemError ("Could not save Commission Amt");
// //
StringBuffer sql = new StringBuffer(); StringBuilder sql = new StringBuilder();
if (MCommission.DOCBASISTYPE_Receipt.equals(m_com.getDocBasisType())) if (MCommission.DOCBASISTYPE_Receipt.equals(m_com.getDocBasisType()))
{ {
if (m_com.isListDetails()) if (m_com.isListDetails())
{ {
sql.append("SELECT h.C_Currency_ID, (l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt," sql.append("SELECT h.C_Currency_ID, (l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,")
+ " (l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty," .append(" (l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,")
+ " NULL, l.C_InvoiceLine_ID, p.DocumentNo||'_'||h.DocumentNo," .append(" NULL, l.C_InvoiceLine_ID, p.DocumentNo||'_'||h.DocumentNo,")
+ " COALESCE(prd.Value,l.Description), h.DateInvoiced " .append(" COALESCE(prd.Value,l.Description), h.DateInvoiced ")
+ "FROM C_Payment p" .append("FROM C_Payment p")
+ " INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)" .append(" INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)")
+ " INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)" .append(" INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)")
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) " .append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) ")
+ " LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) " .append(" LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) ")
+ "WHERE p.DocStatus IN ('CL','CO','RE')" .append("WHERE p.DocStatus IN ('CL','CO','RE')")
+ " AND h.IsSOTrx='Y'" .append(" AND h.IsSOTrx='Y'")
+ " AND p.AD_Client_ID = ?" .append(" AND p.AD_Client_ID = ?")
+ " AND p.DateTrx BETWEEN ? AND ?"); .append(" AND p.DateTrx BETWEEN ? AND ?");
} }
else else
{ {
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt," sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt*al.Amount/h.GrandTotal) AS Amt,")
+ " SUM(l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty," .append(" SUM(l.QtyInvoiced*al.Amount/h.GrandTotal) AS Qty,")
+ " NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) " .append(" NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) ")
+ "FROM C_Payment p" .append("FROM C_Payment p")
+ " INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)" .append(" INNER JOIN C_AllocationLine al ON (p.C_Payment_ID=al.C_Payment_ID)")
+ " INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)" .append(" INNER JOIN C_Invoice h ON (al.C_Invoice_ID = h.C_Invoice_ID)")
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) " .append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) ")
+ "WHERE p.DocStatus IN ('CL','CO','RE')" .append("WHERE p.DocStatus IN ('CL','CO','RE')")
+ " AND h.IsSOTrx='Y'" .append(" AND h.IsSOTrx='Y'")
+ " AND p.AD_Client_ID = ?" .append(" AND p.AD_Client_ID = ?")
+ " AND p.DateTrx BETWEEN ? AND ?"); .append(" AND p.DateTrx BETWEEN ? AND ?");
} }
} }
else if (MCommission.DOCBASISTYPE_Order.equals(m_com.getDocBasisType())) else if (MCommission.DOCBASISTYPE_Order.equals(m_com.getDocBasisType()))
{ {
if (m_com.isListDetails()) if (m_com.isListDetails())
{ {
sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyOrdered, " sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyOrdered, ")
+ "l.C_OrderLine_ID, NULL, h.DocumentNo," .append("l.C_OrderLine_ID, NULL, h.DocumentNo,")
+ " COALESCE(prd.Value,l.Description),h.DateOrdered " .append(" COALESCE(prd.Value,l.Description),h.DateOrdered ")
+ "FROM C_Order h" .append("FROM C_Order h")
+ " INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID)" .append(" INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID)")
+ " LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) " .append(" LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) ")
+ "WHERE h.DocStatus IN ('CL','CO')" .append("WHERE h.DocStatus IN ('CL','CO')")
+ " AND h.IsSOTrx='Y'" .append(" AND h.IsSOTrx='Y'")
+ " AND h.AD_Client_ID = ?" .append(" AND h.AD_Client_ID = ?")
+ " AND h.DateOrdered BETWEEN ? AND ?"); .append(" AND h.DateOrdered BETWEEN ? AND ?");
} }
else else
{ {
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt," sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt,")
+ " SUM(l.QtyOrdered) AS Qty, " .append(" SUM(l.QtyOrdered) AS Qty, ")
+ "NULL, NULL, NULL, NULL, MAX(h.DateOrdered) " .append("NULL, NULL, NULL, NULL, MAX(h.DateOrdered) ")
+ "FROM C_Order h" .append("FROM C_Order h")
+ " INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID) " .append(" INNER JOIN C_OrderLine l ON (h.C_Order_ID = l.C_Order_ID) ")
+ "WHERE h.DocStatus IN ('CL','CO')" .append("WHERE h.DocStatus IN ('CL','CO')")
+ " AND h.IsSOTrx='Y'" .append(" AND h.IsSOTrx='Y'")
+ " AND h.AD_Client_ID = ?" .append(" AND h.AD_Client_ID = ?")
+ " AND h.DateOrdered BETWEEN ? AND ?"); .append(" AND h.DateOrdered BETWEEN ? AND ?");
} }
} }
else // Invoice Basis else // Invoice Basis
{ {
if (m_com.isListDetails()) if (m_com.isListDetails())
{ {
sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyInvoiced, " sql.append("SELECT h.C_Currency_ID, l.LineNetAmt, l.QtyInvoiced, ")
+ "NULL, l.C_InvoiceLine_ID, h.DocumentNo," .append("NULL, l.C_InvoiceLine_ID, h.DocumentNo,")
+ " COALESCE(prd.Value,l.Description),h.DateInvoiced " .append(" COALESCE(prd.Value,l.Description),h.DateInvoiced ")
+ "FROM C_Invoice h" .append("FROM C_Invoice h")
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID)" .append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID)")
+ " LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) " .append(" LEFT OUTER JOIN M_Product prd ON (l.M_Product_ID = prd.M_Product_ID) ")
+ "WHERE h.DocStatus IN ('CL','CO','RE')" .append("WHERE h.DocStatus IN ('CL','CO','RE')")
+ " AND h.IsSOTrx='Y'" .append(" AND h.IsSOTrx='Y'")
+ " AND h.AD_Client_ID = ?" .append(" AND h.AD_Client_ID = ?")
+ " AND h.DateInvoiced BETWEEN ? AND ?"); .append(" AND h.DateInvoiced BETWEEN ? AND ?");
} }
else else
{ {
sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt," sql.append("SELECT h.C_Currency_ID, SUM(l.LineNetAmt) AS Amt,")
+ " SUM(l.QtyInvoiced) AS Qty, " .append(" SUM(l.QtyInvoiced) AS Qty, ")
+ "NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) " .append("NULL, NULL, NULL, NULL, MAX(h.DateInvoiced) ")
+ "FROM C_Invoice h" .append("FROM C_Invoice h")
+ " INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) " .append(" INNER JOIN C_InvoiceLine l ON (h.C_Invoice_ID = l.C_Invoice_ID) ")
+ "WHERE h.DocStatus IN ('CL','CO','RE')" .append("WHERE h.DocStatus IN ('CL','CO','RE')")
+ " AND h.IsSOTrx='Y'" .append(" AND h.IsSOTrx='Y'")
+ " AND h.AD_Client_ID = ?" .append(" AND h.AD_Client_ID = ?")
+ " AND h.DateInvoiced BETWEEN ? AND ?"); .append(" AND h.DateInvoiced BETWEEN ? AND ?");
} }
} }
// CommissionOrders/Invoices // CommissionOrders/Invoices
@ -221,19 +221,19 @@ public class CommissionCalc extends SvrProcess
sql.append(" AND h.C_BPartner_ID=").append(lines[i].getC_BPartner_ID()); sql.append(" AND h.C_BPartner_ID=").append(lines[i].getC_BPartner_ID());
// BPartner Group // BPartner Group
if (lines[i].getC_BP_Group_ID() != 0) if (lines[i].getC_BP_Group_ID() != 0)
sql.append(" AND h.C_BPartner_ID IN " sql.append(" AND h.C_BPartner_ID IN ")
+ "(SELECT C_BPartner_ID FROM C_BPartner WHERE C_BP_Group_ID=").append(lines[i].getC_BP_Group_ID()).append(")"); .append("(SELECT C_BPartner_ID FROM C_BPartner WHERE C_BP_Group_ID=").append(lines[i].getC_BP_Group_ID()).append(")");
// Sales Region // Sales Region
if (lines[i].getC_SalesRegion_ID() != 0) if (lines[i].getC_SalesRegion_ID() != 0)
sql.append(" AND h.C_BPartner_Location_ID IN " sql.append(" AND h.C_BPartner_Location_ID IN ")
+ "(SELECT C_BPartner_Location_ID FROM C_BPartner_Location WHERE C_SalesRegion_ID=").append(lines[i].getC_SalesRegion_ID()).append(")"); .append("(SELECT C_BPartner_Location_ID FROM C_BPartner_Location WHERE C_SalesRegion_ID=").append(lines[i].getC_SalesRegion_ID()).append(")");
// Product // Product
if (lines[i].getM_Product_ID() != 0) if (lines[i].getM_Product_ID() != 0)
sql.append(" AND l.M_Product_ID=").append(lines[i].getM_Product_ID()); sql.append(" AND l.M_Product_ID=").append(lines[i].getM_Product_ID());
// Product Category // Product Category
if (lines[i].getM_Product_Category_ID() != 0) if (lines[i].getM_Product_Category_ID() != 0)
sql.append(" AND l.M_Product_ID IN " sql.append(" AND l.M_Product_ID IN ")
+ "(SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID=").append(lines[i].getM_Product_Category_ID()).append(")"); .append("(SELECT M_Product_ID FROM M_Product WHERE M_Product_Category_ID=").append(lines[i].getM_Product_Category_ID()).append(")");
// Payment Rule // Payment Rule
if (lines[i].getPaymentRule() != null) if (lines[i].getPaymentRule() != null)
sql.append(" AND h.PaymentRule='").append(lines[i].getPaymentRule()).append("'"); sql.append(" AND h.PaymentRule='").append(lines[i].getPaymentRule()).append("'");
@ -254,9 +254,9 @@ public class CommissionCalc extends SvrProcess
// Save Last Run // Save Last Run
m_com.setDateLastRun (p_StartDate); m_com.setDateLastRun (p_StartDate);
m_com.saveEx(); m_com.saveEx();
StringBuilder msgreturn = new StringBuilder("@C_CommissionRun_ID@ = ").append(comRun.getDocumentNo())
return "@C_CommissionRun_ID@ = " + comRun.getDocumentNo() .append(" - ").append(comRun.getDescription());
+ " - " + comRun.getDescription(); return msgreturn.toString();
} // doIt } // doIt
/** /**

View File

@ -112,7 +112,8 @@ public class CopyOrder extends SvrProcess
// //
// Env.setSOTrx(getCtx(), newOrder.isSOTrx()); // Env.setSOTrx(getCtx(), newOrder.isSOTrx());
// return "@C_Order_ID@ " + newOrder.getDocumentNo(); // return "@C_Order_ID@ " + newOrder.getDocumentNo();
return dt.getName() + ": " + newOrder.getDocumentNo(); StringBuilder msgreturn = new StringBuilder(dt.getName()).append(": ").append(newOrder.getDocumentNo());
return msgreturn.toString();
} // doIt } // doIt
} // CopyOrder } // CopyOrder

View File

@ -88,8 +88,8 @@ public class CopyRole extends SvrProcess
String table = tables[i]; String table = tables[i];
String keycolumn = keycolumns[i]; String keycolumn = keycolumns[i];
String sql = "DELETE FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_To; StringBuilder sql = new StringBuilder("DELETE FROM ").append(table).append(" WHERE AD_Role_ID = ").append(m_AD_Role_ID_To);
int no = DB.executeUpdateEx(sql, get_TrxName()); int no = DB.executeUpdateEx(sql.toString(), get_TrxName());
addLog(action++, null, BigDecimal.valueOf(no), "Old records deleted from " + table ); addLog(action++, null, BigDecimal.valueOf(no), "Old records deleted from " + table );
final boolean column_IsReadWrite = final boolean column_IsReadWrite =
@ -97,29 +97,29 @@ public class CopyRole extends SvrProcess
&& !table.equals(I_AD_Role_Included.Table_Name); && !table.equals(I_AD_Role_Included.Table_Name);
final boolean column_SeqNo = table.equals(I_AD_Role_Included.Table_Name); final boolean column_SeqNo = table.equals(I_AD_Role_Included.Table_Name);
sql = "INSERT INTO " + table sql = new StringBuilder("INSERT INTO ").append(table)
+ " (AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, " .append(" (AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, ")
+ "AD_Role_ID, " + keycolumn +", isActive"; .append( "AD_Role_ID, ").append(keycolumn).append(", isActive");
if (column_SeqNo) if (column_SeqNo)
sql += ", SeqNo "; sql.append(", SeqNo ");
if (column_IsReadWrite) if (column_IsReadWrite)
sql += ", isReadWrite) "; sql.append(", isReadWrite) ");
else else
sql += ") "; sql.append(") ");
sql += "SELECT " + m_AD_Client_ID sql.append("SELECT ").append(m_AD_Client_ID)
+ ", "+ m_AD_Org_ID .append(", ").append(m_AD_Org_ID)
+ ", getdate(), "+ Env.getAD_User_ID(Env.getCtx()) .append(", getdate(), ").append(Env.getAD_User_ID(Env.getCtx()))
+ ", getdate(), "+ Env.getAD_User_ID(Env.getCtx()) .append(", getdate(), ").append(Env.getAD_User_ID(Env.getCtx()))
+ ", " + m_AD_Role_ID_To .append(", ").append(m_AD_Role_ID_To)
+ ", " + keycolumn .append(", ").append(keycolumn)
+ ", IsActive "; .append(", IsActive ");
if (column_SeqNo) if (column_SeqNo)
sql += ", SeqNo "; sql.append(", SeqNo ");
if (column_IsReadWrite) if (column_IsReadWrite)
sql += ", isReadWrite "; sql.append(", isReadWrite ");
sql += "FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_From; sql.append("FROM ").append(table).append(" WHERE AD_Role_ID = ").append(m_AD_Role_ID_From);
no = DB.executeUpdateEx (sql, get_TrxName()); no = DB.executeUpdateEx (sql.toString(), get_TrxName());
addLog(action++, null, new BigDecimal(no), "New records inserted into " + table ); addLog(action++, null, new BigDecimal(no), "New records inserted into " + table );
} }

View File

@ -151,11 +151,13 @@ public class DistributionCreate extends SvrProcess
// Update Qty // Update Qty
if (m_singleOrder != null) if (m_singleOrder != null)
{ {
m_singleOrder.setDescription("# " + counter + " - " + m_totalQty); StringBuilder msg = new StringBuilder("# ").append(counter).append(" - ").append(m_totalQty);
m_singleOrder.setDescription(msg.toString());
m_singleOrder.saveEx(); m_singleOrder.saveEx();
} }
return "@Created@ #" + counter + " - @Qty@=" + m_totalQty; StringBuilder msgreturn = new StringBuilder("@Created@ #").append(counter).append(" - @Qty@=").append(m_totalQty);
return msgreturn.toString();
} // doIt } // doIt
/** /**

View File

@ -320,10 +320,12 @@ public class DistributionRun extends SvrProcess
for (int j = 0; j < m_runLines.length; j++) for (int j = 0; j < m_runLines.length; j++)
{ {
MDistributionRunLine runLine = m_runLines[j]; MDistributionRunLine runLine = m_runLines[j];
if (runLine.isActualMinGtTotal()) if (runLine.isActualMinGtTotal()){
throw new Exception ("Line " + runLine.getLine() StringBuilder msg = new StringBuilder("Line ").append(runLine.getLine())
+ " Sum of Min Qty=" + runLine.getActualMin() .append(" Sum of Min Qty=").append(runLine.getActualMin())
+ " is greater than Total Qty=" + runLine.getTotalQty()); .append(" is greater than Total Qty=").append(runLine.getTotalQty());
throw new Exception (msg.toString());
}
if (allocationEqTotal && !runLine.isActualAllocationEqTotal()) if (allocationEqTotal && !runLine.isActualAllocationEqTotal())
allocationEqTotal = false; allocationEqTotal = false;
} // for all run lines } // for all run lines
@ -378,8 +380,9 @@ public class DistributionRun extends SvrProcess
} }
} }
} // for all detail lines } // for all detail lines
throw new Exception ("Cannot adjust Difference = " + difference StringBuilder msgexc = new StringBuilder("Cannot adjust Difference = ").append(difference)
+ " - You need to change Total Qty or Min Qty"); .append(" - You need to change Total Qty or Min Qty");
throw new Exception (msgexc.toString());
} }
else // Distibute else // Distibute
{ {
@ -394,9 +397,11 @@ public class DistributionRun extends SvrProcess
ratioTotal = ratioTotal.add(detail.getRatio()); ratioTotal = ratioTotal.add(detail.getRatio());
} }
} }
if (ratioTotal.compareTo(Env.ZERO) == 0) if (ratioTotal.compareTo(Env.ZERO) == 0){
throw new Exception ("Cannot distribute Difference = " + difference StringBuilder msgexc = new StringBuilder("Cannot distribute Difference = ").append(difference)
+ " - You need to change Total Qty or Min Qty"); .append(" - You need to change Total Qty or Min Qty");
throw new Exception (msgexc.toString());
}
// Distribute // Distribute
for (int i = 0; i < m_details.length; i++) for (int i = 0; i < m_details.length; i++)
{ {
@ -542,8 +547,8 @@ public class DistributionRun extends SvrProcess
product = MProduct.get (getCtx(), detail.getM_Product_ID()); product = MProduct.get (getCtx(), detail.getM_Product_ID());
if (p_IsTest) if (p_IsTest)
{ {
addLog(0,null, detail.getActualAllocation(), StringBuilder msglog = new StringBuilder(bp.getName()).append(" - ").append(product.getName());
bp.getName() + " - " + product.getName()); addLog(0,null, detail.getActualAllocation(), msglog.toString());
continue; continue;
} }
@ -566,8 +571,8 @@ public class DistributionRun extends SvrProcess
log.log(Level.SEVERE, "OrderLine not saved"); log.log(Level.SEVERE, "OrderLine not saved");
return false; return false;
} }
addLog(0,null, detail.getActualAllocation(), order.getDocumentNo() StringBuilder msglog = new StringBuilder(order.getDocumentNo()).append(": ").append(bp.getName()).append(" - ").append(product.getName());
+ ": " + bp.getName() + " - " + product.getName()); addLog(0,null, detail.getActualAllocation(), msglog.toString());
} }
// finish order // finish order
order = null; order = null;
@ -584,40 +589,40 @@ public class DistributionRun extends SvrProcess
private int insertDetailsDistributionDemand() private int insertDetailsDistributionDemand()
{ {
// Handle NULL // Handle NULL
String sql = "UPDATE M_DistributionRunLine SET MinQty = 0 WHERE MinQty IS NULL"; StringBuilder sql = new StringBuilder("UPDATE M_DistributionRunLine SET MinQty = 0 WHERE MinQty IS NULL");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
sql = "UPDATE M_DistributionListLine SET MinQty = 0 WHERE MinQty IS NULL"; sql = new StringBuilder("UPDATE M_DistributionListLine SET MinQty = 0 WHERE MinQty IS NULL");
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
// Delete Old // Delete Old
sql = "DELETE FROM T_DistributionRunDetail WHERE M_DistributionRun_ID=" sql = new StringBuilder("DELETE FROM T_DistributionRunDetail WHERE M_DistributionRun_ID=")
+ p_M_DistributionRun_ID; .append(p_M_DistributionRun_ID);
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("insertDetails - deleted #" + no); log.fine("insertDetails - deleted #" + no);
// Insert New // Insert New
sql = "INSERT INTO T_DistributionRunDetail " sql = new StringBuilder("INSERT INTO T_DistributionRunDetail ")
+ "(M_DistributionRun_ID, M_DistributionRunLine_ID, M_DistributionList_ID, M_DistributionListLine_ID," .append("(M_DistributionRun_ID, M_DistributionRunLine_ID, M_DistributionList_ID, M_DistributionListLine_ID,")
+ "AD_Client_ID,AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy," .append("AD_Client_ID,AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,")
+ "C_BPartner_ID, C_BPartner_Location_ID, M_Product_ID," .append("C_BPartner_ID, C_BPartner_Location_ID, M_Product_ID,")
+ "Ratio, MinQty, Qty) " .append("Ratio, MinQty, Qty) " )
+"SELECT MAX(rl.M_DistributionRun_ID), MAX(rl.M_DistributionRunLine_ID),MAX(ll.M_DistributionList_ID), MAX(ll.M_DistributionListLine_ID), " .append("SELECT MAX(rl.M_DistributionRun_ID), MAX(rl.M_DistributionRunLine_ID),MAX(ll.M_DistributionList_ID), MAX(ll.M_DistributionListLine_ID), ")
+"MAX(rl.AD_Client_ID),MAX(rl.AD_Org_ID), MAX(rl.IsActive), MAX(rl.Created),MAX(rl.CreatedBy), MAX(rl.Updated),MAX(rl.UpdatedBy), " .append("MAX(rl.AD_Client_ID),MAX(rl.AD_Org_ID), MAX(rl.IsActive), MAX(rl.Created),MAX(rl.CreatedBy), MAX(rl.Updated),MAX(rl.UpdatedBy), ")
+"MAX(ll.C_BPartner_ID), MAX(ll.C_BPartner_Location_ID), MAX(rl.M_Product_ID)," .append("MAX(ll.C_BPartner_ID), MAX(ll.C_BPartner_Location_ID), MAX(rl.M_Product_ID),")
// Ration for this process is equal QtyToDeliver // Ration for this process is equal QtyToDeliver
+"COALESCE (SUM(ol.QtyOrdered-ol.QtyDelivered-TargetQty), 0) , " .append("COALESCE (SUM(ol.QtyOrdered-ol.QtyDelivered-TargetQty), 0) , ")
// Min Qty for this process is equal to TargetQty // Min Qty for this process is equal to TargetQty
+" 0 , 0 FROM M_DistributionRunLine rl " .append(" 0 , 0 FROM M_DistributionRunLine rl ")
+"INNER JOIN M_DistributionList l ON (rl.M_DistributionList_ID=l.M_DistributionList_ID) " .append("INNER JOIN M_DistributionList l ON (rl.M_DistributionList_ID=l.M_DistributionList_ID) ")
+"INNER JOIN M_DistributionListLine ll ON (rl.M_DistributionList_ID=ll.M_DistributionList_ID) " .append("INNER JOIN M_DistributionListLine ll ON (rl.M_DistributionList_ID=ll.M_DistributionList_ID) ")
+"INNER JOIN DD_Order o ON (o.C_BPartner_ID=ll.C_BPartner_ID AND o.DocStatus IN ('DR','IN')) " .append("INNER JOIN DD_Order o ON (o.C_BPartner_ID=ll.C_BPartner_ID AND o.DocStatus IN ('DR','IN')) ")
+"INNER JOIN DD_OrderLine ol ON (ol.DD_Order_ID=o.DD_Order_ID AND ol.M_Product_ID=rl.M_Product_ID) " .append("INNER JOIN DD_OrderLine ol ON (ol.DD_Order_ID=o.DD_Order_ID AND ol.M_Product_ID=rl.M_Product_ID) ")
+"INNER JOIN M_Locator loc ON (loc.M_Locator_ID=ol.M_Locator_ID AND loc.M_Warehouse_ID="+p_M_Warehouse_ID+") " .append("INNER JOIN M_Locator loc ON (loc.M_Locator_ID=ol.M_Locator_ID AND loc.M_Warehouse_ID=").append(p_M_Warehouse_ID).append(") ")
+"WHERE rl.M_DistributionRun_ID="+p_M_DistributionRun_ID+" AND rl.IsActive='Y' AND ll.IsActive='Y' AND ol.DatePromised <= "+DB.TO_DATE(p_DatePromised) .append("WHERE rl.M_DistributionRun_ID=").append(p_M_DistributionRun_ID).append(" AND rl.IsActive='Y' AND ll.IsActive='Y' AND ol.DatePromised <= ").append(DB.TO_DATE(p_DatePromised))
+" GROUP BY o.M_Shipper_ID , ll.C_BPartner_ID, ol.M_Product_ID"; .append(" GROUP BY o.M_Shipper_ID , ll.C_BPartner_ID, ol.M_Product_ID");
//+ " BETWEEN "+ DB.TO_DATE(p_DatePromised) +" AND "+ DB.TO_DATE(p_DatePromised_To) //+ " BETWEEN "+ DB.TO_DATE(p_DatePromised) +" AND "+ DB.TO_DATE(p_DatePromised_To)
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
List<MDistributionRunDetail> records = new Query(getCtx(), List<MDistributionRunDetail> records = new Query(getCtx(),
MDistributionRunDetail.Table_Name, MDistributionRunDetail.Table_Name,
@ -647,16 +652,20 @@ public class DistributionRun extends SvrProcess
private BigDecimal getQtyDemand(int M_Product_ID) private BigDecimal getQtyDemand(int M_Product_ID)
{ {
StringBuffer sql = new StringBuffer("SELECT SUM (QtyOrdered-QtyDelivered-TargetQty) FROM DD_OrderLine ol INNER JOIN M_Locator l ON (l.M_Locator_ID=ol.M_Locator_ID) INNER JOIN DD_Order o ON (o.DD_Order_ID=ol.DD_Order_ID) "); String sql = "SELECT SUM (QtyOrdered-QtyDelivered-TargetQty) " +
//sql.append(" WHERE o.DocStatus IN ('DR','IN') AND ol.DatePromised BETWEEN ? AND ? AND l.M_Warehouse_ID=? AND ol.M_Product_ID=? GROUP BY M_Product_ID, l.M_Warehouse_ID"); "FROM DD_OrderLine ol " +
sql.append(" WHERE o.DocStatus IN ('DR','IN') AND ol.DatePromised <= ? AND l.M_Warehouse_ID=? AND ol.M_Product_ID=? GROUP BY M_Product_ID, l.M_Warehouse_ID"); "INNER JOIN M_Locator l ON (l.M_Locator_ID=ol.M_Locator_ID) " +
"INNER JOIN DD_Order o ON (o.DD_Order_ID=ol.DD_Order_ID) " +
" WHERE o.DocStatus IN ('DR','IN') " +
"AND ol.DatePromised <= ? " +
"AND l.M_Warehouse_ID=? " +
"AND ol.M_Product_ID=? " +
"GROUP BY M_Product_ID, l.M_Warehouse_ID";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql.toString(), get_TrxName()); pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setTimestamp(1, p_DatePromised); pstmt.setTimestamp(1, p_DatePromised);
//pstmt.setTimestamp(2, p_DatePromised_To); //pstmt.setTimestamp(2, p_DatePromised_To);
pstmt.setInt(2, p_M_Warehouse_ID); pstmt.setInt(2, p_M_Warehouse_ID);
@ -692,37 +701,37 @@ public class DistributionRun extends SvrProcess
private int insertDetailsDistribution() private int insertDetailsDistribution()
{ {
// Handle NULL // Handle NULL
String sql = "UPDATE M_DistributionRunLine SET MinQty = 0 WHERE MinQty IS NULL"; StringBuilder sql = new StringBuilder("UPDATE M_DistributionRunLine SET MinQty = 0 WHERE MinQty IS NULL");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
sql = "UPDATE M_DistributionListLine SET MinQty = 0 WHERE MinQty IS NULL"; sql = new StringBuilder("UPDATE M_DistributionListLine SET MinQty = 0 WHERE MinQty IS NULL");
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
// Delete Old // Delete Old
sql = "DELETE FROM T_DistributionRunDetail WHERE M_DistributionRun_ID=" sql = new StringBuilder("DELETE FROM T_DistributionRunDetail WHERE M_DistributionRun_ID=")
+ p_M_DistributionRun_ID; .append(p_M_DistributionRun_ID);
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("insertDetails - deleted #" + no); log.fine("insertDetails - deleted #" + no);
// Insert New // Insert New
sql = "INSERT INTO T_DistributionRunDetail " sql = new StringBuilder("INSERT INTO T_DistributionRunDetail ")
+ "(M_DistributionRun_ID, M_DistributionRunLine_ID, M_DistributionList_ID, M_DistributionListLine_ID," .append("(M_DistributionRun_ID, M_DistributionRunLine_ID, M_DistributionList_ID, M_DistributionListLine_ID,")
+ "AD_Client_ID,AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy," .append("AD_Client_ID,AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,")
+ "C_BPartner_ID, C_BPartner_Location_ID, M_Product_ID," .append("C_BPartner_ID, C_BPartner_Location_ID, M_Product_ID,")
+ "Ratio, MinQty, Qty) " .append("Ratio, MinQty, Qty) ")
+"SELECT rl.M_DistributionRun_ID, rl.M_DistributionRunLine_ID,ll.M_DistributionList_ID, ll.M_DistributionListLine_ID, " .append("SELECT rl.M_DistributionRun_ID, rl.M_DistributionRunLine_ID,ll.M_DistributionList_ID, ll.M_DistributionListLine_ID, ")
+"rl.AD_Client_ID,rl.AD_Org_ID, rl.IsActive, rl.Created,rl.CreatedBy, rl.Updated,rl.UpdatedBy, " .append("rl.AD_Client_ID,rl.AD_Org_ID, rl.IsActive, rl.Created,rl.CreatedBy, rl.Updated,rl.UpdatedBy, ")
+"ll.C_BPartner_ID, ll.C_BPartner_Location_ID, rl.M_Product_ID, 0 , " .append("ll.C_BPartner_ID, ll.C_BPartner_Location_ID, rl.M_Product_ID, 0 , ")
+"ol.TargetQty AS MinQty , 0 FROM M_DistributionRunLine rl " .append("ol.TargetQty AS MinQty , 0 FROM M_DistributionRunLine rl ")
+"INNER JOIN M_DistributionList l ON (rl.M_DistributionList_ID=l.M_DistributionList_ID) " .append("INNER JOIN M_DistributionList l ON (rl.M_DistributionList_ID=l.M_DistributionList_ID) ")
+"INNER JOIN M_DistributionListLine ll ON (rl.M_DistributionList_ID=ll.M_DistributionList_ID) " .append("INNER JOIN M_DistributionListLine ll ON (rl.M_DistributionList_ID=ll.M_DistributionList_ID) ")
+"INNER JOIN DD_Order o ON (o.C_BPartner_ID=ll.C_BPartner_ID) " .append("INNER JOIN DD_Order o ON (o.C_BPartner_ID=ll.C_BPartner_ID) ")
+"INNER JOIN DD_OrderLine ol ON (ol.DD_Order_ID=o.DD_Order_ID AND ol.M_Product_ID=rl.M_Product_ID) AND ol.DatePromised" .append("INNER JOIN DD_OrderLine ol ON (ol.DD_Order_ID=o.DD_Order_ID AND ol.M_Product_ID=rl.M_Product_ID) AND ol.DatePromised")
//+ " BETWEEN " + DB.TO_DATE(p_DatePromised) +" AND "+ DB.TO_DATE(p_DatePromised_To) //+ " BETWEEN " + DB.TO_DATE(p_DatePromised) +" AND "+ DB.TO_DATE(p_DatePromised_To)
+ "<="+DB.TO_DATE(p_DatePromised) .append( "<=").append(DB.TO_DATE(p_DatePromised))
+" INNER JOIN M_Locator loc ON (loc.M_Locator_ID=ol.M_Locator_ID AND loc.M_Warehouse_ID="+p_M_Warehouse_ID+") " .append(" INNER JOIN M_Locator loc ON (loc.M_Locator_ID=ol.M_Locator_ID AND loc.M_Warehouse_ID=").append(p_M_Warehouse_ID).append(") ")
+" WHERE rl.M_DistributionRun_ID="+p_M_DistributionRun_ID+" AND l.RatioTotal<>0 AND rl.IsActive='Y' AND ll.IsActive='Y'"; .append(" WHERE rl.M_DistributionRun_ID=").append(p_M_DistributionRun_ID).append(" AND l.RatioTotal<>0 AND rl.IsActive='Y' AND ll.IsActive='Y'");
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
Query query = MTable.get(getCtx(), I_T_DistributionRunDetail.Table_ID). Query query = MTable.get(getCtx(), I_T_DistributionRunDetail.Table_ID).
createQuery(MDistributionRunDetail.COLUMNNAME_M_DistributionRun_ID + "=?", get_TrxName()); createQuery(MDistributionRunDetail.COLUMNNAME_M_DistributionRun_ID + "=?", get_TrxName());
@ -772,9 +781,9 @@ public class DistributionRun extends SvrProcess
{ {
MDistributionRunDetail detail = m_details[i]; MDistributionRunDetail detail = m_details[i];
StringBuffer sql = new StringBuffer("SELECT * FROM DD_OrderLine ol INNER JOIN DD_Order o ON (o.DD_Order_ID=ol.DD_Order_ID) INNER JOIN M_Locator l ON (l.M_Locator_ID=ol.M_Locator_ID) "); String sql = "SELECT * FROM DD_OrderLine ol INNER JOIN DD_Order o ON (o.DD_Order_ID=ol.DD_Order_ID) INNER JOIN M_Locator l ON (l.M_Locator_ID=ol.M_Locator_ID) ";
//sql.append(" WHERE o.DocStatus IN ('DR','IN') AND o.C_BPartner_ID = ? AND M_Product_ID=? AND l.M_Warehouse_ID=? AND ol.DatePromised BETWEEN ? AND ? "); //sql.append(" WHERE o.DocStatus IN ('DR','IN') AND o.C_BPartner_ID = ? AND M_Product_ID=? AND l.M_Warehouse_ID=? AND ol.DatePromised BETWEEN ? AND ? ");
sql.append(" WHERE o.DocStatus IN ('DR','IN') AND o.C_BPartner_ID = ? AND M_Product_ID=? AND l.M_Warehouse_ID=? AND ol.DatePromised <=?"); sql = sql + " WHERE o.DocStatus IN ('DR','IN') AND o.C_BPartner_ID = ? AND M_Product_ID=? AND l.M_Warehouse_ID=? AND ol.DatePromised <=?";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -930,12 +939,12 @@ public class DistributionRun extends SvrProcess
if(p_ConsolidateDocument) if(p_ConsolidateDocument)
{ {
String whereClause = "DocStatus IN ('DR','IN') AND AD_Org_ID=" + bp.getAD_OrgBP_ID_Int() + " AND " + StringBuilder whereClause = new StringBuilder("DocStatus IN ('DR','IN') AND AD_Org_ID=").append(bp.getAD_OrgBP_ID_Int()).append(" AND ")
MDDOrder.COLUMNNAME_C_BPartner_ID +"=? AND " + .append(MDDOrder.COLUMNNAME_C_BPartner_ID).append("=? AND ")
MDDOrder.COLUMNNAME_M_Warehouse_ID +"=? AND " + .append(MDDOrder.COLUMNNAME_M_Warehouse_ID).append("=? AND ")
MDDOrder.COLUMNNAME_DatePromised +"<=? "; .append(MDDOrder.COLUMNNAME_DatePromised).append("<=? ");
order = new Query(getCtx(), MDDOrder.Table_Name, whereClause, get_TrxName()) order = new Query(getCtx(), MDDOrder.Table_Name, whereClause.toString(), get_TrxName())
.setParameters(new Object[]{lastC_BPartner_ID, ws[0].getM_Warehouse_ID(), p_DatePromised}) .setParameters(new Object[]{lastC_BPartner_ID, ws[0].getM_Warehouse_ID(), p_DatePromised})
.setOrderBy(MDDOrder.COLUMNNAME_DatePromised +" DESC") .setOrderBy(MDDOrder.COLUMNNAME_DatePromised +" DESC")
.first(); .first();
@ -988,8 +997,8 @@ public class DistributionRun extends SvrProcess
product = MProduct.get (getCtx(), detail.getM_Product_ID()); product = MProduct.get (getCtx(), detail.getM_Product_ID());
if (p_IsTest) if (p_IsTest)
{ {
addLog(0,null, detail.getActualAllocation(), StringBuilder msglog = new StringBuilder(bp.getName()).append(" - ").append(product.getName());
bp.getName() + " - " + product.getName()); addLog(0,null, detail.getActualAllocation(), msglog.toString());
continue; continue;
} }
@ -1017,7 +1026,9 @@ public class DistributionRun extends SvrProcess
String Description =""; String Description ="";
if (m_run.getName() != null) if (m_run.getName() != null)
Description =Description.concat(m_run.getName()); Description =Description.concat(m_run.getName());
line.setDescription(Description + " " +Msg.translate(getCtx(), "Qty")+ " = " +QtyAllocation+" "); StringBuilder msgline = new StringBuilder(Description).append(" ").append(Msg.translate(getCtx(), "Qty"))
.append(" = ").append(QtyAllocation).append(" ");
line.setDescription(msgline.toString());
//line.setConfirmedQty(QtyAllocation); //line.setConfirmedQty(QtyAllocation);
line.saveEx(); line.saveEx();
} }
@ -1032,7 +1043,8 @@ public class DistributionRun extends SvrProcess
Description =""; Description ="";
if (m_run.getName() != null) if (m_run.getName() != null)
Description =Description.concat(m_run.getName()); Description =Description.concat(m_run.getName());
line.setDescription(Description + " " +Msg.translate(getCtx(), "Qty")+ " = " +QtyAllocation+" "); StringBuilder msgline = new StringBuilder(Description).append(" ").append(Msg.translate(getCtx(), "Qty")).append(" = ").append(QtyAllocation).append(" ");
line.setDescription(msgline.toString());
line.setQty(line.getQtyEntered().add(QtyAllocation)); line.setQty(line.getQtyEntered().add(QtyAllocation));
//line.setConfirmedQty(line.getConfirmedQty().add( QtyAllocation)); //line.setConfirmedQty(line.getConfirmedQty().add( QtyAllocation));
line.saveEx(); line.saveEx();
@ -1064,12 +1076,15 @@ public class DistributionRun extends SvrProcess
String Description =""; String Description ="";
if (m_run.getName() != null) if (m_run.getName() != null)
Description =Description.concat(m_run.getName()); Description =Description.concat(m_run.getName());
line.setDescription(Description + " " +Msg.translate(getCtx(), "Qty")+ " = " +detail.getActualAllocation()+" "); StringBuilder msgline = new StringBuilder(Description).append(" ").append(Msg.translate(getCtx(), "Qty")).append(" = ")
.append(detail.getActualAllocation()).append(" ");
line.setDescription(msgline.toString());
line.saveEx(); line.saveEx();
} }
addLog(0,null, detail.getActualAllocation(), order.getDocumentNo() StringBuilder msglog = new StringBuilder(order.getDocumentNo())
+ ": " + bp.getName() + " - " + product.getName()); .append(": ").append(bp.getName()).append(" - ").append(product.getName());
addLog(0,null, detail.getActualAllocation(), msglog.toString());
} }
// finish order // finish order
order = null; order = null;

View File

@ -132,7 +132,8 @@ public class DunningPrint extends SvrProcess
MBPartner bp = new MBPartner (getCtx(), entry.getC_BPartner_ID(), get_TrxName()); MBPartner bp = new MBPartner (getCtx(), entry.getC_BPartner_ID(), get_TrxName());
if (bp.get_ID() == 0) if (bp.get_ID() == 0)
{ {
addLog (entry.get_ID(), null, null, "@NotFound@: @C_BPartner_ID@ " + entry.getC_BPartner_ID()); StringBuilder msglog = new StringBuilder("@NotFound@: @C_BPartner_ID@ ").append(entry.getC_BPartner_ID());
addLog (entry.get_ID(), null, null,msglog.toString() );
errors++; errors++;
continue; continue;
} }
@ -142,13 +143,15 @@ public class DunningPrint extends SvrProcess
{ {
if (to.get_ID() == 0) if (to.get_ID() == 0)
{ {
addLog (entry.get_ID(), null, null, "@NotFound@: @AD_User_ID@ - " + bp.getName()); StringBuilder msglog = new StringBuilder("@NotFound@: @AD_User_ID@ - ").append(bp.getName());
addLog (entry.get_ID(), null, null,msglog.toString());
errors++; errors++;
continue; continue;
} }
else if (to.getEMail() == null || to.getEMail().length() == 0) else if (to.getEMail() == null || to.getEMail().length() == 0)
{ {
addLog (entry.get_ID(), null, null, "@NotFound@: @EMail@ - " + to.getName()); StringBuilder msglog = new StringBuilder("@NotFound@: @EMail@ - ").append(to.getName());
addLog (entry.get_ID(), null, null, msglog.toString());
errors++; errors++;
continue; continue;
} }
@ -164,7 +167,8 @@ public class DunningPrint extends SvrProcess
MDunningRunEntry.Table_ID, MDunningRunEntry.Table_ID,
entry.getC_DunningRunEntry_ID(), entry.getC_DunningRunEntry_ID(),
entry.getC_BPartner_ID()); entry.getC_BPartner_ID());
info.setDescription(bp.getName() + ", Amt=" + entry.getAmt()); StringBuilder msginfo = new StringBuilder(bp.getName()).append(", Amt=").append(entry.getAmt());
info.setDescription(msginfo.toString());
ReportEngine re = null; ReportEngine re = null;
if (format != null) if (format != null)
re = new ReportEngine(getCtx(), format, query, info); re = new ReportEngine(getCtx(), format, query, info);
@ -174,8 +178,9 @@ public class DunningPrint extends SvrProcess
EMail email = client.createEMail(to.getEMail(), null, null); EMail email = client.createEMail(to.getEMail(), null, null);
if (!email.isValid()) if (!email.isValid())
{ {
addLog (entry.get_ID(), null, null, StringBuilder msglog = new StringBuilder(
"@RequestActionEMailError@ Invalid EMail: " + to); "@RequestActionEMailError@ Invalid EMail: ").append(to);
addLog (entry.get_ID(), null, null,msglog.toString() );
errors++; errors++;
continue; continue;
} }
@ -193,7 +198,8 @@ public class DunningPrint extends SvrProcess
// //
if (re != null) { if (re != null) {
File attachment = re.getPDF(File.createTempFile("Dunning", ".pdf")); File attachment = re.getPDF(File.createTempFile("Dunning", ".pdf"));
log.fine(to + " - " + attachment); StringBuilder msglog = new StringBuilder(to.toString()).append(" - ").append(attachment);
log.fine(msglog.toString());
email.addAttachment(attachment); email.addAttachment(attachment);
} }
// //
@ -202,15 +208,16 @@ public class DunningPrint extends SvrProcess
um.saveEx(); um.saveEx();
if (msg.equals(EMail.SENT_OK)) if (msg.equals(EMail.SENT_OK))
{ {
addLog (entry.get_ID(), null, null, StringBuilder msglog = new StringBuilder(
bp.getName() + " @RequestActionEMailOK@"); bp.getName()).append(" @RequestActionEMailOK@");
addLog (entry.get_ID(), null, null,msglog.toString());
count++; count++;
printed = true; printed = true;
} }
else else
{ {
addLog (entry.get_ID(), null, null, StringBuilder msglog = new StringBuilder(bp.getName()).append(" @RequestActionEMailError@ ").append(msg);
bp.getName() + " @RequestActionEMailError@ " + msg); addLog (entry.get_ID(), null, null,msglog.toString() );
errors++; errors++;
} }
} }
@ -233,8 +240,10 @@ public class DunningPrint extends SvrProcess
run.setProcessed(true); run.setProcessed(true);
run.saveEx(); run.saveEx();
} }
if (p_EMailPDF) if (p_EMailPDF){
return "@Sent@=" + count + " - @Errors@=" + errors; StringBuilder msgreturn = new StringBuilder("@Sent@=").append(count).append(" - @Errors@=").append(errors);
return msgreturn.toString();
}
return "@Printed@=" + count; return "@Printed@=" + count;
} // doIt } // doIt

View File

@ -135,39 +135,41 @@ public class DunningRunCreate extends SvrProcess
private int addInvoices(MDunningLevel level) private int addInvoices(MDunningLevel level)
{ {
int count = 0; int count = 0;
String sql = "SELECT i.C_Invoice_ID, i.C_Currency_ID,"
+ " i.GrandTotal*i.MultiplierAP," StringBuilder sql = new StringBuilder("SELECT i.C_Invoice_ID, i.C_Currency_ID,");
+ " invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)*MultiplierAP," sql.append(" i.GrandTotal*i.MultiplierAP,");
+ " COALESCE(daysBetween(?,ips.DueDate),paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,?))," // ##1/2 sql.append(" invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)*MultiplierAP,");
+ " i.IsInDispute, i.C_BPartner_ID, i.C_InvoicePaySchedule_ID " sql.append(" COALESCE(daysBetween(?,ips.DueDate),paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,?)),");// ##1/2
+ "FROM C_Invoice_v i " sql.append(" i.IsInDispute, i.C_BPartner_ID, i.C_InvoicePaySchedule_ID ");
+ " LEFT OUTER JOIN C_InvoicePaySchedule ips ON (i.C_InvoicePaySchedule_ID=ips.C_InvoicePaySchedule_ID) " sql.append("FROM C_Invoice_v i ");
+ "WHERE i.IsPaid='N' AND i.AD_Client_ID=?" // ##3 sql.append(" LEFT OUTER JOIN C_InvoicePaySchedule ips ON (i.C_InvoicePaySchedule_ID=ips.C_InvoicePaySchedule_ID) ");
+ " AND i.DocStatus IN ('CO','CL')" sql.append("WHERE i.IsPaid='N' AND i.AD_Client_ID=?"); // ##3
+ " AND (i.DunningGrace IS NULL OR i.DunningGrace<?) " sql.append(" AND i.DocStatus IN ('CO','CL')");
sql.append(" AND (i.DunningGrace IS NULL OR i.DunningGrace<?) ");
// Only BP(Group) with Dunning defined // Only BP(Group) with Dunning defined
+ " AND EXISTS (SELECT * FROM C_DunningLevel dl " sql.append(" AND EXISTS (SELECT * FROM C_DunningLevel dl ");
+ "WHERE dl.C_DunningLevel_ID=?" // // ##4 sql.append("WHERE dl.C_DunningLevel_ID=?"); //##4
+ " AND dl.C_Dunning_ID IN " sql.append(" AND dl.C_Dunning_ID IN ");
+ "(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) " sql.append("(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) ");
+ "FROM C_BPartner bp" sql.append("FROM C_BPartner bp");
+ " INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) " sql.append(" INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) ");
+ "WHERE i.C_BPartner_ID=bp.C_BPartner_ID" + sql.append("WHERE i.C_BPartner_ID=bp.C_BPartner_ID");
" AND (bp.DunningGrace IS NULL OR bp.DunningGrace<?)))"; sql.append(" AND (bp.DunningGrace IS NULL OR bp.DunningGrace<?)))");
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND i.C_BPartner_ID=?"; // ##5 sql.append(" AND i.C_BPartner_ID=?"); // ##5
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp " sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
+ "WHERE i.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##5 .append("WHERE i.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)");// ##5
if (p_OnlySOTrx) if (p_OnlySOTrx)
sql += " AND i.IsSOTrx='Y'"; sql.append(" AND i.IsSOTrx='Y'");
if (!p_IsAllCurrencies) if (!p_IsAllCurrencies)
sql += " AND i.C_Currency_ID=" + p_C_Currency_ID; sql.append(" AND i.C_Currency_ID=").append(p_C_Currency_ID);
if ( p_AD_Org_ID != 0 ) if ( p_AD_Org_ID != 0 )
sql += " AND i.AD_Org_ID=" + p_AD_Org_ID; sql.append(" AND i.AD_Org_ID=").append(p_AD_Org_ID);
// log.info(sql); // log.info(sql);
String sql2=null; String sql2= "";
// if sequentially we must check for other levels with smaller days for // if sequentially we must check for other levels with smaller days for
// which this invoice is not yet included! // which this invoice is not yet included!
@ -175,14 +177,16 @@ public class DunningRunCreate extends SvrProcess
// Build a list of all topmost Dunning Levels // Build a list of all topmost Dunning Levels
MDunningLevel[] previousLevels = level.getPreviousLevels(); MDunningLevel[] previousLevels = level.getPreviousLevels();
if (previousLevels!=null && previousLevels.length>0) { if (previousLevels!=null && previousLevels.length>0) {
String sqlAppend = ""; StringBuilder sqlAppend = new StringBuilder();
for (MDunningLevel element : previousLevels) { for (MDunningLevel element : previousLevels) {
sqlAppend += " AND i.C_Invoice_ID IN (SELECT C_Invoice_ID FROM C_DunningRunLine WHERE " + sqlAppend.append(" AND i.C_Invoice_ID IN (SELECT C_Invoice_ID FROM C_DunningRunLine WHERE ");
"C_DunningRunEntry_ID IN (SELECT C_DunningRunEntry_ID FROM C_DunningRunEntry WHERE " + sqlAppend.append("C_DunningRunEntry_ID IN (SELECT C_DunningRunEntry_ID FROM C_DunningRunEntry WHERE ");
"C_DunningRun_ID IN (SELECT C_DunningRun_ID FROM C_DunningRunEntry WHERE " + sqlAppend.append("C_DunningRun_ID IN (SELECT C_DunningRun_ID FROM C_DunningRunEntry WHERE ");
"C_DunningLevel_ID=" + element.get_ID () + ")) AND Processed<>'N')"; sqlAppend.append("C_DunningLevel_ID=");
sqlAppend.append(element.get_ID ());
sqlAppend.append(")) AND Processed<>'N')");
} }
sql += sqlAppend; sql.append(sqlAppend.toString());
} }
} }
// ensure that we do only dunn what's not yet dunned, so we lookup the max of last Dunn Date which was processed // ensure that we do only dunn what's not yet dunned, so we lookup the max of last Dunn Date which was processed
@ -200,7 +204,7 @@ public class DunningRunCreate extends SvrProcess
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
pstmt.setTimestamp(1, m_run.getDunningDate()); pstmt.setTimestamp(1, m_run.getDunningDate());
pstmt.setTimestamp(2, m_run.getDunningDate()); pstmt.setTimestamp(2, m_run.getDunningDate());
pstmt.setInt (3, m_run.getAD_Client_ID()); pstmt.setInt (3, m_run.getAD_Client_ID());
@ -212,7 +216,7 @@ public class DunningRunCreate extends SvrProcess
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
pstmt.setInt (7, p_C_BP_Group_ID); pstmt.setInt (7, p_C_BP_Group_ID);
// //
pstmt2 = DB.prepareStatement (sql2, get_TrxName()); pstmt2 = DB.prepareStatement (sql2.toString(), get_TrxName());
// //
rs = pstmt.executeQuery (); rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())
@ -225,9 +229,15 @@ public class DunningRunCreate extends SvrProcess
boolean IsInDispute = "Y".equals(rs.getString(6)); boolean IsInDispute = "Y".equals(rs.getString(6));
int C_BPartner_ID = rs.getInt(7); int C_BPartner_ID = rs.getInt(7);
int C_InvoicePaySchedule_ID = rs.getInt(8); int C_InvoicePaySchedule_ID = rs.getInt(8);
log.fine("DaysAfterDue: " + DaysAfterDue.intValue() + " isShowAllDue: " + level.isShowAllDue());
log.fine("C_Invoice_ID - DaysDue - GrandTotal: " + C_Invoice_ID + " - " + DaysDue + " - " + GrandTotal); StringBuilder msglog = new StringBuilder()
log.fine("C_InvoicePaySchedule_ID: " + C_InvoicePaySchedule_ID); .append("DaysAfterDue: ").append(DaysAfterDue.intValue()).append(" isShowAllDue: ").append(level.isShowAllDue());
log.fine(msglog.toString());
msglog = new StringBuilder()
.append("C_Invoice_ID - DaysDue - GrandTotal: ").append(C_Invoice_ID).append(" - ").append(DaysDue).append(" - ").append(GrandTotal);
log.fine(msglog.toString());
msglog = new StringBuilder("C_InvoicePaySchedule_ID: ").append(C_InvoicePaySchedule_ID);
log.fine(msglog.toString());
// //
// Check for Dispute // Check for Dispute
if (!p_IncludeInDispute && IsInDispute) if (!p_IncludeInDispute && IsInDispute)
@ -317,10 +327,12 @@ public class DunningRunCreate extends SvrProcess
} }
catch (BPartnerNoAddressException e) catch (BPartnerNoAddressException e)
{ {
String msg = "@Skip@ @C_Invoice_ID@ " + MInvoice.get(getCtx(), C_Invoice_ID).getDocumentInfo() StringBuilder msg = new StringBuilder("@Skip@ @C_Invoice_ID@ ");
+ ", @C_BPartner_ID@ " + MBPartner.get(getCtx(), C_BPartner_ID).getName() msg.append(MInvoice.get(getCtx(), C_Invoice_ID).getDocumentInfo().toString());
+ " @No@ @IsActive@ @C_BPartner_Location_ID@"; msg.append(", @C_BPartner_ID@ ");
getProcessInfo().addLog(getProcessInfo().getAD_PInstance_ID(), null, null, msg); msg.append(MBPartner.get(getCtx(), C_BPartner_ID).getName().toString());
msg.append(" @No@ @IsActive@ @C_BPartner_Location_ID@");
getProcessInfo().addLog(getProcessInfo().getAD_PInstance_ID(), null, null, msg.toString());
return false; return false;
} }
@ -349,42 +361,44 @@ public class DunningRunCreate extends SvrProcess
*/ */
private int addPayments(MDunningLevel level) private int addPayments(MDunningLevel level)
{ {
String sql = "SELECT C_Payment_ID, C_Currency_ID, PayAmt," StringBuilder sql = new StringBuilder("SELECT C_Payment_ID, C_Currency_ID, PayAmt,");
+ " paymentAvailable(C_Payment_ID), C_BPartner_ID " sql.append(" paymentAvailable(C_Payment_ID), C_BPartner_ID ");
+ "FROM C_Payment_v p " sql.append("FROM C_Payment_v p ");
+ "WHERE AD_Client_ID=?" // ##1 sql.append("WHERE AD_Client_ID=?"); // ##1
+ " AND IsAllocated='N' AND C_BPartner_ID IS NOT NULL" sql.append(" AND IsAllocated='N' AND C_BPartner_ID IS NOT NULL");
+ " AND C_Charge_ID IS NULL" sql.append(" AND C_Charge_ID IS NULL");
+ " AND DocStatus IN ('CO','CL')" sql.append(" AND DocStatus IN ('CO','CL')");
//Only BP(Group) with Dunning defined //Only BP(Group) with Dunning defined
+ " AND EXISTS (SELECT * FROM C_DunningLevel dl " sql.append(" AND EXISTS (SELECT * FROM C_DunningLevel dl ");
+ "WHERE dl.C_DunningLevel_ID=?" // // ##2 sql.append("WHERE dl.C_DunningLevel_ID=?");
+ " AND dl.C_Dunning_ID IN " sql.append(" AND dl.C_Dunning_ID IN ");
+ "(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) " sql.append("(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) ");
+ "FROM C_BPartner bp" sql.append("FROM C_BPartner bp");
+ " INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) " sql.append(" INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) ");
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID))"; sql.append("WHERE p.C_BPartner_ID=bp.C_BPartner_ID))");
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND C_BPartner_ID=?"; // ##3 sql.append(" AND C_BPartner_ID=?"); // ##3
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp " sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##3 .append("WHERE p.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"); // ##3
// If it is not a statement we will add lines only if InvoiceLines exists, // If it is not a statement we will add lines only if InvoiceLines exists,
// because we do not want to dunn for money we owe the customer! // because we do not want to dunn for money we owe the customer!
if (!level.isStatement()) if (!level.isStatement())
sql += " AND C_BPartner_ID IN (SELECT C_BPartner_ID FROM C_DunningRunEntry WHERE C_DunningRun_ID=" + m_run.get_ID () + ")"; sql.append(" AND C_BPartner_ID IN (SELECT C_BPartner_ID FROM C_DunningRunEntry WHERE C_DunningRun_ID=")
.append(m_run.get_ID ()).append(")");
// show only receipts / if only Sales // show only receipts / if only Sales
if (p_OnlySOTrx) if (p_OnlySOTrx)
sql += " AND IsReceipt='Y'"; sql.append(" AND IsReceipt='Y'");
if ( p_AD_Org_ID != 0 ) if ( p_AD_Org_ID != 0 )
sql += " AND p.AD_Org_ID=" + p_AD_Org_ID; sql.append(" AND p.AD_Org_ID=").append(p_AD_Org_ID);
int count = 0; int count = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
pstmt.setInt (1, getAD_Client_ID()); pstmt.setInt (1, getAD_Client_ID());
pstmt.setInt (2, level.getC_DunningLevel_ID()); pstmt.setInt (2, level.getC_DunningLevel_ID());
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
@ -413,7 +427,7 @@ public class DunningRunCreate extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql.toString(), e);
getProcessInfo().addLog(getProcessInfo().getAD_PInstance_ID(), null, null, e.getLocalizedMessage()); getProcessInfo().addLog(getProcessInfo().getAD_PInstance_ID(), null, null, e.getLocalizedMessage());
} }
finally finally
@ -441,10 +455,13 @@ public class DunningRunCreate extends SvrProcess
entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID, c_DunningLevel_ID); entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID, c_DunningLevel_ID);
} catch (BPartnerNoAddressException e) { } catch (BPartnerNoAddressException e) {
MPayment payment = new MPayment(getCtx(), C_Payment_ID, null); MPayment payment = new MPayment(getCtx(), C_Payment_ID, null);
String msg = "@Skip@ @C_Payment_ID@ " + payment.getDocumentInfo()
+ ", @C_BPartner_ID@ " + MBPartner.get(getCtx(), C_BPartner_ID).getName() StringBuilder msg = new StringBuilder("@Skip@ @C_Payment_ID@ ");
+ " @No@ @IsActive@ @C_BPartner_Location_ID@"; msg.append(payment.getDocumentInfo().toString());
getProcessInfo().addLog(getProcessInfo().getAD_PInstance_ID(), null, null, msg); msg.append(", @C_BPartner_ID@ ");
msg.append(MBPartner.get(getCtx(), C_BPartner_ID).getName().toString());
msg.append(" @No@ @IsActive@ @C_BPartner_Location_ID@");
getProcessInfo().addLog(getProcessInfo().getAD_PInstance_ID(), null, null, msg.toString());
return false; return false;
} }
if (entry.get_ID() == 0) if (entry.get_ID() == 0)

View File

@ -55,7 +55,8 @@ public class EMailTest extends SvrProcess
// Test Client Mail // Test Client Mail
String clientTest = client.testEMail(); String clientTest = client.testEMail();
addLog(0, null, null, client.getName() + ": " + clientTest); StringBuilder msglog = new StringBuilder(client.getName()).append(": ").append(clientTest);
addLog(0, null, null, msglog.toString());
// Test Client DocumentDir // Test Client DocumentDir
if (!Ini.isClient()) if (!Ini.isClient())
@ -75,7 +76,8 @@ public class EMailTest extends SvrProcess
{ {
MStore store = wstores[i]; MStore store = wstores[i];
String test = store.testEMail(); String test = store.testEMail();
addLog(0, null, null, store.getName() + ": " + test); msglog = new StringBuilder(store.getName()).append(": ").append(test);
addLog(0, null, null, msglog.toString());
} }
return clientTest; return clientTest;

View File

@ -76,21 +76,21 @@ public class ExpenseAPInvoice extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = new StringBuffer ("SELECT * " StringBuilder sql = new StringBuilder ("SELECT * ")
+ "FROM S_TimeExpense e " .append("FROM S_TimeExpense e ")
+ "WHERE e.Processed='Y'" .append("WHERE e.Processed='Y'")
+ " AND e.AD_Client_ID=?"); // #1 .append(" AND e.AD_Client_ID=?"); // #1
if (m_C_BPartner_ID != 0) if (m_C_BPartner_ID != 0)
sql.append(" AND e.C_BPartner_ID=?"); // #2 sql.append(" AND e.C_BPartner_ID=?"); // #2
if (m_DateFrom != null) if (m_DateFrom != null)
sql.append(" AND e.DateReport >= ?"); // #3 sql.append(" AND e.DateReport >= ?"); // #3
if (m_DateTo != null) if (m_DateTo != null)
sql.append(" AND e.DateReport <= ?"); // #4 sql.append(" AND e.DateReport <= ?"); // #4
sql.append(" AND EXISTS (SELECT * FROM S_TimeExpenseLine el " sql.append(" AND EXISTS (SELECT * FROM S_TimeExpenseLine el ")
+ "WHERE e.S_TimeExpense_ID=el.S_TimeExpense_ID" .append("WHERE e.S_TimeExpense_ID=el.S_TimeExpense_ID")
+ " AND el.C_InvoiceLine_ID IS NULL" .append(" AND el.C_InvoiceLine_ID IS NULL")
+ " AND el.ConvertedAmt<>0) " .append(" AND el.ConvertedAmt<>0) ")
+ "ORDER BY e.C_BPartner_ID, e.S_TimeExpense_ID"); .append("ORDER BY e.C_BPartner_ID, e.S_TimeExpense_ID");
// //
int old_BPartner_ID = -1; int old_BPartner_ID = -1;
MInvoice invoice = null; MInvoice invoice = null;
@ -128,18 +128,19 @@ public class ExpenseAPInvoice extends SvrProcess
invoice.setBPartner(bp); invoice.setBPartner(bp);
if (invoice.getC_BPartner_Location_ID() == 0) if (invoice.getC_BPartner_Location_ID() == 0)
{ {
log.log(Level.SEVERE, "No BP Location: " + bp); StringBuilder msglog = new StringBuilder("No BP Location: ").append(bp);
addLog(0, te.getDateReport(), log.log(Level.SEVERE, msglog.toString());
null, "No Location: " + te.getDocumentNo() + " " + bp.getName()); msglog = new StringBuilder("No Location: ").append(te.getDocumentNo()).append(" ").append(bp.getName());
addLog(0, te.getDateReport(), null, msglog.toString() );
invoice = null; invoice = null;
break; break;
} }
invoice.setM_PriceList_ID(te.getM_PriceList_ID()); invoice.setM_PriceList_ID(te.getM_PriceList_ID());
invoice.setSalesRep_ID(te.getDoc_User_ID()); invoice.setSalesRep_ID(te.getDoc_User_ID());
String descr = Msg.translate(getCtx(), "S_TimeExpense_ID") StringBuilder descr = new StringBuilder(Msg.translate(getCtx(), "S_TimeExpense_ID"))
+ ": " + te.getDocumentNo() + " " .append(": ").append(te.getDocumentNo()).append(" " )
+ DisplayType.getDateFormat(DisplayType.Date).format(te.getDateReport()); .append(DisplayType.getDateFormat(DisplayType.Date).format(te.getDateReport()));
invoice.setDescription(descr); invoice.setDescription(descr.toString());
if (!invoice.save()) if (!invoice.save())
new IllegalStateException("Cannot save Invoice"); new IllegalStateException("Cannot save Invoice");
old_BPartner_ID = bp.getC_BPartner_ID(); old_BPartner_ID = bp.getC_BPartner_ID();
@ -200,7 +201,8 @@ public class ExpenseAPInvoice extends SvrProcess
rs = null; pstmt = null; rs = null; pstmt = null;
} }
completeInvoice (invoice); completeInvoice (invoice);
return "@Created@=" + m_noInvoices; StringBuilder msgreturn = new StringBuilder("@Created@=").append(m_noInvoices);
return msgreturn.toString();
} // doIt } // doIt
/** /**
@ -213,8 +215,9 @@ public class ExpenseAPInvoice extends SvrProcess
return; return;
invoice.setDocAction(DocAction.ACTION_Prepare); invoice.setDocAction(DocAction.ACTION_Prepare);
if (!invoice.processIt(DocAction.ACTION_Prepare)) { if (!invoice.processIt(DocAction.ACTION_Prepare)) {
log.warning("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); StringBuilder msglog = new StringBuilder("Invoice Process Failed: ").append(invoice).append(" - ").append(invoice.getProcessMsg());
throw new IllegalStateException("Invoice Process Failed: " + invoice + " - " + invoice.getProcessMsg()); log.warning(msglog.toString());
throw new IllegalStateException(msglog.toString());
} }
if (!invoice.save()) if (!invoice.save())

View File

@ -84,18 +84,18 @@ public class ExpenseSOrder extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = new StringBuffer("SELECT * FROM S_TimeExpenseLine el " StringBuilder sql = new StringBuilder("SELECT * FROM S_TimeExpenseLine el ")
+ "WHERE el.AD_Client_ID=?" // #1 .append("WHERE el.AD_Client_ID=?") // #1
+ " AND el.C_BPartner_ID>0 AND el.IsInvoiced='Y'" // Business Partner && to be invoiced .append(" AND el.C_BPartner_ID>0 AND el.IsInvoiced='Y'") // Business Partner && to be invoiced
+ " AND el.C_OrderLine_ID IS NULL" // not invoiced yet .append(" AND el.C_OrderLine_ID IS NULL") // not invoiced yet
+ " AND EXISTS (SELECT * FROM S_TimeExpense e " // processed only .append(" AND EXISTS (SELECT * FROM S_TimeExpense e ") // processed only
+ "WHERE el.S_TimeExpense_ID=e.S_TimeExpense_ID AND e.Processed='Y')"); .append("WHERE el.S_TimeExpense_ID=e.S_TimeExpense_ID AND e.Processed='Y')");
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql.append(" AND el.C_BPartner_ID=?"); // #2 sql.append(" AND el.C_BPartner_ID=?"); // #2
if (p_DateFrom != null || m_DateTo != null) if (p_DateFrom != null || m_DateTo != null)
{ {
sql.append(" AND EXISTS (SELECT * FROM S_TimeExpense e " sql.append(" AND EXISTS (SELECT * FROM S_TimeExpense e ")
+ "WHERE el.S_TimeExpense_ID=e.S_TimeExpense_ID"); .append("WHERE el.S_TimeExpense_ID=e.S_TimeExpense_ID");
if (p_DateFrom != null) if (p_DateFrom != null)
sql.append(" AND e.DateReport >= ?"); // #3 sql.append(" AND e.DateReport >= ?"); // #3
if (m_DateTo != null) if (m_DateTo != null)
@ -158,8 +158,8 @@ public class ExpenseSOrder extends SvrProcess
rs = null; pstmt = null; rs = null; pstmt = null;
} }
completeOrder (); completeOrder ();
StringBuilder msgreturn = new StringBuilder("@Created@=").append(m_noOrders);
return "@Created@=" + m_noOrders; return msgreturn.toString();
} // doIt } // doIt
/** /**
@ -180,9 +180,11 @@ public class ExpenseSOrder extends SvrProcess
m_order.setBPartner(bp); m_order.setBPartner(bp);
if (m_order.getC_BPartner_Location_ID() == 0) if (m_order.getC_BPartner_Location_ID() == 0)
{ {
log.log(Level.SEVERE, "No BP Location: " + bp); StringBuilder msglog = new StringBuilder("No BP Location: ").append(bp);
log.log(Level.SEVERE, msglog.toString());
msglog = new StringBuilder("No Location: ").append(te.getDocumentNo()).append(" ").append(bp.getName());
addLog(0, te.getDateReport(), addLog(0, te.getDateReport(),
null, "No Location: " + te.getDocumentNo() + " " + bp.getName()); null, msglog.toString());
m_order = null; m_order = null;
return; return;
} }
@ -271,8 +273,10 @@ public class ExpenseSOrder extends SvrProcess
return; return;
m_order.setDocAction(DocAction.ACTION_Prepare); m_order.setDocAction(DocAction.ACTION_Prepare);
if (!m_order.processIt(DocAction.ACTION_Prepare)) { if (!m_order.processIt(DocAction.ACTION_Prepare)) {
log.warning("Order Process Failed: " + m_order + " - " + m_order.getProcessMsg()); StringBuilder msglog = new StringBuilder("Order Process Failed: ").append(m_order).append(" - ").append(m_order.getProcessMsg());
throw new IllegalStateException("Order Process Failed: " + m_order + " - " + m_order.getProcessMsg()); log.warning(msglog.toString());
msglog = new StringBuilder("Order Process Failed: ").append(m_order).append(" - ").append(m_order.getProcessMsg());
throw new IllegalStateException(msglog.toString());
} }
if (!m_order.save()) if (!m_order.save())
throw new IllegalStateException("Cannot save Order"); throw new IllegalStateException("Cannot save Order");

View File

@ -55,11 +55,11 @@ public class FactAcctSummary extends SvrProcess {
@Override @Override
protected String doIt() throws Exception { protected String doIt() throws Exception {
String where = ""; StringBuilder where = new StringBuilder();
if ( p_Cube_ID > 0) if ( p_Cube_ID > 0)
where = "PA_ReportCube_ID = " + p_Cube_ID; where = new StringBuilder("PA_ReportCube_ID = ").append(p_Cube_ID);
List<MReportCube> cubes = new Query(getCtx(), MReportCube.Table_Name, where, get_TrxName()) List<MReportCube> cubes = new Query(getCtx(), MReportCube.Table_Name, where.toString(), get_TrxName())
.setOnlyActiveRecords(true).setClient_ID() .setOnlyActiveRecords(true).setClient_ID()
.list(); .list();

View File

@ -88,35 +88,35 @@ public class ImportAccount extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_ElementValue " sql = new StringBuilder ("DELETE I_ElementValue ")
+ "WHERE I_IsImported='Y'").append(clientCheck); .append("WHERE I_IsImported='Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append(")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID, 0)," .append(" AD_Org_ID = COALESCE (AD_Org_ID, 0),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " Processed = 'N', " .append(" Processed = 'N', ")
+ " Processing = 'Y', " .append(" Processing = 'Y', ")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Reset=" + no); log.fine("Reset=" + no);
@ -125,53 +125,53 @@ public class ImportAccount extends SvrProcess
// Set Element // Set Element
if (m_C_Element_ID != 0) if (m_C_Element_ID != 0)
{ {
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET ElementName=(SELECT Name FROM C_Element WHERE C_Element_ID=").append(m_C_Element_ID).append(") " .append("SET ElementName=(SELECT Name FROM C_Element WHERE C_Element_ID=").append(m_C_Element_ID).append(") ")
+ "WHERE ElementName IS NULL AND C_Element_ID IS NULL" .append("WHERE ElementName IS NULL AND C_Element_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Element Default=" + no); log.fine("Set Element Default=" + no);
} }
// //
sql = new StringBuffer ("UPDATE I_ElementValue i " sql = new StringBuilder ("UPDATE I_ElementValue i ")
+ "SET C_Element_ID = (SELECT C_Element_ID FROM C_Element e" .append("SET C_Element_ID = (SELECT C_Element_ID FROM C_Element e")
+ " WHERE i.ElementName=e.Name AND i.AD_Client_ID=e.AD_Client_ID)" .append(" WHERE i.ElementName=e.Name AND i.AD_Client_ID=e.AD_Client_ID)")
+ "WHERE C_Element_ID IS NULL" .append("WHERE C_Element_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Element=" + no); log.fine("Set Element=" + no);
// //
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Element, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Element, ' ")
+ "WHERE C_Element_ID IS NULL" .append("WHERE C_Element_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid Element=" + no); log.config("Invalid Element=" + no);
// No Name, Value // No Name, Value
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Name, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Name, ' ")
+ "WHERE (Value IS NULL OR Name IS NULL)" .append("WHERE (Value IS NULL OR Name IS NULL)")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid Name=" + no); log.config("Invalid Name=" + no);
// Set Column // Set Column
sql = new StringBuffer ("UPDATE I_ElementValue i " sql = new StringBuilder ("UPDATE I_ElementValue i ")
+ "SET AD_Column_ID = (SELECT AD_Column_ID FROM AD_Column c" .append("SET AD_Column_ID = (SELECT AD_Column_ID FROM AD_Column c")
+ " WHERE UPPER(i.Default_Account)=UPPER(c.ColumnName)" .append(" WHERE UPPER(i.Default_Account)=UPPER(c.ColumnName)")
+ " AND c.AD_Table_ID IN (315,266) AND AD_Reference_ID=25) " .append(" AND c.AD_Table_ID IN (315,266) AND AD_Reference_ID=25) ")
+ "WHERE Default_Account IS NOT NULL AND AD_Column_ID IS NULL" .append("WHERE Default_Account IS NOT NULL AND AD_Column_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Column=" + no); log.fine("Set Column=" + no);
// //
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Column, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Column, ' ")
+ "WHERE AD_Column_ID IS NULL AND Default_Account IS NOT NULL" .append("WHERE AD_Column_ID IS NULL AND Default_Account IS NOT NULL")
+ " AND UPPER(Default_Account)<>'DEFAULT_ACCT'" // ignore default account .append(" AND UPPER(Default_Account)<>'DEFAULT_ACCT'") // ignore default account
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid Column=" + no); log.config("Invalid Column=" + no);
@ -179,76 +179,77 @@ public class ImportAccount extends SvrProcess
String[] yColumns = new String[] {"PostActual", "PostBudget", "PostStatistical", "PostEncumbrance"}; String[] yColumns = new String[] {"PostActual", "PostBudget", "PostStatistical", "PostEncumbrance"};
for (int i = 0; i < yColumns.length; i++) for (int i = 0; i < yColumns.length; i++)
{ {
sql = new StringBuffer ("UPDATE I_ElementValue SET ") sql = new StringBuilder ("UPDATE I_ElementValue SET ")
.append(yColumns[i]).append("='Y' WHERE ") .append(yColumns[i]).append("='Y' WHERE ")
.append(yColumns[i]).append(" IS NULL OR ") .append(yColumns[i]).append(" IS NULL OR ")
.append(yColumns[i]).append(" NOT IN ('Y','N')" .append(yColumns[i]).append(" NOT IN ('Y','N')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set " + yColumns[i] + " Default=" + no); StringBuilder msglog = new StringBuilder("Set ").append(yColumns[i]).append(" Default=").append(no);
log.fine(msglog.toString());
} }
// Summary // Summary
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET IsSummary='N' " .append("SET IsSummary='N' ")
+ "WHERE IsSummary IS NULL OR IsSummary NOT IN ('Y','N')" .append("WHERE IsSummary IS NULL OR IsSummary NOT IN ('Y','N')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsSummary Default=" + no); log.fine("Set IsSummary Default=" + no);
// Doc Controlled // Doc Controlled
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET IsDocControlled = CASE WHEN AD_Column_ID IS NOT NULL THEN 'Y' ELSE 'N' END " .append("SET IsDocControlled = CASE WHEN AD_Column_ID IS NOT NULL THEN 'Y' ELSE 'N' END ")
+ "WHERE IsDocControlled IS NULL OR IsDocControlled NOT IN ('Y','N')" .append("WHERE IsDocControlled IS NULL OR IsDocControlled NOT IN ('Y','N')")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsDocumentControlled Default=" + no); log.fine("Set IsDocumentControlled Default=" + no);
// Check Account Type A (E) L M O R // Check Account Type A (E) L M O R
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET AccountType='E' " .append("SET AccountType='E' ")
+ "WHERE AccountType IS NULL" .append("WHERE AccountType IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set AccountType Default=" + no); log.fine("Set AccountType Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid AccountType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid AccountType, ' ")
+ "WHERE AccountType NOT IN ('A','E','L','M','O','R')" .append("WHERE AccountType NOT IN ('A','E','L','M','O','R')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid AccountType=" + no); log.config("Invalid AccountType=" + no);
// Check Account Sign (N) C B // Check Account Sign (N) C B
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET AccountSign='N' " .append("SET AccountSign='N' ")
+ "WHERE AccountSign IS NULL" .append("WHERE AccountSign IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set AccountSign Default=" + no); log.fine("Set AccountSign Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid AccountSign, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid AccountSign, ' ")
+ "WHERE AccountSign NOT IN ('N','C','D')" .append("WHERE AccountSign NOT IN ('N','C','D')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid AccountSign=" + no); log.config("Invalid AccountSign=" + no);
// No Value // No Value
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Key, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Key, ' ")
+ "WHERE (Value IS NULL OR Value='')" .append("WHERE (Value IS NULL OR Value='')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid Key=" + no); log.config("Invalid Key=" + no);
// **** Update ElementValue from existing // **** Update ElementValue from existing
sql = new StringBuffer ("UPDATE I_ElementValue i " sql = new StringBuilder ("UPDATE I_ElementValue i ")
+ "SET C_ElementValue_ID=(SELECT C_ElementValue_ID FROM C_ElementValue ev" .append("SET C_ElementValue_ID=(SELECT C_ElementValue_ID FROM C_ElementValue ev")
+ " INNER JOIN C_Element e ON (ev.C_Element_ID=e.C_Element_ID)" .append(" INNER JOIN C_Element e ON (ev.C_Element_ID=e.C_Element_ID)")
+ " WHERE i.C_Element_ID=e.C_Element_ID AND i.AD_Client_ID=e.AD_Client_ID" .append(" WHERE i.C_Element_ID=e.C_Element_ID AND i.AD_Client_ID=e.AD_Client_ID")
+ " AND i.Value=ev.Value) " .append(" AND i.Value=ev.Value) ")
+ "WHERE C_ElementValue_ID IS NULL" .append("WHERE C_ElementValue_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Found ElementValue=" + no); log.fine("Found ElementValue=" + no);
@ -259,9 +260,9 @@ public class ImportAccount extends SvrProcess
int noUpdate = 0; int noUpdate = 0;
// Go through Records // Go through Records
sql = new StringBuffer ("SELECT * " sql = new StringBuilder ("SELECT * ")
+ "FROM I_ElementValue " .append("FROM I_ElementValue ")
+ "WHERE I_IsImported='N'").append(clientCheck) .append("WHERE I_IsImported='N'").append(clientCheck)
.append(" ORDER BY I_ElementValue_ID"); .append(" ORDER BY I_ElementValue_ID");
try try
{ {
@ -286,8 +287,8 @@ public class ImportAccount extends SvrProcess
} }
else else
{ {
sql = new StringBuffer ("UPDATE I_ElementValue i " sql = new StringBuilder ("UPDATE I_ElementValue i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert ElementValue ")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert ElementValue "))
.append("WHERE I_ElementValue_ID=").append(I_ElementValue_ID); .append("WHERE I_ElementValue_ID=").append(I_ElementValue_ID);
DB.executeUpdate(sql.toString(), get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
} }
@ -308,8 +309,8 @@ public class ImportAccount extends SvrProcess
} }
else else
{ {
sql = new StringBuffer ("UPDATE I_ElementValue i " sql = new StringBuilder ("UPDATE I_ElementValue i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update ElementValue")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update ElementValue"))
.append("WHERE I_ElementValue_ID=").append(I_ElementValue_ID); .append("WHERE I_ElementValue_ID=").append(I_ElementValue_ID);
DB.executeUpdate(sql.toString(), get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
} }
@ -324,9 +325,9 @@ public class ImportAccount extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
addLog (0, null, new BigDecimal (noInsert), "@C_ElementValue_ID@: @Inserted@"); addLog (0, null, new BigDecimal (noInsert), "@C_ElementValue_ID@: @Inserted@");
@ -335,29 +336,29 @@ public class ImportAccount extends SvrProcess
commitEx(); commitEx();
// ***** Set Parent // ***** Set Parent
sql = new StringBuffer ("UPDATE I_ElementValue i " sql = new StringBuilder ("UPDATE I_ElementValue i ")
+ "SET ParentElementValue_ID=(SELECT C_ElementValue_ID" .append("SET ParentElementValue_ID=(SELECT C_ElementValue_ID")
+ " FROM C_ElementValue ev WHERE i.C_Element_ID=ev.C_Element_ID" .append(" FROM C_ElementValue ev WHERE i.C_Element_ID=ev.C_Element_ID")
+ " AND i.ParentValue=ev.Value AND i.AD_Client_ID=ev.AD_Client_ID) " .append(" AND i.ParentValue=ev.Value AND i.AD_Client_ID=ev.AD_Client_ID) ")
+ "WHERE ParentElementValue_ID IS NULL" .append("WHERE ParentElementValue_ID IS NULL")
+ " AND I_IsImported='Y'").append(clientCheck); .append(" AND I_IsImported='Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Found Parent ElementValue=" + no); log.fine("Found Parent ElementValue=" + no);
// //
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET I_ErrorMsg=I_ErrorMsg||'Info=ParentNotFound, ' " .append("SET I_ErrorMsg=I_ErrorMsg||'Info=ParentNotFound, ' ")
+ "WHERE ParentElementValue_ID IS NULL AND ParentValue IS NOT NULL" .append("WHERE ParentElementValue_ID IS NULL AND ParentValue IS NOT NULL")
+ " AND I_IsImported='Y' AND Processed='N'").append(clientCheck); .append(" AND I_IsImported='Y' AND Processed='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Not Found Parent ElementValue=" + no); log.config("Not Found Parent ElementValue=" + no);
// //
sql = new StringBuffer ("SELECT i.ParentElementValue_ID, i.I_ElementValue_ID," sql = new StringBuilder ("SELECT i.ParentElementValue_ID, i.I_ElementValue_ID,")
+ " e.AD_Tree_ID, i.C_ElementValue_ID, i.Value||'-'||i.Name AS Info " .append(" e.AD_Tree_ID, i.C_ElementValue_ID, i.Value||'-'||i.Name AS Info ")
+ "FROM I_ElementValue i" .append("FROM I_ElementValue i")
+ " INNER JOIN C_Element e ON (i.C_Element_ID=e.C_Element_ID) " .append(" INNER JOIN C_Element e ON (i.C_Element_ID=e.C_Element_ID) ")
+ "WHERE i.C_ElementValue_ID IS NOT NULL AND e.AD_Tree_ID IS NOT NULL" .append("WHERE i.C_ElementValue_ID IS NOT NULL AND e.AD_Tree_ID IS NOT NULL")
+ " AND i.ParentElementValue_ID IS NOT NULL" .append(" AND i.ParentElementValue_ID IS NOT NULL")
+ " AND i.I_IsImported='Y' AND Processed='N' AND i.AD_Client_ID=").append(m_AD_Client_ID); .append(" AND i.I_IsImported='Y' AND Processed='N' AND i.AD_Client_ID=").append(m_AD_Client_ID);
int noParentUpdate = 0; int noParentUpdate = 0;
try try
{ {
@ -402,10 +403,10 @@ public class ImportAccount extends SvrProcess
commitEx(); commitEx();
// Reset Processing Flag // Reset Processing Flag
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET Processing='-'" .append("SET Processing='-'")
+ "WHERE I_IsImported='Y' AND Processed='N' AND Processing='Y'" .append("WHERE I_IsImported='Y' AND Processed='N' AND Processing='Y'")
+ " AND C_ElementValue_ID IS NOT NULL") .append(" AND C_ElementValue_ID IS NOT NULL")
.append(clientCheck); .append(clientCheck);
if (m_updateDefaultAccounts) if (m_updateDefaultAccounts)
sql.append(" AND AD_Column_ID IS NULL"); sql.append(" AND AD_Column_ID IS NULL");
@ -413,17 +414,17 @@ public class ImportAccount extends SvrProcess
log.fine("Reset Processing Flag=" + no); log.fine("Reset Processing Flag=" + no);
if (m_updateDefaultAccounts) if (m_updateDefaultAccounts)
updateDefaults(clientCheck); updateDefaults(clientCheck.toString());
// Update Description // Update Description
sql = new StringBuffer("SELECT * FROM C_ValidCombination vc " sql = new StringBuilder("SELECT * FROM C_ValidCombination vc ")
+ "WHERE EXISTS (SELECT * FROM I_ElementValue i " .append("WHERE EXISTS (SELECT * FROM I_ElementValue i ")
+ "WHERE vc.Account_ID=i.C_ElementValue_ID)"); .append("WHERE vc.Account_ID=i.C_ElementValue_ID)");
// Done // Done
sql = new StringBuffer ("UPDATE I_ElementValue " sql = new StringBuilder ("UPDATE I_ElementValue ")
+ "SET Processing='N', Processed='Y'" .append("SET Processing='N', Processed='Y'")
+ "WHERE I_IsImported='Y'") .append("WHERE I_IsImported='Y'")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Processed=" + no); log.fine("Processed=" + no);
@ -441,8 +442,8 @@ public class ImportAccount extends SvrProcess
log.config("CreateNewCombination=" + m_createNewCombination); log.config("CreateNewCombination=" + m_createNewCombination);
// **** Update Defaults // **** Update Defaults
StringBuffer sql = new StringBuffer ("SELECT C_AcctSchema_ID FROM C_AcctSchema_Element " StringBuilder sql = new StringBuilder ("SELECT C_AcctSchema_ID FROM C_AcctSchema_Element ")
+ "WHERE C_Element_ID=?").append(clientCheck); .append("WHERE C_Element_ID=?").append(clientCheck);
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
@ -459,14 +460,14 @@ public class ImportAccount extends SvrProcess
} }
// Default Account DEFAULT_ACCT // Default Account DEFAULT_ACCT
sql = new StringBuffer ("UPDATE C_AcctSchema_Element e " sql = new StringBuilder ("UPDATE C_AcctSchema_Element e ")
+ "SET C_ElementValue_ID=(SELECT C_ElementValue_ID FROM I_ElementValue i" .append("SET C_ElementValue_ID=(SELECT C_ElementValue_ID FROM I_ElementValue i")
+ " WHERE e.C_Element_ID=i.C_Element_ID AND i.C_ElementValue_ID IS NOT NULL" .append(" WHERE e.C_Element_ID=i.C_Element_ID AND i.C_ElementValue_ID IS NOT NULL")
+ " AND UPPER(i.Default_Account)='DEFAULT_ACCT') " .append(" AND UPPER(i.Default_Account)='DEFAULT_ACCT') ")
+ "WHERE EXISTS (SELECT * FROM I_ElementValue i" .append("WHERE EXISTS (SELECT * FROM I_ElementValue i")
+ " WHERE e.C_Element_ID=i.C_Element_ID AND i.C_ElementValue_ID IS NOT NULL" .append(" WHERE e.C_Element_ID=i.C_Element_ID AND i.C_ElementValue_ID IS NOT NULL")
+ " AND UPPER(i.Default_Account)='DEFAULT_ACCT' " .append(" AND UPPER(i.Default_Account)='DEFAULT_ACCT' ")
+ " AND i.I_IsImported='Y' AND i.Processing='-')") .append(" AND i.I_IsImported='Y' AND i.Processing='-')")
.append(clientCheck); .append(clientCheck);
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@C_AcctSchema_Element_ID@: @Updated@"); addLog (0, null, new BigDecimal (no), "@C_AcctSchema_Element_ID@: @Updated@");
@ -484,21 +485,22 @@ public class ImportAccount extends SvrProcess
MAcctSchema as = new MAcctSchema (getCtx(), C_AcctSchema_ID, get_TrxName()); MAcctSchema as = new MAcctSchema (getCtx(), C_AcctSchema_ID, get_TrxName());
if (as.getAcctSchemaElement("AC").getC_Element_ID() != m_C_Element_ID) if (as.getAcctSchemaElement("AC").getC_Element_ID() != m_C_Element_ID)
{ {
log.log(Level.SEVERE, "C_Element_ID=" + m_C_Element_ID + " not in AcctSchema=" + as); StringBuilder msglog = new StringBuilder("C_Element_ID=").append(m_C_Element_ID).append(" not in AcctSchema=").append(as);
log.log(Level.SEVERE, msglog.toString());
return; return;
} }
int[] counts = new int[] {0, 0, 0}; int[] counts = new int[] {0, 0, 0};
String sql = "SELECT i.C_ElementValue_ID, t.TableName, c.ColumnName, i.I_ElementValue_ID " StringBuilder sql = new StringBuilder("SELECT i.C_ElementValue_ID, t.TableName, c.ColumnName, i.I_ElementValue_ID ")
+ "FROM I_ElementValue i" .append("FROM I_ElementValue i")
+ " INNER JOIN AD_Column c ON (i.AD_Column_ID=c.AD_Column_ID)" .append(" INNER JOIN AD_Column c ON (i.AD_Column_ID=c.AD_Column_ID)")
+ " INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) " .append(" INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) ")
+ "WHERE i.I_IsImported='Y' AND Processing='Y'" .append("WHERE i.I_IsImported='Y' AND Processing='Y'")
+ " AND i.C_ElementValue_ID IS NOT NULL AND C_Element_ID=?"; .append(" AND i.C_ElementValue_ID IS NOT NULL AND C_Element_ID=?");
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName()); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
pstmt.setInt(1, m_C_Element_ID); pstmt.setInt(1, m_C_Element_ID);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
@ -512,8 +514,8 @@ public class ImportAccount extends SvrProcess
counts[u]++; counts[u]++;
if (u != UPDATE_ERROR) if (u != UPDATE_ERROR)
{ {
sql = "UPDATE I_ElementValue SET Processing='N' " sql = new StringBuilder("UPDATE I_ElementValue SET Processing='N' ")
+ "WHERE I_ElementValue_ID=" + I_ElementValue_ID; .append("WHERE I_ElementValue_ID=").append(I_ElementValue_ID);
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 1) if (no != 1)
log.log(Level.SEVERE, "Updated=" + no); log.log(Level.SEVERE, "Updated=" + no);
@ -552,9 +554,10 @@ public class ImportAccount extends SvrProcess
*/ */
private int updateDefaultAccount (String TableName, String ColumnName, int C_AcctSchema_ID, int C_ElementValue_ID) private int updateDefaultAccount (String TableName, String ColumnName, int C_AcctSchema_ID, int C_ElementValue_ID)
{ {
log.fine(TableName + "." + ColumnName + " - " + C_ElementValue_ID); StringBuilder msglog = new StringBuilder(TableName).append(".").append(ColumnName).append(" - ").append(C_ElementValue_ID);
log.fine(msglog.toString());
int retValue = UPDATE_ERROR; int retValue = UPDATE_ERROR;
StringBuffer sql = new StringBuffer ("SELECT x.") StringBuilder sql = new StringBuilder ("SELECT x.")
.append(ColumnName).append(",Account_ID FROM ") .append(ColumnName).append(",Account_ID FROM ")
.append(TableName).append(" x INNER JOIN C_ValidCombination vc ON (x.") .append(TableName).append(" x INNER JOIN C_ValidCombination vc ON (x.")
.append(ColumnName).append("=vc.C_ValidCombination_ID) ") .append(ColumnName).append("=vc.C_ValidCombination_ID) ")
@ -586,13 +589,14 @@ public class ImportAccount extends SvrProcess
int newC_ValidCombination_ID = acct.getC_ValidCombination_ID(); int newC_ValidCombination_ID = acct.getC_ValidCombination_ID();
if (C_ValidCombination_ID != newC_ValidCombination_ID) if (C_ValidCombination_ID != newC_ValidCombination_ID)
{ {
sql = new StringBuffer ("UPDATE ").append(TableName) sql = new StringBuilder ("UPDATE ").append(TableName)
.append(" SET ").append(ColumnName).append("=").append(newC_ValidCombination_ID) .append(" SET ").append(ColumnName).append("=").append(newC_ValidCombination_ID)
.append(" WHERE C_AcctSchema_ID=").append(C_AcctSchema_ID); .append(" WHERE C_AcctSchema_ID=").append(C_AcctSchema_ID);
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("New #" + no + " - " msglog = new StringBuilder("New #").append(no).append(" - ")
+ TableName + "." + ColumnName + " - " + C_ElementValue_ID .append(TableName).append(".").append(ColumnName).append(" - ").append(C_ElementValue_ID)
+ " -- " + C_ValidCombination_ID + " -> " + newC_ValidCombination_ID); .append(" -- ").append(C_ValidCombination_ID).append(" -> ").append(newC_ValidCombination_ID);
log.fine(msglog.toString());
if (no == 1) if (no == 1)
retValue = UPDATE_YES; retValue = UPDATE_YES;
} }
@ -603,25 +607,28 @@ public class ImportAccount extends SvrProcess
else // Replace Combination else // Replace Combination
{ {
// Only Acct Combination directly // Only Acct Combination directly
sql = new StringBuffer ("UPDATE C_ValidCombination SET Account_ID=") sql = new StringBuilder ("UPDATE C_ValidCombination SET Account_ID=")
.append(C_ElementValue_ID).append(" WHERE C_ValidCombination_ID=").append(C_ValidCombination_ID); .append(C_ElementValue_ID).append(" WHERE C_ValidCombination_ID=").append(C_ValidCombination_ID);
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Replace #" + no + " - " msglog = new StringBuilder("Replace #").append(no).append(" - ")
+ "C_ValidCombination_ID=" + C_ValidCombination_ID + ", New Account_ID=" + C_ElementValue_ID); .append("C_ValidCombination_ID=").append(C_ValidCombination_ID).append(", New Account_ID=").append(C_ElementValue_ID);
log.fine(msglog.toString());
if (no == 1) if (no == 1)
{ {
retValue = UPDATE_YES; retValue = UPDATE_YES;
// Where Acct was used // Where Acct was used
sql = new StringBuffer ("UPDATE C_ValidCombination SET Account_ID=") sql = new StringBuilder ("UPDATE C_ValidCombination SET Account_ID=")
.append(C_ElementValue_ID).append(" WHERE Account_ID=").append(Account_ID); .append(C_ElementValue_ID).append(" WHERE Account_ID=").append(Account_ID);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("ImportAccount.updateDefaultAccount - Replace VC #" + no + " - " msglog = new StringBuilder("ImportAccount.updateDefaultAccount - Replace VC #").append(no).append(" - ")
+ "Account_ID=" + Account_ID + ", New Account_ID=" + C_ElementValue_ID); .append("Account_ID=").append(Account_ID).append(", New Account_ID=").append(C_ElementValue_ID);
sql = new StringBuffer ("UPDATE Fact_Acct SET Account_ID=") log.fine(msglog.toString());
sql = new StringBuilder ("UPDATE Fact_Acct SET Account_ID=")
.append(C_ElementValue_ID).append(" WHERE Account_ID=").append(Account_ID); .append(C_ElementValue_ID).append(" WHERE Account_ID=").append(Account_ID);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("ImportAccount.updateDefaultAccount - Replace Fact #" + no + " - " msglog = new StringBuilder("ImportAccount.updateDefaultAccount - Replace Fact #").append(no).append(" - ")
+ "Account_ID=" + Account_ID + ", New Account_ID=" + C_ElementValue_ID); .append("Account_ID=").append(Account_ID).append(", New Account_ID=").append(C_ElementValue_ID);
log.fine(msglog.toString());
} }
} // replace combination } // replace combination
} // need to update } // need to update

View File

@ -91,7 +91,7 @@ implements ImportProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = getWhereClause(); String clientCheck = getWhereClause();
@ -100,50 +100,50 @@ implements ImportProcess
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_BPartner " sql = new StringBuilder ("DELETE I_BPartner ")
+ "WHERE I_IsImported='Y'").append(clientCheck); .append("WHERE I_IsImported='Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_BPartner " sql = new StringBuilder ("UPDATE I_BPartner ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append(")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID, 0)," .append(" AD_Org_ID = COALESCE (AD_Org_ID, 0),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Reset=" + no); log.fine("Reset=" + no);
ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_BEFORE_VALIDATE); ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_BEFORE_VALIDATE);
// Set BP_Group // Set BP_Group
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'" .append("SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'")
+ " AND g.AD_Client_ID=i.AD_Client_ID) "); .append(" AND g.AD_Client_ID=i.AD_Client_ID) ");
sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL" sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Group Default=" + no); log.fine("Set Group Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET C_BP_Group_ID=(SELECT C_BP_Group_ID FROM C_BP_Group g" .append("SET C_BP_Group_ID=(SELECT C_BP_Group_ID FROM C_BP_Group g")
+ " WHERE i.GroupValue=g.Value AND g.AD_Client_ID=i.AD_Client_ID) " .append(" WHERE i.GroupValue=g.Value AND g.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE C_BP_Group_ID IS NULL" .append("WHERE C_BP_Group_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Group=" + no); log.fine("Set Group=" + no);
// //
sql = new StringBuffer ("UPDATE I_BPartner " sql = new StringBuilder ("UPDATE I_BPartner ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Group, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Group, ' ")
+ "WHERE C_BP_Group_ID IS NULL" .append("WHERE C_BP_Group_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.config("Invalid Group=" + no); log.config("Invalid Group=" + no);
@ -158,123 +158,123 @@ implements ImportProcess
log.fine("Set Country Default=" + no); log.fine("Set Country Default=" + no);
**/ **/
// //
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c" .append("SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c")
+ " WHERE i.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, i.AD_Client_ID)) " .append(" WHERE i.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, i.AD_Client_ID)) ")
+ "WHERE C_Country_ID IS NULL" .append("WHERE C_Country_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Country=" + no); log.fine("Set Country=" + no);
// //
sql = new StringBuffer ("UPDATE I_BPartner " sql = new StringBuilder ("UPDATE I_BPartner ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' ")
+ "WHERE C_Country_ID IS NULL AND (City IS NOT NULL OR Address1 IS NOT NULL)" .append("WHERE C_Country_ID IS NULL AND (City IS NOT NULL OR Address1 IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.config("Invalid Country=" + no); log.config("Invalid Country=" + no);
// Set Region // Set Region
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "Set RegionName=(SELECT MAX(Name) FROM C_Region r" .append("Set RegionName=(SELECT MAX(Name) FROM C_Region r")
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=i.C_Country_ID" .append(" WHERE r.IsDefault='Y' AND r.C_Country_ID=i.C_Country_ID")
+ " AND r.AD_Client_ID IN (0, i.AD_Client_ID)) " ); .append(" AND r.AD_Client_ID IN (0, i.AD_Client_ID)) " );
sql.append("WHERE RegionName IS NULL AND C_Region_ID IS NULL" sql.append("WHERE RegionName IS NULL AND C_Region_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Region Default=" + no); log.fine("Set Region Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r" .append("Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r")
+ " WHERE r.Name=i.RegionName AND r.C_Country_ID=i.C_Country_ID" .append(" WHERE r.Name=i.RegionName AND r.C_Country_ID=i.C_Country_ID")
+ " AND r.AD_Client_ID IN (0, i.AD_Client_ID)) " .append(" AND r.AD_Client_ID IN (0, i.AD_Client_ID)) ")
+ "WHERE C_Region_ID IS NULL" .append("WHERE C_Region_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Region=" + no); log.fine("Set Region=" + no);
// //
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' ")
+ "WHERE C_Region_ID IS NULL " .append("WHERE C_Region_ID IS NULL ")
+ " AND EXISTS (SELECT * FROM C_Country c" .append(" AND EXISTS (SELECT * FROM C_Country c")
+ " WHERE c.C_Country_ID=i.C_Country_ID AND c.HasRegion='Y')" .append(" WHERE c.C_Country_ID=i.C_Country_ID AND c.HasRegion='Y')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.config("Invalid Region=" + no); log.config("Invalid Region=" + no);
// Set Greeting // Set Greeting
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET C_Greeting_ID=(SELECT C_Greeting_ID FROM C_Greeting g" .append("SET C_Greeting_ID=(SELECT C_Greeting_ID FROM C_Greeting g")
+ " WHERE i.BPContactGreeting=g.Name AND g.AD_Client_ID IN (0, i.AD_Client_ID)) " .append(" WHERE i.BPContactGreeting=g.Name AND g.AD_Client_ID IN (0, i.AD_Client_ID)) ")
+ "WHERE C_Greeting_ID IS NULL AND BPContactGreeting IS NOT NULL" .append("WHERE C_Greeting_ID IS NULL AND BPContactGreeting IS NOT NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Greeting=" + no); log.fine("Set Greeting=" + no);
// //
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Greeting, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Greeting, ' ")
+ "WHERE C_Greeting_ID IS NULL AND BPContactGreeting IS NOT NULL" .append("WHERE C_Greeting_ID IS NULL AND BPContactGreeting IS NOT NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.config("Invalid Greeting=" + no); log.config("Invalid Greeting=" + no);
// Existing User ? // Existing User ?
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET (C_BPartner_ID,AD_User_ID)=" .append("SET (C_BPartner_ID,AD_User_ID)=")
+ "(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u " .append("(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u ")
+ "WHERE i.EMail=u.EMail AND u.AD_Client_ID=i.AD_Client_ID) " .append("WHERE i.EMail=u.EMail AND u.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE i.EMail IS NOT NULL AND I_IsImported='N'").append(clientCheck); .append("WHERE i.EMail IS NOT NULL AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Found EMail User=" + no); log.fine("Found EMail User=" + no);
// Existing BPartner ? Match Value // Existing BPartner ? Match Value
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p" .append("SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p")
+ " WHERE i.Value=p.Value AND p.AD_Client_ID=i.AD_Client_ID) " .append(" WHERE i.Value=p.Value AND p.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND Value IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND Value IS NOT NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Found BPartner=" + no); log.fine("Found BPartner=" + no);
// Existing Contact ? Match Name // Existing Contact ? Match Name
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET AD_User_ID=(SELECT AD_User_ID FROM AD_User c" .append("SET AD_User_ID=(SELECT AD_User_ID FROM AD_User c")
+ " WHERE i.ContactName=c.Name AND i.C_BPartner_ID=c.C_BPartner_ID AND c.AD_Client_ID=i.AD_Client_ID) " .append(" WHERE i.ContactName=c.Name AND i.C_BPartner_ID=c.C_BPartner_ID AND c.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NOT NULL AND AD_User_ID IS NULL AND ContactName IS NOT NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND AD_User_ID IS NULL AND ContactName IS NOT NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Found Contact=" + no); log.fine("Found Contact=" + no);
// Existing Location ? Exact Match // Existing Location ? Exact Match
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID" .append("SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID")
+ " FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)" .append(" FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)")
+ " WHERE i.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=i.AD_Client_ID" .append(" WHERE i.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=i.AD_Client_ID")
+ " AND (i.Address1=l.Address1 OR (i.Address1 IS NULL AND l.Address1 IS NULL))" .append(" AND (i.Address1=l.Address1 OR (i.Address1 IS NULL AND l.Address1 IS NULL))")
+ " AND (i.Address2=l.Address2 OR (i.Address2 IS NULL AND l.Address2 IS NULL))" .append(" AND (i.Address2=l.Address2 OR (i.Address2 IS NULL AND l.Address2 IS NULL))")
+ " AND (i.City=l.City OR (i.City IS NULL AND l.City IS NULL))" .append(" AND (i.City=l.City OR (i.City IS NULL AND l.City IS NULL))")
+ " AND (i.Postal=l.Postal OR (i.Postal IS NULL AND l.Postal IS NULL))" .append(" AND (i.Postal=l.Postal OR (i.Postal IS NULL AND l.Postal IS NULL))")
+ " AND (i.Postal_Add=l.Postal_Add OR (l.Postal_Add IS NULL AND l.Postal_Add IS NULL))" .append(" AND (i.Postal_Add=l.Postal_Add OR (l.Postal_Add IS NULL AND l.Postal_Add IS NULL))")
+ " AND (i.C_Region_ID=l.C_Region_ID OR (l.C_Region_ID IS NULL AND i.C_Region_ID IS NULL))" .append(" AND (i.C_Region_ID=l.C_Region_ID OR (l.C_Region_ID IS NULL AND i.C_Region_ID IS NULL))")
+ " AND i.C_Country_ID=l.C_Country_ID) " .append(" AND i.C_Country_ID=l.C_Country_ID) ")
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Found Location=" + no); log.fine("Found Location=" + no);
// Interest Area // Interest Area
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET R_InterestArea_ID=(SELECT R_InterestArea_ID FROM R_InterestArea ia " .append("SET R_InterestArea_ID=(SELECT R_InterestArea_ID FROM R_InterestArea ia ")
+ "WHERE i.InterestAreaName=ia.Name AND ia.AD_Client_ID=i.AD_Client_ID) " .append("WHERE i.InterestAreaName=ia.Name AND ia.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE R_InterestArea_ID IS NULL AND InterestAreaName IS NOT NULL" .append("WHERE R_InterestArea_ID IS NULL AND InterestAreaName IS NOT NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Set Interest Area=" + no); log.fine("Set Interest Area=" + no);
// Value is mandatory error // Value is mandatory error
sql = new StringBuffer ("UPDATE I_BPartner " sql = new StringBuilder ("UPDATE I_BPartner ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Value is mandatory, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Value is mandatory, ' ")
+ "WHERE Value IS NULL " .append("WHERE Value IS NULL ")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.config("Value is mandatory=" + no); log.config("Value is mandatory=" + no);
@ -290,8 +290,8 @@ implements ImportProcess
int noUpdate = 0; int noUpdate = 0;
// Go through Records // Go through Records
sql = new StringBuffer ("SELECT * FROM I_BPartner " sql = new StringBuilder ("SELECT * FROM I_BPartner ")
+ "WHERE I_IsImported='N'").append(clientCheck); .append("WHERE I_IsImported='N'").append(clientCheck);
// gody: 20070113 - Order so the same values are consecutive. // gody: 20070113 - Order so the same values are consecutive.
sql.append(" ORDER BY Value, I_BPartner_ID"); sql.append(" ORDER BY Value, I_BPartner_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -314,10 +314,11 @@ implements ImportProcess
String New_BPValue = rs.getString("Value") ; String New_BPValue = rs.getString("Value") ;
X_I_BPartner impBP = new X_I_BPartner (getCtx(), rs, get_TrxName()); X_I_BPartner impBP = new X_I_BPartner (getCtx(), rs, get_TrxName());
log.fine("I_BPartner_ID=" + impBP.getI_BPartner_ID() StringBuilder msglog = new StringBuilder("I_BPartner_ID=") .append(impBP.getI_BPartner_ID())
+ ", C_BPartner_ID=" + impBP.getC_BPartner_ID() .append(", C_BPartner_ID=").append(impBP.getC_BPartner_ID())
+ ", C_BPartner_Location_ID=" + impBP.getC_BPartner_Location_ID() .append(", C_BPartner_Location_ID=").append(impBP.getC_BPartner_Location_ID())
+ ", AD_User_ID=" + impBP.getAD_User_ID()); .append(", AD_User_ID=").append(impBP.getAD_User_ID());
log.fine(msglog.toString());
if ( ! New_BPValue.equals(Old_BPValue)) { if ( ! New_BPValue.equals(Old_BPValue)) {
@ -334,13 +335,14 @@ implements ImportProcess
if (bp.save()) if (bp.save())
{ {
impBP.setC_BPartner_ID(bp.getC_BPartner_ID()); impBP.setC_BPartner_ID(bp.getC_BPartner_ID());
log.finest("Insert BPartner - " + bp.getC_BPartner_ID()); msglog = new StringBuilder("Insert BPartner - ").append(bp.getC_BPartner_ID());
log.finest(msglog.toString());
noInsert++; noInsert++;
} }
else else
{ {
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'Cannot Insert BPartner, ' ") .append("'Cannot Insert BPartner, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -374,13 +376,14 @@ implements ImportProcess
// //
if (bp.save()) if (bp.save())
{ {
log.finest("Update BPartner - " + bp.getC_BPartner_ID()); msglog = new StringBuilder("Update BPartner - ").append(bp.getC_BPartner_ID());
log.finest(msglog.toString());
noUpdate++; noUpdate++;
} }
else else
{ {
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'Cannot Update BPartner, ' ") .append("'Cannot Update BPartner, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -425,14 +428,16 @@ implements ImportProcess
location.setAddress2(impBP.getAddress2()); location.setAddress2(impBP.getAddress2());
location.setPostal(impBP.getPostal()); location.setPostal(impBP.getPostal());
location.setPostal_Add(impBP.getPostal_Add()); location.setPostal_Add(impBP.getPostal_Add());
if (location.save()) if (location.save()){
log.finest("Insert Location - " + location.getC_Location_ID()); msglog = new StringBuilder("Insert Location - ").append(location.getC_Location_ID());
log.finest(msglog.toString());
}
else else
{ {
rollback(); rollback();
noInsert--; noInsert--;
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'Cannot Insert Location, ' ") .append("'Cannot Insert Location, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -447,15 +452,16 @@ implements ImportProcess
ModelValidationEngine.get().fireImportValidate(this, impBP, bpl, ImportValidator.TIMING_AFTER_IMPORT); ModelValidationEngine.get().fireImportValidate(this, impBP, bpl, ImportValidator.TIMING_AFTER_IMPORT);
if (bpl.save()) if (bpl.save())
{ {
log.finest("Insert BP Location - " + bpl.getC_BPartner_Location_ID()); msglog = new StringBuilder("Insert BP Location - ").append(bpl.getC_BPartner_Location_ID());
log.finest(msglog.toString());
impBP.setC_BPartner_Location_ID(bpl.getC_BPartner_Location_ID()); impBP.setC_BPartner_Location_ID(bpl.getC_BPartner_Location_ID());
} }
else else
{ {
rollback(); rollback();
noInsert--; noInsert--;
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'Cannot Insert BPLocation, ' ") .append("'Cannot Insert BPLocation, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -477,8 +483,8 @@ implements ImportProcess
{ {
rollback(); rollback();
noInsert--; noInsert--;
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'BP of User <> BP, ' ") .append("'BP of User <> BP, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -511,14 +517,15 @@ implements ImportProcess
ModelValidationEngine.get().fireImportValidate(this, impBP, user, ImportValidator.TIMING_AFTER_IMPORT); ModelValidationEngine.get().fireImportValidate(this, impBP, user, ImportValidator.TIMING_AFTER_IMPORT);
if (user.save()) if (user.save())
{ {
log.finest("Update BP Contact - " + user.getAD_User_ID()); msglog = new StringBuilder("Update BP Contact - ").append(user.getAD_User_ID());
log.finest(msglog.toString());
} }
else else
{ {
rollback(); rollback();
noInsert--; noInsert--;
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'Cannot Update BP Contact, ' ") .append("'Cannot Update BP Contact, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -548,15 +555,16 @@ implements ImportProcess
ModelValidationEngine.get().fireImportValidate(this, impBP, user, ImportValidator.TIMING_AFTER_IMPORT); ModelValidationEngine.get().fireImportValidate(this, impBP, user, ImportValidator.TIMING_AFTER_IMPORT);
if (user.save()) if (user.save())
{ {
log.finest("Insert BP Contact - " + user.getAD_User_ID()); msglog = new StringBuilder("Insert BP Contact - ").append(user.getAD_User_ID());
log.finest(msglog.toString());
impBP.setAD_User_ID(user.getAD_User_ID()); impBP.setAD_User_ID(user.getAD_User_ID());
} }
else else
{ {
rollback(); rollback();
noInsert--; noInsert--;
sql = new StringBuffer ("UPDATE I_BPartner i " sql = new StringBuilder ("UPDATE I_BPartner i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||")
.append("'Cannot Insert BPContact, ' ") .append("'Cannot Insert BPContact, ' ")
.append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID()); .append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(), get_TrxName()); DB.executeUpdateEx(sql.toString(), get_TrxName());
@ -592,9 +600,9 @@ implements ImportProcess
DB.close(rs, pstmt); DB.close(rs, pstmt);
rs = null; pstmt = null; rs = null; pstmt = null;
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_BPartner " sql = new StringBuilder ("UPDATE I_BPartner ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
addLog (0, null, new BigDecimal (noInsert), "@C_BPartner_ID@: @Inserted@"); addLog (0, null, new BigDecimal (noInsert), "@C_BPartner_ID@: @Inserted@");
@ -607,7 +615,8 @@ implements ImportProcess
//@Override //@Override
public String getWhereClause() public String getWhereClause()
{ {
return " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder msgreturn = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
return msgreturn.toString();
} }

View File

@ -82,249 +82,250 @@ public class ImportBankStatement extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
log.info("AD_Org_ID=" + p_AD_Org_ID + ", C_BankAccount_ID" + p_C_BankAccount_ID); StringBuilder msglog = new StringBuilder("AD_Org_ID=").append(p_AD_Org_ID).append(", C_BankAccount_ID").append(p_C_BankAccount_ID);
StringBuffer sql = null; log.info(msglog.toString());
StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + p_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(p_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (p_deleteOldImported) if (p_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_BankStatement " sql = new StringBuilder ("DELETE I_BankStatement ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_BankStatement " sql = new StringBuilder ("UPDATE I_BankStatement ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append ("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID,").append (p_AD_Org_ID).append ("),"); .append(" AD_Org_ID = COALESCE (AD_Org_ID,").append (p_AD_Org_ID).append ("),");
sql.append(" IsActive = COALESCE (IsActive, 'Y')," sql.append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL OR AD_Client_ID IS NULL OR AD_Org_ID IS NULL OR AD_Client_ID=0 OR AD_Org_ID=0"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL OR AD_Client_ID IS NULL OR AD_Org_ID IS NULL OR AD_Client_ID=0 OR AD_Org_ID=0");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
sql = new StringBuffer ("UPDATE I_BankStatement o " sql = new StringBuilder ("UPDATE I_BankStatement o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org=" + no); log.warning ("Invalid Org=" + no);
// Set Bank Account // Set Bank Account
sql = new StringBuffer("UPDATE I_BankStatement i " sql = new StringBuilder("UPDATE I_BankStatement i ")
+ "SET C_BankAccount_ID=" .append("SET C_BankAccount_ID=")
+ "( " .append("( ")
+ " SELECT C_BankAccount_ID " .append(" SELECT C_BankAccount_ID ")
+ " FROM C_BankAccount a, C_Bank b " .append(" FROM C_BankAccount a, C_Bank b ")
+ " WHERE b.IsOwnBank='Y' " .append(" WHERE b.IsOwnBank='Y' ")
+ " AND a.AD_Client_ID=i.AD_Client_ID " .append(" AND a.AD_Client_ID=i.AD_Client_ID ")
+ " AND a.C_Bank_ID=b.C_Bank_ID " .append(" AND a.C_Bank_ID=b.C_Bank_ID ")
+ " AND a.AccountNo=i.BankAccountNo " .append(" AND a.AccountNo=i.BankAccountNo ")
+ " AND b.RoutingNo=i.RoutingNo " .append(" AND b.RoutingNo=i.RoutingNo ")
+ " OR b.SwiftCode=i.RoutingNo " .append(" OR b.SwiftCode=i.RoutingNo ")
+ ") " .append(") ")
+ "WHERE i.C_BankAccount_ID IS NULL " .append("WHERE i.C_BankAccount_ID IS NULL ")
+ "AND i.I_IsImported<>'Y' " .append("AND i.I_IsImported<>'Y' ")
+ "OR i.I_IsImported IS NULL").append(clientCheck); .append("OR i.I_IsImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Bank Account (With Routing No)=" + no); log.info("Bank Account (With Routing No)=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement i " sql = new StringBuilder("UPDATE I_BankStatement i ")
+ "SET C_BankAccount_ID=" .append("SET C_BankAccount_ID=")
+ "( " .append("( ")
+ " SELECT C_BankAccount_ID " .append(" SELECT C_BankAccount_ID ")
+ " FROM C_BankAccount a, C_Bank b " .append(" FROM C_BankAccount a, C_Bank b ")
+ " WHERE b.IsOwnBank='Y' " .append(" WHERE b.IsOwnBank='Y' ")
+ " AND a.C_Bank_ID=b.C_Bank_ID " .append(" AND a.C_Bank_ID=b.C_Bank_ID ")
+ " AND a.AccountNo=i.BankAccountNo " .append(" AND a.AccountNo=i.BankAccountNo ")
+ " AND a.AD_Client_ID=i.AD_Client_ID " .append(" AND a.AD_Client_ID=i.AD_Client_ID ")
+ ") " .append(") ")
+ "WHERE i.C_BankAccount_ID IS NULL " .append("WHERE i.C_BankAccount_ID IS NULL ")
+ "AND i.I_isImported<>'Y' " .append("AND i.I_isImported<>'Y' ")
+ "OR i.I_isImported IS NULL").append(clientCheck); .append("OR i.I_isImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Bank Account (Without Routing No)=" + no); log.info("Bank Account (Without Routing No)=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement i " sql = new StringBuilder("UPDATE I_BankStatement i ")
+ "SET C_BankAccount_ID=(SELECT C_BankAccount_ID FROM C_BankAccount a WHERE a.C_BankAccount_ID=").append(p_C_BankAccount_ID); .append("SET C_BankAccount_ID=(SELECT C_BankAccount_ID FROM C_BankAccount a WHERE a.C_BankAccount_ID=").append(p_C_BankAccount_ID)
sql.append(" and a.AD_Client_ID=i.AD_Client_ID) " .append(" and a.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE i.C_BankAccount_ID IS NULL " .append("WHERE i.C_BankAccount_ID IS NULL ")
+ "AND i.BankAccountNo IS NULL " .append("AND i.BankAccountNo IS NULL ")
+ "AND i.I_isImported<>'Y' " .append("AND i.I_isImported<>'Y' ")
+ "OR i.I_isImported IS NULL").append(clientCheck); .append("OR i.I_isImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Bank Account=" + no); log.info("Bank Account=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Bank Account, ' " .append("SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Bank Account, ' ")
+ "WHERE C_BankAccount_ID IS NULL " .append("WHERE C_BankAccount_ID IS NULL ")
+ "AND I_isImported<>'Y' " .append("AND I_isImported<>'Y' ")
+ "OR I_isImported IS NULL").append(clientCheck); .append("OR I_isImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid Bank Account=" + no); log.warning("Invalid Bank Account=" + no);
// Set Currency // Set Currency
sql = new StringBuffer ("UPDATE I_BankStatement i " sql = new StringBuilder ("UPDATE I_BankStatement i ")
+ "SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c")
+ " WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) " .append(" WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE C_Currency_ID IS NULL" .append("WHERE C_Currency_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Set Currency=" + no); log.info("Set Currency=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement i " sql = new StringBuilder("UPDATE I_BankStatement i ")
+ "SET C_Currency_ID=(SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID=i.C_BankAccount_ID) " .append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID=i.C_BankAccount_ID) ")
+ "WHERE i.C_Currency_ID IS NULL " .append("WHERE i.C_Currency_ID IS NULL ")
+ "AND i.ISO_Code IS NULL").append(clientCheck); .append("AND i.ISO_Code IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Set Currency=" + no); log.info("Set Currency=" + no);
// //
sql = new StringBuffer ("UPDATE I_BankStatement " sql = new StringBuilder ("UPDATE I_BankStatement ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency,' ")
+ "WHERE C_Currency_ID IS NULL " .append("WHERE C_Currency_ID IS NULL ")
+ "AND I_IsImported<>'E' " .append("AND I_IsImported<>'E' ")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid Currency=" + no); log.warning("Invalid Currency=" + no);
// Set Amount // Set Amount
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET ChargeAmt=0 " .append("SET ChargeAmt=0 ")
+ "WHERE ChargeAmt IS NULL " .append("WHERE ChargeAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Charge Amount=" + no); log.info("Charge Amount=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET InterestAmt=0 " .append("SET InterestAmt=0 ")
+ "WHERE InterestAmt IS NULL " .append("WHERE InterestAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Interest Amount=" + no); log.info("Interest Amount=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET TrxAmt=StmtAmt - InterestAmt - ChargeAmt " .append("SET TrxAmt=StmtAmt - InterestAmt - ChargeAmt ")
+ "WHERE TrxAmt IS NULL " .append("WHERE TrxAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Transaction Amount=" + no); log.info("Transaction Amount=" + no);
// //
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Amount, ' " .append("SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Amount, ' ")
+ "WHERE TrxAmt + ChargeAmt + InterestAmt <> StmtAmt " .append("WHERE TrxAmt + ChargeAmt + InterestAmt <> StmtAmt ")
+ "AND I_isImported<>'Y'").append(clientCheck); .append("AND I_isImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Invaid Amount=" + no); log.info("Invaid Amount=" + no);
// Set Valuta Date // Set Valuta Date
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET ValutaDate=StatementLineDate " .append("SET ValutaDate=StatementLineDate ")
+ "WHERE ValutaDate IS NULL " .append("WHERE ValutaDate IS NULL ")
+ "AND I_isImported<>'Y'").append(clientCheck); .append("AND I_isImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Valuta Date=" + no); log.info("Valuta Date=" + no);
// Check Payment<->Invoice combination // Check Payment<->Invoice combination
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->Invoice, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->Invoice, ' ")
+ "WHERE I_BankStatement_ID IN " .append("WHERE I_BankStatement_ID IN ")
+ "(SELECT I_BankStatement_ID " .append("(SELECT I_BankStatement_ID ")
+ "FROM I_BankStatement i" .append("FROM I_BankStatement i")
+ " INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) " .append(" INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) ")
+ "WHERE i.C_Invoice_ID IS NOT NULL " .append("WHERE i.C_Invoice_ID IS NOT NULL ")
+ " AND p.C_Invoice_ID IS NOT NULL " .append(" AND p.C_Invoice_ID IS NOT NULL ")
+ " AND p.C_Invoice_ID<>i.C_Invoice_ID) ") .append(" AND p.C_Invoice_ID<>i.C_Invoice_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Payment<->Invoice Mismatch=" + no); log.info("Payment<->Invoice Mismatch=" + no);
// Check Payment<->BPartner combination // Check Payment<->BPartner combination
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->BPartner, ' ")
+ "WHERE I_BankStatement_ID IN " .append("WHERE I_BankStatement_ID IN ")
+ "(SELECT I_BankStatement_ID " .append("(SELECT I_BankStatement_ID ")
+ "FROM I_BankStatement i" .append("FROM I_BankStatement i")
+ " INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) " .append(" INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) ")
+ "WHERE i.C_BPartner_ID IS NOT NULL " .append("WHERE i.C_BPartner_ID IS NOT NULL ")
+ " AND p.C_BPartner_ID IS NOT NULL " .append(" AND p.C_BPartner_ID IS NOT NULL ")
+ " AND p.C_BPartner_ID<>i.C_BPartner_ID) ") .append(" AND p.C_BPartner_ID<>i.C_BPartner_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Payment<->BPartner Mismatch=" + no); log.info("Payment<->BPartner Mismatch=" + no);
// Check Invoice<->BPartner combination // Check Invoice<->BPartner combination
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice<->BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice<->BPartner, ' ")
+ "WHERE I_BankStatement_ID IN " .append("WHERE I_BankStatement_ID IN ")
+ "(SELECT I_BankStatement_ID " .append("(SELECT I_BankStatement_ID ")
+ "FROM I_BankStatement i" .append("FROM I_BankStatement i")
+ " INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID) " .append(" INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID) ")
+ "WHERE i.C_BPartner_ID IS NOT NULL " .append("WHERE i.C_BPartner_ID IS NOT NULL ")
+ " AND v.C_BPartner_ID IS NOT NULL " .append(" AND v.C_BPartner_ID IS NOT NULL ")
+ " AND v.C_BPartner_ID<>i.C_BPartner_ID) ") .append(" AND v.C_BPartner_ID<>i.C_BPartner_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Invoice<->BPartner Mismatch=" + no); log.info("Invoice<->BPartner Mismatch=" + no);
// Check Invoice.BPartner<->Payment.BPartner combination // Check Invoice.BPartner<->Payment.BPartner combination
sql = new StringBuffer("UPDATE I_BankStatement " sql = new StringBuilder("UPDATE I_BankStatement ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice.BPartner<->Payment.BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice.BPartner<->Payment.BPartner, ' ")
+ "WHERE I_BankStatement_ID IN " .append("WHERE I_BankStatement_ID IN ")
+ "(SELECT I_BankStatement_ID " .append("(SELECT I_BankStatement_ID ")
+ "FROM I_BankStatement i" .append("FROM I_BankStatement i")
+ " INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID)" .append(" INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID)")
+ " INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) " .append(" INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) ")
+ "WHERE p.C_Invoice_ID<>v.C_Invoice_ID" .append("WHERE p.C_Invoice_ID<>v.C_Invoice_ID")
+ " AND v.C_BPartner_ID<>p.C_BPartner_ID) ") .append(" AND v.C_BPartner_ID<>p.C_BPartner_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Invoice.BPartner<->Payment.BPartner Mismatch=" + no); log.info("Invoice.BPartner<->Payment.BPartner Mismatch=" + no);
// Detect Duplicates // Detect Duplicates
sql = new StringBuffer("SELECT i.I_BankStatement_ID, l.C_BankStatementLine_ID, i.EftTrxID " sql = new StringBuilder("SELECT i.I_BankStatement_ID, l.C_BankStatementLine_ID, i.EftTrxID ")
+ "FROM I_BankStatement i, C_BankStatement s, C_BankStatementLine l " .append("FROM I_BankStatement i, C_BankStatement s, C_BankStatementLine l ")
+ "WHERE i.I_isImported='N' " .append("WHERE i.I_isImported='N' ")
+ "AND s.C_BankStatement_ID=l.C_BankStatement_ID " .append("AND s.C_BankStatement_ID=l.C_BankStatement_ID ")
+ "AND i.EftTrxID IS NOT NULL AND " .append("AND i.EftTrxID IS NOT NULL AND ")
// Concatenate EFT Info // Concatenate EFT Info
+ "(l.EftTrxID||l.EftAmt||l.EftStatementLineDate||l.EftValutaDate||l.EftTrxType||l.EftCurrency||l.EftReference||s.EftStatementReference " .append("(l.EftTrxID||l.EftAmt||l.EftStatementLineDate||l.EftValutaDate||l.EftTrxType||l.EftCurrency||l.EftReference||s.EftStatementReference ")
+ "||l.EftCheckNo||l.EftMemo||l.EftPayee||l.EftPayeeAccount) " .append("||l.EftCheckNo||l.EftMemo||l.EftPayee||l.EftPayeeAccount) ")
+ "= " .append("= ")
+ "(i.EftTrxID||i.EftAmt||i.EftStatementLineDate||i.EftValutaDate||i.EftTrxType||i.EftCurrency||i.EftReference||i.EftStatementReference " .append("(i.EftTrxID||i.EftAmt||i.EftStatementLineDate||i.EftValutaDate||i.EftTrxType||i.EftCurrency||i.EftReference||i.EftStatementReference ")
+ "||i.EftCheckNo||i.EftMemo||i.EftPayee||i.EftPayeeAccount) "); .append("||i.EftCheckNo||i.EftMemo||i.EftPayee||i.EftPayeeAccount) ");
StringBuffer updateSql = new StringBuffer("UPDATE I_Bankstatement " StringBuilder updateSql = new StringBuilder("UPDATE I_Bankstatement ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Duplicate['||?||']' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Duplicate['||?||']' ")
+ "WHERE I_BankStatement_ID=?").append(clientCheck); .append("WHERE I_BankStatement_ID=?").append(clientCheck);
PreparedStatement pupdt = DB.prepareStatement(updateSql.toString(), get_TrxName()); PreparedStatement pupdt = DB.prepareStatement(updateSql.toString(), get_TrxName());
PreparedStatement pstmtDuplicates = null; PreparedStatement pstmtDuplicates = null;
@ -335,9 +336,9 @@ public class ImportBankStatement extends SvrProcess
ResultSet rs = pstmtDuplicates.executeQuery(); ResultSet rs = pstmtDuplicates.executeQuery();
while (rs.next()) while (rs.next())
{ {
String info = "Line_ID=" + rs.getInt(2) // l.C_BankStatementLine_ID StringBuilder info = new StringBuilder("Line_ID=").append(rs.getInt(2)) // l.C_BankStatementLine_ID
+ ",EDTTrxID=" + rs.getString(3); // i.EftTrxID .append(",EDTTrxID=").append(rs.getString(3)); // i.EftTrxID
pupdt.setString(1, info); pupdt.setString(1, info.toString());
pupdt.setInt(2, rs.getInt(1)); // i.I_BankStatement_ID pupdt.setInt(2, rs.getInt(1)); // i.I_BankStatement_ID
pupdt.executeUpdate(); pupdt.executeUpdate();
no++; no++;
@ -360,9 +361,9 @@ public class ImportBankStatement extends SvrProcess
commitEx(); commitEx();
//Import Bank Statement //Import Bank Statement
sql = new StringBuffer("SELECT * FROM I_BankStatement" sql = new StringBuilder("SELECT * FROM I_BankStatement")
+ " WHERE I_IsImported='N'" .append(" WHERE I_IsImported='N'")
+ " ORDER BY C_BankAccount_ID, Name, EftStatementDate, EftStatementReference"); .append(" ORDER BY C_BankAccount_ID, Name, EftStatementDate, EftStatementReference");
MBankStatement statement = null; MBankStatement statement = null;
MBankAccount account = null; MBankAccount account = null;
@ -383,14 +384,16 @@ public class ImportBankStatement extends SvrProcess
{ {
account = MBankAccount.get (m_ctx, imp.getC_BankAccount_ID()); account = MBankAccount.get (m_ctx, imp.getC_BankAccount_ID());
statement = null; statement = null;
log.info("New Statement, Account=" + account.getAccountNo()); msglog = new StringBuilder("New Statement, Account=").append(account.getAccountNo());
log.info(msglog.toString());
} }
// Create a new Bank Statement for every account // Create a new Bank Statement for every account
else if (account.getC_BankAccount_ID() != imp.getC_BankAccount_ID()) else if (account.getC_BankAccount_ID() != imp.getC_BankAccount_ID())
{ {
account = MBankAccount.get (m_ctx, imp.getC_BankAccount_ID()); account = MBankAccount.get (m_ctx, imp.getC_BankAccount_ID());
statement = null; statement = null;
log.info("New Statement, Account=" + account.getAccountNo()); msglog = new StringBuilder("New Statement, Account=").append(account.getAccountNo());
log.info(msglog.toString());
} }
// Create a new Bank Statement for every statement name // Create a new Bank Statement for every statement name
else if ((statement.getName() != null) && (imp.getName() != null)) else if ((statement.getName() != null) && (imp.getName() != null))
@ -398,7 +401,8 @@ public class ImportBankStatement extends SvrProcess
if (!statement.getName().equals(imp.getName())) if (!statement.getName().equals(imp.getName()))
{ {
statement = null; statement = null;
log.info("New Statement, Statement Name=" + imp.getName()); msglog = new StringBuilder("New Statement, Statement Name=").append(imp.getName());
log.info(msglog.toString());
} }
} }
// Create a new Bank Statement for every statement reference // Create a new Bank Statement for every statement reference
@ -407,7 +411,8 @@ public class ImportBankStatement extends SvrProcess
if (!statement.getEftStatementReference().equals(imp.getEftStatementReference())) if (!statement.getEftStatementReference().equals(imp.getEftStatementReference()))
{ {
statement = null; statement = null;
log.info("New Statement, Statement Reference=" + imp.getEftStatementReference()); msglog = new StringBuilder("New Statement, Statement Reference=").append(imp.getEftStatementReference());
log.info(msglog.toString());
} }
} }
// Create a new Bank Statement for every statement date // Create a new Bank Statement for every statement date
@ -416,7 +421,8 @@ public class ImportBankStatement extends SvrProcess
if (!statement.getStatementDate().equals(imp.getStatementDate())) if (!statement.getStatementDate().equals(imp.getStatementDate()))
{ {
statement = null; statement = null;
log.info("New Statement, Statement Date=" + imp.getStatementDate()); msglog = new StringBuilder("New Statement, Statement Date=").append(imp.getStatementDate());
log.info(msglog.toString());
} }
} }
@ -513,9 +519,9 @@ public class ImportBankStatement extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_BankStatement " sql = new StringBuilder ("UPDATE I_BankStatement ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //

View File

@ -84,138 +84,139 @@ public class ImportConversionRate extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
log.info("doIt - AD_Client_ID=" + p_AD_Client_ID StringBuilder msglog = new StringBuilder("doIt - AD_Client_ID=").append(p_AD_Client_ID)
+ ",AD_Org_ID=" + p_AD_Org_ID .append(",AD_Org_ID=").append(p_AD_Org_ID)
+ ",C_ConversionType_ID=" + p_C_ConversionType_ID .append(",C_ConversionType_ID=").append(p_C_ConversionType_ID)
+ ",ValidFrom=" + p_ValidFrom .append(",ValidFrom=").append(p_ValidFrom)
+ ",CreateReciprocalRate=" + p_CreateReciprocalRate); .append(",CreateReciprocalRate=").append(p_CreateReciprocalRate);
log.info(msglog.toString());
// //
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + p_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(p_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (p_DeleteOldImported) if (p_DeleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_Conversion_Rate " sql = new StringBuilder ("DELETE I_Conversion_Rate ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, Location, IsActive, Created/Updated // Set Client, Org, Location, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_Conversion_Rate " sql = new StringBuilder ("UPDATE I_Conversion_Rate ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append ("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID,").append (p_AD_Org_ID).append ("),"); .append(" AD_Org_ID = COALESCE (AD_Org_ID,").append (p_AD_Org_ID).append ("),");
if (p_C_ConversionType_ID != 0) if (p_C_ConversionType_ID != 0)
sql.append(" C_ConversionType_ID = COALESCE (C_ConversionType_ID,").append (p_C_ConversionType_ID).append ("),"); sql.append(" C_ConversionType_ID = COALESCE (C_ConversionType_ID,").append (p_C_ConversionType_ID).append ("),");
if (p_ValidFrom != null) if (p_ValidFrom != null)
sql.append(" ValidFrom = COALESCE (ValidFrom,").append (DB.TO_DATE(p_ValidFrom)).append ("),"); sql.append(" ValidFrom = COALESCE (ValidFrom,").append (DB.TO_DATE(p_ValidFrom)).append ("),");
else else
sql.append(" ValidFrom = COALESCE (ValidFrom,SysDate),"); sql.append(" ValidFrom = COALESCE (ValidFrom,SysDate),");
sql.append(" CreateReciprocalRate = COALESCE (CreateReciprocalRate,'").append (p_CreateReciprocalRate ? "Y" : "N").append ("')," sql.append(" CreateReciprocalRate = COALESCE (CreateReciprocalRate,'").append (p_CreateReciprocalRate ? "Y" : "N").append ("'),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = ").append(getAD_User_ID()).append("," .append(" UpdatedBy = ").append(getAD_User_ID()).append(",")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " Processed = 'N'," .append(" Processed = 'N'," )
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset =" + no); log.info ("Reset =" + no);
// Org // Org
sql = new StringBuffer ("UPDATE I_Conversion_Rate o " sql = new StringBuilder ("UPDATE I_Conversion_Rate o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL" .append("WHERE (AD_Org_ID IS NULL")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org =" + no); log.warning ("Invalid Org =" + no);
// Conversion Type // Conversion Type
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET C_ConversionType_ID = (SELECT C_ConversionType_ID FROM C_ConversionType c" .append("SET C_ConversionType_ID = (SELECT C_ConversionType_ID FROM C_ConversionType c")
+ " WHERE c.Value=i.ConversionTypeValue AND c.AD_Client_ID IN (0,i.AD_Client_ID) AND c.IsActive='Y') " .append(" WHERE c.Value=i.ConversionTypeValue AND c.AD_Client_ID IN (0,i.AD_Client_ID) AND c.IsActive='Y') ")
+ "WHERE C_ConversionType_ID IS NULL AND ConversionTypeValue IS NOT NULL" .append("WHERE C_ConversionType_ID IS NULL AND ConversionTypeValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.fine("Set ConversionType =" + no); log.fine("Set ConversionType =" + no);
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ConversionType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ConversionType, ' ")
+ "WHERE (C_ConversionType_ID IS NULL" .append("WHERE (C_ConversionType_ID IS NULL")
+ " OR NOT EXISTS (SELECT * FROM C_ConversionType c " .append(" OR NOT EXISTS (SELECT * FROM C_ConversionType c ")
+ "WHERE i.C_ConversionType_ID=c.C_ConversionType_ID AND c.IsActive='Y'" .append("WHERE i.C_ConversionType_ID=c.C_ConversionType_ID AND c.IsActive='Y'")
+ " AND c.AD_Client_ID IN (0,i.AD_Client_ID)))" .append(" AND c.AD_Client_ID IN (0,i.AD_Client_ID)))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid ConversionType =" + no); log.warning ("Invalid ConversionType =" + no);
// Currency // Currency
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET C_Currency_ID = (SELECT C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID = (SELECT C_Currency_ID FROM C_Currency c")
+ " WHERE c.ISO_Code=i.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID) AND c.IsActive='Y') " .append(" WHERE c.ISO_Code=i.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID) AND c.IsActive='Y') ")
+ "WHERE C_Currency_ID IS NULL AND ISO_Code IS NOT NULL" .append("WHERE C_Currency_ID IS NULL AND ISO_Code IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.fine("Set Currency =" + no); log.fine("Set Currency =" + no);
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency, ' ")
+ "WHERE (C_Currency_ID IS NULL" .append("WHERE (C_Currency_ID IS NULL")
+ " OR NOT EXISTS (SELECT * FROM C_Currency c " .append(" OR NOT EXISTS (SELECT * FROM C_Currency c ")
+ "WHERE i.C_Currency_ID=c.C_Currency_ID AND c.IsActive='Y'" .append("WHERE i.C_Currency_ID=c.C_Currency_ID AND c.IsActive='Y'")
+ " AND c.AD_Client_ID IN (0,i.AD_Client_ID)))" .append(" AND c.AD_Client_ID IN (0,i.AD_Client_ID)))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Currency =" + no); log.warning ("Invalid Currency =" + no);
// Currency To // Currency To
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET C_Currency_ID_To = (SELECT C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID_To = (SELECT C_Currency_ID FROM C_Currency c")
+ " WHERE c.ISO_Code=i.ISO_Code_To AND c.AD_Client_ID IN (0,i.AD_Client_ID) AND c.IsActive='Y') " .append(" WHERE c.ISO_Code=i.ISO_Code_To AND c.AD_Client_ID IN (0,i.AD_Client_ID) AND c.IsActive='Y') ")
+ "WHERE C_Currency_ID_To IS NULL AND ISO_Code_To IS NOT NULL" .append("WHERE C_Currency_ID_To IS NULL AND ISO_Code_To IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.fine("Set Currency To =" + no); log.fine("Set Currency To =" + no);
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency To, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency To, ' ")
+ "WHERE (C_Currency_ID_To IS NULL" .append("WHERE (C_Currency_ID_To IS NULL")
+ " OR NOT EXISTS (SELECT * FROM C_Currency c " .append(" OR NOT EXISTS (SELECT * FROM C_Currency c ")
+ "WHERE i.C_Currency_ID_To=c.C_Currency_ID AND c.IsActive='Y'" .append("WHERE i.C_Currency_ID_To=c.C_Currency_ID AND c.IsActive='Y'")
+ " AND c.AD_Client_ID IN (0,i.AD_Client_ID)))" .append(" AND c.AD_Client_ID IN (0,i.AD_Client_ID)))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Currency To =" + no); log.warning ("Invalid Currency To =" + no);
// Rates // Rates
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET MultiplyRate = 1 / DivideRate " .append("SET MultiplyRate = 1 / DivideRate ")
+ "WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0" .append("WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.fine("Set MultiplyRate =" + no); log.fine("Set MultiplyRate =" + no);
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET DivideRate = 1 / MultiplyRate " .append("SET DivideRate = 1 / MultiplyRate ")
+ "WHERE (DivideRate IS NULL OR DivideRate = 0) AND MultiplyRate IS NOT NULL AND MultiplyRate<>0" .append("WHERE (DivideRate IS NULL OR DivideRate = 0) AND MultiplyRate IS NOT NULL AND MultiplyRate<>0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.fine("Set DivideRate =" + no); log.fine("Set DivideRate =" + no);
sql = new StringBuffer ("UPDATE I_Conversion_Rate i " sql = new StringBuilder ("UPDATE I_Conversion_Rate i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Rates, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Rates, ' ")
+ "WHERE (MultiplyRate IS NULL OR MultiplyRate = 0 OR DivideRate IS NULL OR DivideRate = 0)" .append("WHERE (MultiplyRate IS NULL OR MultiplyRate = 0 OR DivideRate IS NULL OR DivideRate = 0)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Rates =" + no); log.warning ("Invalid Rates =" + no);
@ -231,8 +232,8 @@ public class ImportConversionRate extends SvrProcess
/*********************************************************************/ /*********************************************************************/
int noInsert = 0; int noInsert = 0;
sql = new StringBuffer ("SELECT * FROM I_Conversion_Rate " sql = new StringBuilder ("SELECT * FROM I_Conversion_Rate ")
+ "WHERE I_IsImported='N'").append (clientCheck) .append("WHERE I_IsImported='N'").append (clientCheck)
.append(" ORDER BY C_Currency_ID, C_Currency_ID_To, ValidFrom"); .append(" ORDER BY C_Currency_ID, C_Currency_ID_To, ValidFrom");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
@ -289,9 +290,9 @@ public class ImportConversionRate extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_Conversion_Rate " sql = new StringBuilder ("UPDATE I_Conversion_Rate ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //

View File

@ -58,20 +58,25 @@ public class ImportDelete extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
log.info("AD_Table_ID=" + p_AD_Table_ID); StringBuilder msglog = new StringBuilder("AD_Table_ID=").append(p_AD_Table_ID);
log.info(msglog.toString());
// get Table Info // get Table Info
MTable table = new MTable (getCtx(), p_AD_Table_ID, get_TrxName()); MTable table = new MTable (getCtx(), p_AD_Table_ID, get_TrxName());
if (table.get_ID() == 0) if (table.get_ID() == 0){
throw new IllegalArgumentException ("No AD_Table_ID=" + p_AD_Table_ID); StringBuilder msgexc = new StringBuilder("No AD_Table_ID=").append(p_AD_Table_ID);
throw new IllegalArgumentException (msgexc.toString());
}
String tableName = table.getTableName(); String tableName = table.getTableName();
if (!tableName.startsWith("I")) if (!tableName.startsWith("I")){
throw new IllegalArgumentException ("Not an import table = " + tableName); StringBuilder msgexc = new StringBuilder("Not an import table = ").append(tableName);
throw new IllegalArgumentException (msgexc.toString());
}
// Delete // Delete
String sql = "DELETE FROM " + tableName + " WHERE AD_Client_ID=" + getAD_Client_ID(); StringBuilder sql = new StringBuilder("DELETE FROM ").append(tableName).append(" WHERE AD_Client_ID=").append(getAD_Client_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
String msg = Msg.translate(getCtx(), tableName + "_ID") + " #" + no; StringBuilder msg = new StringBuilder(Msg.translate(getCtx(), tableName + "_ID")).append(" #").append(no);
return msg; return msg.toString();
} // ImportDelete } // ImportDelete
} // ImportDelete } // ImportDelete

View File

@ -95,271 +95,272 @@ public class ImportGLJournal extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
log.info("IsValidateOnly=" + m_IsValidateOnly + ", IsImportOnlyNoErrors=" + m_IsImportOnlyNoErrors); StringBuilder msglog = new StringBuilder("IsValidateOnly=").append(m_IsValidateOnly).append(", IsImportOnlyNoErrors=").append(m_IsImportOnlyNoErrors);
StringBuffer sql = null; log.info(msglog.toString());
StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (m_DeleteOldImported) if (m_DeleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_GLJournal " sql = new StringBuilder ("DELETE I_GLJournal ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set IsActive, Created/Updated // Set IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET IsActive = COALESCE (IsActive, 'Y')," .append("SET IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
// Set Client from Name // Set Client from Name
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET AD_Client_ID=(SELECT c.AD_Client_ID FROM AD_Client c WHERE c.Value=i.ClientValue) " .append("SET AD_Client_ID=(SELECT c.AD_Client_ID FROM AD_Client c WHERE c.Value=i.ClientValue) ")
+ "WHERE (AD_Client_ID IS NULL OR AD_Client_ID=0) AND ClientValue IS NOT NULL" .append("WHERE (AD_Client_ID IS NULL OR AD_Client_ID=0) AND ClientValue IS NOT NULL")
+ " AND I_IsImported<>'Y'"); .append(" AND I_IsImported<>'Y'");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Client from Value=" + no); log.fine("Set Client from Value=" + no);
// Set Default Client, Doc Org, AcctSchema, DatAcct // Set Default Client, Doc Org, AcctSchema, DatAcct
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (m_AD_Client_ID).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (m_AD_Client_ID).append ("),")
+ " AD_OrgDoc_ID = COALESCE (AD_OrgDoc_ID,").append (m_AD_Org_ID).append ("),"); .append(" AD_OrgDoc_ID = COALESCE (AD_OrgDoc_ID,").append (m_AD_Org_ID).append ("),");
if (m_C_AcctSchema_ID != 0) if (m_C_AcctSchema_ID != 0)
sql.append(" C_AcctSchema_ID = COALESCE (C_AcctSchema_ID,").append (m_C_AcctSchema_ID).append ("),"); sql.append(" C_AcctSchema_ID = COALESCE (C_AcctSchema_ID,").append (m_C_AcctSchema_ID).append ("),");
if (m_DateAcct != null) if (m_DateAcct != null)
sql.append(" DateAcct = COALESCE (DateAcct,").append (DB.TO_DATE(m_DateAcct)).append ("),"); sql.append(" DateAcct = COALESCE (DateAcct,").append (DB.TO_DATE(m_DateAcct)).append ("),");
sql.append(" Updated = COALESCE (Updated, SysDate) " sql.append(" Updated = COALESCE (Updated, SysDate) ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Client/DocOrg/Default=" + no); log.fine("Client/DocOrg/Default=" + no);
// Error Doc Org // Error Doc Org
sql = new StringBuffer ("UPDATE I_GLJournal o " sql = new StringBuilder ("UPDATE I_GLJournal o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Doc Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Doc Org, '")
+ "WHERE (AD_OrgDoc_ID IS NULL OR AD_OrgDoc_ID=0" .append("WHERE (AD_OrgDoc_ID IS NULL OR AD_OrgDoc_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_OrgDoc_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_OrgDoc_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Doc Org=" + no); log.warning ("Invalid Doc Org=" + no);
// Set AcctSchema // Set AcctSchema
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_AcctSchema_ID=(SELECT a.C_AcctSchema_ID FROM C_AcctSchema a" .append("SET C_AcctSchema_ID=(SELECT a.C_AcctSchema_ID FROM C_AcctSchema a")
+ " WHERE i.AcctSchemaName=a.Name AND i.AD_Client_ID=a.AD_Client_ID) " .append(" WHERE i.AcctSchemaName=a.Name AND i.AD_Client_ID=a.AD_Client_ID) ")
+ "WHERE C_AcctSchema_ID IS NULL AND AcctSchemaName IS NOT NULL" .append("WHERE C_AcctSchema_ID IS NULL AND AcctSchemaName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set AcctSchema from Name=" + no); log.fine("Set AcctSchema from Name=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_AcctSchema_ID=(SELECT c.C_AcctSchema1_ID FROM AD_ClientInfo c WHERE c.AD_Client_ID=i.AD_Client_ID) " .append("SET C_AcctSchema_ID=(SELECT c.C_AcctSchema1_ID FROM AD_ClientInfo c WHERE c.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE C_AcctSchema_ID IS NULL AND AcctSchemaName IS NULL" .append("WHERE C_AcctSchema_ID IS NULL AND AcctSchemaName IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set AcctSchema from Client=" + no); log.fine("Set AcctSchema from Client=" + no);
// Error AcctSchema // Error AcctSchema
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid AcctSchema, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid AcctSchema, '")
+ "WHERE (C_AcctSchema_ID IS NULL OR C_AcctSchema_ID=0" .append("WHERE (C_AcctSchema_ID IS NULL OR C_AcctSchema_ID=0")
+ " OR NOT EXISTS (SELECT * FROM C_AcctSchema a WHERE i.AD_Client_ID=a.AD_Client_ID))" .append(" OR NOT EXISTS (SELECT * FROM C_AcctSchema a WHERE i.AD_Client_ID=a.AD_Client_ID))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid AcctSchema=" + no); log.warning ("Invalid AcctSchema=" + no);
// Set DateAcct (mandatory) // Set DateAcct (mandatory)
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET DateAcct=SysDate " .append("SET DateAcct=SysDate ")
+ "WHERE DateAcct IS NULL" .append("WHERE DateAcct IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set DateAcct=" + no); log.fine("Set DateAcct=" + no);
// Document Type // Document Type
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_DocType_ID=(SELECT d.C_DocType_ID FROM C_DocType d" .append("SET C_DocType_ID=(SELECT d.C_DocType_ID FROM C_DocType d")
+ " WHERE d.Name=i.DocTypeName AND d.DocBaseType='GLJ' AND i.AD_Client_ID=d.AD_Client_ID) " .append(" WHERE d.Name=i.DocTypeName AND d.DocBaseType='GLJ' AND i.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL" .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set DocType=" + no); log.fine("Set DocType=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocType, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocType, '")
+ "WHERE (C_DocType_ID IS NULL OR C_DocType_ID=0" .append("WHERE (C_DocType_ID IS NULL OR C_DocType_ID=0")
+ " OR NOT EXISTS (SELECT * FROM C_DocType d WHERE i.AD_Client_ID=d.AD_Client_ID AND d.DocBaseType='GLJ'))" .append(" OR NOT EXISTS (SELECT * FROM C_DocType d WHERE i.AD_Client_ID=d.AD_Client_ID AND d.DocBaseType='GLJ'))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid DocType=" + no); log.warning ("Invalid DocType=" + no);
// GL Category // GL Category
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET GL_Category_ID=(SELECT c.GL_Category_ID FROM GL_Category c" .append("SET GL_Category_ID=(SELECT c.GL_Category_ID FROM GL_Category c")
+ " WHERE c.Name=i.CategoryName AND i.AD_Client_ID=c.AD_Client_ID) " .append(" WHERE c.Name=i.CategoryName AND i.AD_Client_ID=c.AD_Client_ID) ")
+ "WHERE GL_Category_ID IS NULL AND CategoryName IS NOT NULL" .append("WHERE GL_Category_ID IS NULL AND CategoryName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set DocType=" + no); log.fine("Set DocType=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Category, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Category, '")
+ "WHERE (GL_Category_ID IS NULL OR GL_Category_ID=0)" .append("WHERE (GL_Category_ID IS NULL OR GL_Category_ID=0)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid GLCategory=" + no); log.warning ("Invalid GLCategory=" + no);
// Set Currency // Set Currency
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_Currency_ID=(SELECT c.C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID=(SELECT c.C_Currency_ID FROM C_Currency c")
+ " WHERE c.ISO_Code=i.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) " .append(" WHERE c.ISO_Code=i.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE C_Currency_ID IS NULL AND ISO_Code IS NOT NULL" .append("WHERE C_Currency_ID IS NULL AND ISO_Code IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency from ISO=" + no); log.fine("Set Currency from ISO=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_Currency_ID=(SELECT a.C_Currency_ID FROM C_AcctSchema a" .append("SET C_Currency_ID=(SELECT a.C_Currency_ID FROM C_AcctSchema a")
+ " WHERE a.C_AcctSchema_ID=i.C_AcctSchema_ID AND a.AD_Client_ID=i.AD_Client_ID)" .append(" WHERE a.C_AcctSchema_ID=i.C_AcctSchema_ID AND a.AD_Client_ID=i.AD_Client_ID)")
+ "WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL" .append("WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default Currency=" + no); log.fine("Set Default Currency=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Currency, '")
+ "WHERE (C_Currency_ID IS NULL OR C_Currency_ID=0)" .append("WHERE (C_Currency_ID IS NULL OR C_Currency_ID=0)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Currency=" + no); log.warning ("Invalid Currency=" + no);
// Set Conversion Type // Set Conversion Type
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET ConversionTypeValue='S' " .append("SET ConversionTypeValue='S' ")
+ "WHERE C_ConversionType_ID IS NULL AND ConversionTypeValue IS NULL" .append("WHERE C_ConversionType_ID IS NULL AND ConversionTypeValue IS NULL")
+ " AND I_IsImported='N'").append (clientCheck); .append(" AND I_IsImported='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set CurrencyType Value to Spot =" + no); log.fine("Set CurrencyType Value to Spot =" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_ConversionType_ID=(SELECT c.C_ConversionType_ID FROM C_ConversionType c" .append("SET C_ConversionType_ID=(SELECT c.C_ConversionType_ID FROM C_ConversionType c")
+ " WHERE c.Value=i.ConversionTypeValue AND c.AD_Client_ID IN (0,i.AD_Client_ID)) " .append(" WHERE c.Value=i.ConversionTypeValue AND c.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE C_ConversionType_ID IS NULL AND ConversionTypeValue IS NOT NULL" .append("WHERE C_ConversionType_ID IS NULL AND ConversionTypeValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set CurrencyType from Value=" + no); log.fine("Set CurrencyType from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid CurrencyType, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid CurrencyType, '")
+ "WHERE (C_ConversionType_ID IS NULL OR C_ConversionType_ID=0) AND ConversionTypeValue IS NOT NULL" .append("WHERE (C_ConversionType_ID IS NULL OR C_ConversionType_ID=0) AND ConversionTypeValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid CurrencyTypeValue=" + no); log.warning ("Invalid CurrencyTypeValue=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No ConversionType, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No ConversionType, '")
+ "WHERE (C_ConversionType_ID IS NULL OR C_ConversionType_ID=0)" .append("WHERE (C_ConversionType_ID IS NULL OR C_ConversionType_ID=0)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No CourrencyType=" + no); log.warning ("No CourrencyType=" + no);
// Set/Overwrite Home Currency Rate // Set/Overwrite Home Currency Rate
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET CurrencyRate=1" .append("SET CurrencyRate=1")
+ "WHERE EXISTS (SELECT * FROM C_AcctSchema a" .append("WHERE EXISTS (SELECT * FROM C_AcctSchema a")
+ " WHERE a.C_AcctSchema_ID=i.C_AcctSchema_ID AND a.C_Currency_ID=i.C_Currency_ID)" .append(" WHERE a.C_AcctSchema_ID=i.C_AcctSchema_ID AND a.C_Currency_ID=i.C_Currency_ID)")
+ " AND C_Currency_ID IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append(" AND C_Currency_ID IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Home CurrencyRate=" + no); log.fine("Set Home CurrencyRate=" + no);
// Set Currency Rate // Set Currency Rate
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET CurrencyRate=(SELECT MAX(r.MultiplyRate) FROM C_Conversion_Rate r, C_AcctSchema s" .append("SET CurrencyRate=(SELECT MAX(r.MultiplyRate) FROM C_Conversion_Rate r, C_AcctSchema s")
+ " WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID" .append(" WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID")
+ " AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID" .append(" AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID")
+ " AND r.AD_Client_ID=i.AD_Client_ID AND r.AD_Org_ID=i.AD_OrgDoc_ID" .append(" AND r.AD_Client_ID=i.AD_Client_ID AND r.AD_Org_ID=i.AD_OrgDoc_ID")
+ " AND r.C_ConversionType_ID=i.C_ConversionType_ID" .append(" AND r.C_ConversionType_ID=i.C_ConversionType_ID")
+ " AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo " .append(" AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo ")
// ORDER BY ValidFrom DESC // ORDER BY ValidFrom DESC
+ ") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0" .append(") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Org Rate=" + no); log.fine("Set Org Rate=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET CurrencyRate=(SELECT MAX(r.MultiplyRate) FROM C_Conversion_Rate r, C_AcctSchema s" .append("SET CurrencyRate=(SELECT MAX(r.MultiplyRate) FROM C_Conversion_Rate r, C_AcctSchema s")
+ " WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID" .append(" WHERE s.C_AcctSchema_ID=i.C_AcctSchema_ID AND s.AD_Client_ID=i.AD_Client_ID")
+ " AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID" .append(" AND r.C_Currency_ID=i.C_Currency_ID AND r.C_Currency_ID_TO=s.C_Currency_ID")
+ " AND r.AD_Client_ID=i.AD_Client_ID" .append(" AND r.AD_Client_ID=i.AD_Client_ID")
+ " AND r.C_ConversionType_ID=i.C_ConversionType_ID" .append(" AND r.C_ConversionType_ID=i.C_ConversionType_ID")
+ " AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo " .append(" AND i.DateAcct BETWEEN r.ValidFrom AND r.ValidTo ")
// ORDER BY ValidFrom DESC // ORDER BY ValidFrom DESC
+ ") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0" .append(") WHERE CurrencyRate IS NULL OR CurrencyRate=0 AND C_Currency_ID>0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Client Rate=" + no); log.fine("Set Client Rate=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Rate, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Rate, '")
+ "WHERE CurrencyRate IS NULL OR CurrencyRate=0" .append("WHERE CurrencyRate IS NULL OR CurrencyRate=0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No Rate=" + no); log.warning ("No Rate=" + no);
// Set Period // Set Period
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_Period_ID=(SELECT MAX(p.C_Period_ID) FROM C_Period p" .append("SET C_Period_ID=(SELECT MAX(p.C_Period_ID) FROM C_Period p")
+ " INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)" .append(" INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)")
+ " INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID)" .append(" INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID)")
+ " WHERE c.AD_Client_ID=i.AD_Client_ID" .append(" WHERE c.AD_Client_ID=i.AD_Client_ID")
// globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug // globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug
+ " AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S') " .append(" AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S') ")
+ "WHERE C_Period_ID IS NULL" .append("WHERE C_Period_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Period=" + no); log.fine("Set Period=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Period, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Period, '")
+ "WHERE C_Period_ID IS NULL OR C_Period_ID NOT IN" .append("WHERE C_Period_ID IS NULL OR C_Period_ID NOT IN")
+ "(SELECT C_Period_ID FROM C_Period p" .append("(SELECT C_Period_ID FROM C_Period p")
+ " INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)" .append(" INNER JOIN C_Year y ON (y.C_Year_ID=p.C_Year_ID)")
+ " INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID) " .append(" INNER JOIN AD_ClientInfo c ON (c.C_Calendar_ID=y.C_Calendar_ID) ")
+ " WHERE c.AD_Client_ID=i.AD_Client_ID" .append(" WHERE c.AD_Client_ID=i.AD_Client_ID")
// globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug // globalqss - cruiz - Bug [ 1577712 ] Financial Period Bug
+ " AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S')" .append(" AND i.DateAcct BETWEEN p.StartDate AND p.EndDate AND p.IsActive='Y' AND p.PeriodType='S')")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Period=" + no); log.warning ("Invalid Period=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_ErrorMsg=I_ErrorMsg||'WARN=Period Closed, ' " .append("SET I_ErrorMsg=I_ErrorMsg||'WARN=Period Closed, ' ")
+ "WHERE C_Period_ID IS NOT NULL AND NOT EXISTS" .append("WHERE C_Period_ID IS NOT NULL AND NOT EXISTS")
+ " (SELECT * FROM C_PeriodControl pc WHERE pc.C_Period_ID=i.C_Period_ID AND DocBaseType='GLJ' AND PeriodStatus='O') " .append(" (SELECT * FROM C_PeriodControl pc WHERE pc.C_Period_ID=i.C_Period_ID AND DocBaseType='GLJ' AND PeriodStatus='O') ")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Period Closed=" + no); log.warning ("Period Closed=" + no);
// Posting Type // Posting Type
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET PostingType='A' " .append("SET PostingType='A' ")
+ "WHERE PostingType IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE PostingType IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Actual PostingType=" + no); log.fine("Set Actual PostingType=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid PostingType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid PostingType, ' ")
+ "WHERE PostingType IS NULL OR NOT EXISTS" .append("WHERE PostingType IS NULL OR NOT EXISTS")
+ " (SELECT * FROM AD_Ref_List r WHERE r.AD_Reference_ID=125 AND i.PostingType=r.Value)" .append(" (SELECT * FROM AD_Ref_List r WHERE r.AD_Reference_ID=125 AND i.PostingType=r.Value)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid PostingTypee=" + no); log.warning ("Invalid PostingTypee=" + no);
@ -369,152 +370,152 @@ public class ImportGLJournal extends SvrProcess
// (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) // (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0)
// Set Org from Name (* is overwritten and default) // Set Org from Name (* is overwritten and default)
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET AD_Org_ID=COALESCE((SELECT o.AD_Org_ID FROM AD_Org o" .append("SET AD_Org_ID=COALESCE((SELECT o.AD_Org_ID FROM AD_Org o")
+ " WHERE o.Value=i.OrgValue AND o.IsSummary='N' AND i.AD_Client_ID=o.AD_Client_ID),AD_Org_ID) " .append(" WHERE o.Value=i.OrgValue AND o.IsSummary='N' AND i.AD_Client_ID=o.AD_Client_ID),AD_Org_ID) ")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0) AND OrgValue IS NOT NULL" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0) AND OrgValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'"); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Org from Value=" + no); log.fine("Set Org from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET AD_Org_ID=AD_OrgDoc_ID " .append("SET AD_Org_ID=AD_OrgDoc_ID ")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0) AND OrgValue IS NULL AND AD_OrgDoc_ID IS NOT NULL AND AD_OrgDoc_ID<>0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0) AND OrgValue IS NULL AND AD_OrgDoc_ID IS NOT NULL AND AD_OrgDoc_ID<>0")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Org from Doc Org=" + no); log.fine("Set Org from Doc Org=" + no);
// Error Org // Error Org
sql = new StringBuffer ("UPDATE I_GLJournal o " sql = new StringBuilder ("UPDATE I_GLJournal o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org=" + no); log.warning ("Invalid Org=" + no);
// Set Account // Set Account
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET Account_ID=(SELECT MAX(ev.C_ElementValue_ID) FROM C_ElementValue ev" .append("SET Account_ID=(SELECT MAX(ev.C_ElementValue_ID) FROM C_ElementValue ev")
+ " INNER JOIN C_Element e ON (e.C_Element_ID=ev.C_Element_ID)" .append(" INNER JOIN C_Element e ON (e.C_Element_ID=ev.C_Element_ID)")
+ " INNER JOIN C_AcctSchema_Element ase ON (e.C_Element_ID=ase.C_Element_ID AND ase.ElementType='AC')" .append(" INNER JOIN C_AcctSchema_Element ase ON (e.C_Element_ID=ase.C_Element_ID AND ase.ElementType='AC')")
+ " WHERE ev.Value=i.AccountValue AND ev.IsSummary='N'" .append(" WHERE ev.Value=i.AccountValue AND ev.IsSummary='N'")
+ " AND i.C_AcctSchema_ID=ase.C_AcctSchema_ID AND i.AD_Client_ID=ev.AD_Client_ID) " .append(" AND i.C_AcctSchema_ID=ase.C_AcctSchema_ID AND i.AD_Client_ID=ev.AD_Client_ID) ")
+ "WHERE Account_ID IS NULL AND AccountValue IS NOT NULL" .append("WHERE Account_ID IS NULL AND AccountValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Account from Value=" + no); log.fine("Set Account from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Account, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Account, '")
+ "WHERE (Account_ID IS NULL OR Account_ID=0)" .append("WHERE (Account_ID IS NULL OR Account_ID=0)")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Account=" + no); log.warning ("Invalid Account=" + no);
// Set BPartner // Set BPartner
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_BPartner_ID=(SELECT bp.C_BPartner_ID FROM C_BPartner bp" .append("SET C_BPartner_ID=(SELECT bp.C_BPartner_ID FROM C_BPartner bp")
+ " WHERE bp.Value=i.BPartnerValue AND bp.IsSummary='N' AND i.AD_Client_ID=bp.AD_Client_ID) " .append(" WHERE bp.Value=i.BPartnerValue AND bp.IsSummary='N' AND i.AD_Client_ID=bp.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BPartner from Value=" + no); log.fine("Set BPartner from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner, '")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid BPartner=" + no); log.warning ("Invalid BPartner=" + no);
// Set Product // Set Product
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET M_Product_ID=(SELECT MAX(p.M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(p.M_Product_ID) FROM M_Product p")
+ " WHERE (p.Value=i.ProductValue OR p.UPC=i.UPC OR p.SKU=i.SKU)" .append(" WHERE (p.Value=i.ProductValue OR p.UPC=i.UPC OR p.SKU=i.SKU)")
+ " AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) " .append(" AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)" .append("WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, '")
+ "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)" .append("WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Product=" + no); log.warning ("Invalid Product=" + no);
// Set Project // Set Project
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET C_Project_ID=(SELECT p.C_Project_ID FROM C_Project p" .append("SET C_Project_ID=(SELECT p.C_Project_ID FROM C_Project p")
+ " WHERE p.Value=i.ProjectValue AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.Value=i.ProjectValue AND p.IsSummary='N' AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_Project_ID IS NULL AND ProjectValue IS NOT NULL" .append("WHERE C_Project_ID IS NULL AND ProjectValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Project from Value=" + no); log.fine("Set Project from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Project, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Project, '")
+ "WHERE C_Project_ID IS NULL AND ProjectValue IS NOT NULL" .append("WHERE C_Project_ID IS NULL AND ProjectValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Project=" + no); log.warning ("Invalid Project=" + no);
// Set TrxOrg // Set TrxOrg
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET AD_OrgTrx_ID=(SELECT o.AD_Org_ID FROM AD_Org o" .append("SET AD_OrgTrx_ID=(SELECT o.AD_Org_ID FROM AD_Org o")
+ " WHERE o.Value=i.OrgValue AND o.IsSummary='N' AND i.AD_Client_ID=o.AD_Client_ID) " .append(" WHERE o.Value=i.OrgValue AND o.IsSummary='N' AND i.AD_Client_ID=o.AD_Client_ID) ")
+ "WHERE AD_OrgTrx_ID IS NULL AND OrgTrxValue IS NOT NULL" .append("WHERE AD_OrgTrx_ID IS NULL AND OrgTrxValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set OrgTrx from Value=" + no); log.fine("Set OrgTrx from Value=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid OrgTrx, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid OrgTrx, '")
+ "WHERE AD_OrgTrx_ID IS NULL AND OrgTrxValue IS NOT NULL" .append("WHERE AD_OrgTrx_ID IS NULL AND OrgTrxValue IS NOT NULL")
+ " AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck); .append(" AND (C_ValidCombination_ID IS NULL OR C_ValidCombination_ID=0) AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid OrgTrx=" + no); log.warning ("Invalid OrgTrx=" + no);
// Source Amounts // Source Amounts
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET AmtSourceDr = 0 " .append("SET AmtSourceDr = 0 ")
+ "WHERE AmtSourceDr IS NULL" .append("WHERE AmtSourceDr IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set 0 Source Dr=" + no); log.fine("Set 0 Source Dr=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET AmtSourceCr = 0 " .append("SET AmtSourceCr = 0 ")
+ "WHERE AmtSourceCr IS NULL" .append("WHERE AmtSourceCr IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set 0 Source Cr=" + no); log.fine("Set 0 Source Cr=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_ErrorMsg=I_ErrorMsg||'WARN=Zero Source Balance, ' " .append("SET I_ErrorMsg=I_ErrorMsg||'WARN=Zero Source Balance, ' ")
+ "WHERE (AmtSourceDr-AmtSourceCr)=0" .append("WHERE (AmtSourceDr-AmtSourceCr)=0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Zero Source Balance=" + no); log.warning ("Zero Source Balance=" + no);
// Accounted Amounts (Only if No Error) // Accounted Amounts (Only if No Error)
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET AmtAcctDr = ROUND(AmtSourceDr * CurrencyRate, 2) " // HARDCODED rounding .append("SET AmtAcctDr = ROUND(AmtSourceDr * CurrencyRate, 2) ") // HARDCODED rounding
+ "WHERE AmtAcctDr IS NULL OR AmtAcctDr=0" .append("WHERE AmtAcctDr IS NULL OR AmtAcctDr=0")
+ " AND I_IsImported='N'").append (clientCheck); .append(" AND I_IsImported='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Calculate Acct Dr=" + no); log.fine("Calculate Acct Dr=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET AmtAcctCr = ROUND(AmtSourceCr * CurrencyRate, 2) " .append("SET AmtAcctCr = ROUND(AmtSourceCr * CurrencyRate, 2) ")
+ "WHERE AmtAcctCr IS NULL OR AmtAcctCr=0" .append("WHERE AmtAcctCr IS NULL OR AmtAcctCr=0")
+ " AND I_IsImported='N'").append (clientCheck); .append(" AND I_IsImported='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Calculate Acct Cr=" + no); log.fine("Calculate Acct Cr=" + no);
sql = new StringBuffer ("UPDATE I_GLJournal i " sql = new StringBuilder ("UPDATE I_GLJournal i ")
+ "SET I_ErrorMsg=I_ErrorMsg||'WARN=Zero Acct Balance, ' " .append("SET I_ErrorMsg=I_ErrorMsg||'WARN=Zero Acct Balance, ' ")
+ "WHERE (AmtSourceDr-AmtSourceCr)<>0 AND (AmtAcctDr-AmtAcctCr)=0" .append("WHERE (AmtSourceDr-AmtSourceCr)<>0 AND (AmtAcctDr-AmtAcctCr)=0")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Zero Acct Balance=" + no); log.warning ("Zero Acct Balance=" + no);
@ -533,9 +534,9 @@ public class ImportGLJournal extends SvrProcess
/*********************************************************************/ /*********************************************************************/
// Get Balance // Get Balance
sql = new StringBuffer ("SELECT SUM(AmtSourceDr)-SUM(AmtSourceCr), SUM(AmtAcctDr)-SUM(AmtAcctCr) " sql = new StringBuilder ("SELECT SUM(AmtSourceDr)-SUM(AmtSourceCr), SUM(AmtAcctDr)-SUM(AmtAcctCr) ")
+ "FROM I_GLJournal " .append("FROM I_GLJournal ")
+ "WHERE I_IsImported='N'").append (clientCheck); .append("WHERE I_IsImported='N'").append (clientCheck);
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
@ -548,8 +549,10 @@ public class ImportGLJournal extends SvrProcess
if (source != null && source.signum() == 0 if (source != null && source.signum() == 0
&& acct != null && acct.signum() == 0) && acct != null && acct.signum() == 0)
log.info ("Import Balance = 0"); log.info ("Import Balance = 0");
else else{
log.warning("Balance Source=" + source + ", Acct=" + acct); msglog = new StringBuilder("Balance Source=").append(source).append(", Acct=").append(acct);
log.warning(msglog.toString());
}
if (source != null) if (source != null)
addLog (0, null, source, "@AmtSourceDr@ - @AmtSourceCr@"); addLog (0, null, source, "@AmtSourceDr@ - @AmtSourceCr@");
if (acct != null) if (acct != null)
@ -585,10 +588,12 @@ public class ImportGLJournal extends SvrProcess
if (m_IsValidateOnly || m_IsImportOnlyNoErrors) if (m_IsValidateOnly || m_IsImportOnlyNoErrors)
throw new Exception ("@Errors@=" + errors); throw new Exception ("@Errors@=" + errors);
} }
else if (m_IsValidateOnly) else if (m_IsValidateOnly){
return "@Errors@=" + errors; StringBuilder msgreturn = new StringBuilder("@Errors@=").append(errors);
return msgreturn.toString();
log.info("Validation Errors=" + errors); }
msglog = new StringBuilder("Validation Errors=").append(errors);
log.info(msglog.toString());
// moved commit above to save error messages // moved commit above to save error messages
// commit(); // commit();
@ -606,11 +611,11 @@ public class ImportGLJournal extends SvrProcess
boolean wasCreateNewBatch = false; boolean wasCreateNewBatch = false;
// Go through Journal Records // Go through Journal Records
sql = new StringBuffer ("SELECT * FROM I_GLJournal " sql = new StringBuilder ("SELECT * FROM I_GLJournal ")
+ "WHERE I_IsImported='N'").append (clientCheck) .append("WHERE I_IsImported='N'").append (clientCheck)
.append(" ORDER BY COALESCE(BatchDocumentNo, TO_NCHAR(I_GLJournal_ID)||' '), COALESCE(JournalDocumentNo, " + .append(" ORDER BY COALESCE(BatchDocumentNo, TO_NCHAR(I_GLJournal_ID)||' '), COALESCE(JournalDocumentNo, ")
"TO_NCHAR(I_GLJournal_ID)||' '), C_AcctSchema_ID, PostingType, C_DocType_ID, GL_Category_ID, " + .append("TO_NCHAR(I_GLJournal_ID)||' '), C_AcctSchema_ID, PostingType, C_DocType_ID, GL_Category_ID, ")
"C_Currency_ID, TRUNC(DateAcct), Line, I_GLJournal_ID"); .append("C_Currency_ID, TRUNC(DateAcct), Line, I_GLJournal_ID");
try try
{ {
pstmt = DB.prepareStatement (sql.toString (), get_TrxName()); pstmt = DB.prepareStatement (sql.toString (), get_TrxName());
@ -647,13 +652,13 @@ public class ImportGLJournal extends SvrProcess
batch.setDocumentNo (imp.getBatchDocumentNo()); batch.setDocumentNo (imp.getBatchDocumentNo());
batch.setC_DocType_ID(imp.getC_DocType_ID()); batch.setC_DocType_ID(imp.getC_DocType_ID());
batch.setPostingType(imp.getPostingType()); batch.setPostingType(imp.getPostingType());
String description = imp.getBatchDescription(); StringBuilder description = new StringBuilder(imp.getBatchDescription());
if (description == null || description.length() == 0) if (description == null || description.length() == 0)
description = "*Import-"; description = new StringBuilder("*Import-");
else else
description += " *Import-"; description.append(" *Import-");
description += new Timestamp(System.currentTimeMillis()); description.append(new Timestamp(System.currentTimeMillis()));
batch.setDescription(description); batch.setDescription(description.toString());
if (!batch.save()) if (!batch.save())
{ {
log.log(Level.SEVERE, "Batch not saved"); log.log(Level.SEVERE, "Batch not saved");
@ -795,9 +800,9 @@ public class ImportGLJournal extends SvrProcess
pstmt = null; pstmt = null;
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_GLJournal " sql = new StringBuilder ("UPDATE I_GLJournal ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //

View File

@ -68,67 +68,68 @@ public class ImportInOutConfirm extends SvrProcess
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("I_InOutLineConfirm_ID=" + p_I_InOutLineConfirm_ID); StringBuilder msglog = new StringBuilder("I_InOutLineConfirm_ID=").append(p_I_InOutLineConfirm_ID);
StringBuffer sql = null; log.info(msglog.toString());
StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + p_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(p_AD_Client_ID);
// Delete Old Imported // Delete Old Imported
if (p_DeleteOldImported) if (p_DeleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_InOutLineConfirm " sql = new StringBuilder ("DELETE I_InOutLineConfirm ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set IsActive, Created/Updated // Set IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_InOutLineConfirm " sql = new StringBuilder ("UPDATE I_InOutLineConfirm ")
+ "SET IsActive = COALESCE (IsActive, 'Y')," .append("SET IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
// Set Client from Name // Set Client from Name
sql = new StringBuffer ("UPDATE I_InOutLineConfirm i " sql = new StringBuilder ("UPDATE I_InOutLineConfirm i ")
+ "SET AD_Client_ID=COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append (") " .append("SET AD_Client_ID=COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append (") ")
+ "WHERE (AD_Client_ID IS NULL OR AD_Client_ID=0)" .append("WHERE (AD_Client_ID IS NULL OR AD_Client_ID=0)")
+ " AND I_IsImported<>'Y'"); .append(" AND I_IsImported<>'Y'");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Client from Value=" + no); log.fine("Set Client from Value=" + no);
// Error Confirmation Line // Error Confirmation Line
sql = new StringBuffer ("UPDATE I_InOutLineConfirm i " sql = new StringBuilder ("UPDATE I_InOutLineConfirm i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Confirmation Line, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Confirmation Line, '")
+ "WHERE (M_InOutLineConfirm_ID IS NULL OR M_InOutLineConfirm_ID=0" .append("WHERE (M_InOutLineConfirm_ID IS NULL OR M_InOutLineConfirm_ID=0")
+ " OR NOT EXISTS (SELECT * FROM M_InOutLineConfirm c WHERE i.M_InOutLineConfirm_ID=c.M_InOutLineConfirm_ID))" .append(" OR NOT EXISTS (SELECT * FROM M_InOutLineConfirm c WHERE i.M_InOutLineConfirm_ID=c.M_InOutLineConfirm_ID))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid InOutLineConfirm=" + no); log.warning ("Invalid InOutLineConfirm=" + no);
// Error Confirmation No // Error Confirmation No
sql = new StringBuffer ("UPDATE I_InOutLineConfirm i " sql = new StringBuilder ("UPDATE I_InOutLineConfirm i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Missing Confirmation No, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Missing Confirmation No, '")
+ "WHERE (ConfirmationNo IS NULL OR ConfirmationNo='')" .append("WHERE (ConfirmationNo IS NULL OR ConfirmationNo='')")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid ConfirmationNo=" + no); log.warning ("Invalid ConfirmationNo=" + no);
// Qty // Qty
sql = new StringBuffer ("UPDATE I_InOutLineConfirm i " sql = new StringBuilder ("UPDATE I_InOutLineConfirm i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Target<>(Confirmed+Difference+Scrapped), ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Target<>(Confirmed+Difference+Scrapped), ' ")
+ "WHERE EXISTS (SELECT * FROM M_InOutLineConfirm c " .append("WHERE EXISTS (SELECT * FROM M_InOutLineConfirm c ")
+ "WHERE i.M_InOutLineConfirm_ID=c.M_InOutLineConfirm_ID" .append("WHERE i.M_InOutLineConfirm_ID=c.M_InOutLineConfirm_ID")
+ " AND c.TargetQty<>(i.ConfirmedQty+i.ScrappedQty+i.DifferenceQty))" .append(" AND c.TargetQty<>(i.ConfirmedQty+i.ScrappedQty+i.DifferenceQty))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Qty=" + no); log.warning ("Invalid Qty=" + no);
@ -138,8 +139,8 @@ public class ImportInOutConfirm extends SvrProcess
/*********************************************************************/ /*********************************************************************/
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
sql = new StringBuffer ("SELECT * FROM I_InOutLineConfirm " sql = new StringBuilder ("SELECT * FROM I_InOutLineConfirm ")
+ "WHERE I_IsImported='N'").append (clientCheck) .append("WHERE I_IsImported='N'").append (clientCheck)
.append(" ORDER BY I_InOutLineConfirm_ID"); .append(" ORDER BY I_InOutLineConfirm_ID");
no = 0; no = 0;
try try
@ -193,8 +194,8 @@ public class ImportInOutConfirm extends SvrProcess
{ {
pstmt = null; pstmt = null;
} }
StringBuilder msgreturn = new StringBuilder("@Updated@ #").append(no);
return "@Updated@ #" + no; return msgreturn.toString();
} // doIt } // doIt
} // ImportInOutConfirm } // ImportInOutConfirm

View File

@ -112,7 +112,8 @@ public class ImportInventory extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
log.info("M_Locator_ID=" + p_M_Locator_ID + ",MovementDate=" + p_MovementDate); StringBuilder msglog = new StringBuilder("M_Locator_ID=").append(p_M_Locator_ID).append(",MovementDate=").append(p_MovementDate);
log.info(msglog.toString());
if (p_UpdateCosting) { if (p_UpdateCosting) {
if (p_C_AcctSchema_ID <= 0) { if (p_C_AcctSchema_ID <= 0) {
@ -130,174 +131,174 @@ public class ImportInventory extends SvrProcess
acctSchema = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID, get_TrxName()); acctSchema = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID, get_TrxName());
} }
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + p_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(p_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (p_DeleteOldImported) if (p_DeleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_Inventory " sql = new StringBuilder ("DELETE I_Inventory ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Delete Old Imported=" + no); log.fine("Delete Old Imported=" + no);
} }
// Set Client, Org, Location, IsActive, Created/Updated // Set Client, Org, Location, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (p_AD_Client_ID).append ("),")
+ " AD_Org_ID = DECODE (NVL(AD_Org_ID),0,").append (p_AD_Org_ID).append (",AD_Org_ID),"); .append(" AD_Org_ID = DECODE (NVL(AD_Org_ID),0,").append (p_AD_Org_ID).append (",AD_Org_ID),");
if (p_MovementDate != null) if (p_MovementDate != null)
sql.append(" MovementDate = COALESCE (MovementDate,").append (DB.TO_DATE(p_MovementDate)).append ("),"); sql.append(" MovementDate = COALESCE (MovementDate,").append (DB.TO_DATE(p_MovementDate)).append ("),");
sql.append(" IsActive = COALESCE (IsActive, 'Y')," sql.append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " M_Warehouse_ID = NULL," // reset .append(" M_Warehouse_ID = NULL,") // reset
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
sql = new StringBuffer ("UPDATE I_Inventory o " sql = new StringBuilder ("UPDATE I_Inventory o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org=" + no); log.warning ("Invalid Org=" + no);
// Document Type // Document Type
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET C_DocType_ID=(SELECT d.C_DocType_ID FROM C_DocType d" .append("SET C_DocType_ID=(SELECT d.C_DocType_ID FROM C_DocType d")
+ " WHERE d.Name=i.DocTypeName AND d.DocBaseType='MMI' AND i.AD_Client_ID=d.AD_Client_ID) " .append(" WHERE d.Name=i.DocTypeName AND d.DocBaseType='MMI' AND i.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL" .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set DocType=" + no); log.fine("Set DocType=" + no);
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocType, ' ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL" .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid DocType=" + no); log.warning ("Invalid DocType=" + no);
// Locator // Locator
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET M_Locator_ID=(SELECT MAX(M_Locator_ID) FROM M_Locator l" .append("SET M_Locator_ID=(SELECT MAX(M_Locator_ID) FROM M_Locator l")
+ " WHERE i.LocatorValue=l.Value AND i.AD_Client_ID=l.AD_Client_ID) " .append(" WHERE i.LocatorValue=l.Value AND i.AD_Client_ID=l.AD_Client_ID) ")
+ "WHERE M_Locator_ID IS NULL AND LocatorValue IS NOT NULL" .append("WHERE M_Locator_ID IS NULL AND LocatorValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Locator from Value =" + no); log.fine("Set Locator from Value =" + no);
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET M_Locator_ID=(SELECT MAX(M_Locator_ID) FROM M_Locator l" .append("SET M_Locator_ID=(SELECT MAX(M_Locator_ID) FROM M_Locator l")
+ " WHERE i.X=l.X AND i.Y=l.Y AND i.Z=l.Z AND i.AD_Client_ID=l.AD_Client_ID) " .append(" WHERE i.X=l.X AND i.Y=l.Y AND i.Z=l.Z AND i.AD_Client_ID=l.AD_Client_ID) ")
+ "WHERE M_Locator_ID IS NULL AND X IS NOT NULL AND Y IS NOT NULL AND Z IS NOT NULL" .append("WHERE M_Locator_ID IS NULL AND X IS NOT NULL AND Y IS NOT NULL AND Z IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Locator from X,Y,Z =" + no); log.fine("Set Locator from X,Y,Z =" + no);
if (p_M_Locator_ID != 0) if (p_M_Locator_ID != 0)
{ {
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET M_Locator_ID = ").append (p_M_Locator_ID).append ( .append("SET M_Locator_ID = ").append (p_M_Locator_ID)
" WHERE M_Locator_ID IS NULL" .append (" WHERE M_Locator_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Locator from Parameter=" + no); log.fine("Set Locator from Parameter=" + no);
} }
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Location, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Location, ' ")
+ "WHERE M_Locator_ID IS NULL" .append("WHERE M_Locator_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No Location=" + no); log.warning ("No Location=" + no);
// Set M_Warehouse_ID // Set M_Warehouse_ID
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Locator l WHERE i.M_Locator_ID=l.M_Locator_ID) " .append("SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Locator l WHERE i.M_Locator_ID=l.M_Locator_ID) ")
+ "WHERE M_Locator_ID IS NOT NULL" .append("WHERE M_Locator_ID IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Warehouse from Locator =" + no); log.fine("Set Warehouse from Locator =" + no);
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Warehouse, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Warehouse, ' ")
+ "WHERE M_Warehouse_ID IS NULL" .append("WHERE M_Warehouse_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No Warehouse=" + no); log.warning ("No Warehouse=" + no);
// Product // Product
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE i.Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND Value IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND Value IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_Inventory i " sql = new StringBuilder ("UPDATE I_Inventory i ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE i.UPC=p.UPC AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.UPC=p.UPC AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND UPC IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
log.fine("Set Product from UPC=" + no); log.fine("Set Product from UPC=" + no);
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Product, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Product, ' ")
+ "WHERE M_Product_ID IS NULL" .append("WHERE M_Product_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No Product=" + no); log.warning ("No Product=" + no);
// Charge // Charge
sql = new StringBuffer ("UPDATE I_Inventory o " sql = new StringBuilder ("UPDATE I_Inventory o ")
+ "SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge p" .append("SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge p")
+ " WHERE o.ChargeName=p.Name AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.ChargeName=p.Name AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Charge=" + no); log.fine("Set Charge=" + no);
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' ")
+ "WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)" .append("WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Charge=" + no); log.warning ("Invalid Charge=" + no);
// No QtyCount or QtyInternalUse // No QtyCount or QtyInternalUse
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Qty Count or Internal Use, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Qty Count or Internal Use, ' ")
+ "WHERE QtyCount IS NULL AND QtyInternalUse IS NULL" .append("WHERE QtyCount IS NULL AND QtyInternalUse IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No QtyCount or QtyInternalUse=" + no); log.warning ("No QtyCount or QtyInternalUse=" + no);
// Excluding quantities // Excluding quantities
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Excluding quantities, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Excluding quantities, ' ")
+ "WHERE NVL(QtyInternalUse,0)<>0 AND (NVL(QtyCount,0)<>0 OR NVL(QtyBook,0)<>0) " .append("WHERE NVL(QtyInternalUse,0)<>0 AND (NVL(QtyCount,0)<>0 OR NVL(QtyBook,0)<>0) ")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Excluding quantities=" + no); log.warning ("Excluding quantities=" + no);
// Required charge for internal use // Required charge for internal use
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Required charge, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Required charge, ' ")
+ "WHERE NVL(QtyInternalUse,0)<>0 AND NVL(C_Charge_ID,0)=0 " .append("WHERE NVL(QtyInternalUse,0)<>0 AND NVL(C_Charge_ID,0)=0 ")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate (sql.toString (), get_TrxName()); no = DB.executeUpdate (sql.toString (), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Required charge=" + no); log.warning ("Required charge=" + no);
@ -312,8 +313,8 @@ public class ImportInventory extends SvrProcess
int noInsertLine = 0; int noInsertLine = 0;
// Go through Inventory Records // Go through Inventory Records
sql = new StringBuffer ("SELECT * FROM I_Inventory " sql = new StringBuilder ("SELECT * FROM I_Inventory ")
+ "WHERE I_IsImported='N'").append (clientCheck) .append("WHERE I_IsImported='N'").append (clientCheck)
.append(" ORDER BY M_Warehouse_ID, TRUNC(MovementDate), I_Inventory_ID"); .append(" ORDER BY M_Warehouse_ID, TRUNC(MovementDate), I_Inventory_ID");
try try
{ {
@ -415,9 +416,9 @@ public class ImportInventory extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_Inventory " sql = new StringBuilder ("UPDATE I_Inventory ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //

View File

@ -86,282 +86,282 @@ public class ImportInvoice extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_Invoice " sql = new StringBuilder ("DELETE I_Invoice ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (m_AD_Client_ID).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (m_AD_Client_ID).append ("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID,").append (m_AD_Org_ID).append (")," .append(" AD_Org_ID = COALESCE (AD_Org_ID,").append (m_AD_Org_ID).append ("),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org=" + no); log.warning ("Invalid Org=" + no);
// Document Type - PO - SO // Document Type - PO - SO
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName")
+ " AND d.DocBaseType IN ('API','APC') AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN ('API','APC') AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set PO DocType=" + no); log.fine("Set PO DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName")
+ " AND d.DocBaseType IN ('ARI','ARC') AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN ('ARI','ARC') AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set SO DocType=" + no); log.fine("Set SO DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName")
+ " AND d.DocBaseType IN ('API','ARI','APC','ARC') AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN ('API','ARI','APC','ARC') AND o.AD_Client_ID=d.AD_Client_ID) ")
//+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); //+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set DocType=" + no); log.fine("Set DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocTypeName, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocTypeName, ' ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL" .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid DocTypeName=" + no); log.warning ("Invalid DocTypeName=" + no);
// DocType Default // DocType Default
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'" .append("SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'")
+ " AND d.DocBaseType='API' AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType='API' AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set PO Default DocType=" + no); log.fine("Set PO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'" .append("SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'")
+ " AND d.DocBaseType='ARI' AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType='ARI' AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set SO Default DocType=" + no); log.fine("Set SO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'" .append("SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'")
+ " AND d.DocBaseType IN('ARI','API') AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN('ARI','API') AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set Default DocType=" + no); log.fine("Set Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No DocType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No DocType, ' ")
+ "WHERE C_DocType_ID IS NULL" .append("WHERE C_DocType_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No DocType=" + no); log.warning ("No DocType=" + no);
// Set IsSOTrx // Set IsSOTrx
sql = new StringBuffer ("UPDATE I_Invoice o SET IsSOTrx='Y' " sql = new StringBuilder ("UPDATE I_Invoice o SET IsSOTrx='Y' ")
+ "WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='ARI' AND o.AD_Client_ID=d.AD_Client_ID)" .append("WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='ARI' AND o.AD_Client_ID=d.AD_Client_ID)")
+ " AND C_DocType_ID IS NOT NULL" .append(" AND C_DocType_ID IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsSOTrx=Y=" + no); log.fine("Set IsSOTrx=Y=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o SET IsSOTrx='N' " sql = new StringBuilder ("UPDATE I_Invoice o SET IsSOTrx='N' ")
+ "WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='API' AND o.AD_Client_ID=d.AD_Client_ID)" .append("WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='API' AND o.AD_Client_ID=d.AD_Client_ID)")
+ " AND C_DocType_ID IS NOT NULL" .append(" AND C_DocType_ID IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsSOTrx=N=" + no); log.fine("Set IsSOTrx=N=" + no);
// Price List // Price List
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'" .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'")
+ " AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default Currency PriceList=" + no); log.fine("Set Default Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'" .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'")
+ " AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PriceList=" + no); log.fine("Set Default PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p " .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p ")
+ " WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency PriceList=" + no); log.fine("Set Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p " .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p ")
+ " WHERE p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PriceList=" + no); log.fine("Set PriceList=" + no);
// //
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PriceList, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PriceList, ' ")
+ "WHERE M_PriceList_ID IS NULL" .append("WHERE M_PriceList_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No PriceList=" + no); log.warning("No PriceList=" + no);
// Payment Term // Payment Term
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_PaymentTerm_ID=(SELECT C_PaymentTerm_ID FROM C_PaymentTerm p" .append("SET C_PaymentTerm_ID=(SELECT C_PaymentTerm_ID FROM C_PaymentTerm p")
+ " WHERE o.PaymentTermValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.PaymentTermValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_PaymentTerm_ID IS NULL AND PaymentTermValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_PaymentTerm_ID IS NULL AND PaymentTermValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PaymentTerm=" + no); log.fine("Set PaymentTerm=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_PaymentTerm_ID=(SELECT MAX(C_PaymentTerm_ID) FROM C_PaymentTerm p" .append("SET C_PaymentTerm_ID=(SELECT MAX(C_PaymentTerm_ID) FROM C_PaymentTerm p")
+ " WHERE p.IsDefault='Y' AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.IsDefault='Y' AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PaymentTerm=" + no); log.fine("Set Default PaymentTerm=" + no);
// //
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PaymentTerm, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PaymentTerm, ' ")
+ "WHERE C_PaymentTerm_ID IS NULL" .append("WHERE C_PaymentTerm_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No PaymentTerm=" + no); log.warning ("No PaymentTerm=" + no);
// globalqss - Add project and activity // globalqss - Add project and activity
// Project // Project
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_Project_ID=(SELECT C_Project_ID FROM C_Project p" .append("SET C_Project_ID=(SELECT C_Project_ID FROM C_Project p")
+ " WHERE o.ProjectValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.ProjectValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_Project_ID IS NULL AND ProjectValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_Project_ID IS NULL AND ProjectValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Project=" + no); log.fine("Set Project=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Project, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Project, ' ")
+ "WHERE C_Project_ID IS NULL AND (ProjectValue IS NOT NULL)" .append("WHERE C_Project_ID IS NULL AND (ProjectValue IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Project=" + no); log.warning ("Invalid Project=" + no);
// Activity // Activity
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_Activity_ID=(SELECT C_Activity_ID FROM C_Activity p" .append("SET C_Activity_ID=(SELECT C_Activity_ID FROM C_Activity p")
+ " WHERE o.ActivityValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.ActivityValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_Activity_ID IS NULL AND ActivityValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_Activity_ID IS NULL AND ActivityValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Activity=" + no); log.fine("Set Activity=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Activity, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Activity, ' ")
+ "WHERE C_Activity_ID IS NULL AND (ActivityValue IS NOT NULL)" .append("WHERE C_Activity_ID IS NULL AND (ActivityValue IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Activity=" + no); log.warning ("Invalid Activity=" + no);
// globalqss - add charge // globalqss - add charge
// Charge // Charge
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge p" .append("SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge p")
+ " WHERE o.ChargeName=p.Name AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.ChargeName=p.Name AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Charge=" + no); log.fine("Set Charge=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' ")
+ "WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)" .append("WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Charge=" + no); log.warning ("Invalid Charge=" + no);
// //
// BP from EMail // BP from EMail
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u" .append("SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u")
+ " WHERE o.EMail=u.EMail AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) " .append(" WHERE o.EMail=u.EMail AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) ")
+ "WHERE C_BPartner_ID IS NULL AND EMail IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND EMail IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP from EMail=" + no); log.fine("Set BP from EMail=" + no);
// BP from ContactName // BP from ContactName
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u" .append("SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u")
+ " WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) " .append(" WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) ")
+ "WHERE C_BPartner_ID IS NULL AND ContactName IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND ContactName IS NOT NULL")
+ " AND EXISTS (SELECT Name FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1)" .append(" AND EXISTS (SELECT Name FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP from ContactName=" + no); log.fine("Set BP from ContactName=" + no);
// BP from Value // BP from Value
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp" .append("SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp")
+ " WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID) " .append(" WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP from Value=" + no); log.fine("Set BP from Value=" + no);
// Default BP // Default BP
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_BPartner_ID=(SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo c" .append("SET C_BPartner_ID=(SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo c")
+ " WHERE o.AD_Client_ID=c.AD_Client_ID) " .append(" WHERE o.AD_Client_ID=c.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NULL AND Name IS NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NULL AND Name IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default BP=" + no); log.fine("Set Default BP=" + no);
// Existing Location ? Exact Match // Existing Location ? Exact Match
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID" .append("SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID")
+ " FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)" .append(" FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)")
+ " WHERE o.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=o.AD_Client_ID" .append(" WHERE o.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=o.AD_Client_ID")
+ " AND DUMP(o.Address1)=DUMP(l.Address1) AND DUMP(o.Address2)=DUMP(l.Address2)" .append(" AND DUMP(o.Address1)=DUMP(l.Address1) AND DUMP(o.Address2)=DUMP(l.Address2)")
+ " AND DUMP(o.City)=DUMP(l.City) AND DUMP(o.Postal)=DUMP(l.Postal)" .append(" AND DUMP(o.City)=DUMP(l.City) AND DUMP(o.Postal)=DUMP(l.Postal)")
+ " AND o.C_Region_ID=l.C_Region_ID AND o.C_Country_ID=l.C_Country_ID) " .append(" AND o.C_Region_ID=l.C_Region_ID AND o.C_Country_ID=l.C_Country_ID) ")
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL")
+ " AND I_IsImported='N'").append (clientCheck); .append(" AND I_IsImported='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Found Location=" + no); log.fine("Found Location=" + no);
// Set Location from BPartner // Set Location from BPartner
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_BPartner_Location_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l" .append("SET C_BPartner_Location_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l")
+ " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID" .append(" WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID")
+ " AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')" .append(" AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')")
+ ") " .append(") ")
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP Location from BP=" + no); log.fine("Set BP Location from BP=" + no);
// //
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BP Location, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BP Location, ' ")
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No BP Location=" + no); log.warning ("No BP Location=" + no);
@ -376,102 +376,102 @@ public class ImportInvoice extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Country Default=" + no); log.fine("Set Country Default=" + no);
**/ **/
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c" .append("SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c")
+ " WHERE o.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, o.AD_Client_ID)) " .append(" WHERE o.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, o.AD_Client_ID)) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL AND CountryCode IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL AND CountryCode IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Country=" + no); log.fine("Set Country=" + no);
// //
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' ")
+ "WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Country=" + no); log.warning ("Invalid Country=" + no);
// Set Region // Set Region
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "Set RegionName=(SELECT MAX(Name) FROM C_Region r" .append("Set RegionName=(SELECT MAX(Name) FROM C_Region r")
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID" .append(" WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID")
+ " AND r.AD_Client_ID IN (0, o.AD_Client_ID)) " .append(" AND r.AD_Client_ID IN (0, o.AD_Client_ID)) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Region Default=" + no); log.fine("Set Region Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r" .append("Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r")
+ " WHERE r.Name=o.RegionName AND r.C_Country_ID=o.C_Country_ID" .append(" WHERE r.Name=o.RegionName AND r.C_Country_ID=o.C_Country_ID")
+ " AND r.AD_Client_ID IN (0, o.AD_Client_ID)) " .append(" AND r.AD_Client_ID IN (0, o.AD_Client_ID)) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Region=" + no); log.fine("Set Region=" + no);
// //
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' ")
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL " .append("WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL ")
+ " AND EXISTS (SELECT * FROM C_Country c" .append(" AND EXISTS (SELECT * FROM C_Country c")
+ " WHERE c.C_Country_ID=o.C_Country_ID AND c.HasRegion='Y')" .append(" WHERE c.C_Country_ID=o.C_Country_ID AND c.HasRegion='Y')")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Region=" + no); log.warning ("Invalid Region=" + no);
// Product // Product
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND UPC IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from UPC=" + no); log.fine("Set Product from UPC=" + no);
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND SKU IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND SKU IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product fom SKU=" + no); log.fine("Set Product fom SKU=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, ' ")
+ "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)" .append("WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Product=" + no); log.warning ("Invalid Product=" + no);
// globalqss - charge and product are exclusive // globalqss - charge and product are exclusive
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Product and Charge, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Product and Charge, ' ")
+ "WHERE M_Product_ID IS NOT NULL AND C_Charge_ID IS NOT NULL " .append("WHERE M_Product_ID IS NOT NULL AND C_Charge_ID IS NOT NULL ")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Product and Charge exclusive=" + no); log.warning ("Invalid Product and Charge exclusive=" + no);
// Tax // Tax
sql = new StringBuffer ("UPDATE I_Invoice o " sql = new StringBuilder ("UPDATE I_Invoice o ")
+ "SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t" .append("SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t")
+ " WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID) " .append(" WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID) ")
+ "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL" .append("WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Tax=" + no); log.fine("Set Tax=" + no);
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Tax, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Tax, ' ")
+ "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL" .append("WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Tax=" + no); log.warning ("Invalid Tax=" + no);
@ -481,8 +481,8 @@ public class ImportInvoice extends SvrProcess
// -- New BPartner --------------------------------------------------- // -- New BPartner ---------------------------------------------------
// Go through Invoice Records w/o C_BPartner_ID // Go through Invoice Records w/o C_BPartner_ID
sql = new StringBuffer ("SELECT * FROM I_Invoice " sql = new StringBuilder ("SELECT * FROM I_Invoice ")
+ "WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck); .append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
try try
{ {
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName()); PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
@ -601,10 +601,10 @@ public class ImportInvoice extends SvrProcess
{ {
log.log(Level.SEVERE, "CreateBP", e); log.log(Level.SEVERE, "CreateBP", e);
} }
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
+ "WHERE C_BPartner_ID IS NULL" .append("WHERE C_BPartner_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No BPartner=" + no); log.warning ("No BPartner=" + no);
@ -617,8 +617,8 @@ public class ImportInvoice extends SvrProcess
int noInsertLine = 0; int noInsertLine = 0;
// Go through Invoice Records w/o // Go through Invoice Records w/o
sql = new StringBuffer ("SELECT * FROM I_Invoice " sql = new StringBuilder ("SELECT * FROM I_Invoice ")
+ "WHERE I_IsImported='N'").append (clientCheck) .append("WHERE I_IsImported='N'").append (clientCheck)
.append(" ORDER BY C_BPartner_ID, C_BPartner_Location_ID, I_Invoice_ID"); .append(" ORDER BY C_BPartner_ID, C_BPartner_Location_ID, I_Invoice_ID");
try try
{ {
@ -760,9 +760,9 @@ public class ImportInvoice extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_Invoice " sql = new StringBuilder ("UPDATE I_Invoice ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //

View File

@ -88,7 +88,7 @@ public class ImportOrder extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID; String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID;
@ -97,272 +97,272 @@ public class ImportOrder extends SvrProcess
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_Order " sql = new StringBuilder ("DELETE I_Order ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (m_AD_Client_ID).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (m_AD_Client_ID).append ("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID,").append (m_AD_Org_ID).append (")," .append(" AD_Org_ID = COALESCE (AD_Org_ID,").append (m_AD_Org_ID).append ("),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org=" + no); log.warning ("Invalid Org=" + no);
// Document Type - PO - SO // Document Type - PO - SO
sql = new StringBuffer ("UPDATE I_Order o " // PO Document Type Name sql = new StringBuilder ("UPDATE I_Order o ") // PO Document Type Name
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName")
+ " AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PO DocType=" + no); log.fine("Set PO DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order o " // SO Document Type Name sql = new StringBuilder ("UPDATE I_Order o ") // SO Document Type Name
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName")
+ " AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set SO DocType=" + no); log.fine("Set SO DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=o.DocTypeName")
+ " AND d.DocBaseType IN ('SOO','POO') AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN ('SOO','POO') AND o.AD_Client_ID=d.AD_Client_ID) ")
//+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); //+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set DocType=" + no); log.fine("Set DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order " // Error Invalid Doc Type Name sql = new StringBuilder ("UPDATE I_Order ") // Error Invalid Doc Type Name
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocTypeName, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocTypeName, ' ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL" .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid DocTypeName=" + no); log.warning ("Invalid DocTypeName=" + no);
// DocType Default // DocType Default
sql = new StringBuffer ("UPDATE I_Order o " // Default PO sql = new StringBuilder ("UPDATE I_Order o ") // Default PO
+ "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'" .append("SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'")
+ " AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='N' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PO Default DocType=" + no); log.fine("Set PO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order o " // Default SO sql = new StringBuilder ("UPDATE I_Order o ") // Default SO
+ "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'" .append("SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'")
+ " AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx='Y' AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set SO Default DocType=" + no); log.fine("Set SO Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'" .append("SET C_DocType_ID=(SELECT MAX(C_DocType_ID) FROM C_DocType d WHERE d.IsDefault='Y'")
+ " AND d.DocBaseType IN('SOO','POO') AND o.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN('SOO','POO') AND o.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND IsSOTrx IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default DocType=" + no); log.fine("Set Default DocType=" + no);
sql = new StringBuffer ("UPDATE I_Order " // No DocType sql = new StringBuilder ("UPDATE I_Order ") // No DocType
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No DocType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No DocType, ' ")
+ "WHERE C_DocType_ID IS NULL" .append("WHERE C_DocType_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No DocType=" + no); log.warning ("No DocType=" + no);
// Set IsSOTrx // Set IsSOTrx
sql = new StringBuffer ("UPDATE I_Order o SET IsSOTrx='Y' " sql = new StringBuilder ("UPDATE I_Order o SET IsSOTrx='Y' ")
+ "WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID)" .append("WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='SOO' AND o.AD_Client_ID=d.AD_Client_ID)")
+ " AND C_DocType_ID IS NOT NULL" .append(" AND C_DocType_ID IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsSOTrx=Y=" + no); log.fine("Set IsSOTrx=Y=" + no);
sql = new StringBuffer ("UPDATE I_Order o SET IsSOTrx='N' " sql = new StringBuilder ("UPDATE I_Order o SET IsSOTrx='N' ")
+ "WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID)" .append("WHERE EXISTS (SELECT * FROM C_DocType d WHERE o.C_DocType_ID=d.C_DocType_ID AND d.DocBaseType='POO' AND o.AD_Client_ID=d.AD_Client_ID)")
+ " AND C_DocType_ID IS NOT NULL" .append(" AND C_DocType_ID IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsSOTrx=N=" + no); log.fine("Set IsSOTrx=N=" + no);
// Price List // Price List
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'" .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'")
+ " AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" AND p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default Currency PriceList=" + no); log.fine("Set Default Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'" .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p WHERE p.IsDefault='Y'")
+ " AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PriceList=" + no); log.fine("Set Default PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p " .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p ")
+ " WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.C_Currency_ID=o.C_Currency_ID AND p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency PriceList=" + no); log.fine("Set Currency PriceList=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p " .append("SET M_PriceList_ID=(SELECT MAX(M_PriceList_ID) FROM M_PriceList p ")
+ " WHERE p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.IsSOPriceList=o.IsSOTrx AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_PriceList_ID IS NULL AND C_Currency_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PriceList=" + no); log.fine("Set PriceList=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PriceList, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PriceList, ' ")
+ "WHERE M_PriceList_ID IS NULL" .append("WHERE M_PriceList_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No PriceList=" + no); log.warning("No PriceList=" + no);
// @Trifon - Import Order Source // @Trifon - Import Order Source
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_OrderSource_ID=(SELECT C_OrderSource_ID FROM C_OrderSource p" .append("SET C_OrderSource_ID=(SELECT C_OrderSource_ID FROM C_OrderSource p")
+ " WHERE o.C_OrderSourceValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.C_OrderSourceValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_OrderSource_ID IS NULL AND C_OrderSourceValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_OrderSource_ID IS NULL AND C_OrderSourceValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Order Source=" + no); log.fine("Set Order Source=" + no);
// Set proper error message // Set proper error message
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Not Found Order Source, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Not Found Order Source, ' ")
+ "WHERE C_OrderSource_ID IS NULL AND C_OrderSourceValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_OrderSource_ID IS NULL AND C_OrderSourceValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No OrderSource=" + no); log.warning("No OrderSource=" + no);
// Payment Term // Payment Term
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_PaymentTerm_ID=(SELECT C_PaymentTerm_ID FROM C_PaymentTerm p" .append("SET C_PaymentTerm_ID=(SELECT C_PaymentTerm_ID FROM C_PaymentTerm p")
+ " WHERE o.PaymentTermValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.PaymentTermValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_PaymentTerm_ID IS NULL AND PaymentTermValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_PaymentTerm_ID IS NULL AND PaymentTermValue IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PaymentTerm=" + no); log.fine("Set PaymentTerm=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_PaymentTerm_ID=(SELECT MAX(C_PaymentTerm_ID) FROM C_PaymentTerm p" .append("SET C_PaymentTerm_ID=(SELECT MAX(C_PaymentTerm_ID) FROM C_PaymentTerm p")
+ " WHERE p.IsDefault='Y' AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE p.IsDefault='Y' AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_PaymentTerm_ID IS NULL AND o.PaymentTermValue IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default PaymentTerm=" + no); log.fine("Set Default PaymentTerm=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PaymentTerm, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No PaymentTerm, ' ")
+ "WHERE C_PaymentTerm_ID IS NULL" .append("WHERE C_PaymentTerm_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No PaymentTerm=" + no); log.warning ("No PaymentTerm=" + no);
// Warehouse // Warehouse
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_Warehouse_ID=(SELECT MAX(M_Warehouse_ID) FROM M_Warehouse w" .append("SET M_Warehouse_ID=(SELECT MAX(M_Warehouse_ID) FROM M_Warehouse w")
+ " WHERE o.AD_Client_ID=w.AD_Client_ID AND o.AD_Org_ID=w.AD_Org_ID) " .append(" WHERE o.AD_Client_ID=w.AD_Client_ID AND o.AD_Org_ID=w.AD_Org_ID) ")
+ "WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); // Warehouse for Org no = DB.executeUpdate(sql.toString(), get_TrxName()); // Warehouse for Org
if (no != 0) if (no != 0)
log.fine("Set Warehouse=" + no); log.fine("Set Warehouse=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w" .append("SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w")
+ " WHERE o.AD_Client_ID=w.AD_Client_ID) " .append(" WHERE o.AD_Client_ID=w.AD_Client_ID) ")
+ "WHERE M_Warehouse_ID IS NULL" .append("WHERE M_Warehouse_ID IS NULL")
+ " AND EXISTS (SELECT AD_Client_ID FROM M_Warehouse w WHERE w.AD_Client_ID=o.AD_Client_ID GROUP BY AD_Client_ID HAVING COUNT(*)=1)" .append(" AND EXISTS (SELECT AD_Client_ID FROM M_Warehouse w WHERE w.AD_Client_ID=o.AD_Client_ID GROUP BY AD_Client_ID HAVING COUNT(*)=1)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set Only Client Warehouse=" + no); log.fine("Set Only Client Warehouse=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Warehouse, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Warehouse, ' ")
+ "WHERE M_Warehouse_ID IS NULL" .append("WHERE M_Warehouse_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No Warehouse=" + no); log.warning ("No Warehouse=" + no);
// BP from EMail // BP from EMail
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u" .append("SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u")
+ " WHERE o.EMail=u.EMail AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) " .append(" WHERE o.EMail=u.EMail AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) ")
+ "WHERE C_BPartner_ID IS NULL AND EMail IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND EMail IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP from EMail=" + no); log.fine("Set BP from EMail=" + no);
// BP from ContactName // BP from ContactName
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u" .append("SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u")
+ " WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) " .append(" WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) ")
+ "WHERE C_BPartner_ID IS NULL AND ContactName IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND ContactName IS NOT NULL")
+ " AND EXISTS (SELECT Name FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1)" .append(" AND EXISTS (SELECT Name FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP from ContactName=" + no); log.fine("Set BP from ContactName=" + no);
// BP from Value // BP from Value
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp" .append("SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp")
+ " WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID) " .append(" WHERE o.BPartnerValue=bp.Value AND o.AD_Client_ID=bp.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP from Value=" + no); log.fine("Set BP from Value=" + no);
// Default BP // Default BP
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_BPartner_ID=(SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo c" .append("SET C_BPartner_ID=(SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo c")
+ " WHERE o.AD_Client_ID=c.AD_Client_ID) " .append(" WHERE o.AD_Client_ID=c.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NULL AND Name IS NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NULL AND Name IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Default BP=" + no); log.fine("Set Default BP=" + no);
// Existing Location ? Exact Match // Existing Location ? Exact Match
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET (BillTo_ID,C_BPartner_Location_ID)=(SELECT C_BPartner_Location_ID,C_BPartner_Location_ID" .append("SET (BillTo_ID,C_BPartner_Location_ID)=(SELECT C_BPartner_Location_ID,C_BPartner_Location_ID")
+ " FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)" .append(" FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)")
+ " WHERE o.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=o.AD_Client_ID" .append(" WHERE o.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=o.AD_Client_ID")
+ " AND DUMP(o.Address1)=DUMP(l.Address1) AND DUMP(o.Address2)=DUMP(l.Address2)" .append(" AND DUMP(o.Address1)=DUMP(l.Address1) AND DUMP(o.Address2)=DUMP(l.Address2)")
+ " AND DUMP(o.City)=DUMP(l.City) AND DUMP(o.Postal)=DUMP(l.Postal)" .append(" AND DUMP(o.City)=DUMP(l.City) AND DUMP(o.Postal)=DUMP(l.Postal)")
+ " AND o.C_Region_ID=l.C_Region_ID AND o.C_Country_ID=l.C_Country_ID) " .append(" AND o.C_Region_ID=l.C_Region_ID AND o.C_Country_ID=l.C_Country_ID) ")
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL")
+ " AND I_IsImported='N'").append (clientCheck); .append(" AND I_IsImported='N'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Found Location=" + no); log.fine("Found Location=" + no);
// Set Bill Location from BPartner // Set Bill Location from BPartner
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET BillTo_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l" .append("SET BillTo_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l")
+ " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID" .append(" WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID")
+ " AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR (l.IsPayFrom='Y' AND o.IsSOTrx='N'))" .append(" AND ((l.IsBillTo='Y' AND o.IsSOTrx='Y') OR (l.IsPayFrom='Y' AND o.IsSOTrx='N'))")
+ ") " .append(") ")
+ "WHERE C_BPartner_ID IS NOT NULL AND BillTo_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND BillTo_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP BillTo from BP=" + no); log.fine("Set BP BillTo from BP=" + no);
// Set Location from BPartner // Set Location from BPartner
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_BPartner_Location_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l" .append("SET C_BPartner_Location_ID=(SELECT MAX(C_BPartner_Location_ID) FROM C_BPartner_Location l")
+ " WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID" .append(" WHERE l.C_BPartner_ID=o.C_BPartner_ID AND o.AD_Client_ID=l.AD_Client_ID")
+ " AND ((l.IsShipTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')" .append(" AND ((l.IsShipTo='Y' AND o.IsSOTrx='Y') OR o.IsSOTrx='N')")
+ ") " .append(") ")
+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set BP Location from BP=" + no); log.fine("Set BP Location from BP=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BP Location, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BP Location, ' ")
+ "WHERE C_BPartner_ID IS NOT NULL AND (BillTo_ID IS NULL OR C_BPartner_Location_ID IS NULL)" .append("WHERE C_BPartner_ID IS NOT NULL AND (BillTo_ID IS NULL OR C_BPartner_Location_ID IS NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No BP Location=" + no); log.warning ("No BP Location=" + no);
@ -377,117 +377,117 @@ public class ImportOrder extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Country Default=" + no); log.fine("Set Country Default=" + no);
**/ **/
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c" .append("SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c")
+ " WHERE o.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, o.AD_Client_ID)) " .append(" WHERE o.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, o.AD_Client_ID)) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL AND CountryCode IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL AND CountryCode IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Country=" + no); log.fine("Set Country=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' ")
+ "WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Country_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Country=" + no); log.warning ("Invalid Country=" + no);
// Set Region // Set Region
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "Set RegionName=(SELECT MAX(Name) FROM C_Region r" .append("Set RegionName=(SELECT MAX(Name) FROM C_Region r")
+ " WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID" .append(" WHERE r.IsDefault='Y' AND r.C_Country_ID=o.C_Country_ID")
+ " AND r.AD_Client_ID IN (0, o.AD_Client_ID)) " .append(" AND r.AD_Client_ID IN (0, o.AD_Client_ID)) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Region Default=" + no); log.fine("Set Region Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r" .append("Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r")
+ " WHERE r.Name=o.RegionName AND r.C_Country_ID=o.C_Country_ID" .append(" WHERE r.Name=o.RegionName AND r.C_Country_ID=o.C_Country_ID")
+ " AND r.AD_Client_ID IN (0, o.AD_Client_ID)) " .append(" AND r.AD_Client_ID IN (0, o.AD_Client_ID)) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL AND RegionName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Region=" + no); log.fine("Set Region=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' ")
+ "WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL " .append("WHERE C_BPartner_ID IS NULL AND C_Region_ID IS NULL ")
+ " AND EXISTS (SELECT * FROM C_Country c" .append(" AND EXISTS (SELECT * FROM C_Country c")
+ " WHERE c.C_Country_ID=o.C_Country_ID AND c.HasRegion='Y')" .append(" WHERE c.C_Country_ID=o.C_Country_ID AND c.HasRegion='Y')")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Region=" + no); log.warning ("Invalid Region=" + no);
// Product // Product
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.ProductValue=p.Value AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND ProductValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from Value=" + no); log.fine("Set Product from Value=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.UPC=p.UPC AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND UPC IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND UPC IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product from UPC=" + no); log.fine("Set Product from UPC=" + no);
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p" .append("SET M_Product_ID=(SELECT MAX(M_Product_ID) FROM M_Product p")
+ " WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE o.SKU=p.SKU AND o.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL AND SKU IS NOT NULL" .append("WHERE M_Product_ID IS NULL AND SKU IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Product fom SKU=" + no); log.fine("Set Product fom SKU=" + no);
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Product, ' ")
+ "WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)" .append("WHERE M_Product_ID IS NULL AND (ProductValue IS NOT NULL OR UPC IS NOT NULL OR SKU IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Product=" + no); log.warning ("Invalid Product=" + no);
// Charge // Charge
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge c" .append("SET C_Charge_ID=(SELECT C_Charge_ID FROM C_Charge c")
+ " WHERE o.ChargeName=c.Name AND o.AD_Client_ID=c.AD_Client_ID) " .append(" WHERE o.ChargeName=c.Name AND o.AD_Client_ID=c.AD_Client_ID) ")
+ "WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_Charge_ID IS NULL AND ChargeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Charge=" + no); log.fine("Set Charge=" + no);
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Charge, ' ")
+ "WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)" .append("WHERE C_Charge_ID IS NULL AND (ChargeName IS NOT NULL)")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Charge=" + no); log.warning ("Invalid Charge=" + no);
// //
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Product and Charge, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Product and Charge, ' ")
+ "WHERE M_Product_ID IS NOT NULL AND C_Charge_ID IS NOT NULL " .append("WHERE M_Product_ID IS NOT NULL AND C_Charge_ID IS NOT NULL ")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Product and Charge exclusive=" + no); log.warning ("Invalid Product and Charge exclusive=" + no);
// Tax // Tax
sql = new StringBuffer ("UPDATE I_Order o " sql = new StringBuilder ("UPDATE I_Order o ")
+ "SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t" .append("SET C_Tax_ID=(SELECT MAX(C_Tax_ID) FROM C_Tax t")
+ " WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID) " .append(" WHERE o.TaxIndicator=t.TaxIndicator AND o.AD_Client_ID=t.AD_Client_ID) ")
+ "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL" .append("WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Tax=" + no); log.fine("Set Tax=" + no);
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Tax, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Tax, ' ")
+ "WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL" .append("WHERE C_Tax_ID IS NULL AND TaxIndicator IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Tax=" + no); log.warning ("Invalid Tax=" + no);
@ -497,8 +497,8 @@ public class ImportOrder extends SvrProcess
// -- New BPartner --------------------------------------------------- // -- New BPartner ---------------------------------------------------
// Go through Order Records w/o C_BPartner_ID // Go through Order Records w/o C_BPartner_ID
sql = new StringBuffer ("SELECT * FROM I_Order " sql = new StringBuilder ("SELECT * FROM I_Order ")
+ "WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck); .append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
try try
{ {
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName()); PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
@ -618,10 +618,10 @@ public class ImportOrder extends SvrProcess
{ {
log.log(Level.SEVERE, "BP - " + sql.toString(), e); log.log(Level.SEVERE, "BP - " + sql.toString(), e);
} }
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
+ "WHERE C_BPartner_ID IS NULL" .append("WHERE C_BPartner_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No BPartner=" + no); log.warning ("No BPartner=" + no);
@ -634,8 +634,8 @@ public class ImportOrder extends SvrProcess
int noInsertLine = 0; int noInsertLine = 0;
// Go through Order Records w/o // Go through Order Records w/o
sql = new StringBuffer ("SELECT * FROM I_Order " sql = new StringBuilder ("SELECT * FROM I_Order ")
+ "WHERE I_IsImported='N'").append (clientCheck) .append("WHERE I_IsImported='N'").append (clientCheck)
.append(" ORDER BY C_BPartner_ID, BillTo_ID, C_BPartner_Location_ID, I_Order_ID"); .append(" ORDER BY C_BPartner_ID, BillTo_ID, C_BPartner_Location_ID, I_Order_ID");
try try
{ {
@ -788,15 +788,16 @@ public class ImportOrder extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_Order " sql = new StringBuilder ("UPDATE I_Order ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //
addLog (0, null, new BigDecimal (noInsert), "@C_Order_ID@: @Inserted@"); addLog (0, null, new BigDecimal (noInsert), "@C_Order_ID@: @Inserted@");
addLog (0, null, new BigDecimal (noInsertLine), "@C_OrderLine_ID@: @Inserted@"); addLog (0, null, new BigDecimal (noInsertLine), "@C_OrderLine_ID@: @Inserted@");
return "#" + noInsert + "/" + noInsertLine; StringBuilder msgreturn = new StringBuilder("#").append(noInsert).append("/").append(noInsertLine);
return msgreturn.toString();
} // doIt } // doIt
} // ImportOrder } // ImportOrder

View File

@ -90,7 +90,7 @@ public class ImportPayment extends SvrProcess
p_AD_Org_ID = ba.getAD_Org_ID(); p_AD_Org_ID = ba.getAD_Org_ID();
log.info("AD_Org_ID=" + p_AD_Org_ID); log.info("AD_Org_ID=" + p_AD_Org_ID);
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + ba.getAD_Client_ID(); String clientCheck = " AND AD_Client_ID=" + ba.getAD_Client_ID();
@ -99,307 +99,307 @@ public class ImportPayment extends SvrProcess
// Delete Old Imported // Delete Old Imported
if (p_deleteOldImported) if (p_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_Payment " sql = new StringBuilder ("DELETE I_Payment ")
+ "WHERE I_IsImported='Y'").append (clientCheck); .append("WHERE I_IsImported='Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_Payment " sql = new StringBuilder ("UPDATE I_Payment ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID,").append (ba.getAD_Client_ID()).append (")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID,").append (ba.getAD_Client_ID()).append ("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID,").append (p_AD_Org_ID).append ("),"); .append(" AD_Org_ID = COALESCE (AD_Org_ID,").append (p_AD_Org_ID).append ("),");
sql.append(" IsActive = COALESCE (IsActive, 'Y')," sql.append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL OR AD_Client_ID IS NULL OR AD_Org_ID IS NULL OR AD_Client_ID=0 OR AD_Org_ID=0"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL OR AD_Client_ID IS NULL OR AD_Org_ID IS NULL OR AD_Client_ID=0 OR AD_Org_ID=0");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info ("Reset=" + no); log.info ("Reset=" + no);
sql = new StringBuffer ("UPDATE I_Payment o " sql = new StringBuilder ("UPDATE I_Payment o ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '" .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Org, '")
+ "WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0" .append("WHERE (AD_Org_ID IS NULL OR AD_Org_ID=0")
+ " OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))" .append(" OR EXISTS (SELECT * FROM AD_Org oo WHERE o.AD_Org_ID=oo.AD_Org_ID AND (oo.IsSummary='Y' OR oo.IsActive='N')))")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid Org=" + no); log.warning ("Invalid Org=" + no);
// Set Bank Account // Set Bank Account
sql = new StringBuffer("UPDATE I_Payment i " sql = new StringBuilder("UPDATE I_Payment i ")
+ "SET C_BankAccount_ID=" .append("SET C_BankAccount_ID=")
+ "( " .append("( ")
+ " SELECT C_BankAccount_ID " .append(" SELECT C_BankAccount_ID ")
+ " FROM C_BankAccount a, C_Bank b " .append(" FROM C_BankAccount a, C_Bank b ")
+ " WHERE b.IsOwnBank='Y' " .append(" WHERE b.IsOwnBank='Y' ")
+ " AND a.AD_Client_ID=i.AD_Client_ID " .append(" AND a.AD_Client_ID=i.AD_Client_ID ")
+ " AND a.C_Bank_ID=b.C_Bank_ID " .append(" AND a.C_Bank_ID=b.C_Bank_ID ")
+ " AND a.AccountNo=i.BankAccountNo " .append(" AND a.AccountNo=i.BankAccountNo ")
+ " AND b.RoutingNo=i.RoutingNo " .append(" AND b.RoutingNo=i.RoutingNo ")
+ " OR b.SwiftCode=i.RoutingNo " .append(" OR b.SwiftCode=i.RoutingNo ")
+ ") " .append(") ")
+ "WHERE i.C_BankAccount_ID IS NULL " .append("WHERE i.C_BankAccount_ID IS NULL ")
+ "AND i.I_IsImported<>'Y' " .append("AND i.I_IsImported<>'Y' ")
+ "OR i.I_IsImported IS NULL").append(clientCheck); .append("OR i.I_IsImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Bank Account (With Routing No)=" + no); log.info("Bank Account (With Routing No)=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment i " sql = new StringBuilder("UPDATE I_Payment i ")
+ "SET C_BankAccount_ID=" .append("SET C_BankAccount_ID=")
+ "( " .append("( ")
+ " SELECT C_BankAccount_ID " .append(" SELECT C_BankAccount_ID ")
+ " FROM C_BankAccount a, C_Bank b " .append(" FROM C_BankAccount a, C_Bank b ")
+ " WHERE b.IsOwnBank='Y' " .append(" WHERE b.IsOwnBank='Y' ")
+ " AND a.C_Bank_ID=b.C_Bank_ID " .append(" AND a.C_Bank_ID=b.C_Bank_ID ")
+ " AND a.AccountNo=i.BankAccountNo " .append(" AND a.AccountNo=i.BankAccountNo ")
+ " AND a.AD_Client_ID=i.AD_Client_ID " .append(" AND a.AD_Client_ID=i.AD_Client_ID ")
+ ") " .append(") ")
+ "WHERE i.C_BankAccount_ID IS NULL " .append("WHERE i.C_BankAccount_ID IS NULL ")
+ "AND i.I_isImported<>'Y' " .append("AND i.I_isImported<>'Y' ")
+ "OR i.I_isImported IS NULL").append(clientCheck); .append("OR i.I_isImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Bank Account (Without Routing No)=" + no); log.info("Bank Account (Without Routing No)=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment i " sql = new StringBuilder("UPDATE I_Payment i ")
+ "SET C_BankAccount_ID=(SELECT C_BankAccount_ID FROM C_BankAccount a WHERE a.C_BankAccount_ID=").append(p_C_BankAccount_ID); .append("SET C_BankAccount_ID=(SELECT C_BankAccount_ID FROM C_BankAccount a WHERE a.C_BankAccount_ID=").append(p_C_BankAccount_ID);
sql.append(" and a.AD_Client_ID=i.AD_Client_ID) " sql.append(" and a.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE i.C_BankAccount_ID IS NULL " .append("WHERE i.C_BankAccount_ID IS NULL ")
+ "AND i.BankAccountNo IS NULL " .append("AND i.BankAccountNo IS NULL ")
+ "AND i.I_isImported<>'Y' " .append("AND i.I_isImported<>'Y' ")
+ "OR i.I_isImported IS NULL").append(clientCheck); .append("OR i.I_isImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Bank Account=" + no); log.info("Bank Account=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Bank Account, ' " .append("SET I_isImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Bank Account, ' ")
+ "WHERE C_BankAccount_ID IS NULL " .append("WHERE C_BankAccount_ID IS NULL ")
+ "AND I_isImported<>'Y' " .append("AND I_isImported<>'Y' ")
+ "OR I_isImported IS NULL").append(clientCheck); .append("OR I_isImported IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid Bank Account=" + no); log.warning("Invalid Bank Account=" + no);
// Set Currency // Set Currency
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuilder ("UPDATE I_Payment i ")
+ "SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c")
+ " WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) " .append(" WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE C_Currency_ID IS NULL" .append("WHERE C_Currency_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Set Currency=" + no); log.info("Set Currency=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment i " sql = new StringBuilder("UPDATE I_Payment i ")
+ "SET C_Currency_ID=(SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID=i.C_BankAccount_ID) " .append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_BankAccount WHERE C_BankAccount_ID=i.C_BankAccount_ID) ")
+ "WHERE i.C_Currency_ID IS NULL " .append("WHERE i.C_Currency_ID IS NULL ")
+ "AND i.ISO_Code IS NULL").append(clientCheck); .append("AND i.ISO_Code IS NULL").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Set Currency=" + no); log.info("Set Currency=" + no);
// //
sql = new StringBuffer ("UPDATE I_Payment " sql = new StringBuilder ("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Currency,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Currency,' ")
+ "WHERE C_Currency_ID IS NULL " .append("WHERE C_Currency_ID IS NULL ")
+ "AND I_IsImported<>'E' " .append("AND I_IsImported<>'E' ")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No Currency=" + no); log.warning("No Currency=" + no);
// Set Amount // Set Amount
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET ChargeAmt=0 " .append("SET ChargeAmt=0 ")
+ "WHERE ChargeAmt IS NULL " .append("WHERE ChargeAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Charge Amount=" + no); log.info("Charge Amount=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET TaxAmt=0 " .append("SET TaxAmt=0 ")
+ "WHERE TaxAmt IS NULL " .append("WHERE TaxAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Tax Amount=" + no); log.info("Tax Amount=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET WriteOffAmt=0 " .append("SET WriteOffAmt=0 ")
+ "WHERE WriteOffAmt IS NULL " .append("WHERE WriteOffAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("WriteOff Amount=" + no); log.info("WriteOff Amount=" + no);
// //
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET DiscountAmt=0 " .append("SET DiscountAmt=0 ")
+ "WHERE DiscountAmt IS NULL " .append("WHERE DiscountAmt IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Discount Amount=" + no); log.info("Discount Amount=" + no);
// //
// Set Date // Set Date
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET DateTrx=Created " .append("SET DateTrx=Created ")
+ "WHERE DateTrx IS NULL " .append("WHERE DateTrx IS NULL ")
+ "AND I_isImported<>'Y'").append(clientCheck); .append("AND I_isImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Trx Date=" + no); log.info("Trx Date=" + no);
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET DateAcct=DateTrx " .append("SET DateAcct=DateTrx ")
+ "WHERE DateAcct IS NULL " .append("WHERE DateAcct IS NULL ")
+ "AND I_isImported<>'Y'").append(clientCheck); .append("AND I_isImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Acct Date=" + no); log.info("Acct Date=" + no);
// Invoice // Invoice
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuilder ("UPDATE I_Payment i ")
+ "SET C_Invoice_ID=(SELECT MAX(C_Invoice_ID) FROM C_Invoice ii" .append("SET C_Invoice_ID=(SELECT MAX(C_Invoice_ID) FROM C_Invoice ii")
+ " WHERE i.InvoiceDocumentNo=ii.DocumentNo AND i.AD_Client_ID=ii.AD_Client_ID) " .append(" WHERE i.InvoiceDocumentNo=ii.DocumentNo AND i.AD_Client_ID=ii.AD_Client_ID) ")
+ "WHERE C_Invoice_ID IS NULL AND InvoiceDocumentNo IS NOT NULL" .append("WHERE C_Invoice_ID IS NULL AND InvoiceDocumentNo IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set Invoice from DocumentNo=" + no); log.fine("Set Invoice from DocumentNo=" + no);
// BPartner // BPartner
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuilder ("UPDATE I_Payment i ")
+ "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp" .append("SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_BPartner bp")
+ " WHERE i.BPartnerValue=bp.Value AND i.AD_Client_ID=bp.AD_Client_ID) " .append(" WHERE i.BPartnerValue=bp.Value AND i.AD_Client_ID=bp.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartnerValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set BP from Value=" + no); log.fine("Set BP from Value=" + no);
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuilder ("UPDATE I_Payment i ")
+ "SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_Invoice ii" .append("SET C_BPartner_ID=(SELECT MAX(C_BPartner_ID) FROM C_Invoice ii")
+ " WHERE i.C_Invoice_ID=ii.C_Invoice_ID AND i.AD_Client_ID=ii.AD_Client_ID) " .append(" WHERE i.C_Invoice_ID=ii.C_Invoice_ID AND i.AD_Client_ID=ii.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL AND C_Invoice_ID IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND C_Invoice_ID IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set BP from Invoice=" + no); log.fine("Set BP from Invoice=" + no);
sql = new StringBuffer ("UPDATE I_Payment " sql = new StringBuilder ("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner,' ")
+ "WHERE C_BPartner_ID IS NULL " .append("WHERE C_BPartner_ID IS NULL ")
+ "AND I_IsImported<>'E' " .append("AND I_IsImported<>'E' ")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No BPartner=" + no); log.warning("No BPartner=" + no);
// Check Payment<->Invoice combination // Check Payment<->Invoice combination
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->Invoice, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->Invoice, ' ")
+ "WHERE I_Payment_ID IN " .append("WHERE I_Payment_ID IN ")
+ "(SELECT I_Payment_ID " .append("(SELECT I_Payment_ID ")
+ "FROM I_Payment i" .append("FROM I_Payment i")
+ " INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) " .append(" INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) ")
+ "WHERE i.C_Invoice_ID IS NOT NULL " .append("WHERE i.C_Invoice_ID IS NOT NULL ")
+ " AND p.C_Invoice_ID IS NOT NULL " .append(" AND p.C_Invoice_ID IS NOT NULL ")
+ " AND p.C_Invoice_ID<>i.C_Invoice_ID) ") .append(" AND p.C_Invoice_ID<>i.C_Invoice_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Payment<->Invoice Mismatch=" + no); log.info("Payment<->Invoice Mismatch=" + no);
// Check Payment<->BPartner combination // Check Payment<->BPartner combination
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Payment<->BPartner, ' ")
+ "WHERE I_Payment_ID IN " .append("WHERE I_Payment_ID IN ")
+ "(SELECT I_Payment_ID " .append("(SELECT I_Payment_ID ")
+ "FROM I_Payment i" .append("FROM I_Payment i")
+ " INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) " .append(" INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) ")
+ "WHERE i.C_BPartner_ID IS NOT NULL " .append("WHERE i.C_BPartner_ID IS NOT NULL ")
+ " AND p.C_BPartner_ID IS NOT NULL " .append(" AND p.C_BPartner_ID IS NOT NULL ")
+ " AND p.C_BPartner_ID<>i.C_BPartner_ID) ") .append(" AND p.C_BPartner_ID<>i.C_BPartner_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Payment<->BPartner Mismatch=" + no); log.info("Payment<->BPartner Mismatch=" + no);
// Check Invoice<->BPartner combination // Check Invoice<->BPartner combination
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice<->BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice<->BPartner, ' ")
+ "WHERE I_Payment_ID IN " .append("WHERE I_Payment_ID IN ")
+ "(SELECT I_Payment_ID " .append("(SELECT I_Payment_ID ")
+ "FROM I_Payment i" .append("FROM I_Payment i")
+ " INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID) " .append(" INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID) ")
+ "WHERE i.C_BPartner_ID IS NOT NULL " .append("WHERE i.C_BPartner_ID IS NOT NULL ")
+ " AND v.C_BPartner_ID IS NOT NULL " .append(" AND v.C_BPartner_ID IS NOT NULL ")
+ " AND v.C_BPartner_ID<>i.C_BPartner_ID) ") .append(" AND v.C_BPartner_ID<>i.C_BPartner_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Invoice<->BPartner Mismatch=" + no); log.info("Invoice<->BPartner Mismatch=" + no);
// Check Invoice.BPartner<->Payment.BPartner combination // Check Invoice.BPartner<->Payment.BPartner combination
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice.BPartner<->Payment.BPartner, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Err=Invalid Invoice.BPartner<->Payment.BPartner, ' ")
+ "WHERE I_Payment_ID IN " .append("WHERE I_Payment_ID IN ")
+ "(SELECT I_Payment_ID " .append("(SELECT I_Payment_ID ")
+ "FROM I_Payment i" .append("FROM I_Payment i")
+ " INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID)" .append(" INNER JOIN C_Invoice v ON (i.C_Invoice_ID=v.C_Invoice_ID)")
+ " INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) " .append(" INNER JOIN C_Payment p ON (i.C_Payment_ID=p.C_Payment_ID) ")
+ "WHERE p.C_Invoice_ID<>v.C_Invoice_ID" .append("WHERE p.C_Invoice_ID<>v.C_Invoice_ID")
+ " AND v.C_BPartner_ID<>p.C_BPartner_ID) ") .append(" AND v.C_BPartner_ID<>p.C_BPartner_ID) ")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Invoice.BPartner<->Payment.BPartner Mismatch=" + no); log.info("Invoice.BPartner<->Payment.BPartner Mismatch=" + no);
// TrxType // TrxType
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET TrxType='S' " // MPayment.TRXTYPE_Sales .append("SET TrxType='S' ") // MPayment.TRXTYPE_Sales
+ "WHERE TrxType IS NULL " .append("WHERE TrxType IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("TrxType Default=" + no); log.info("TrxType Default=" + no);
// TenderType // TenderType
sql = new StringBuffer("UPDATE I_Payment " sql = new StringBuilder("UPDATE I_Payment ")
+ "SET TenderType='K' " // MPayment.TENDERTYPE_Check .append("SET TenderType='K' ") // MPayment.TENDERTYPE_Check
+ "WHERE TenderType IS NULL " .append("WHERE TenderType IS NULL ")
+ "AND I_IsImported<>'Y'").append(clientCheck); .append("AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("TenderType Default=" + no); log.info("TenderType Default=" + no);
// Document Type // Document Type
sql = new StringBuffer ("UPDATE I_Payment i " sql = new StringBuilder ("UPDATE I_Payment i ")
+ "SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=i.DocTypeName" .append("SET C_DocType_ID=(SELECT C_DocType_ID FROM C_DocType d WHERE d.Name=i.DocTypeName")
+ " AND d.DocBaseType IN ('ARR','APP') AND i.AD_Client_ID=d.AD_Client_ID) " .append(" AND d.DocBaseType IN ('ARR','APP') AND i.AD_Client_ID=d.AD_Client_ID) ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck); .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("Set DocType=" + no); log.fine("Set DocType=" + no);
sql = new StringBuffer ("UPDATE I_Payment " sql = new StringBuilder ("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocTypeName, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid DocTypeName, ' ")
+ "WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL" .append("WHERE C_DocType_ID IS NULL AND DocTypeName IS NOT NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("Invalid DocTypeName=" + no); log.warning ("Invalid DocTypeName=" + no);
sql = new StringBuffer ("UPDATE I_Payment " sql = new StringBuilder ("UPDATE I_Payment ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No DocType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No DocType, ' ")
+ "WHERE C_DocType_ID IS NULL" .append("WHERE C_DocType_ID IS NULL")
+ " AND I_IsImported<>'Y'").append (clientCheck); .append(" AND I_IsImported<>'Y'").append (clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning ("No DocType=" + no); log.warning ("No DocType=" + no);
@ -407,9 +407,9 @@ public class ImportPayment extends SvrProcess
commitEx(); commitEx();
//Import Bank Statement //Import Bank Statement
sql = new StringBuffer("SELECT * FROM I_Payment" sql = new StringBuilder("SELECT * FROM I_Payment")
+ " WHERE I_IsImported='N'" .append(" WHERE I_IsImported='N'")
+ " ORDER BY C_BankAccount_ID, CheckNo, DateTrx, R_AuthCode"); .append(" ORDER BY C_BankAccount_ID, CheckNo, DateTrx, R_AuthCode");
MBankAccount account = null; MBankAccount account = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -526,9 +526,9 @@ public class ImportPayment extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_Payment " sql = new StringBuilder ("UPDATE I_Payment ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
// //

View File

@ -83,7 +83,7 @@ public class ImportProduct extends SvrProcess implements ImportProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = getWhereClause(); String clientCheck = getWhereClause();
@ -92,43 +92,43 @@ public class ImportProduct extends SvrProcess implements ImportProcess
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_Product " sql = new StringBuilder ("DELETE I_Product ")
+ "WHERE I_IsImported='Y'").append(clientCheck); .append("WHERE I_IsImported='Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Delete Old Imported =" + no); log.info("Delete Old Imported =" + no);
} }
// Set Client, Org, IaActive, Created/Updated, ProductType // Set Client, Org, IaActive, Created/Updated, ProductType
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append(")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID, 0)," .append(" AD_Org_ID = COALESCE (AD_Org_ID, 0),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " ProductType = COALESCE (ProductType, 'I')," .append(" ProductType = COALESCE (ProductType, 'I'),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Reset=" + no); log.info("Reset=" + no);
ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_BEFORE_VALIDATE); ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_BEFORE_VALIDATE);
// Set Optional BPartner // Set Optional BPartner
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p" .append("SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p")
+ " WHERE i.BPartner_Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.BPartner_Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE C_BPartner_ID IS NULL" .append("WHERE C_BPartner_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("BPartner=" + no); log.info("BPartner=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid BPartner,' ")
+ "WHERE C_BPartner_ID IS NULL AND BPartner_Value IS NOT NULL" .append("WHERE C_BPartner_ID IS NULL AND BPartner_Value IS NOT NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid BPartner=" + no); log.warning("Invalid BPartner=" + no);
@ -136,48 +136,48 @@ public class ImportProduct extends SvrProcess implements ImportProcess
// **** Find Product // **** Find Product
// EAN/UPC // EAN/UPC
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" .append("SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p")
+ " WHERE i.UPC=p.UPC AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.UPC=p.UPC AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL" .append("WHERE M_Product_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Product Existing UPC=" + no); log.info("Product Existing UPC=" + no);
// Value // Value
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p" .append("SET M_Product_ID=(SELECT M_Product_ID FROM M_Product p")
+ " WHERE i.Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.Value=p.Value AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL" .append("WHERE M_Product_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Product Existing Value=" + no); log.info("Product Existing Value=" + no);
// BP ProdNo // BP ProdNo
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET M_Product_ID=(SELECT M_Product_ID FROM M_Product_po p" .append("SET M_Product_ID=(SELECT M_Product_ID FROM M_Product_po p")
+ " WHERE i.C_BPartner_ID=p.C_BPartner_ID" .append(" WHERE i.C_BPartner_ID=p.C_BPartner_ID")
+ " AND i.VendorProductNo=p.VendorProductNo AND i.AD_Client_ID=p.AD_Client_ID) " .append(" AND i.VendorProductNo=p.VendorProductNo AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NULL" .append("WHERE M_Product_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Product Existing Vendor ProductNo=" + no); log.info("Product Existing Vendor ProductNo=" + no);
// Set Product Category // Set Product Category
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET ProductCategory_Value=(SELECT MAX(Value) FROM M_Product_Category" .append("SET ProductCategory_Value=(SELECT MAX(Value) FROM M_Product_Category")
+ " WHERE IsDefault='Y' AND AD_Client_ID=").append(m_AD_Client_ID).append(") " .append(" WHERE IsDefault='Y' AND AD_Client_ID=").append(m_AD_Client_ID).append(") ")
+ "WHERE ProductCategory_Value IS NULL AND M_Product_Category_ID IS NULL" .append("WHERE ProductCategory_Value IS NULL AND M_Product_Category_ID IS NULL")
+ " AND M_Product_ID IS NULL" // set category only if product not found .append(" AND M_Product_ID IS NULL") // set category only if product not found
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Category Default Value=" + no); log.fine("Set Category Default Value=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET M_Product_Category_ID=(SELECT M_Product_Category_ID FROM M_Product_Category c" .append("SET M_Product_Category_ID=(SELECT M_Product_Category_ID FROM M_Product_Category c")
+ " WHERE i.ProductCategory_Value=c.Value AND i.AD_Client_ID=c.AD_Client_ID) " .append(" WHERE i.ProductCategory_Value=c.Value AND i.AD_Client_ID=c.AD_Client_ID) ")
+ "WHERE ProductCategory_Value IS NOT NULL AND M_Product_Category_ID IS NULL" .append("WHERE ProductCategory_Value IS NOT NULL AND M_Product_Category_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Set Category=" + no); log.info("Set Category=" + no);
@ -188,12 +188,12 @@ public class ImportProduct extends SvrProcess implements ImportProcess
"Discontinued","DiscontinuedBy","DiscontinuedAt","ImageURL","DescriptionURL"}; "Discontinued","DiscontinuedBy","DiscontinuedAt","ImageURL","DescriptionURL"};
for (int i = 0; i < strFields.length; i++) for (int i = 0; i < strFields.length; i++)
{ {
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET ").append(strFields[i]).append(" = (SELECT ").append(strFields[i]).append(" FROM M_Product p" .append("SET ").append(strFields[i]).append(" = (SELECT ").append(strFields[i]).append(" FROM M_Product p")
+ " WHERE i.M_Product_ID=p.M_Product_ID AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.M_Product_ID=p.M_Product_ID AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NOT NULL" .append("WHERE M_Product_ID IS NOT NULL")
+ " AND ").append(strFields[i]).append(" IS NULL" .append(" AND ").append(strFields[i]).append(" IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine(strFields[i] + " - default from existing Product=" + no); log.fine(strFields[i] + " - default from existing Product=" + no);
@ -202,12 +202,12 @@ public class ImportProduct extends SvrProcess implements ImportProcess
"Volume","Weight","ShelfWidth","ShelfHeight","ShelfDepth","UnitsPerPallet"}; "Volume","Weight","ShelfWidth","ShelfHeight","ShelfDepth","UnitsPerPallet"};
for (int i = 0; i < numFields.length; i++) for (int i = 0; i < numFields.length; i++)
{ {
sql = new StringBuffer ("UPDATE I_PRODUCT i " sql = new StringBuilder ("UPDATE I_PRODUCT i ")
+ "SET ").append(numFields[i]).append(" = (SELECT ").append(numFields[i]).append(" FROM M_Product p" .append("SET ").append(numFields[i]).append(" = (SELECT ").append(numFields[i]).append(" FROM M_Product p")
+ " WHERE i.M_Product_ID=p.M_Product_ID AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.M_Product_ID=p.M_Product_ID AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NOT NULL" .append("WHERE M_Product_ID IS NOT NULL")
+ " AND (").append(numFields[i]).append(" IS NULL OR ").append(numFields[i]).append("=0)" .append(" AND (").append(numFields[i]).append(" IS NULL OR ").append(numFields[i]).append("=0)")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine(numFields[i] + " default from existing Product=" + no); log.fine(numFields[i] + " default from existing Product=" + no);
@ -219,13 +219,13 @@ public class ImportProduct extends SvrProcess implements ImportProcess
"Discontinued","DiscontinuedBy", "DiscontinuedAt"}; "Discontinued","DiscontinuedBy", "DiscontinuedAt"};
for (int i = 0; i < strFieldsPO.length; i++) for (int i = 0; i < strFieldsPO.length; i++)
{ {
sql = new StringBuffer ("UPDATE I_PRODUCT i " sql = new StringBuilder ("UPDATE I_PRODUCT i ")
+ "SET ").append(strFieldsPO[i]).append(" = (SELECT ").append(strFieldsPO[i]) .append("SET ").append(strFieldsPO[i]).append(" = (SELECT ").append(strFieldsPO[i])
.append(" FROM M_Product_PO p" .append(" FROM M_Product_PO p")
+ " WHERE i.M_Product_ID=p.M_Product_ID AND i.C_BPartner_ID=p.C_BPartner_ID AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.M_Product_ID=p.M_Product_ID AND i.C_BPartner_ID=p.C_BPartner_ID AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NOT NULL AND C_BPartner_ID IS NOT NULL" .append("WHERE M_Product_ID IS NOT NULL AND C_BPartner_ID IS NOT NULL")
+ " AND ").append(strFieldsPO[i]).append(" IS NULL" .append(" AND ").append(strFieldsPO[i]).append(" IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine(strFieldsPO[i] + " default from existing Product PO=" + no); log.fine(strFieldsPO[i] + " default from existing Product PO=" + no);
@ -235,111 +235,111 @@ public class ImportProduct extends SvrProcess implements ImportProcess
"Order_Min","Order_Pack","CostPerOrder","DeliveryTime_Promised"}; "Order_Min","Order_Pack","CostPerOrder","DeliveryTime_Promised"};
for (int i = 0; i < numFieldsPO.length; i++) for (int i = 0; i < numFieldsPO.length; i++)
{ {
sql = new StringBuffer ("UPDATE I_PRODUCT i " sql = new StringBuilder ("UPDATE I_PRODUCT i ")
+ "SET ").append(numFieldsPO[i]).append(" = (SELECT ").append(numFieldsPO[i]) .append("SET ").append(numFieldsPO[i]).append(" = (SELECT ").append(numFieldsPO[i])
.append(" FROM M_Product_PO p" .append(" FROM M_Product_PO p")
+ " WHERE i.M_Product_ID=p.M_Product_ID AND i.C_BPartner_ID=p.C_BPartner_ID AND i.AD_Client_ID=p.AD_Client_ID) " .append(" WHERE i.M_Product_ID=p.M_Product_ID AND i.C_BPartner_ID=p.C_BPartner_ID AND i.AD_Client_ID=p.AD_Client_ID) ")
+ "WHERE M_Product_ID IS NOT NULL AND C_BPartner_ID IS NOT NULL" .append("WHERE M_Product_ID IS NOT NULL AND C_BPartner_ID IS NOT NULL")
+ " AND (").append(numFieldsPO[i]).append(" IS NULL OR ").append(numFieldsPO[i]).append("=0)" .append(" AND (").append(numFieldsPO[i]).append(" IS NULL OR ").append(numFieldsPO[i]).append("=0)")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine(numFieldsPO[i] + " default from existing Product PO=" + no); log.fine(numFieldsPO[i] + " default from existing Product PO=" + no);
} }
// Invalid Category // Invalid Category
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ProdCategory,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ProdCategory,' ")
+ "WHERE M_Product_Category_ID IS NULL" .append("WHERE M_Product_Category_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid Category=" + no); log.warning("Invalid Category=" + no);
// Set UOM (System/own) // Set UOM (System/own)
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET X12DE355 = " .append("SET X12DE355 = ")
+ "(SELECT MAX(X12DE355) FROM C_UOM u WHERE u.IsDefault='Y' AND u.AD_Client_ID IN (0,i.AD_Client_ID)) " .append("(SELECT MAX(X12DE355) FROM C_UOM u WHERE u.IsDefault='Y' AND u.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE X12DE355 IS NULL AND C_UOM_ID IS NULL" .append("WHERE X12DE355 IS NULL AND C_UOM_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set UOM Default=" + no); log.fine("Set UOM Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET C_UOM_ID = (SELECT C_UOM_ID FROM C_UOM u WHERE u.X12DE355=i.X12DE355 AND u.AD_Client_ID IN (0,i.AD_Client_ID)) " .append("SET C_UOM_ID = (SELECT C_UOM_ID FROM C_UOM u WHERE u.X12DE355=i.X12DE355 AND u.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE C_UOM_ID IS NULL" .append("WHERE C_UOM_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Set UOM=" + no); log.info("Set UOM=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid UOM, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid UOM, ' ")
+ "WHERE C_UOM_ID IS NULL" .append("WHERE C_UOM_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid UOM=" + no); log.warning("Invalid UOM=" + no);
// Set Currency // Set Currency
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET ISO_Code=(SELECT ISO_Code FROM C_Currency c" .append("SET ISO_Code=(SELECT ISO_Code FROM C_Currency c")
+ " INNER JOIN C_AcctSchema a ON (a.C_Currency_ID=c.C_Currency_ID)" .append(" INNER JOIN C_AcctSchema a ON (a.C_Currency_ID=c.C_Currency_ID)")
+ " INNER JOIN AD_ClientInfo ci ON (a.C_AcctSchema_ID=ci.C_AcctSchema1_ID)" .append(" INNER JOIN AD_ClientInfo ci ON (a.C_AcctSchema_ID=ci.C_AcctSchema1_ID)")
+ " WHERE ci.AD_Client_ID=i.AD_Client_ID) " .append(" WHERE ci.AD_Client_ID=i.AD_Client_ID) ")
+ "WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL" .append("WHERE C_Currency_ID IS NULL AND ISO_Code IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set Currency Default=" + no); log.fine("Set Currency Default=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c" .append("SET C_Currency_ID=(SELECT C_Currency_ID FROM C_Currency c")
+ " WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) " .append(" WHERE i.ISO_Code=c.ISO_Code AND c.AD_Client_ID IN (0,i.AD_Client_ID)) ")
+ "WHERE C_Currency_ID IS NULL" .append("WHERE C_Currency_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("doIt- Set Currency=" + no); log.info("doIt- Set Currency=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Currency,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Currency,' ")
+ "WHERE C_Currency_ID IS NULL" .append("WHERE C_Currency_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid Currency=" + no); log.warning("Invalid Currency=" + no);
// Verify ProductType // Verify ProductType
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ProductType,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ProductType,' ")
+ "WHERE ProductType NOT IN ('E','I','R','S')" .append("WHERE ProductType NOT IN ('E','I','R','S')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Invalid ProductType=" + no); log.warning("Invalid ProductType=" + no);
// Unique UPC/Value // Unique UPC/Value
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Value not unique,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Value not unique,' ")
+ "WHERE I_IsImported<>'Y'" .append("WHERE I_IsImported<>'Y'")
+ " AND Value IN (SELECT Value FROM I_Product ii WHERE i.AD_Client_ID=ii.AD_Client_ID GROUP BY Value HAVING COUNT(*) > 1)").append(clientCheck); .append(" AND Value IN (SELECT Value FROM I_Product ii WHERE i.AD_Client_ID=ii.AD_Client_ID GROUP BY Value HAVING COUNT(*) > 1)").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Not Unique Value=" + no); log.warning("Not Unique Value=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=UPC not unique,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=UPC not unique,' ")
+ "WHERE I_IsImported<>'Y'" .append("WHERE I_IsImported<>'Y'")
+ " AND UPC IN (SELECT UPC FROM I_Product ii WHERE i.AD_Client_ID=ii.AD_Client_ID GROUP BY UPC HAVING COUNT(*) > 1)").append(clientCheck); .append(" AND UPC IN (SELECT UPC FROM I_Product ii WHERE i.AD_Client_ID=ii.AD_Client_ID GROUP BY UPC HAVING COUNT(*) > 1)").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("Not Unique UPC=" + no); log.warning("Not Unique UPC=" + no);
// Mandatory Value // Mandatory Value
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Mandatory Value,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Mandatory Value,' ")
+ "WHERE Value IS NULL" .append("WHERE Value IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.warning("No Mandatory Value=" + no); log.warning("No Mandatory Value=" + no);
@ -351,19 +351,19 @@ public class ImportProduct extends SvrProcess implements ImportProcess
// + " AND VendorProductNo IS NULL AND (C_BPartner_ID IS NOT NULL OR BPartner_Value IS NOT NULL)").append(clientCheck); // + " AND VendorProductNo IS NULL AND (C_BPartner_ID IS NOT NULL OR BPartner_Value IS NOT NULL)").append(clientCheck);
// no = DB.executeUpdate(sql.toString(), get_TrxName()); // no = DB.executeUpdate(sql.toString(), get_TrxName());
// log.info(log.l3_Util, "No Mandatory VendorProductNo=" + no); // log.info(log.l3_Util, "No Mandatory VendorProductNo=" + no);
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET VendorProductNo=Value " .append("SET VendorProductNo=Value ")
+ "WHERE C_BPartner_ID IS NOT NULL AND VendorProductNo IS NULL" .append("WHERE C_BPartner_ID IS NOT NULL AND VendorProductNo IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("VendorProductNo Set to Value=" + no); log.info("VendorProductNo Set to Value=" + no);
// //
sql = new StringBuffer ("UPDATE I_Product i " sql = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=VendorProductNo not unique,' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=VendorProductNo not unique,' ")
+ "WHERE I_IsImported<>'Y'" .append("WHERE I_IsImported<>'Y'")
+ " AND C_BPartner_ID IS NOT NULL" .append(" AND C_BPartner_ID IS NOT NULL")
+ " AND (C_BPartner_ID, VendorProductNo) IN " .append(" AND (C_BPartner_ID, VendorProductNo) IN ")
+ " (SELECT C_BPartner_ID, VendorProductNo FROM I_Product ii WHERE i.AD_Client_ID=ii.AD_Client_ID GROUP BY C_BPartner_ID, VendorProductNo HAVING COUNT(*) > 1)") .append(" (SELECT C_BPartner_ID, VendorProductNo FROM I_Product ii WHERE i.AD_Client_ID=ii.AD_Client_ID GROUP BY C_BPartner_ID, VendorProductNo HAVING COUNT(*) > 1)")
.append(clientCheck); .append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
@ -373,8 +373,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
int C_TaxCategory_ID = 0; int C_TaxCategory_ID = 0;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement StringBuilder dbpst = new StringBuilder("SELECT C_TaxCategory_ID FROM C_TaxCategory WHERE IsDefault='Y'").append(clientCheck);
("SELECT C_TaxCategory_ID FROM C_TaxCategory WHERE IsDefault='Y'" + clientCheck, get_TrxName()); PreparedStatement pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
C_TaxCategory_ID = rs.getInt(1); C_TaxCategory_ID = rs.getInt(1);
@ -399,7 +399,7 @@ public class ImportProduct extends SvrProcess implements ImportProcess
// Go through Records // Go through Records
log.fine("start inserting/updating ..."); log.fine("start inserting/updating ...");
sql = new StringBuffer ("SELECT * FROM I_Product WHERE I_IsImported='N'") sql = new StringBuilder ("SELECT * FROM I_Product WHERE I_IsImported='N'")
.append(clientCheck); .append(clientCheck);
try try
{ {
@ -504,8 +504,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
} }
else else
{ {
StringBuffer sql0 = new StringBuffer ("UPDATE I_Product i " StringBuilder sql0 = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Product failed")) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Product failed"))
.append("WHERE I_Product_ID=").append(I_Product_ID); .append("WHERE I_Product_ID=").append(I_Product_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -513,19 +513,19 @@ public class ImportProduct extends SvrProcess implements ImportProcess
} }
else // Update Product else // Update Product
{ {
String sqlt = "UPDATE M_PRODUCT " StringBuilder sqlt = new StringBuilder("UPDATE M_PRODUCT ")
+ "SET (Value,Name,Description,DocumentNote,Help," .append("SET (Value,Name,Description,DocumentNote,Help,")
+ "UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType," .append("UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,")
+ "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet," .append("Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,")
+ "Discontinued,DiscontinuedBy, DiscontinuedAt, Updated,UpdatedBy)= " .append("Discontinued,DiscontinuedBy, DiscontinuedAt, Updated,UpdatedBy)= ")
+ "(SELECT Value,Name,Description,DocumentNote,Help," .append("(SELECT Value,Name,Description,DocumentNote,Help,")
+ "UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType," .append("UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,")
+ "Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet," .append("Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,")
+ "Discontinued,DiscontinuedBy, DiscontinuedAt, SysDate,UpdatedBy" .append("Discontinued,DiscontinuedBy, DiscontinuedAt, SysDate,UpdatedBy")
+ " FROM I_Product WHERE I_Product_ID="+I_Product_ID+") " .append(" FROM I_Product WHERE I_Product_ID=").append(I_Product_ID).append(") ")
+ "WHERE M_Product_ID="+M_Product_ID; .append("WHERE M_Product_ID=").append(M_Product_ID);
PreparedStatement pstmt_updateProduct = DB.prepareStatement PreparedStatement pstmt_updateProduct = DB.prepareStatement
(sqlt, get_TrxName()); (sqlt.toString(), get_TrxName());
//jz pstmt_updateProduct.setInt(1, I_Product_ID); //jz pstmt_updateProduct.setInt(1, I_Product_ID);
// pstmt_updateProduct.setInt(2, M_Product_ID); // pstmt_updateProduct.setInt(2, M_Product_ID);
@ -538,8 +538,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
catch (SQLException ex) catch (SQLException ex)
{ {
log.warning("Update Product - " + ex.toString()); log.warning("Update Product - " + ex.toString());
StringBuffer sql0 = new StringBuffer ("UPDATE I_Product i " StringBuilder sql0 = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update Product: " + ex.toString())) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update Product: " + ex.toString()))
.append("WHERE I_Product_ID=").append(I_Product_ID); .append("WHERE I_Product_ID=").append(I_Product_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -554,22 +554,22 @@ public class ImportProduct extends SvrProcess implements ImportProcess
// If Product existed, Try to Update first // If Product existed, Try to Update first
if (!newProduct) if (!newProduct)
{ {
String sqlt = "UPDATE M_Product_PO " StringBuilder sqlt = new StringBuilder("UPDATE M_Product_PO ")
+ "SET (IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC," .append("SET (IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC,")
+ "PriceList,PricePO,RoyaltyAmt,PriceEffective," .append("PriceList,PricePO,RoyaltyAmt,PriceEffective,")
+ "VendorProductNo,VendorCategory,Manufacturer," .append("VendorProductNo,VendorCategory,Manufacturer,")
+ "Discontinued,DiscontinuedBy, DiscontinuedAt, Order_Min,Order_Pack," .append("Discontinued,DiscontinuedBy, DiscontinuedAt, Order_Min,Order_Pack,")
+ "CostPerOrder,DeliveryTime_Promised,Updated,UpdatedBy)= " .append("CostPerOrder,DeliveryTime_Promised,Updated,UpdatedBy)= ")
+ "(SELECT CAST('Y' AS CHAR),C_UOM_ID,C_Currency_ID,UPC," //jz fix EDB unknown datatype error .append("(SELECT CAST('Y' AS CHAR),C_UOM_ID,C_Currency_ID,UPC,") //jz fix EDB unknown datatype error
+ "PriceList,PricePO,RoyaltyAmt,PriceEffective," .append("PriceList,PricePO,RoyaltyAmt,PriceEffective,")
+ "VendorProductNo,VendorCategory,Manufacturer," .append("VendorProductNo,VendorCategory,Manufacturer,")
+ "Discontinued,DiscontinuedBy, DiscontinuedAt, Order_Min,Order_Pack," .append("Discontinued,DiscontinuedBy, DiscontinuedAt, Order_Min,Order_Pack,")
+ "CostPerOrder,DeliveryTime_Promised,SysDate,UpdatedBy" .append("CostPerOrder,DeliveryTime_Promised,SysDate,UpdatedBy")
+ " FROM I_Product" .append(" FROM I_Product")
+ " WHERE I_Product_ID="+I_Product_ID+") " .append(" WHERE I_Product_ID=").append(I_Product_ID).append(") ")
+ "WHERE M_Product_ID="+M_Product_ID+" AND C_BPartner_ID="+C_BPartner_ID; .append("WHERE M_Product_ID=").append(M_Product_ID).append(" AND C_BPartner_ID=").append(C_BPartner_ID);
PreparedStatement pstmt_updateProductPO = DB.prepareStatement PreparedStatement pstmt_updateProductPO = DB.prepareStatement
(sqlt, get_TrxName()); (sqlt.toString(), get_TrxName());
//jz pstmt_updateProductPO.setInt(1, I_Product_ID); //jz pstmt_updateProductPO.setInt(1, I_Product_ID);
// pstmt_updateProductPO.setInt(2, M_Product_ID); // pstmt_updateProductPO.setInt(2, M_Product_ID);
// pstmt_updateProductPO.setInt(3, C_BPartner_ID); // pstmt_updateProductPO.setInt(3, C_BPartner_ID);
@ -584,8 +584,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
log.warning("Update Product_PO - " + ex.toString()); log.warning("Update Product_PO - " + ex.toString());
noUpdate--; noUpdate--;
rollback(); rollback();
StringBuffer sql0 = new StringBuffer ("UPDATE I_Product i " StringBuilder sql0 = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update Product_PO: " + ex.toString())) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update Product_PO: " + ex.toString()))
.append("WHERE I_Product_ID=").append(I_Product_ID); .append("WHERE I_Product_ID=").append(I_Product_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -608,8 +608,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
log.warning("Insert Product_PO - " + ex.toString()); log.warning("Insert Product_PO - " + ex.toString());
noInsert--; // assume that product also did not exist noInsert--; // assume that product also did not exist
rollback(); rollback();
StringBuffer sql0 = new StringBuffer ("UPDATE I_Product i " StringBuilder sql0 = new StringBuilder ("UPDATE I_Product i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Product_PO: " + ex.toString())) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert Product_PO: " + ex.toString()))
.append("WHERE I_Product_ID=").append(I_Product_ID); .append("WHERE I_Product_ID=").append(I_Product_ID);
DB.executeUpdate(sql0.toString(), get_TrxName()); DB.executeUpdate(sql0.toString(), get_TrxName());
continue; continue;
@ -659,9 +659,9 @@ public class ImportProduct extends SvrProcess implements ImportProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_Product " sql = new StringBuilder ("UPDATE I_Product ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");
addLog (0, null, new BigDecimal (noInsert), "@M_Product_ID@: @Inserted@"); addLog (0, null, new BigDecimal (noInsert), "@M_Product_ID@: @Inserted@");
@ -680,7 +680,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
@Override @Override
public String getWhereClause() { public String getWhereClause() {
return " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder msgreturn = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
return msgreturn.toString();
} }
} // ImportProduct } // ImportProduct

View File

@ -76,181 +76,181 @@ public class ImportReportLine extends SvrProcess
*/ */
protected String doIt() throws java.lang.Exception protected String doIt() throws java.lang.Exception
{ {
StringBuffer sql = null; StringBuilder sql = null;
int no = 0; int no = 0;
String clientCheck = " AND AD_Client_ID=" + m_AD_Client_ID; StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(m_AD_Client_ID);
// **** Prepare **** // **** Prepare ****
// Delete Old Imported // Delete Old Imported
if (m_deleteOldImported) if (m_deleteOldImported)
{ {
sql = new StringBuffer ("DELETE I_ReportLine " sql = new StringBuilder ("DELETE I_ReportLine ")
+ "WHERE I_IsImported='Y'").append(clientCheck); .append("WHERE I_IsImported='Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Delete Old Impored =" + no); log.fine("Delete Old Impored =" + no);
} }
// Set Client, Org, IsActive, Created/Updated // Set Client, Org, IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append(")," .append("SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append("),")
+ " AD_Org_ID = COALESCE (AD_Org_ID, 0)," .append(" AD_Org_ID = COALESCE (AD_Org_ID, 0),")
+ " IsActive = COALESCE (IsActive, 'Y')," .append(" IsActive = COALESCE (IsActive, 'Y'),")
+ " Created = COALESCE (Created, SysDate)," .append(" Created = COALESCE (Created, SysDate),")
+ " CreatedBy = COALESCE (CreatedBy, 0)," .append(" CreatedBy = COALESCE (CreatedBy, 0),")
+ " Updated = COALESCE (Updated, SysDate)," .append(" Updated = COALESCE (Updated, SysDate),")
+ " UpdatedBy = COALESCE (UpdatedBy, 0)," .append(" UpdatedBy = COALESCE (UpdatedBy, 0),")
+ " I_ErrorMsg = ' '," .append(" I_ErrorMsg = ' ',")
+ " I_IsImported = 'N' " .append(" I_IsImported = 'N' ")
+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL"); .append("WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Reset=" + no); log.fine("Reset=" + no);
// ReportLineSetName (Default) // ReportLineSetName (Default)
if (m_PA_ReportLineSet_ID != 0) if (m_PA_ReportLineSet_ID != 0)
{ {
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET ReportLineSetName=(SELECT Name FROM PA_ReportLineSet r" .append("SET ReportLineSetName=(SELECT Name FROM PA_ReportLineSet r")
+ " WHERE PA_ReportLineSet_ID=").append(m_PA_ReportLineSet_ID).append(" AND i.AD_Client_ID=r.AD_Client_ID) " .append(" WHERE PA_ReportLineSet_ID=").append(m_PA_ReportLineSet_ID).append(" AND i.AD_Client_ID=r.AD_Client_ID) ")
+ "WHERE ReportLineSetName IS NULL AND PA_ReportLineSet_ID IS NULL" .append("WHERE ReportLineSetName IS NULL AND PA_ReportLineSet_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set ReportLineSetName Default=" + no); log.fine("Set ReportLineSetName Default=" + no);
} }
// Set PA_ReportLineSet_ID // Set PA_ReportLineSet_ID
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET PA_ReportLineSet_ID=(SELECT PA_ReportLineSet_ID FROM PA_ReportLineSet r" .append("SET PA_ReportLineSet_ID=(SELECT PA_ReportLineSet_ID FROM PA_ReportLineSet r")
+ " WHERE i.ReportLineSetName=r.Name AND i.AD_Client_ID=r.AD_Client_ID) " .append(" WHERE i.ReportLineSetName=r.Name AND i.AD_Client_ID=r.AD_Client_ID) ")
+ "WHERE PA_ReportLineSet_ID IS NULL" .append("WHERE PA_ReportLineSet_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PA_ReportLineSet_ID=" + no); log.fine("Set PA_ReportLineSet_ID=" + no);
// //
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ReportLineSet, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ReportLineSet, ' ")
+ "WHERE PA_ReportLineSet_ID IS NULL" .append("WHERE PA_ReportLineSet_ID IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid ReportLineSet=" + no); log.config("Invalid ReportLineSet=" + no);
// Ignore if there is no Report Line Name or ID // Ignore if there is no Report Line Name or ID
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Ignored=NoLineName, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'Ignored=NoLineName, ' ")
+ "WHERE PA_ReportLine_ID IS NULL AND Name IS NULL" .append("WHERE PA_ReportLine_ID IS NULL AND Name IS NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid LineName=" + no); log.config("Invalid LineName=" + no);
// Validate ElementValue // Validate ElementValue
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET C_ElementValue_ID=(SELECT C_ElementValue_ID FROM C_ElementValue e" .append("SET C_ElementValue_ID=(SELECT C_ElementValue_ID FROM C_ElementValue e")
+ " WHERE i.ElementValue=e.Value AND i.AD_Client_ID=e.AD_Client_ID) " .append(" WHERE i.ElementValue=e.Value AND i.AD_Client_ID=e.AD_Client_ID) ")
+ "WHERE C_ElementValue_ID IS NULL AND ElementValue IS NOT NULL" .append("WHERE C_ElementValue_ID IS NULL AND ElementValue IS NOT NULL")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set C_ElementValue_ID=" + no); log.fine("Set C_ElementValue_ID=" + no);
// Validate C_ElementValue_ID // Validate C_ElementValue_ID
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ElementValue, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid ElementValue, ' ")
+ "WHERE C_ElementValue_ID IS NULL AND LineType<>'C'" // MReportLine.LINETYPE_Calculation .append("WHERE C_ElementValue_ID IS NULL AND LineType<>'C'") // MReportLine.LINETYPE_Calculation
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid AccountType=" + no); log.config("Invalid AccountType=" + no);
// Set SeqNo // Set SeqNo
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET SeqNo=I_ReportLine_ID " .append("SET SeqNo=I_ReportLine_ID ")
+ "WHERE SeqNo IS NULL" .append("WHERE SeqNo IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set SeqNo Default=" + no); log.fine("Set SeqNo Default=" + no);
// Copy/Sync from first Row of Line // Copy/Sync from first Row of Line
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET (Description, SeqNo, IsSummary, IsPrinted, LineType, CalculationType, AmountType, PAAmountType, PAPeriodType, PostingType)=" .append("SET (Description, SeqNo, IsSummary, IsPrinted, LineType, CalculationType, AmountType, PAAmountType, PAPeriodType, PostingType)=")
+ " (SELECT Description, SeqNo, IsSummary, IsPrinted, LineType, CalculationType, AmountType, PAAmountType, PAPeriodType, PostingType" .append(" (SELECT Description, SeqNo, IsSummary, IsPrinted, LineType, CalculationType, AmountType, PAAmountType, PAPeriodType, PostingType")
+ " FROM I_ReportLine ii WHERE i.Name=ii.Name AND i.PA_ReportLineSet_ID=ii.PA_ReportLineSet_ID" .append(" FROM I_ReportLine ii WHERE i.Name=ii.Name AND i.PA_ReportLineSet_ID=ii.PA_ReportLineSet_ID")
+ " AND ii.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii" .append(" AND ii.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii")
+ " WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID)) " .append(" WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID)) ")
+ "WHERE EXISTS (SELECT *" .append("WHERE EXISTS (SELECT *")
+ " FROM I_ReportLine ii WHERE i.Name=ii.Name AND i.PA_ReportLineSet_ID=ii.PA_ReportLineSet_ID" .append(" FROM I_ReportLine ii WHERE i.Name=ii.Name AND i.PA_ReportLineSet_ID=ii.PA_ReportLineSet_ID")
+ " AND ii.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii" .append(" AND ii.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii")
+ " WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID))" .append(" WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID))")
+ " AND I_IsImported='N'").append(clientCheck); // not if previous error .append(" AND I_IsImported='N'").append(clientCheck); // not if previous error
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Sync from first Row of Line=" + no); log.fine("Sync from first Row of Line=" + no);
// Validate IsSummary - (N) Y // Validate IsSummary - (N) Y
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET IsSummary='N' " .append("SET IsSummary='N' ")
+ "WHERE IsSummary IS NULL OR IsSummary NOT IN ('Y','N')" .append("WHERE IsSummary IS NULL OR IsSummary NOT IN ('Y','N')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsSummary Default=" + no); log.fine("Set IsSummary Default=" + no);
// Validate IsPrinted - (Y) N // Validate IsPrinted - (Y) N
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET IsPrinted='Y' " .append("SET IsPrinted='Y' ")
+ "WHERE IsPrinted IS NULL OR IsPrinted NOT IN ('Y','N')" .append("WHERE IsPrinted IS NULL OR IsPrinted NOT IN ('Y','N')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set IsPrinted Default=" + no); log.fine("Set IsPrinted Default=" + no);
// Validate Line Type - (S) C // Validate Line Type - (S) C
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET LineType='S' " .append("SET LineType='S' ")
+ "WHERE LineType IS NULL OR LineType NOT IN ('S','C')" .append("WHERE LineType IS NULL OR LineType NOT IN ('S','C')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set LineType Default=" + no); log.fine("Set LineType Default=" + no);
// Validate Optional Calculation Type - A P R S // Validate Optional Calculation Type - A P R S
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid CalculationType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid CalculationType, ' ")
+ "WHERE CalculationType IS NOT NULL AND CalculationType NOT IN ('A','P','R','S')" .append("WHERE CalculationType IS NOT NULL AND CalculationType NOT IN ('A','P','R','S')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid CalculationType=" + no); log.config("Invalid CalculationType=" + no);
// Convert Optional Amount Type to PAAmount Type and PAPeriodType // Convert Optional Amount Type to PAAmount Type and PAPeriodType
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET PAAmountType = substr(AmountType,1,1), PAPeriodType = substr(AmountType,1,2) " .append("SET PAAmountType = substr(AmountType,1,1), PAPeriodType = substr(AmountType,1,2) ")
+ "WHERE AmountType IS NOT NULL AND (PAAmountType IS NULL OR PAPeriodType IS NULL) " .append("WHERE AmountType IS NOT NULL AND (PAAmountType IS NULL OR PAPeriodType IS NULL) ")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Converted AmountType=" + no); log.config("Converted AmountType=" + no);
// Validate Optional Amount Type - // Validate Optional Amount Type -
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid PAAmountType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid PAAmountType, ' ")
+ "WHERE PAAmountType IS NOT NULL AND UPPER(AmountType) NOT IN ('B','C','D','Q','S','R')" .append("WHERE PAAmountType IS NOT NULL AND UPPER(AmountType) NOT IN ('B','C','D','Q','S','R')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid AmountType=" + no); log.config("Invalid AmountType=" + no);
// Validate Optional Period Type - // Validate Optional Period Type -
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid PAPeriodType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid PAPeriodType, ' ")
+ "WHERE PAPeriodType IS NOT NULL AND UPPER(AmountType) NOT IN ('P','Y','T','N')" .append("WHERE PAPeriodType IS NOT NULL AND UPPER(AmountType) NOT IN ('P','Y','T','N')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid PeriodType=" + no); log.config("Invalid PeriodType=" + no);
// Validate Optional Posting Type - A B E S R // Validate Optional Posting Type - A B E S R
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid CalculationType, ' " .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid CalculationType, ' ")
+ "WHERE PostingType IS NOT NULL AND PostingType NOT IN ('A','B','E','S','R')" .append("WHERE PostingType IS NOT NULL AND PostingType NOT IN ('A','B','E','S','R')")
+ " AND I_IsImported<>'Y'").append(clientCheck); .append(" AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Invalid PostingType=" + no); log.config("Invalid PostingType=" + no);
// Set PA_ReportLine_ID // Set PA_ReportLine_ID
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET PA_ReportLine_ID=(SELECT MAX(PA_ReportLine_ID) FROM PA_ReportLine r" .append("SET PA_ReportLine_ID=(SELECT MAX(PA_ReportLine_ID) FROM PA_ReportLine r")
+ " WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID) " .append(" WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID) ")
+ "WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL" .append("WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PA_ReportLine_ID=" + no); log.fine("Set PA_ReportLine_ID=" + no);
@ -261,29 +261,29 @@ public class ImportReportLine extends SvrProcess
int noUpdateLine = 0; int noUpdateLine = 0;
// **** Create Missing ReportLines // **** Create Missing ReportLines
sql = new StringBuffer ("SELECT DISTINCT PA_ReportLineSet_ID, Name " sql = new StringBuilder ("SELECT DISTINCT PA_ReportLineSet_ID, Name ")
+ "FROM I_ReportLine " .append("FROM I_ReportLine ")
+ "WHERE I_IsImported='N' AND PA_ReportLine_ID IS NULL" .append("WHERE I_IsImported='N' AND PA_ReportLine_ID IS NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
try try
{ {
// Insert ReportLine // Insert ReportLine
PreparedStatement pstmt_insertLine = DB.prepareStatement StringBuilder dbpst = new StringBuilder("INSERT INTO PA_ReportLine ")
("INSERT INTO PA_ReportLine " .append("(PA_ReportLine_ID,PA_ReportLineSet_ID,")
+ "(PA_ReportLine_ID,PA_ReportLineSet_ID," .append("AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,")
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy," .append("Name,SeqNo,IsPrinted,IsSummary,LineType)")
+ "Name,SeqNo,IsPrinted,IsSummary,LineType)" .append("SELECT ?,PA_ReportLineSet_ID,")
+ "SELECT ?,PA_ReportLineSet_ID," .append("AD_Client_ID,AD_Org_ID,'Y',SysDate,CreatedBy,SysDate,UpdatedBy,")
+ "AD_Client_ID,AD_Org_ID,'Y',SysDate,CreatedBy,SysDate,UpdatedBy," .append("Name,SeqNo,IsPrinted,IsSummary,LineType ")
+ "Name,SeqNo,IsPrinted,IsSummary,LineType "
//jz + "FROM I_ReportLine " //jz + "FROM I_ReportLine "
// + "WHERE PA_ReportLineSet_ID=? AND Name=? AND ROWNUM=1" // #2..3 // + "WHERE PA_ReportLineSet_ID=? AND Name=? AND ROWNUM=1" // #2..3
+ "FROM I_ReportLine " .append("FROM I_ReportLine ")
+ "WHERE I_ReportLine_ID=(SELECT MAX(I_ReportLine_ID) " .append("WHERE I_ReportLine_ID=(SELECT MAX(I_ReportLine_ID) ")
+ "FROM I_ReportLine " .append("FROM I_ReportLine ")
+ "WHERE PA_ReportLineSet_ID=? AND Name=? " // #2..3 .append("WHERE PA_ReportLineSet_ID=? AND Name=? ") // #2..3
//jz + clientCheck, get_TrxName()); //jz + clientCheck, get_TrxName());
+ clientCheck + ")", get_TrxName()); .append(clientCheck).append(")");
PreparedStatement pstmt_insertLine = DB.prepareStatement(dbpst.toString(), get_TrxName());
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
@ -322,25 +322,25 @@ public class ImportReportLine extends SvrProcess
} }
// Set PA_ReportLine_ID (for newly created) // Set PA_ReportLine_ID (for newly created)
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET PA_ReportLine_ID=(SELECT MAX(PA_ReportLine_ID) FROM PA_ReportLine r" .append("SET PA_ReportLine_ID=(SELECT MAX(PA_ReportLine_ID) FROM PA_ReportLine r")
+ " WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID) " .append(" WHERE i.Name=r.Name AND i.PA_ReportLineSet_ID=r.PA_ReportLineSet_ID) ")
+ "WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL" .append("WHERE PA_ReportLine_ID IS NULL AND PA_ReportLineSet_ID IS NOT NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set PA_ReportLine_ID=" + no); log.fine("Set PA_ReportLine_ID=" + no);
// **** Update ReportLine // **** Update ReportLine
sql = new StringBuffer ("UPDATE PA_ReportLine r " sql = new StringBuilder ("UPDATE PA_ReportLine r ")
+ "SET (Description,SeqNo,IsSummary,IsPrinted,LineType,CalculationType,AmountType,PAAmountType,PAPeriodType,PostingType,Updated,UpdatedBy)=" .append("SET (Description,SeqNo,IsSummary,IsPrinted,LineType,CalculationType,AmountType,PAAmountType,PAPeriodType,PostingType,Updated,UpdatedBy)=")
+ " (SELECT Description,SeqNo,IsSummary,IsPrinted,LineType,CalculationType,AmountType,PAAmountType,PAPeriodType,PostingType,SysDate,UpdatedBy" .append(" (SELECT Description,SeqNo,IsSummary,IsPrinted,LineType,CalculationType,AmountType,PAAmountType,PAPeriodType,PostingType,SysDate,UpdatedBy")
+ " FROM I_ReportLine i WHERE r.Name=i.Name AND r.PA_ReportLineSet_ID=i.PA_ReportLineSet_ID" .append(" FROM I_ReportLine i WHERE r.Name=i.Name AND r.PA_ReportLineSet_ID=i.PA_ReportLineSet_ID")
+ " AND i.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii" .append(" AND i.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii")
+ " WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID)) " .append(" WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID)) ")
+ "WHERE EXISTS (SELECT *" .append("WHERE EXISTS (SELECT *")
+ " FROM I_ReportLine i WHERE r.Name=i.Name AND r.PA_ReportLineSet_ID=i.PA_ReportLineSet_ID" .append(" FROM I_ReportLine i WHERE r.Name=i.Name AND r.PA_ReportLineSet_ID=i.PA_ReportLineSet_ID")
+ " AND i.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii" .append(" AND i.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii")
+ " WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID AND i.I_IsImported='N'))") .append(" WHERE i.Name=iii.Name AND i.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID AND i.I_IsImported='N'))")
.append(clientCheck); .append(clientCheck);
noUpdateLine = DB.executeUpdate(sql.toString(), get_TrxName()); noUpdateLine = DB.executeUpdate(sql.toString(), get_TrxName());
log.config("Update PA_ReportLine=" + noUpdateLine); log.config("Update PA_ReportLine=" + noUpdateLine);
@ -351,26 +351,26 @@ public class ImportReportLine extends SvrProcess
int noUpdateSource = 0; int noUpdateSource = 0;
// **** Create ReportSource // **** Create ReportSource
sql = new StringBuffer ("SELECT I_ReportLine_ID, PA_ReportSource_ID " sql = new StringBuilder ("SELECT I_ReportLine_ID, PA_ReportSource_ID ")
+ "FROM I_ReportLine " .append("FROM I_ReportLine ")
+ "WHERE PA_ReportLine_ID IS NOT NULL" .append("WHERE PA_ReportLine_ID IS NOT NULL")
+ " AND I_IsImported='N'").append(clientCheck); .append(" AND I_IsImported='N'").append(clientCheck);
try try
{ {
// Insert ReportSource // Insert ReportSource
PreparedStatement pstmt_insertSource = DB.prepareStatement StringBuilder dbpst = new StringBuilder("INSERT INTO PA_ReportSource ")
("INSERT INTO PA_ReportSource " .append("(PA_ReportSource_ID,")
+ "(PA_ReportSource_ID," .append("AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,")
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy," .append("PA_ReportLine_ID,ElementType,C_ElementValue_ID) ")
+ "PA_ReportLine_ID,ElementType,C_ElementValue_ID) " .append("SELECT ?,")
+ "SELECT ?," .append("AD_Client_ID,AD_Org_ID,'Y',SysDate,CreatedBy,SysDate,UpdatedBy,")
+ "AD_Client_ID,AD_Org_ID,'Y',SysDate,CreatedBy,SysDate,UpdatedBy," .append("PA_ReportLine_ID,'AC',C_ElementValue_ID ")
+ "PA_ReportLine_ID,'AC',C_ElementValue_ID " .append("FROM I_ReportLine ")
+ "FROM I_ReportLine " .append("WHERE I_ReportLine_ID=?")
+ "WHERE I_ReportLine_ID=?" .append(" AND I_IsImported='N'")
+ " AND I_IsImported='N'" .append(clientCheck);
+ clientCheck, get_TrxName()); PreparedStatement pstmt_insertSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
// Update ReportSource // Update ReportSource
//jz //jz
@ -387,11 +387,11 @@ public class ImportReportLine extends SvrProcess
*/ */
// Delete ReportSource - afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports // Delete ReportSource - afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports
PreparedStatement pstmt_deleteSource = DB.prepareStatement dbpst = new StringBuilder("DELETE FROM PA_ReportSource ")
("DELETE FROM PA_ReportSource " .append("WHERE C_ElementValue_ID IS NULL")
+ "WHERE C_ElementValue_ID IS NULL" .append(" AND PA_ReportSource_ID=?")
+ " AND PA_ReportSource_ID=?" .append(clientCheck);
+ clientCheck, get_TrxName()); PreparedStatement pstmt_deleteSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
//End afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports //End afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports
// Set Imported = Y // Set Imported = Y
@ -424,8 +424,8 @@ public class ImportReportLine extends SvrProcess
catch (Exception ex) catch (Exception ex)
{ {
log.finest("Insert ReportSource - " + ex.toString()); log.finest("Insert ReportSource - " + ex.toString());
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert ElementSource: " + ex.toString())) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Insert ElementSource: " + ex.toString()))
.append("WHERE I_ReportLine_ID=").append(I_ReportLine_ID); .append("WHERE I_ReportLine_ID=").append(I_ReportLine_ID);
DB.executeUpdate(sql.toString(), get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
continue; continue;
@ -434,15 +434,15 @@ public class ImportReportLine extends SvrProcess
else // update Report Source else // update Report Source
{ {
//jz //jz
String sqlt="UPDATE PA_ReportSource " StringBuilder sqlt= new StringBuilder("UPDATE PA_ReportSource ")
+ "SET (ElementType,C_ElementValue_ID,Updated,UpdatedBy)=" .append("SET (ElementType,C_ElementValue_ID,Updated,UpdatedBy)=")
+ " (SELECT CAST('AC' AS CHAR(2)),C_ElementValue_ID,SysDate,UpdatedBy" //jz .append(" (SELECT CAST('AC' AS CHAR(2)),C_ElementValue_ID,SysDate,UpdatedBy") //jz
+ " FROM I_ReportLine" .append(" FROM I_ReportLine")
+ " WHERE I_ReportLine_ID=" + I_ReportLine_ID + ") " .append(" WHERE I_ReportLine_ID=").append(I_ReportLine_ID).append(") ")
+ "WHERE PA_ReportSource_ID="+PA_ReportSource_ID+" " .append("WHERE PA_ReportSource_ID=").append(PA_ReportSource_ID).append(" ")
+ clientCheck; .append(clientCheck);
PreparedStatement pstmt_updateSource = DB.prepareStatement PreparedStatement pstmt_updateSource = DB.prepareStatement
(sqlt, get_TrxName()); (sqlt.toString(), get_TrxName());
//pstmt_updateSource.setInt(1, I_ReportLine_ID); //pstmt_updateSource.setInt(1, I_ReportLine_ID);
//pstmt_updateSource.setInt(2, PA_ReportSource_ID); //pstmt_updateSource.setInt(2, PA_ReportSource_ID);
try try
@ -455,8 +455,8 @@ public class ImportReportLine extends SvrProcess
catch (SQLException ex) catch (SQLException ex)
{ {
log.finest( "Update ReportSource - " + ex.toString()); log.finest( "Update ReportSource - " + ex.toString());
sql = new StringBuffer ("UPDATE I_ReportLine i " sql = new StringBuilder ("UPDATE I_ReportLine i ")
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update ElementSource: " + ex.toString())) .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append(DB.TO_STRING("Update ElementSource: " + ex.toString()))
.append("WHERE I_ReportLine_ID=").append(I_ReportLine_ID); .append("WHERE I_ReportLine_ID=").append(I_ReportLine_ID);
DB.executeUpdate(sql.toString(), get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
continue; continue;
@ -494,9 +494,9 @@ public class ImportReportLine extends SvrProcess
} }
// Set Error to indicator to not imported // Set Error to indicator to not imported
sql = new StringBuffer ("UPDATE I_ReportLine " sql = new StringBuilder ("UPDATE I_ReportLine ")
+ "SET I_IsImported='N', Updated=SysDate " .append("SET I_IsImported='N', Updated=SysDate ")
+ "WHERE I_IsImported<>'Y'").append(clientCheck); .append("WHERE I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
addLog (0, null, new BigDecimal (no), "@Errors@"); addLog (0, null, new BigDecimal (no), "@Errors@");

View File

@ -74,7 +74,7 @@ public class InOutGenerate extends SvrProcess
private int m_lastC_BPartner_Location_ID = -1; private int m_lastC_BPartner_Location_ID = -1;
/** The Query sql */ /** The Query sql */
private String m_sql = null; private StringBuffer m_sql = null;
/** Storages temp space */ /** Storages temp space */
@ -147,38 +147,38 @@ public class InOutGenerate extends SvrProcess
if (p_Selection) // VInOutGen if (p_Selection) // VInOutGen
{ {
m_sql = "SELECT C_Order.* FROM C_Order, T_Selection " m_sql = new StringBuffer("SELECT C_Order.* FROM C_Order, T_Selection ")
+ "WHERE C_Order.DocStatus='CO' AND C_Order.IsSOTrx='Y' AND C_Order.AD_Client_ID=? " .append("WHERE C_Order.DocStatus='CO' AND C_Order.IsSOTrx='Y' AND C_Order.AD_Client_ID=? ")
+ "AND C_Order.C_Order_ID = T_Selection.T_Selection_ID " .append("AND C_Order.C_Order_ID = T_Selection.T_Selection_ID ")
+ "AND T_Selection.AD_PInstance_ID=? "; .append("AND T_Selection.AD_PInstance_ID=? ");
} }
else else
{ {
m_sql = "SELECT * FROM C_Order o " m_sql = new StringBuffer("SELECT * FROM C_Order o ")
+ "WHERE DocStatus='CO' AND IsSOTrx='Y'" .append("WHERE DocStatus='CO' AND IsSOTrx='Y'")
// No Offer,POS // No Offer,POS
+ " AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType " .append(" AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType ")
+ "WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))" .append("WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR'))")
+ " AND o.IsDropShip='N'" .append(" AND o.IsDropShip='N'")
// No Manual // No Manual
+ " AND o.DeliveryRule<>'M'" .append(" AND o.DeliveryRule<>'M'")
// Open Order Lines with Warehouse // Open Order Lines with Warehouse
+ " AND EXISTS (SELECT * FROM C_OrderLine ol " .append(" AND EXISTS (SELECT * FROM C_OrderLine ol ")
+ "WHERE ol.M_Warehouse_ID=?"; // #1 .append("WHERE ol.M_Warehouse_ID=?"); // #1
if (p_DatePromised != null) if (p_DatePromised != null)
m_sql += " AND TRUNC(ol.DatePromised)<=?"; // #2 m_sql.append(" AND TRUNC(ol.DatePromised)<=?"); // #2
m_sql += " AND o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyDelivered)"; m_sql.append(" AND o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyDelivered)");
// //
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
m_sql += " AND o.C_BPartner_ID=?"; // #3 m_sql.append(" AND o.C_BPartner_ID=?"); // #3
} }
m_sql += " ORDER BY M_Warehouse_ID, PriorityRule, M_Shipper_ID, C_BPartner_ID, C_BPartner_Location_ID, C_Order_ID"; m_sql.append(" ORDER BY M_Warehouse_ID, PriorityRule, M_Shipper_ID, C_BPartner_ID, C_BPartner_Location_ID, C_Order_ID");
// m_sql += " FOR UPDATE"; // m_sql += " FOR UPDATE";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (m_sql, get_TrxName()); pstmt = DB.prepareStatement (m_sql.toString(), get_TrxName());
int index = 1; int index = 1;
if (p_Selection) if (p_Selection)
{ {
@ -196,7 +196,7 @@ public class InOutGenerate extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, m_sql, e); log.log(Level.SEVERE, m_sql.toString(), e);
} }
return generate(pstmt); return generate(pstmt);
} // doIt } // doIt
@ -228,23 +228,23 @@ public class InOutGenerate extends SvrProcess
Timestamp minGuaranteeDate = m_movementDate; Timestamp minGuaranteeDate = m_movementDate;
boolean completeOrder = MOrder.DELIVERYRULE_CompleteOrder.equals(order.getDeliveryRule()); boolean completeOrder = MOrder.DELIVERYRULE_CompleteOrder.equals(order.getDeliveryRule());
// OrderLine WHERE // OrderLine WHERE
String where = " AND M_Warehouse_ID=" + p_M_Warehouse_ID; StringBuilder where = new StringBuilder(" AND M_Warehouse_ID=").append(p_M_Warehouse_ID);
if (p_DatePromised != null) if (p_DatePromised != null)
where += " AND (TRUNC(DatePromised)<=" + DB.TO_DATE(p_DatePromised, true) where.append(" AND (TRUNC(DatePromised)<=").append(DB.TO_DATE(p_DatePromised, true))
+ " OR DatePromised IS NULL)"; .append(" OR DatePromised IS NULL)");
// Exclude Auto Delivery if not Force // Exclude Auto Delivery if not Force
if (!MOrder.DELIVERYRULE_Force.equals(order.getDeliveryRule())) if (!MOrder.DELIVERYRULE_Force.equals(order.getDeliveryRule()))
where += " AND (C_OrderLine.M_Product_ID IS NULL" where.append(" AND (C_OrderLine.M_Product_ID IS NULL")
+ " OR EXISTS (SELECT * FROM M_Product p " .append(" OR EXISTS (SELECT * FROM M_Product p ")
+ "WHERE C_OrderLine.M_Product_ID=p.M_Product_ID" .append("WHERE C_OrderLine.M_Product_ID=p.M_Product_ID")
+ " AND IsExcludeAutoDelivery='N'))"; .append(" AND IsExcludeAutoDelivery='N'))");
// Exclude Unconfirmed // Exclude Unconfirmed
if (!p_IsUnconfirmedInOut) if (!p_IsUnconfirmedInOut)
where += " AND NOT EXISTS (SELECT * FROM M_InOutLine iol" where.append(" AND NOT EXISTS (SELECT * FROM M_InOutLine iol")
+ " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) " .append(" INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID) ")
+ "WHERE iol.C_OrderLine_ID=C_OrderLine.C_OrderLine_ID AND io.DocStatus IN ('IP','WC'))"; .append("WHERE iol.C_OrderLine_ID=C_OrderLine.C_OrderLine_ID AND io.DocStatus IN ('IP','WC'))");
// Deadlock Prevention - Order by M_Product_ID // Deadlock Prevention - Order by M_Product_ID
MOrderLine[] lines = order.getLines (where, "C_BPartner_Location_ID, M_Product_ID"); MOrderLine[] lines = order.getLines (where.toString(), "C_BPartner_Location_ID, M_Product_ID");
for (int i = 0; i < lines.length; i++) for (int i = 0; i < lines.length; i++)
{ {
MOrderLine line = lines[i]; MOrderLine line = lines[i];
@ -272,18 +272,18 @@ public class InOutGenerate extends SvrProcess
line.getC_OrderLine_ID(), where2, null); line.getC_OrderLine_ID(), where2, null);
for (int j = 0; j < iols.length; j++) for (int j = 0; j < iols.length; j++)
unconfirmedShippedQty = unconfirmedShippedQty.add(iols[j].getMovementQty()); unconfirmedShippedQty = unconfirmedShippedQty.add(iols[j].getMovementQty());
String logInfo = "Unconfirmed Qty=" + unconfirmedShippedQty StringBuilder logInfo = new StringBuilder("Unconfirmed Qty=").append(unconfirmedShippedQty)
+ " - ToDeliver=" + toDeliver + "->"; .append(" - ToDeliver=").append(toDeliver).append("->");
toDeliver = toDeliver.subtract(unconfirmedShippedQty); toDeliver = toDeliver.subtract(unconfirmedShippedQty);
logInfo += toDeliver; logInfo.append(toDeliver);
if (toDeliver.signum() < 0) if (toDeliver.signum() < 0)
{ {
toDeliver = Env.ZERO; toDeliver = Env.ZERO;
logInfo += " (set to 0)"; logInfo.append(" (set to 0)");
} }
// Adjust On Hand // Adjust On Hand
onHand = onHand.subtract(unconfirmedShippedQty); onHand = onHand.subtract(unconfirmedShippedQty);
log.fine(logInfo); log.fine(logInfo.toString());
} }
// Comments & lines w/o product & services // Comments & lines w/o product & services
@ -397,7 +397,7 @@ public class InOutGenerate extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, m_sql, e); log.log(Level.SEVERE, m_sql.toString(), e);
} }
try try
{ {
@ -410,7 +410,8 @@ public class InOutGenerate extends SvrProcess
pstmt = null; pstmt = null;
} }
completeShipment(); completeShipment();
return "@Created@ = " + m_created; StringBuilder msgreturn = new StringBuilder("@Created@ = ").append(m_created);
return msgreturn.toString();
} // generate } // generate
@ -584,7 +585,8 @@ public class InOutGenerate extends SvrProcess
} }
m_shipment.saveEx(); m_shipment.saveEx();
addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, m_shipment.getDocumentNo(),m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID()); String message = Msg.parseTranslation(getCtx(), "@ShipmentProcessed@ " + m_shipment.getDocumentNo());
addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, message, m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID());
m_created++; m_created++;
//reset storage cache as MInOut.completeIt will update m_storage //reset storage cache as MInOut.completeIt will update m_storage

View File

@ -119,52 +119,53 @@ public class InventoryCountCreate extends SvrProcess
if (p_DeleteOld) if (p_DeleteOld)
{ {
//Added Line by armen //Added Line by armen
String sql1 = "DELETE FROM M_InventoryLineMA ma WHERE EXISTS " StringBuilder sql1 = new StringBuilder("DELETE FROM M_InventoryLineMA ma WHERE EXISTS ")
+ "(SELECT * FROM M_InventoryLine l WHERE l.M_InventoryLine_ID=ma.M_InventoryLine_ID" .append("(SELECT * FROM M_InventoryLine l WHERE l.M_InventoryLine_ID=ma.M_InventoryLine_ID")
+ " AND Processed='N' AND M_Inventory_ID=" + p_M_Inventory_ID + ")"; .append(" AND Processed='N' AND M_Inventory_ID=").append(p_M_Inventory_ID).append(")");
int no1 = DB.executeUpdate(sql1, get_TrxName()); int no1 = DB.executeUpdate(sql1.toString(), get_TrxName());
log.fine("doIt - Deleted MA #" + no1); log.fine("doIt - Deleted MA #" + no1);
//End of Added Line //End of Added Line
String sql = "DELETE M_InventoryLine WHERE Processed='N' " StringBuilder sql = new StringBuilder("DELETE M_InventoryLine WHERE Processed='N' ")
+ "AND M_Inventory_ID=" + p_M_Inventory_ID; .append("AND M_Inventory_ID=").append(p_M_Inventory_ID);
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("doIt - Deleted #" + no); log.fine("doIt - Deleted #" + no);
} }
// Create Null Storage records // Create Null Storage records
if (p_QtyRange != null && p_QtyRange.equals("=")) if (p_QtyRange != null && p_QtyRange.equals("="))
{ {
String sql = "INSERT INTO M_Storage " StringBuilder sql = new StringBuilder("INSERT INTO M_Storage ");
+ "(AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," sql.append("(AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,");
+ " M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID," sql.append(" M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,");
+ " QtyOnHand, QtyReserved, QtyOrdered, DateLastInventory) " sql.append(" QtyOnHand, QtyReserved, QtyOrdered, DateLastInventory) ");
+ "SELECT l.AD_CLIENT_ID, l.AD_ORG_ID, 'Y', SysDate, 0,SysDate, 0," sql.append("SELECT l.AD_CLIENT_ID, l.AD_ORG_ID, 'Y', SysDate, 0,SysDate, 0,");
+ " l.M_Locator_ID, p.M_Product_ID, 0," sql.append(" l.M_Locator_ID, p.M_Product_ID, 0,");
+ " 0,0,0,null " sql.append(" 0,0,0,null ");
+ "FROM M_Locator l" sql.append("FROM M_Locator l");
+ " INNER JOIN M_Product p ON (l.AD_Client_ID=p.AD_Client_ID) " sql.append(" INNER JOIN M_Product p ON (l.AD_Client_ID=p.AD_Client_ID) ");
+ "WHERE l.M_Warehouse_ID=" + m_inventory.getM_Warehouse_ID(); sql.append("WHERE l.M_Warehouse_ID=");
sql.append(m_inventory.getM_Warehouse_ID());
if (p_M_Locator_ID != 0) if (p_M_Locator_ID != 0)
sql += " AND l.M_Locator_ID=" + p_M_Locator_ID; sql.append(" AND l.M_Locator_ID=").append(p_M_Locator_ID);
sql += " AND l.IsDefault='Y'" sql.append(" AND l.IsDefault='Y'")
+ " AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'" .append(" AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'")
+ " AND NOT EXISTS (SELECT * FROM M_Storage s" .append(" AND NOT EXISTS (SELECT * FROM M_Storage s")
+ " INNER JOIN M_Locator sl ON (s.M_Locator_ID=sl.M_Locator_ID) " .append(" INNER JOIN M_Locator sl ON (s.M_Locator_ID=sl.M_Locator_ID) ")
+ "WHERE sl.M_Warehouse_ID=l.M_Warehouse_ID" .append("WHERE sl.M_Warehouse_ID=l.M_Warehouse_ID")
+ " AND s.M_Product_ID=p.M_Product_ID)"; .append(" AND s.M_Product_ID=p.M_Product_ID)");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("'0' Inserted #" + no); log.fine("'0' Inserted #" + no);
} }
StringBuffer sql = new StringBuffer( StringBuilder sql = new StringBuilder("SELECT s.M_Product_ID, s.M_Locator_ID, s.M_AttributeSetInstance_ID,");
"SELECT s.M_Product_ID, s.M_Locator_ID, s.M_AttributeSetInstance_ID," sql.append(" s.QtyOnHand, p.M_AttributeSet_ID ");
+ " s.QtyOnHand, p.M_AttributeSet_ID " sql.append("FROM M_Product p");
+ "FROM M_Product p" sql.append(" INNER JOIN M_Storage s ON (s.M_Product_ID=p.M_Product_ID)");
+ " INNER JOIN M_Storage s ON (s.M_Product_ID=p.M_Product_ID)" sql.append(" INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) ");
+ " INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID) " sql.append("WHERE l.M_Warehouse_ID=?");
+ "WHERE l.M_Warehouse_ID=?" sql.append(" AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'");
+ " AND p.IsActive='Y' AND p.IsStocked='Y' and p.ProductType='I'");
// //
if (p_M_Locator_ID != 0) if (p_M_Locator_ID != 0)
sql.append(" AND s.M_Locator_ID=?"); sql.append(" AND s.M_Locator_ID=?");
@ -182,15 +183,17 @@ public class InventoryCountCreate extends SvrProcess
sql.append(" AND UPPER(p.Value) LIKE ?"); sql.append(" AND UPPER(p.Value) LIKE ?");
// //
if (p_M_Product_Category_ID != 0) if (p_M_Product_Category_ID != 0)
sql.append(" AND p.M_Product_Category_ID IN (" + getSubCategoryWhereClause(p_M_Product_Category_ID) + ")"); sql.append(" AND p.M_Product_Category_ID IN (")
.append(getSubCategoryWhereClause(p_M_Product_Category_ID))
.append(")");
// Do not overwrite existing records // Do not overwrite existing records
if (!p_DeleteOld) if (!p_DeleteOld)
sql.append(" AND NOT EXISTS (SELECT * FROM M_InventoryLine il " sql.append(" AND NOT EXISTS (SELECT * FROM M_InventoryLine il ")
+ "WHERE il.M_Inventory_ID=?" .append("WHERE il.M_Inventory_ID=?")
+ " AND il.M_Product_ID=s.M_Product_ID" .append(" AND il.M_Product_ID=s.M_Product_ID")
+ " AND il.M_Locator_ID=s.M_Locator_ID" .append(" AND il.M_Locator_ID=s.M_Locator_ID")
+ " AND COALESCE(il.M_AttributeSetInstance_ID,0)=COALESCE(s.M_AttributeSetInstance_ID,0))"); .append(" AND COALESCE(il.M_AttributeSetInstance_ID,0)=COALESCE(s.M_AttributeSetInstance_ID,0))");
// + " AND il.M_AttributeSetInstance_ID=s.M_AttributeSetInstance_ID)"); // + " AND il.M_AttributeSetInstance_ID=s.M_AttributeSetInstance_ID)");
// //
sql.append(" ORDER BY l.Value, p.Value, s.QtyOnHand DESC"); // Locator/Product sql.append(" ORDER BY l.Value, p.Value, s.QtyOnHand DESC"); // Locator/Product
@ -254,15 +257,16 @@ public class InventoryCountCreate extends SvrProcess
// Set Count to Zero // Set Count to Zero
if (p_InventoryCountSetZero) if (p_InventoryCountSetZero)
{ {
String sql1 = "UPDATE M_InventoryLine l " StringBuilder sql1 = new StringBuilder("UPDATE M_InventoryLine l ")
+ "SET QtyCount=0 " .append("SET QtyCount=0 ")
+ "WHERE M_Inventory_ID=" + p_M_Inventory_ID; .append("WHERE M_Inventory_ID=").append(p_M_Inventory_ID);
int no = DB.executeUpdate(sql1, get_TrxName()); int no = DB.executeUpdate(sql1.toString(), get_TrxName());
log.info("Set Cont to Zero=" + no); log.info("Set Cont to Zero=" + no);
} }
// //
return "@M_InventoryLine_ID@ - #" + count; StringBuilder msgreturn = new StringBuilder("@M_InventoryLine_ID@ - #").append(count);
return msgreturn.toString();
} // doIt } // doIt
/** /**
@ -347,7 +351,7 @@ public class InventoryCountCreate extends SvrProcess
private String getSubCategoryWhereClause(int productCategoryId) throws SQLException, AdempiereSystemError{ private String getSubCategoryWhereClause(int productCategoryId) throws SQLException, AdempiereSystemError{
//if a node with this id is found later in the search we have a loop in the tree //if a node with this id is found later in the search we have a loop in the tree
int subTreeRootParentId = 0; int subTreeRootParentId = 0;
String retString = " "; StringBuilder retString = new StringBuilder();
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category"; String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100); final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
Statement stmt = DB.createStatement(); Statement stmt = DB.createStatement();
@ -358,10 +362,10 @@ public class InventoryCountCreate extends SvrProcess
} }
categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2))); categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2)));
} }
retString += getSubCategoriesString(productCategoryId, categories, subTreeRootParentId); retString.append(getSubCategoriesString(productCategoryId, categories, subTreeRootParentId));
rs.close(); rs.close();
stmt.close(); stmt.close();
return retString; return retString.toString();
} }
/** /**
@ -373,7 +377,7 @@ public class InventoryCountCreate extends SvrProcess
* @throws AdempiereSystemError if a loop is detected * @throws AdempiereSystemError if a loop is detected
*/ */
private String getSubCategoriesString(int productCategoryId, Vector<SimpleTreeNode> categories, int loopIndicatorId) throws AdempiereSystemError { private String getSubCategoriesString(int productCategoryId, Vector<SimpleTreeNode> categories, int loopIndicatorId) throws AdempiereSystemError {
String ret = ""; StringBuilder ret = new StringBuilder();
final Iterator iter = categories.iterator(); final Iterator iter = categories.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
SimpleTreeNode node = (SimpleTreeNode) iter.next(); SimpleTreeNode node = (SimpleTreeNode) iter.next();
@ -381,11 +385,13 @@ public class InventoryCountCreate extends SvrProcess
if (node.getNodeId() == loopIndicatorId) { if (node.getNodeId() == loopIndicatorId) {
throw new AdempiereSystemError("The product category tree contains a loop on categoryId: " + loopIndicatorId); throw new AdempiereSystemError("The product category tree contains a loop on categoryId: " + loopIndicatorId);
} }
ret = ret + getSubCategoriesString(node.getNodeId(), categories, loopIndicatorId) + ","; ret.append(getSubCategoriesString(node.getNodeId(), categories, loopIndicatorId));
ret.append(",");
} }
} }
log.fine(ret); log.fine(ret.toString());
return ret + productCategoryId; StringBuilder msgreturn = new StringBuilder(ret).append(productCategoryId);
return msgreturn.toString();
} }
/** /**

View File

@ -75,34 +75,34 @@ public class InventoryCountUpdate extends SvrProcess
throw new AdempiereSystemError ("Not found: M_Inventory_ID=" + p_M_Inventory_ID); throw new AdempiereSystemError ("Not found: M_Inventory_ID=" + p_M_Inventory_ID);
// Multiple Lines for one item // Multiple Lines for one item
String sql = "UPDATE M_InventoryLine SET IsActive='N' " StringBuilder sql = new StringBuilder("UPDATE M_InventoryLine SET IsActive='N' ")
+ "WHERE M_Inventory_ID=" + p_M_Inventory_ID .append("WHERE M_Inventory_ID=").append(p_M_Inventory_ID)
+ " AND (M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID) IN " .append(" AND (M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID) IN ")
+ "(SELECT M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID " .append("(SELECT M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID ")
+ "FROM M_InventoryLine " .append("FROM M_InventoryLine ")
+ "WHERE M_Inventory_ID=" + p_M_Inventory_ID .append("WHERE M_Inventory_ID=").append(p_M_Inventory_ID)
+ " GROUP BY M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID " .append(" GROUP BY M_Product_ID, M_Locator_ID, M_AttributeSetInstance_ID ")
+ "HAVING COUNT(*) > 1)"; .append("HAVING COUNT(*) > 1)");
int multiple = DB.executeUpdate(sql, get_TrxName()); int multiple = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Multiple=" + multiple); log.info("Multiple=" + multiple);
int delMA = MInventoryLineMA.deleteInventoryMA(p_M_Inventory_ID, get_TrxName()); int delMA = MInventoryLineMA.deleteInventoryMA(p_M_Inventory_ID, get_TrxName());
log.info("DeletedMA=" + delMA); log.info("DeletedMA=" + delMA);
// ASI // ASI
sql = "UPDATE M_InventoryLine l " sql = new StringBuilder("UPDATE M_InventoryLine l ")
+ "SET (QtyBook,QtyCount) = " .append("SET (QtyBook,QtyCount) = ")
+ "(SELECT QtyOnHand,QtyOnHand FROM M_Storage s " .append("(SELECT QtyOnHand,QtyOnHand FROM M_Storage s ")
+ "WHERE s.M_Product_ID=l.M_Product_ID AND s.M_Locator_ID=l.M_Locator_ID" .append("WHERE s.M_Product_ID=l.M_Product_ID AND s.M_Locator_ID=l.M_Locator_ID")
+ " AND s.M_AttributeSetInstance_ID=l.M_AttributeSetInstance_ID)," .append(" AND s.M_AttributeSetInstance_ID=l.M_AttributeSetInstance_ID),")
+ " Updated=SysDate," .append(" Updated=SysDate,")
+ " UpdatedBy=" + getAD_User_ID() .append(" UpdatedBy=").append(getAD_User_ID())
// //
+ " WHERE M_Inventory_ID=" + p_M_Inventory_ID .append(" WHERE M_Inventory_ID=").append(p_M_Inventory_ID)
+ " AND EXISTS (SELECT * FROM M_Storage s " .append(" AND EXISTS (SELECT * FROM M_Storage s ")
+ "WHERE s.M_Product_ID=l.M_Product_ID AND s.M_Locator_ID=l.M_Locator_ID" .append("WHERE s.M_Product_ID=l.M_Product_ID AND s.M_Locator_ID=l.M_Locator_ID")
+ " AND s.M_AttributeSetInstance_ID=l.M_AttributeSetInstance_ID)"; .append(" AND s.M_AttributeSetInstance_ID=l.M_AttributeSetInstance_ID)");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Update with ASI=" + no); log.info("Update with ASI=" + no);
// No ASI // No ASI
@ -111,17 +111,19 @@ public class InventoryCountUpdate extends SvrProcess
// Set Count to Zero // Set Count to Zero
if (p_InventoryCountSetZero) if (p_InventoryCountSetZero)
{ {
sql = "UPDATE M_InventoryLine l " sql = new StringBuilder("UPDATE M_InventoryLine l ")
+ "SET QtyCount=0 " .append("SET QtyCount=0 ")
+ "WHERE M_Inventory_ID=" + p_M_Inventory_ID; .append("WHERE M_Inventory_ID=").append(p_M_Inventory_ID);
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Set Count to Zero=" + no); log.info("Set Count to Zero=" + no);
} }
if (multiple > 0) if (multiple > 0){
return "@M_InventoryLine_ID@ - #" + (no + noMA) + " --> @InventoryProductMultiple@"; StringBuilder msgreturn = new StringBuilder("@M_InventoryLine_ID@ - #").append((no + noMA)).append(" --> @InventoryProductMultiple@");
return msgreturn.toString();
return "@M_InventoryLine_ID@ - #" + no; }
StringBuilder msgreturn = new StringBuilder("@M_InventoryLine_ID@ - #").append(no);
return msgreturn.toString();
} // doIt } // doIt
/** /**

View File

@ -94,23 +94,23 @@ public class InventoryValue extends SvrProcess
MAcctSchema as = c.getAcctSchema(); MAcctSchema as = c.getAcctSchema();
// Delete (just to be sure) // Delete (just to be sure)
StringBuffer sql = new StringBuffer ("DELETE T_InventoryValue WHERE AD_PInstance_ID="); StringBuilder sql = new StringBuilder ("DELETE T_InventoryValue WHERE AD_PInstance_ID=");
sql.append(getAD_PInstance_ID()); sql.append(getAD_PInstance_ID());
int no = DB.executeUpdateEx(sql.toString(), get_TrxName()); int no = DB.executeUpdateEx(sql.toString(), get_TrxName());
// Insert Standard Costs // Insert Standard Costs
sql = new StringBuffer ("INSERT INTO T_InventoryValue " sql = new StringBuilder ("INSERT INTO T_InventoryValue ")
+ "(AD_PInstance_ID, M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID," .append("(AD_PInstance_ID, M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID,")
+ " AD_Client_ID, AD_Org_ID, CostStandard) " .append(" AD_Client_ID, AD_Org_ID, CostStandard) ")
+ "SELECT ").append(getAD_PInstance_ID()) .append("SELECT ").append(getAD_PInstance_ID())
.append(", w.M_Warehouse_ID, c.M_Product_ID, c.M_AttributeSetInstance_ID," .append(", w.M_Warehouse_ID, c.M_Product_ID, c.M_AttributeSetInstance_ID,")
+ " w.AD_Client_ID, w.AD_Org_ID, c.CurrentCostPrice " .append(" w.AD_Client_ID, w.AD_Org_ID, c.CurrentCostPrice ")
+ "FROM M_Warehouse w" .append("FROM M_Warehouse w")
+ " INNER JOIN AD_ClientInfo ci ON (w.AD_Client_ID=ci.AD_Client_ID)" .append(" INNER JOIN AD_ClientInfo ci ON (w.AD_Client_ID=ci.AD_Client_ID)")
+ " INNER JOIN C_AcctSchema acs ON (ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID)" .append(" INNER JOIN C_AcctSchema acs ON (ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID)")
+ " INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID))" .append(" INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID))")
+ " INNER JOIN M_CostElement ce ON (c.M_CostElement_ID=ce.M_CostElement_ID AND ce.CostingMethod='S' AND ce.CostElementType='M') " .append(" INNER JOIN M_CostElement ce ON (c.M_CostElement_ID=ce.M_CostElement_ID AND ce.CostingMethod='S' AND ce.CostElementType='M') ")
+ "WHERE w.M_Warehouse_ID=").append(p_M_Warehouse_ID); .append("WHERE w.M_Warehouse_ID=").append(p_M_Warehouse_ID);
int noInsertStd = DB.executeUpdateEx(sql.toString(), get_TrxName()); int noInsertStd = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Inserted Std=" + noInsertStd); log.fine("Inserted Std=" + noInsertStd);
if (noInsertStd == 0) if (noInsertStd == 0)
@ -120,41 +120,41 @@ public class InventoryValue extends SvrProcess
int noInsertCost = 0; int noInsertCost = 0;
if (p_M_CostElement_ID != 0) if (p_M_CostElement_ID != 0)
{ {
sql = new StringBuffer ("INSERT INTO T_InventoryValue " sql = new StringBuilder ("INSERT INTO T_InventoryValue ")
+ "(AD_PInstance_ID, M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID," .append("(AD_PInstance_ID, M_Warehouse_ID, M_Product_ID, M_AttributeSetInstance_ID,")
+ " AD_Client_ID, AD_Org_ID, CostStandard, Cost, M_CostElement_ID) " .append(" AD_Client_ID, AD_Org_ID, CostStandard, Cost, M_CostElement_ID) ")
+ "SELECT ").append(getAD_PInstance_ID()) .append("SELECT ").append(getAD_PInstance_ID())
.append(", w.M_Warehouse_ID, c.M_Product_ID, c.M_AttributeSetInstance_ID," .append(", w.M_Warehouse_ID, c.M_Product_ID, c.M_AttributeSetInstance_ID,")
+ " w.AD_Client_ID, w.AD_Org_ID, 0, c.CurrentCostPrice, c.M_CostElement_ID " .append(" w.AD_Client_ID, w.AD_Org_ID, 0, c.CurrentCostPrice, c.M_CostElement_ID ")
+ "FROM M_Warehouse w" .append("FROM M_Warehouse w")
+ " INNER JOIN AD_ClientInfo ci ON (w.AD_Client_ID=ci.AD_Client_ID)" .append(" INNER JOIN AD_ClientInfo ci ON (w.AD_Client_ID=ci.AD_Client_ID)")
+ " INNER JOIN C_AcctSchema acs ON (ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID)" .append(" INNER JOIN C_AcctSchema acs ON (ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID)")
+ " INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID)) " .append(" INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID)) ")
+ "WHERE w.M_Warehouse_ID=").append(p_M_Warehouse_ID) .append("WHERE w.M_Warehouse_ID=").append(p_M_Warehouse_ID)
.append(" AND c.M_CostElement_ID=").append(p_M_CostElement_ID) .append(" AND c.M_CostElement_ID=").append(p_M_CostElement_ID)
.append(" AND NOT EXISTS (SELECT * FROM T_InventoryValue iv " .append(" AND NOT EXISTS (SELECT * FROM T_InventoryValue iv ")
+ "WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID()) .append("WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND iv.M_Warehouse_ID=w.M_Warehouse_ID" .append(" AND iv.M_Warehouse_ID=w.M_Warehouse_ID")
+ " AND iv.M_Product_ID=c.M_Product_ID" .append(" AND iv.M_Product_ID=c.M_Product_ID")
+ " AND iv.M_AttributeSetInstance_ID=c.M_AttributeSetInstance_ID)"); .append(" AND iv.M_AttributeSetInstance_ID=c.M_AttributeSetInstance_ID)");
noInsertCost = DB.executeUpdateEx(sql.toString(), get_TrxName()); noInsertCost = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Inserted Cost=" + noInsertCost); log.fine("Inserted Cost=" + noInsertCost);
// Update Std Cost Records // Update Std Cost Records
sql = new StringBuffer ("UPDATE T_InventoryValue iv " sql = new StringBuilder ("UPDATE T_InventoryValue iv ")
+ "SET (Cost, M_CostElement_ID)=" .append("SET (Cost, M_CostElement_ID)=")
+ "(SELECT c.CurrentCostPrice, c.M_CostElement_ID " .append("(SELECT c.CurrentCostPrice, c.M_CostElement_ID ")
+ "FROM M_Warehouse w" .append("FROM M_Warehouse w")
+ " INNER JOIN AD_ClientInfo ci ON (w.AD_Client_ID=ci.AD_Client_ID)" .append(" INNER JOIN AD_ClientInfo ci ON (w.AD_Client_ID=ci.AD_Client_ID)")
+ " INNER JOIN C_AcctSchema acs ON (ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID)" .append(" INNER JOIN C_AcctSchema acs ON (ci.C_AcctSchema1_ID=acs.C_AcctSchema_ID)")
+ " INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID" .append(" INNER JOIN M_Cost c ON (acs.C_AcctSchema_ID=c.C_AcctSchema_ID")
+ " AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID)) " .append(" AND acs.M_CostType_ID=c.M_CostType_ID AND c.AD_Org_ID IN (0, w.AD_Org_ID)) ")
+ "WHERE c.M_CostElement_ID=" + p_M_CostElement_ID .append("WHERE c.M_CostElement_ID=").append(p_M_CostElement_ID)
+ " AND iv.M_Warehouse_ID=w.M_Warehouse_ID" .append(" AND iv.M_Warehouse_ID=w.M_Warehouse_ID")
+ " AND iv.M_Product_ID=c.M_Product_ID" .append(" AND iv.M_Product_ID=c.M_Product_ID")
+ " AND iv.M_AttributeSetInstance_ID=c.M_AttributeSetInstance_ID) " .append(" AND iv.M_AttributeSetInstance_ID=c.M_AttributeSetInstance_ID) ")
+ "WHERE EXISTS (SELECT * FROM T_InventoryValue ivv " .append("WHERE EXISTS (SELECT * FROM T_InventoryValue ivv ")
+ "WHERE ivv.AD_PInstance_ID=" + getAD_PInstance_ID() .append("WHERE ivv.AD_PInstance_ID=").append(getAD_PInstance_ID())
+ " AND ivv.M_CostElement_ID IS NULL)"); .append(" AND ivv.M_CostElement_ID IS NULL)");
int noUpdatedCost = DB.executeUpdateEx(sql.toString(), get_TrxName()); int noUpdatedCost = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Updated Cost=" + noUpdatedCost); log.fine("Updated Cost=" + noUpdatedCost);
} }
@ -164,97 +164,97 @@ public class InventoryValue extends SvrProcess
// Update Constants // Update Constants
// YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format // YYYY-MM-DD HH24:MI:SS.mmmm JDBC Timestamp format
String myDate = p_DateValue.toString(); String myDate = p_DateValue.toString();
sql = new StringBuffer ("UPDATE T_InventoryValue SET ") sql = new StringBuilder ("UPDATE T_InventoryValue SET ")
.append("DateValue=TO_DATE('").append(myDate.substring(0,10)) .append("DateValue=TO_DATE('").append(myDate.substring(0,10))
.append(" 23:59:59','YYYY-MM-DD HH24:MI:SS'),") .append(" 23:59:59','YYYY-MM-DD HH24:MI:SS'),")
.append("M_PriceList_Version_ID=").append(p_M_PriceList_Version_ID).append(",") .append("M_PriceList_Version_ID=").append(p_M_PriceList_Version_ID).append(",")
.append("C_Currency_ID=").append(p_C_Currency_ID) .append("C_Currency_ID=").append(p_C_Currency_ID)
.append(" WHERE AD_PInstance_ID=" + getAD_PInstance_ID()); .append(" WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Constants=" + no); log.fine("Constants=" + no);
// Get current QtyOnHand with ASI // Get current QtyOnHand with ASI
sql = new StringBuffer ("UPDATE T_InventoryValue iv SET QtyOnHand = " sql = new StringBuilder ("UPDATE T_InventoryValue iv SET QtyOnHand = ")
+ "(SELECT SUM(QtyOnHand) FROM M_Storage s" .append("(SELECT SUM(QtyOnHand) FROM M_Storage s")
+ " INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) " .append(" INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) ")
+ "WHERE iv.M_Product_ID=s.M_Product_ID" .append("WHERE iv.M_Product_ID=s.M_Product_ID")
+ " AND iv.M_Warehouse_ID=l.M_Warehouse_ID" .append(" AND iv.M_Warehouse_ID=l.M_Warehouse_ID")
+ " AND iv.M_AttributeSetInstance_ID=s.M_AttributeSetInstance_ID) " .append(" AND iv.M_AttributeSetInstance_ID=s.M_AttributeSetInstance_ID) ")
+ "WHERE AD_PInstance_ID=").append(getAD_PInstance_ID()) .append("WHERE AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND iv.M_AttributeSetInstance_ID<>0"); .append(" AND iv.M_AttributeSetInstance_ID<>0");
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("QtHand with ASI=" + no); log.fine("QtHand with ASI=" + no);
// Get current QtyOnHand without ASI // Get current QtyOnHand without ASI
sql = new StringBuffer ("UPDATE T_InventoryValue iv SET QtyOnHand = " sql = new StringBuilder ("UPDATE T_InventoryValue iv SET QtyOnHand = ")
+ "(SELECT SUM(QtyOnHand) FROM M_Storage s" .append("(SELECT SUM(QtyOnHand) FROM M_Storage s")
+ " INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) " .append(" INNER JOIN M_Locator l ON (l.M_Locator_ID=s.M_Locator_ID) ")
+ "WHERE iv.M_Product_ID=s.M_Product_ID" .append("WHERE iv.M_Product_ID=s.M_Product_ID")
+ " AND iv.M_Warehouse_ID=l.M_Warehouse_ID) " .append(" AND iv.M_Warehouse_ID=l.M_Warehouse_ID) ")
+ "WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID()) .append("WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(" AND iv.M_AttributeSetInstance_ID=0"); .append(" AND iv.M_AttributeSetInstance_ID=0");
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("QtHand w/o ASI=" + no); log.fine("QtHand w/o ASI=" + no);
// Adjust for Valuation Date // Adjust for Valuation Date
sql = new StringBuffer("UPDATE T_InventoryValue iv " sql = new StringBuilder("UPDATE T_InventoryValue iv ")
+ "SET QtyOnHand=" .append("SET QtyOnHand=")
+ "(SELECT iv.QtyOnHand - NVL(SUM(t.MovementQty), 0) " .append("(SELECT iv.QtyOnHand - NVL(SUM(t.MovementQty), 0) ")
+ "FROM M_Transaction t" .append("FROM M_Transaction t")
+ " INNER JOIN M_Locator l ON (t.M_Locator_ID=l.M_Locator_ID) " .append(" INNER JOIN M_Locator l ON (t.M_Locator_ID=l.M_Locator_ID) ")
+ "WHERE t.M_Product_ID=iv.M_Product_ID" .append("WHERE t.M_Product_ID=iv.M_Product_ID")
+ " AND t.M_AttributeSetInstance_ID=iv.M_AttributeSetInstance_ID" .append(" AND t.M_AttributeSetInstance_ID=iv.M_AttributeSetInstance_ID")
+ " AND t.MovementDate > iv.DateValue" .append(" AND t.MovementDate > iv.DateValue")
+ " AND l.M_Warehouse_ID=iv.M_Warehouse_ID) " .append(" AND l.M_Warehouse_ID=iv.M_Warehouse_ID) ")
+ "WHERE iv.M_AttributeSetInstance_ID<>0" .append("WHERE iv.M_AttributeSetInstance_ID<>0" )
+ " AND iv.AD_PInstance_ID=").append(getAD_PInstance_ID()); .append(" AND iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Update with ASI=" + no); log.fine("Update with ASI=" + no);
// //
sql = new StringBuffer("UPDATE T_InventoryValue iv " sql = new StringBuilder("UPDATE T_InventoryValue iv ")
+ "SET QtyOnHand=" .append("SET QtyOnHand=")
+ "(SELECT iv.QtyOnHand - NVL(SUM(t.MovementQty), 0) " .append("(SELECT iv.QtyOnHand - NVL(SUM(t.MovementQty), 0) ")
+ "FROM M_Transaction t" .append("FROM M_Transaction t")
+ " INNER JOIN M_Locator l ON (t.M_Locator_ID=l.M_Locator_ID) " .append(" INNER JOIN M_Locator l ON (t.M_Locator_ID=l.M_Locator_ID) ")
+ "WHERE t.M_Product_ID=iv.M_Product_ID" .append("WHERE t.M_Product_ID=iv.M_Product_ID")
+ " AND t.MovementDate > iv.DateValue" .append(" AND t.MovementDate > iv.DateValue")
+ " AND l.M_Warehouse_ID=iv.M_Warehouse_ID) " .append(" AND l.M_Warehouse_ID=iv.M_Warehouse_ID) ")
+ "WHERE iv.M_AttributeSetInstance_ID=0 " .append("WHERE iv.M_AttributeSetInstance_ID=0 ")
+ "AND iv.AD_PInstance_ID=").append(getAD_PInstance_ID()); .append("AND iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdateEx(sql.toString(), get_TrxName()); no = DB.executeUpdateEx(sql.toString(), get_TrxName());
log.fine("Update w/o ASI=" + no); log.fine("Update w/o ASI=" + no);
// Delete Records w/o OnHand Qty // Delete Records w/o OnHand Qty
sql = new StringBuffer("DELETE T_InventoryValue " sql = new StringBuilder("DELETE T_InventoryValue ")
+ "WHERE (QtyOnHand=0 OR QtyOnHand IS NULL) AND AD_PInstance_ID=").append(getAD_PInstance_ID()); .append("WHERE (QtyOnHand=0 OR QtyOnHand IS NULL) AND AD_PInstance_ID=").append(getAD_PInstance_ID());
int noQty = DB.executeUpdateEx (sql.toString(), get_TrxName()); int noQty = DB.executeUpdateEx (sql.toString(), get_TrxName());
log.fine("NoQty Deleted=" + noQty); log.fine("NoQty Deleted=" + noQty);
// Update Prices // Update Prices
sql = new StringBuffer("UPDATE T_InventoryValue iv " sql = new StringBuilder("UPDATE T_InventoryValue iv ")
+ "SET PricePO = " .append("SET PricePO = ")
+ "(SELECT MAX(currencyConvert (po.PriceList,po.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, po.AD_Client_ID,po.AD_Org_ID))" .append("(SELECT MAX(currencyConvert (po.PriceList,po.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, po.AD_Client_ID,po.AD_Org_ID))")
+ " FROM M_Product_PO po WHERE po.M_Product_ID=iv.M_Product_ID" .append(" FROM M_Product_PO po WHERE po.M_Product_ID=iv.M_Product_ID")
+ " AND po.IsCurrentVendor='Y'), " .append(" AND po.IsCurrentVendor='Y'), ")
+ "PriceList = " .append("PriceList = ")
+ "(SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)" .append("(SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)")
+ " FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp" .append(" FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp")
+ " WHERE pp.M_Product_ID=iv.M_Product_ID AND pp.M_PriceList_Version_ID=iv.M_PriceList_Version_ID" .append(" WHERE pp.M_Product_ID=iv.M_Product_ID AND pp.M_PriceList_Version_ID=iv.M_PriceList_Version_ID")
+ " AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID" .append(" AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID")
+ " AND plv.M_PriceList_ID=pl.M_PriceList_ID), " .append(" AND plv.M_PriceList_ID=pl.M_PriceList_ID), ")
+ "PriceStd = " .append("PriceStd = ")
+ "(SELECT currencyConvert(pp.PriceStd,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)" .append("(SELECT currencyConvert(pp.PriceStd,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)")
+ " FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp" .append(" FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp")
+ " WHERE pp.M_Product_ID=iv.M_Product_ID AND pp.M_PriceList_Version_ID=iv.M_PriceList_Version_ID" .append(" WHERE pp.M_Product_ID=iv.M_Product_ID AND pp.M_PriceList_Version_ID=iv.M_PriceList_Version_ID")
+ " AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID" .append(" AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID")
+ " AND plv.M_PriceList_ID=pl.M_PriceList_ID), " .append(" AND plv.M_PriceList_ID=pl.M_PriceList_ID), ")
+ "PriceLimit = " .append("PriceLimit = ")
+ "(SELECT currencyConvert(pp.PriceLimit,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)" .append("(SELECT currencyConvert(pp.PriceLimit,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)")
+ " FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp" .append(" FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp")
+ " WHERE pp.M_Product_ID=iv.M_Product_ID AND pp.M_PriceList_Version_ID=iv.M_PriceList_Version_ID" .append(" WHERE pp.M_Product_ID=iv.M_Product_ID AND pp.M_PriceList_Version_ID=iv.M_PriceList_Version_ID")
+ " AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID" .append(" AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID")
+ " AND plv.M_PriceList_ID=pl.M_PriceList_ID)" .append(" AND plv.M_PriceList_ID=pl.M_PriceList_ID)")
+ " WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID()); .append(" WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdateEx (sql.toString(), get_TrxName()); no = DB.executeUpdateEx (sql.toString(), get_TrxName());
String msg = ""; String msg = "";
@ -264,28 +264,29 @@ public class InventoryValue extends SvrProcess
// Convert if different Currency // Convert if different Currency
if (as.getC_Currency_ID() != p_C_Currency_ID) if (as.getC_Currency_ID() != p_C_Currency_ID)
{ {
sql = new StringBuffer ("UPDATE T_InventoryValue iv " sql = new StringBuilder ("UPDATE T_InventoryValue iv ")
+ "SET CostStandard= " .append("SET CostStandard= ")
+ "(SELECT currencyConvert(iv.CostStandard,acs.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, iv.AD_Client_ID,iv.AD_Org_ID) " .append("(SELECT currencyConvert(iv.CostStandard,acs.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, iv.AD_Client_ID,iv.AD_Org_ID) ")
+ "FROM C_AcctSchema acs WHERE acs.C_AcctSchema_ID=" + as.getC_AcctSchema_ID() + ")," .append("FROM C_AcctSchema acs WHERE acs.C_AcctSchema_ID=").append(as.getC_AcctSchema_ID()).append("),")
+ " Cost= " .append(" Cost= ")
+ "(SELECT currencyConvert(iv.Cost,acs.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, iv.AD_Client_ID,iv.AD_Org_ID) " .append("(SELECT currencyConvert(iv.Cost,acs.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, iv.AD_Client_ID,iv.AD_Org_ID) ")
+ "FROM C_AcctSchema acs WHERE acs.C_AcctSchema_ID=" + as.getC_AcctSchema_ID() + ") " .append("FROM C_AcctSchema acs WHERE acs.C_AcctSchema_ID=").append(as.getC_AcctSchema_ID()).append(") ")
+ "WHERE iv.AD_PInstance_ID=" + getAD_PInstance_ID()); .append("WHERE iv.AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdateEx (sql.toString(), get_TrxName()); no = DB.executeUpdateEx (sql.toString(), get_TrxName());
log.fine("Converted=" + no); log.fine("Converted=" + no);
} }
// Update Values // Update Values
no = DB.executeUpdateEx("UPDATE T_InventoryValue SET " StringBuilder dbeux = new StringBuilder("UPDATE T_InventoryValue SET ")
+ "PricePOAmt = QtyOnHand * PricePO, " .append("PricePOAmt = QtyOnHand * PricePO, ")
+ "PriceListAmt = QtyOnHand * PriceList, " .append("PriceListAmt = QtyOnHand * PriceList, ")
+ "PriceStdAmt = QtyOnHand * PriceStd, " .append("PriceStdAmt = QtyOnHand * PriceStd, ")
+ "PriceLimitAmt = QtyOnHand * PriceLimit, " .append("PriceLimitAmt = QtyOnHand * PriceLimit, ")
+ "CostStandardAmt = QtyOnHand * CostStandard, " .append("CostStandardAmt = QtyOnHand * CostStandard, ")
+ "CostAmt = QtyOnHand * Cost " .append("CostAmt = QtyOnHand * Cost ")
+ "WHERE AD_PInstance_ID=" + getAD_PInstance_ID() .append("WHERE AD_PInstance_ID=").append(getAD_PInstance_ID()
, get_TrxName()); );
no = DB.executeUpdateEx(dbeux.toString(), get_TrxName());
log.fine("Calculation=" + no); log.fine("Calculation=" + no);
// //
return msg; return msg;

View File

@ -21,6 +21,7 @@ import org.compiere.model.MInvoiceBatch;
import org.compiere.model.MInvoiceBatchLine; import org.compiere.model.MInvoiceBatchLine;
import org.compiere.model.MInvoiceLine; import org.compiere.model.MInvoiceLine;
import org.compiere.util.AdempiereUserError; import org.compiere.util.AdempiereUserError;
import org.compiere.util.Msg;
/** /**
@ -142,7 +143,8 @@ public class InvoiceBatchProcess extends SvrProcess
batch.setProcessed(true); batch.setProcessed(true);
batch.saveEx(); batch.saveEx();
return "#" + m_count; StringBuilder msgreturn = new StringBuilder("#").append(m_count);
return msgreturn.toString();
} // doIt } // doIt
@ -162,7 +164,8 @@ public class InvoiceBatchProcess extends SvrProcess
} }
m_invoice.saveEx(); m_invoice.saveEx();
addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), m_invoice.getDocumentNo(),m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
m_count++; m_count++;
m_invoice = null; m_invoice = null;

View File

@ -129,38 +129,38 @@ public class InvoiceGenerate extends SvrProcess
+ ", C_Order_ID=" + p_C_Order_ID + ", DocAction=" + p_docAction + ", C_Order_ID=" + p_C_Order_ID + ", DocAction=" + p_docAction
+ ", Consolidate=" + p_ConsolidateDocument); + ", Consolidate=" + p_ConsolidateDocument);
// //
String sql = null; StringBuilder sql = null;
if (p_Selection) // VInvoiceGen if (p_Selection) // VInvoiceGen
{ {
sql = "SELECT C_Order.* FROM C_Order, T_Selection " sql = new StringBuilder("SELECT C_Order.* FROM C_Order, T_Selection ")
+ "WHERE C_Order.DocStatus='CO' AND C_Order.IsSOTrx='Y' " .append("WHERE C_Order.DocStatus='CO' AND C_Order.IsSOTrx='Y' ")
+ "AND C_Order.C_Order_ID = T_Selection.T_Selection_ID " .append("AND C_Order.C_Order_ID = T_Selection.T_Selection_ID ")
+ "AND T_Selection.AD_PInstance_ID=? " .append("AND T_Selection.AD_PInstance_ID=? ")
+ "ORDER BY C_Order.M_Warehouse_ID, C_Order.PriorityRule, C_Order.C_BPartner_ID, C_Order.Bill_Location_ID, C_Order.C_Order_ID"; .append("ORDER BY C_Order.M_Warehouse_ID, C_Order.PriorityRule, C_Order.C_BPartner_ID, C_Order.Bill_Location_ID, C_Order.C_Order_ID");
} }
else else
{ {
sql = "SELECT * FROM C_Order o " sql = new StringBuilder("SELECT * FROM C_Order o ")
+ "WHERE DocStatus IN('CO','CL') AND IsSOTrx='Y'"; .append("WHERE DocStatus IN('CO','CL') AND IsSOTrx='Y'");
if (p_AD_Org_ID != 0) if (p_AD_Org_ID != 0)
sql += " AND AD_Org_ID=?"; sql.append(" AND AD_Org_ID=?");
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND C_BPartner_ID=?"; sql.append(" AND C_BPartner_ID=?");
if (p_C_Order_ID != 0) if (p_C_Order_ID != 0)
sql += " AND C_Order_ID=?"; sql.append(" AND C_Order_ID=?");
// //
sql += " AND EXISTS (SELECT * FROM C_OrderLine ol " sql.append(" AND EXISTS (SELECT * FROM C_OrderLine ol ")
+ "WHERE o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyInvoiced) " .append("WHERE o.C_Order_ID=ol.C_Order_ID AND ol.QtyOrdered<>ol.QtyInvoiced) ")
+ "AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType " .append("AND o.C_DocType_ID IN (SELECT C_DocType_ID FROM C_DocType ")
+ "WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR')) " .append("WHERE DocBaseType='SOO' AND DocSubTypeSO NOT IN ('ON','OB','WR')) ")
+ "ORDER BY M_Warehouse_ID, PriorityRule, C_BPartner_ID, Bill_Location_ID, C_Order_ID"; .append("ORDER BY M_Warehouse_ID, PriorityRule, C_BPartner_ID, Bill_Location_ID, C_Order_ID");
} }
// sql += " FOR UPDATE"; // sql += " FOR UPDATE";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
int index = 1; int index = 1;
if (p_Selection) if (p_Selection)
{ {
@ -178,7 +178,7 @@ public class InvoiceGenerate extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql.toString(), e);
} }
return generate(pstmt); return generate(pstmt);
} // doIt } // doIt
@ -197,7 +197,8 @@ public class InvoiceGenerate extends SvrProcess
while (rs.next ()) while (rs.next ())
{ {
MOrder order = new MOrder (getCtx(), rs, get_TrxName()); MOrder order = new MOrder (getCtx(), rs, get_TrxName());
statusUpdate(Msg.getMsg(getCtx(), "Processing") + " " + order.getDocumentInfo()); StringBuilder msgsup = new StringBuilder(Msg.getMsg(getCtx(), "Processing")).append(" ").append(order.getDocumentInfo());
statusUpdate(msgsup.toString());
// New Invoice Location // New Invoice Location
if (!p_ConsolidateDocument if (!p_ConsolidateDocument
@ -337,7 +338,8 @@ public class InvoiceGenerate extends SvrProcess
pstmt = null; pstmt = null;
} }
completeInvoice(); completeInvoice();
return "@Created@ = " + m_created; StringBuilder msgreturn = new StringBuilder("@Created@ = ").append(m_created);
return msgreturn.toString();
} // generate } // generate
@ -400,14 +402,14 @@ public class InvoiceGenerate extends SvrProcess
AD_Language = Language.getBaseAD_Language(); AD_Language = Language.getBaseAD_Language();
java.text.SimpleDateFormat format = DisplayType.getDateFormat java.text.SimpleDateFormat format = DisplayType.getDateFormat
(DisplayType.Date, Language.getLanguage(AD_Language)); (DisplayType.Date, Language.getLanguage(AD_Language));
String reference = dt.getPrintName(m_bp.getAD_Language()) StringBuilder reference = new StringBuilder(dt.getPrintName(m_bp.getAD_Language()))
+ ": " + ship.getDocumentNo() .append(": ").append(ship.getDocumentNo())
+ " - " + format.format(ship.getMovementDate()); .append(" - ").append(format.format(ship.getMovementDate()));
m_ship = ship; m_ship = ship;
// //
MInvoiceLine line = new MInvoiceLine (m_invoice); MInvoiceLine line = new MInvoiceLine (m_invoice);
line.setIsDescription(true); line.setIsDescription(true);
line.setDescription(reference); line.setDescription(reference.toString());
line.setLine(m_line + sLine.getLine() - 2); line.setLine(m_line + sLine.getLine() - 2);
if (!line.save()) if (!line.save())
throw new IllegalStateException("Could not create Invoice Comment Line (sh)"); throw new IllegalStateException("Could not create Invoice Comment Line (sh)");
@ -497,7 +499,8 @@ public class InvoiceGenerate extends SvrProcess
} }
m_invoice.saveEx(); m_invoice.saveEx();
addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, m_invoice.getDocumentNo(),m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
m_created++; m_created++;
} }
m_invoice = null; m_invoice = null;

View File

@ -117,47 +117,47 @@ public class InvoiceNGL extends SvrProcess
p_DateReval = new Timestamp(System.currentTimeMillis()); p_DateReval = new Timestamp(System.currentTimeMillis());
// Delete - just to be sure // Delete - just to be sure
String sql = "DELETE T_InvoiceGL WHERE AD_PInstance_ID=" + getAD_PInstance_ID(); StringBuilder sql = new StringBuilder("DELETE T_InvoiceGL WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.info("Deleted #" + no); log.info("Deleted #" + no);
// Insert Trx // Insert Trx
String dateStr = DB.TO_DATE(p_DateReval, true); String dateStr = DB.TO_DATE(p_DateReval, true);
sql = "INSERT INTO T_InvoiceGL (AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy," sql = new StringBuilder("INSERT INTO T_InvoiceGL (AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,")
+ " AD_PInstance_ID, C_Invoice_ID, GrandTotal, OpenAmt, " .append(" AD_PInstance_ID, C_Invoice_ID, GrandTotal, OpenAmt, ")
+ " Fact_Acct_ID, AmtSourceBalance, AmtAcctBalance, " .append(" Fact_Acct_ID, AmtSourceBalance, AmtAcctBalance, ")
+ " AmtRevalDr, AmtRevalCr, C_DocTypeReval_ID, IsAllCurrencies, " .append(" AmtRevalDr, AmtRevalCr, C_DocTypeReval_ID, IsAllCurrencies, ")
+ " DateReval, C_ConversionTypeReval_ID, AmtRevalDrDiff, AmtRevalCrDiff, APAR) " .append(" DateReval, C_ConversionTypeReval_ID, AmtRevalDrDiff, AmtRevalCrDiff, APAR) ")
// -- // --
+ "SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created,i.CreatedBy, i.Updated,i.UpdatedBy," .append("SELECT i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created,i.CreatedBy, i.Updated,i.UpdatedBy,")
+ getAD_PInstance_ID() + ", i.C_Invoice_ID, i.GrandTotal, invoiceOpen(i.C_Invoice_ID, 0), " .append( getAD_PInstance_ID()).append(", i.C_Invoice_ID, i.GrandTotal, invoiceOpen(i.C_Invoice_ID, 0), ")
+ " fa.Fact_Acct_ID, fa.AmtSourceDr-fa.AmtSourceCr, fa.AmtAcctDr-fa.AmtAcctCr, " .append(" fa.Fact_Acct_ID, fa.AmtSourceDr-fa.AmtSourceCr, fa.AmtAcctDr-fa.AmtAcctCr, ")
// AmtRevalDr, AmtRevalCr, // AmtRevalDr, AmtRevalCr,
+ " currencyConvert(fa.AmtSourceDr, i.C_Currency_ID, a.C_Currency_ID, " + dateStr + ", " + p_C_ConversionTypeReval_ID + ", i.AD_Client_ID, i.AD_Org_ID)," .append(" currencyConvert(fa.AmtSourceDr, i.C_Currency_ID, a.C_Currency_ID, ").append(dateStr).append(", ").append(p_C_ConversionTypeReval_ID).append(", i.AD_Client_ID, i.AD_Org_ID),")
+ " currencyConvert(fa.AmtSourceCr, i.C_Currency_ID, a.C_Currency_ID, " + dateStr + ", " + p_C_ConversionTypeReval_ID + ", i.AD_Client_ID, i.AD_Org_ID)," .append(" currencyConvert(fa.AmtSourceCr, i.C_Currency_ID, a.C_Currency_ID, ").append(dateStr).append(", ").append(p_C_ConversionTypeReval_ID).append(", i.AD_Client_ID, i.AD_Org_ID),")
+ (p_C_DocTypeReval_ID==0 ? "NULL" : String.valueOf(p_C_DocTypeReval_ID)) + ", " .append((p_C_DocTypeReval_ID==0 ? "NULL" : String.valueOf(p_C_DocTypeReval_ID))).append(", ")
+ (p_IsAllCurrencies ? "'Y'," : "'N',") .append((p_IsAllCurrencies ? "'Y'," : "'N',"))
+ dateStr + ", " + p_C_ConversionTypeReval_ID + ", 0, 0, '" + p_APAR + "' " .append(dateStr).append(", ").append(p_C_ConversionTypeReval_ID).append(", 0, 0, '").append(p_APAR).append("' ")
// //
+ "FROM C_Invoice_v i" .append("FROM C_Invoice_v i")
+ " INNER JOIN Fact_Acct fa ON (fa.AD_Table_ID=318 AND fa.Record_ID=i.C_Invoice_ID" .append(" INNER JOIN Fact_Acct fa ON (fa.AD_Table_ID=318 AND fa.Record_ID=i.C_Invoice_ID")
+ " AND (i.GrandTotal=fa.AmtSourceDr OR i.GrandTotal=fa.AmtSourceCr))" .append(" AND (i.GrandTotal=fa.AmtSourceDr OR i.GrandTotal=fa.AmtSourceCr))")
+ " INNER JOIN C_AcctSchema a ON (fa.C_AcctSchema_ID=a.C_AcctSchema_ID) " .append(" INNER JOIN C_AcctSchema a ON (fa.C_AcctSchema_ID=a.C_AcctSchema_ID) ")
+ "WHERE i.IsPaid='N'" .append("WHERE i.IsPaid='N'")
+ " AND EXISTS (SELECT * FROM C_ElementValue ev " .append(" AND EXISTS (SELECT * FROM C_ElementValue ev ")
+ "WHERE ev.C_ElementValue_ID=fa.Account_ID AND (ev.AccountType='A' OR ev.AccountType='L'))" .append("WHERE ev.C_ElementValue_ID=fa.Account_ID AND (ev.AccountType='A' OR ev.AccountType='L'))")
+ " AND fa.C_AcctSchema_ID=" + p_C_AcctSchema_ID; .append(" AND fa.C_AcctSchema_ID=").append(p_C_AcctSchema_ID);
if (!p_IsAllCurrencies) if (!p_IsAllCurrencies)
sql += " AND i.C_Currency_ID<>a.C_Currency_ID"; sql.append(" AND i.C_Currency_ID<>a.C_Currency_ID");
if (ONLY_AR.equals(p_APAR)) if (ONLY_AR.equals(p_APAR))
sql += " AND i.IsSOTrx='Y'"; sql.append(" AND i.IsSOTrx='Y'");
else if (ONLY_AP.equals(p_APAR)) else if (ONLY_AP.equals(p_APAR))
sql += " AND i.IsSOTrx='N'"; sql.append(" AND i.IsSOTrx='N'");
if (!p_IsAllCurrencies && p_C_Currency_ID != 0) if (!p_IsAllCurrencies && p_C_Currency_ID != 0)
sql += " AND i.C_Currency_ID=" + p_C_Currency_ID; sql.append(" AND i.C_Currency_ID=").append(p_C_Currency_ID);
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Inserted #" + no); log.info("Inserted #" + no);
else if (CLogMgt.isLevelFiner()) else if (CLogMgt.isLevelFiner())
@ -166,35 +166,35 @@ public class InvoiceNGL extends SvrProcess
log.warning("Inserted #" + no); log.warning("Inserted #" + no);
// Calculate Difference // Calculate Difference
sql = "UPDATE T_InvoiceGL gl " sql = new StringBuilder("UPDATE T_InvoiceGL gl ")
+ "SET (AmtRevalDrDiff,AmtRevalCrDiff)=" .append("SET (AmtRevalDrDiff,AmtRevalCrDiff)=")
+ "(SELECT gl.AmtRevalDr-fa.AmtAcctDr, gl.AmtRevalCr-fa.AmtAcctCr " .append("(SELECT gl.AmtRevalDr-fa.AmtAcctDr, gl.AmtRevalCr-fa.AmtAcctCr ")
+ "FROM Fact_Acct fa " .append("FROM Fact_Acct fa ")
+ "WHERE gl.Fact_Acct_ID=fa.Fact_Acct_ID) " .append("WHERE gl.Fact_Acct_ID=fa.Fact_Acct_ID) ")
+ "WHERE AD_PInstance_ID=" + getAD_PInstance_ID(); .append("WHERE AD_PInstance_ID=").append(getAD_PInstance_ID());
int noT = DB.executeUpdate(sql, get_TrxName()); int noT = DB.executeUpdate(sql.toString(), get_TrxName());
if (noT > 0) if (noT > 0)
log.config("Difference #" + noT); log.config("Difference #" + noT);
// Percentage // Percentage
sql = "UPDATE T_InvoiceGL SET Percent = 100 " sql = new StringBuilder("UPDATE T_InvoiceGL SET Percent = 100 ")
+ "WHERE GrandTotal=OpenAmt AND AD_PInstance_ID=" + getAD_PInstance_ID(); .append("WHERE GrandTotal=OpenAmt AND AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.info("Not Paid #" + no); log.info("Not Paid #" + no);
sql = "UPDATE T_InvoiceGL SET Percent = ROUND(OpenAmt*100/GrandTotal,6) " sql = new StringBuilder("UPDATE T_InvoiceGL SET Percent = ROUND(OpenAmt*100/GrandTotal,6) ")
+ "WHERE GrandTotal<>OpenAmt AND GrandTotal <> 0 AND AD_PInstance_ID=" + getAD_PInstance_ID(); .append("WHERE GrandTotal<>OpenAmt AND GrandTotal <> 0 AND AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.info("Partial Paid #" + no); log.info("Partial Paid #" + no);
sql = "UPDATE T_InvoiceGL SET AmtRevalDr = AmtRevalDr * Percent/100," sql = new StringBuilder("UPDATE T_InvoiceGL SET AmtRevalDr = AmtRevalDr * Percent/100,")
+ " AmtRevalCr = AmtRevalCr * Percent/100," .append(" AmtRevalCr = AmtRevalCr * Percent/100,")
+ " AmtRevalDrDiff = AmtRevalDrDiff * Percent/100," .append(" AmtRevalDrDiff = AmtRevalDrDiff * Percent/100,")
+ " AmtRevalCrDiff = AmtRevalCrDiff * Percent/100 " .append(" AmtRevalCrDiff = AmtRevalCrDiff * Percent/100 ")
+ "WHERE Percent <> 100 AND AD_PInstance_ID=" + getAD_PInstance_ID(); .append("WHERE Percent <> 100 AND AD_PInstance_ID=").append(getAD_PInstance_ID());
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no > 0) if (no > 0)
log.config("Partial Calc #" + no); log.config("Partial Calc #" + no);
@ -207,7 +207,8 @@ public class InvoiceNGL extends SvrProcess
else else
info = createGLJournal(); info = createGLJournal();
} }
return "#" + noT + info; StringBuilder msgreturn = new StringBuilder("#").append(noT).append(info);
return msgreturn.toString();
} // doIt } // doIt
/** /**
@ -303,7 +304,8 @@ public class InvoiceNGL extends SvrProcess
} }
createBalancing (asDefaultAccts, journal, drTotal, crTotal, AD_Org_ID, (list.size()+1) * 10); createBalancing (asDefaultAccts, journal, drTotal, crTotal, AD_Org_ID, (list.size()+1) * 10);
return " - " + batch.getDocumentNo() + " #" + list.size(); StringBuilder msgreturn = new StringBuilder(" - ").append(batch.getDocumentNo()).append(" #").append(list.size());
return msgreturn.toString();
} // createGLJournal } // createGLJournal
/** /**

View File

@ -84,12 +84,12 @@ public class InvoicePayScheduleValidate extends SvrProcess
schedule[i].saveEx(); schedule[i].saveEx();
} }
} }
String msg = "@OK@"; StringBuilder msg = new StringBuilder("@OK@");
if (!valid) if (!valid)
msg = "@GrandTotal@ = " + invoice.getGrandTotal() msg = new StringBuilder("@GrandTotal@ = ").append(invoice.getGrandTotal())
+ " <> @Total@ = " + total .append(" <> @Total@ = ").append(total)
+ " - @Difference@ = " + invoice.getGrandTotal().subtract(total); .append(" - @Difference@ = ").append(invoice.getGrandTotal().subtract(total));
return Msg.parseTranslation(getCtx(), msg); return Msg.parseTranslation(getCtx(), msg.toString());
} // doIt } // doIt
} // InvoicePayScheduleValidate } // InvoicePayScheduleValidate

View File

@ -130,21 +130,20 @@ public class InvoicePrint extends SvrProcess
MClient client = MClient.get(getCtx()); MClient client = MClient.get(getCtx());
// Get Info // Get Info
StringBuffer sql = new StringBuffer ( StringBuilder sql = new StringBuilder ("SELECT i.C_Invoice_ID,bp.AD_Language,c.IsMultiLingualDocument,") // 1..3
"SELECT i.C_Invoice_ID,bp.AD_Language,c.IsMultiLingualDocument," // 1..3
// Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see ReportCtl+MInvoice // Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see ReportCtl+MInvoice
+ " COALESCE(bp.Invoice_PrintFormat_ID, dt.AD_PrintFormat_ID, pf.Invoice_PrintFormat_ID)," // 4 .append(" COALESCE(bp.Invoice_PrintFormat_ID, dt.AD_PrintFormat_ID, pf.Invoice_PrintFormat_ID),") // 4
+ " dt.DocumentCopies+bp.DocumentCopies," // 5 .append(" dt.DocumentCopies+bp.DocumentCopies,") // 5
+ " bpc.AD_User_ID, i.DocumentNo," // 6..7 .append(" bpc.AD_User_ID, i.DocumentNo,") // 6..7
+ " bp.C_BPartner_ID " // 8 .append(" bp.C_BPartner_ID ") // 8
+ "FROM C_Invoice i" .append("FROM C_Invoice i")
+ " INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID)" .append(" INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID)")
+ " LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID)" .append(" LEFT OUTER JOIN AD_User bpc ON (i.AD_User_ID=bpc.AD_User_ID)")
+ " INNER JOIN AD_Client c ON (i.AD_Client_ID=c.AD_Client_ID)" .append(" INNER JOIN AD_Client c ON (i.AD_Client_ID=c.AD_Client_ID)")
+ " INNER JOIN AD_PrintForm pf ON (i.AD_Client_ID=pf.AD_Client_ID)" .append(" INNER JOIN AD_PrintForm pf ON (i.AD_Client_ID=pf.AD_Client_ID)")
+ " INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)" .append(" INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)")
+ " WHERE i.AD_Client_ID=? AND i.AD_Org_ID=? AND i.isSOTrx='Y' AND " .append(" WHERE i.AD_Client_ID=? AND i.AD_Org_ID=? AND i.isSOTrx='Y' AND ")
+ " pf.AD_Org_ID IN (0,i.AD_Org_ID) AND " ); // more them 1 PF .append(" pf.AD_Org_ID IN (0,i.AD_Org_ID) AND " ); // more them 1 PF
boolean needAnd = false; boolean needAnd = false;
if (m_C_Invoice_ID != 0) if (m_C_Invoice_ID != 0)
sql.append("i.C_Invoice_ID=").append(m_C_Invoice_ID); sql.append("i.C_Invoice_ID=").append(m_C_Invoice_ID);
@ -289,8 +288,8 @@ public class InvoicePrint extends SvrProcess
boolean printed = false; boolean printed = false;
if (p_EMailPDF) if (p_EMailPDF)
{ {
String subject = mText.getMailHeader() + " - " + DocumentNo; StringBuilder subject =new StringBuilder(mText.getMailHeader()).append(" - ").append(DocumentNo);
EMail email = client.createEMail(to.getEMail(), subject, null); EMail email = client.createEMail(to.getEMail(), subject.toString(), null);
if (!email.isValid()) if (!email.isValid())
{ {
addLog (C_Invoice_ID, null, null, addLog (C_Invoice_ID, null, null,
@ -303,10 +302,10 @@ public class InvoicePrint extends SvrProcess
mText.setPO(new MInvoice(getCtx(), C_Invoice_ID, get_TrxName())); mText.setPO(new MInvoice(getCtx(), C_Invoice_ID, get_TrxName()));
String message = mText.getMailText(true); String message = mText.getMailText(true);
if (mText.isHtml()) if (mText.isHtml())
email.setMessageHTML(subject, message); email.setMessageHTML(subject.toString(), message);
else else
{ {
email.setSubject (subject); email.setSubject (subject.toString());
email.setMessageText (message); email.setMessageText (message);
} }
// //
@ -348,8 +347,8 @@ public class InvoicePrint extends SvrProcess
// Print Confirm // Print Confirm
if (printed) if (printed)
{ {
StringBuffer sb = new StringBuffer ("UPDATE C_Invoice " StringBuilder sb = new StringBuilder ("UPDATE C_Invoice ")
+ "SET DatePrinted=SysDate, IsPrinted='Y' WHERE C_Invoice_ID=") .append("SET DatePrinted=SysDate, IsPrinted='Y' WHERE C_Invoice_ID=")
.append (C_Invoice_ID); .append (C_Invoice_ID);
int no = DB.executeUpdate(sb.toString(), get_TrxName()); int no = DB.executeUpdate(sb.toString(), get_TrxName());
} }
@ -364,9 +363,12 @@ public class InvoicePrint extends SvrProcess
DB.close(rs, pstmt); DB.close(rs, pstmt);
} }
// //
if (p_EMailPDF) if (p_EMailPDF){
return "@Sent@=" + count + " - @Errors@=" + errors; StringBuilder msgreturn = new StringBuilder("@Sent@=").append(count).append(" - @Errors@=").append(errors);
return "@Printed@=" + count; return msgreturn.toString();
}
StringBuilder msgreturn = new StringBuilder("@Printed@=").append(count);
return msgreturn.toString();
} // doIt } // doIt
} // InvoicePrint } // InvoicePrint

View File

@ -134,10 +134,10 @@ public class InvoiceWriteOff extends SvrProcess
if (p_CreatePayment && p_C_BankAccount_ID == 0) if (p_CreatePayment && p_C_BankAccount_ID == 0)
throw new AdempiereUserError ("@FillMandatory@ @C_BankAccount_ID@"); throw new AdempiereUserError ("@FillMandatory@ @C_BankAccount_ID@");
// //
StringBuffer sql = new StringBuffer( StringBuilder sql = new StringBuilder(
"SELECT C_Invoice_ID,DocumentNo,DateInvoiced," "SELECT C_Invoice_ID,DocumentNo,DateInvoiced,")
+ " C_Currency_ID,GrandTotal, invoiceOpen(C_Invoice_ID, 0) AS OpenAmt " .append(" C_Currency_ID,GrandTotal, invoiceOpen(C_Invoice_ID, 0) AS OpenAmt ")
+ "FROM C_Invoice WHERE "); .append("FROM C_Invoice WHERE ");
if (p_C_Invoice_ID != 0) if (p_C_Invoice_ID != 0)
sql.append("C_Invoice_ID=").append(p_C_Invoice_ID); sql.append("C_Invoice_ID=").append(p_C_Invoice_ID);
else else
@ -201,7 +201,8 @@ public class InvoiceWriteOff extends SvrProcess
// final // final
processPayment(); processPayment();
processAllocation(); processAllocation();
return "#" + counter; StringBuilder msgreturn = new StringBuilder("#").append(counter);
return msgreturn.toString();
} // doIt } // doIt
/** /**

View File

@ -51,14 +51,18 @@ public class IssueReport extends SvrProcess
return "NOT reported - Enable Error Reporting in Window System"; return "NOT reported - Enable Error Reporting in Window System";
// //
MIssue issue = new MIssue(getCtx(), m_AD_Issue_ID, get_TrxName()); MIssue issue = new MIssue(getCtx(), m_AD_Issue_ID, get_TrxName());
if (issue.get_ID() == 0) if (issue.get_ID() == 0){
return "No Issue to report - ID=" + m_AD_Issue_ID; StringBuilder msgreturn = new StringBuilder("No Issue to report - ID=").append(m_AD_Issue_ID);
return msgreturn.toString();
}
// //
String error = issue.report(); String error = issue.report();
if (error != null) if (error != null)
throw new AdempiereSystemError(error); throw new AdempiereSystemError(error);
if (issue.save()) if (issue.save()){
return "Issue Reported: " + issue.getRequestDocumentNo(); StringBuilder msgreturn = new StringBuilder("Issue Reported: ").append(issue.getRequestDocumentNo());
return msgreturn.toString();
}
throw new AdempiereSystemError("Issue Not Saved"); throw new AdempiereSystemError("Issue Not Saved");
} // doIt } // doIt

View File

@ -79,10 +79,10 @@ public class M_PriceList_Create extends SvrProcess {
*/ */
protected String doIt() throws Exception { protected String doIt() throws Exception {
String sql; StringBuilder sql = new StringBuilder();
String sqlupd; StringBuilder sqlupd = new StringBuilder();
String sqldel; StringBuilder sqldel = new StringBuilder();
String sqlins; StringBuilder sqlins = new StringBuilder();
int cntu = 0; int cntu = 0;
int cntd = 0; int cntd = 0;
int cnti = 0; int cnti = 0;
@ -91,67 +91,66 @@ public class M_PriceList_Create extends SvrProcess {
int totd = 0; int totd = 0;
int V_temp; int V_temp;
int v_NextNo = 0; int v_NextNo = 0;
String Message = " "; StringBuilder Message = new StringBuilder();
// //
//Checking Prerequisites //Checking Prerequisites
//PO Prices must exists //PO Prices must exists
// //
sqlupd = "UPDATE M_Product_PO " + " SET PriceList = 0 " sqlupd.append("UPDATE M_Product_PO SET PriceList = 0 ")
+ " WHERE PriceList IS NULL "; .append(" WHERE PriceList IS NULL ");
cntu = DB.executeUpdate(sqlupd, get_TrxName()); cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError( raiseError(
"Update The PriceList to zero of M_Product_PO WHERE PriceList IS NULL", "Update The PriceList to zero of M_Product_PO WHERE PriceList IS NULL",
sqlupd); sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
sqlupd = "UPDATE M_Product_PO " + " SET PriceLastPO = 0 " sqlupd = new StringBuilder("UPDATE M_Product_PO SET PriceLastPO = 0 ");
+ " WHERE PriceLastPO IS NULL "; sqlupd.append(" WHERE PriceLastPO IS NULL ");
cntu = DB.executeUpdate(sqlupd, get_TrxName()); cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError( raiseError(
"Update The PriceListPO to zero of M_Product_PO WHERE PriceLastPO IS NULL", "Update The PriceListPO to zero of M_Product_PO WHERE PriceLastPO IS NULL",
sqlupd); sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
sqlupd = "UPDATE M_Product_PO " sqlupd = new StringBuilder("UPDATE M_Product_PO SET PricePO = PriceLastPO ");
+ " SET PricePO = PriceLastPO " sqlupd.append(" WHERE (PricePO IS NULL OR PricePO = 0) AND PriceLastPO <> 0 ");
+ " WHERE (PricePO IS NULL OR PricePO = 0) AND PriceLastPO <> 0 ";
cntu = DB.executeUpdate(sqlupd, get_TrxName()); cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError( raiseError(
"Update The PricePO to PriceLastPO of M_Product_PO WHERE (PricePO IS NULL OR PricePO = 0) AND PriceLastPO <> 0 ", "Update The PricePO to PriceLastPO of M_Product_PO WHERE (PricePO IS NULL OR PricePO = 0) AND PriceLastPO <> 0 ",
sqlupd); sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
sqlupd = "UPDATE M_Product_PO " + " SET PricePO = 0 " sqlupd = new StringBuilder("UPDATE M_Product_PO SET PricePO = 0 ");
+ " WHERE PricePO IS NULL "; sqlupd.append(" WHERE PricePO IS NULL ");
cntu = DB.executeUpdate(sqlupd, get_TrxName()); cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError( raiseError(
"Update The PricePO to Zero of M_Product_PO WHERE PricePO IS NULL", "Update The PricePO to Zero of M_Product_PO WHERE PricePO IS NULL",
sqlupd); sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
// //
// Set default current vendor // Set default current vendor
// //
sqlupd = "UPDATE M_Product_PO " + " SET IsCurrentVendor = 'Y' " sqlupd = new StringBuilder("UPDATE M_Product_PO SET IsCurrentVendor = 'Y' ");
+ " WHERE IsCurrentVendor = 'N' " + " AND NOT EXISTS " sqlupd.append(" WHERE IsCurrentVendor = 'N' AND NOT EXISTS ");
+ " (SELECT pp.M_Product_ID " + " FROM M_Product_PO pp " sqlupd.append(" (SELECT pp.M_Product_ID FROM M_Product_PO pp ");
+ " WHERE pp.M_Product_ID = M_Product_PO.M_Product_ID" sqlupd.append(" WHERE pp.M_Product_ID = M_Product_PO.M_Product_ID");
+ " GROUP BY pp.M_Product_ID HAVING COUNT(*) > 1) "; sqlupd.append(" GROUP BY pp.M_Product_ID HAVING COUNT(*) > 1) ");
cntu = DB.executeUpdate(sqlupd, get_TrxName()); cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError("Update IsCurrentVendor to Y of M_Product_PO ", sqlupd); raiseError("Update IsCurrentVendor to Y of M_Product_PO ", sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
@ -161,26 +160,26 @@ public class M_PriceList_Create extends SvrProcess {
// //
// Make sure that we have only one active product // Make sure that we have only one active product
// //
sql = "SELECT DISTINCT M_Product_ID FROM M_Product_PO po " sql.append("SELECT DISTINCT M_Product_ID FROM M_Product_PO po ");
+ " WHERE IsCurrentVendor='Y' AND IsActive='Y' " sql.append(" WHERE IsCurrentVendor='Y' AND IsActive='Y' ");
+ " AND EXISTS (SELECT M_Product_ID " sql.append(" AND EXISTS (SELECT M_Product_ID ");
+ " FROM M_Product_PO x " sql.append(" FROM M_Product_PO x ");
+ " WHERE x.M_Product_ID=po.M_Product_ID " sql.append(" WHERE x.M_Product_ID=po.M_Product_ID ");
+ " AND IsCurrentVendor='Y' AND IsActive='Y' " sql.append(" AND IsCurrentVendor='Y' AND IsActive='Y' ");
+ " GROUP BY M_Product_ID " + " HAVING COUNT(*) > 1 ) "; sql.append(" GROUP BY M_Product_ID ").append(" HAVING COUNT(*) > 1 ) ");
PreparedStatement Cur_Duplicates = null; PreparedStatement Cur_Duplicates = null;
Cur_Duplicates = DB.prepareStatement(sql, get_TrxName()); Cur_Duplicates = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet dupl = Cur_Duplicates.executeQuery(); ResultSet dupl = Cur_Duplicates.executeQuery();
while (dupl.next()) { while (dupl.next()) {
sql = "SELECT M_Product_ID " + " ,C_BPartner_ID " sql = new StringBuilder("SELECT M_Product_ID ,C_BPartner_ID ");
+ " FROM M_Product_PO " + " WHERE IsCurrentVendor = 'Y' " sql.append(" FROM M_Product_PO WHERE IsCurrentVendor = 'Y' ");
+ " AND IsActive = 'Y' " sql.append(" AND IsActive = 'Y' ");
+ " AND M_Product_ID = " + dupl.getInt("M_Product_ID") sql.append(" AND M_Product_ID = ").append(dupl.getInt("M_Product_ID"));
+ " ORDER BY PriceList DESC"; sql.append(" ORDER BY PriceList DESC");
PreparedStatement Cur_Vendors = null; PreparedStatement Cur_Vendors = null;
Cur_Vendors = DB.prepareStatement(sql, get_TrxName()); Cur_Vendors = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet Vend = Cur_Vendors.executeQuery(); ResultSet Vend = Cur_Vendors.executeQuery();
// //
@ -189,17 +188,17 @@ public class M_PriceList_Create extends SvrProcess {
Vend.next(); Vend.next();
while (Vend.next()) { while (Vend.next()) {
sqlupd = "UPDATE M_Product_PO " sqlupd = new StringBuilder("UPDATE M_Product_PO ");
+ " SET IsCurrentVendor = 'N' " sqlupd.append(" SET IsCurrentVendor = 'N' ");
+ " WHERE M_Product_ID= " + Vend.getInt("M_Product_ID") sqlupd.append(" WHERE M_Product_ID= ").append(Vend.getInt("M_Product_ID"));
+ " AND C_BPartner_ID= " sqlupd.append(" AND C_BPartner_ID= ");
+ Vend.getInt("C_BPartner_ID"); sqlupd.append(Vend.getInt("C_BPartner_ID"));
cntu = DB.executeUpdate(sqlupd, get_TrxName()); cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError( raiseError(
"Update IsCurrentVendor to N of M_Product_PO for a M_Product_ID and C_BPartner_ID ingresed", "Update IsCurrentVendor to N of M_Product_PO for a M_Product_ID and C_BPartner_ID ingresed",
sqlupd); sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
@ -219,56 +218,60 @@ public class M_PriceList_Create extends SvrProcess {
// Delete Old Data // Delete Old Data
// //
if (p_DeleteOld.equals("Y")) { if (p_DeleteOld.equals("Y")) {
sqldel = "DELETE M_ProductPrice " sqldel.append("DELETE M_ProductPrice ")
+ " WHERE M_PriceList_Version_ID = " .append(" WHERE M_PriceList_Version_ID = ")
+ p_PriceList_Version_ID; .append(p_PriceList_Version_ID);
cntd = DB.executeUpdate(sqldel, get_TrxName()); cntd = DB.executeUpdate(sqldel.toString(), get_TrxName());
if (cntd == -1) if (cntd == -1)
raiseError(" DELETE M_ProductPrice ", sqldel); raiseError(" DELETE M_ProductPrice ", sqldel.toString());
totd += cntd; totd += cntd;
Message = "@Deleted@=" + cntd + " - "; Message = new StringBuilder("@Deleted@=").append(cntd).append(" - ");
log.fine("Deleted " + cntd); log.fine("Deleted " + cntd);
} }
// //
// Get PriceList Info // Get PriceList Info
// //
sql = "SELECT p.C_Currency_ID " + " , c.StdPrecision " sql = new StringBuilder("SELECT p.C_Currency_ID , c.StdPrecision ");
+ " , v.AD_Client_ID " + " , v.AD_Org_ID " + " , v.UpdatedBy " sql.append(" , v.AD_Client_ID , v.AD_Org_ID , v.UpdatedBy ");
+ " , v.M_DiscountSchema_ID " sql.append(" , v.M_DiscountSchema_ID ");
+ " , M_PriceList_Version_Base_ID " + " FROM M_PriceList p " sql.append(" , M_PriceList_Version_Base_ID FROM M_PriceList p ");
+ " ,M_PriceList_Version v " + " ,C_Currency c " sql.append(" ,M_PriceList_Version v ,C_Currency c ");
+ " WHERE p.M_PriceList_ID = v.M_PriceList_ID " sql.append(" WHERE p.M_PriceList_ID = v.M_PriceList_ID ");
+ " AND p.C_Currency_ID = c.C_Currency_ID" sql.append(" AND p.C_Currency_ID = c.C_Currency_ID");
+ " AND v.M_PriceList_Version_ID = " + p_PriceList_Version_ID; sql.append(" AND v.M_PriceList_Version_ID = ").append(p_PriceList_Version_ID);
PreparedStatement curgen = null; PreparedStatement curgen = null;
curgen = DB.prepareStatement(sql, get_TrxName()); curgen = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet v = curgen.executeQuery(); ResultSet v = curgen.executeQuery();
while (v.next()) { while (v.next()) {
// //
// For All Discount Lines in Sequence // For All Discount Lines in Sequence
// //
sql = "SELECT m_discountschemaline_id" sql = new StringBuilder("SELECT m_discountschemaline_id");
+ ",ad_client_id,ad_org_id,isactive,created,createdby,updated,updatedby" sql.append(",ad_client_id,ad_org_id,isactive,created,createdby,updated,updatedby");
+ ",m_discountschema_id,seqno,m_product_category_id,c_bpartner_id,m_product_id" sql.append(",m_discountschema_id,seqno,m_product_category_id,c_bpartner_id,m_product_id");
+ ",conversiondate,list_base,list_addamt,list_discount,list_rounding,list_minamt" sql.append(",conversiondate,list_base,list_addamt,list_discount,list_rounding,list_minamt");
+ ",list_maxamt,list_fixed,std_base,std_addamt,std_discount,std_rounding" sql.append(",list_maxamt,list_fixed,std_base,std_addamt,std_discount,std_rounding");
+ ",std_minamt,std_maxamt,std_fixed,limit_base,limit_addamt,limit_discount" sql.append(",std_minamt,std_maxamt,std_fixed,limit_base,limit_addamt,limit_discount");
+ ",limit_rounding,limit_minamt,limit_maxamt,limit_fixed,group1,group2,c_conversiontype_id" sql.append(",limit_rounding,limit_minamt,limit_maxamt,limit_fixed,group1,group2,c_conversiontype_id");
+ " FROM M_DiscountSchemaLine" sql.append(" FROM M_DiscountSchemaLine");
+ " WHERE M_DiscountSchema_ID=" sql.append(" WHERE M_DiscountSchema_ID=");
+ v.getInt("M_DiscountSchema_ID") sql.append(v.getInt("M_DiscountSchema_ID"));
+ " AND IsActive='Y' ORDER BY SeqNo"; sql.append(" AND IsActive='Y' ORDER BY SeqNo");
PreparedStatement Cur_DiscountLine = null; PreparedStatement Cur_DiscountLine = null;
Cur_DiscountLine = DB.prepareStatement(sql, get_TrxName()); Cur_DiscountLine = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet dl = Cur_DiscountLine.executeQuery(); ResultSet dl = Cur_DiscountLine.executeQuery();
while (dl.next()) { while (dl.next()) {
// //
//Clear Temporary Table //Clear Temporary Table
// //
sqldel = "DELETE FROM T_Selection WHERE AD_PInstance_ID="+ m_AD_PInstance_ID; sqldel = new StringBuilder("DELETE FROM T_Selection WHERE AD_PInstance_ID=");
cntd = DB.executeUpdate(sqldel, get_TrxName()); sqldel.append(m_AD_PInstance_ID);
cntd = DB.executeUpdate(sqldel.toString(), get_TrxName());
if (cntd == -1) if (cntd == -1)
raiseError(" DELETE T_Selection ", sqldel); raiseError(" DELETE T_Selection ", sqldel.toString());
totd += cntd; totd += cntd;
log.fine("Deleted " + cntd); log.fine("Deleted " + cntd);
// //
@ -281,29 +284,30 @@ public class M_PriceList_Create extends SvrProcess {
// //
//Create Selection from M_Product_PO //Create Selection from M_Product_PO
// //
sqlins = "INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) " sqlins.append("INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) ");
+ " SELECT DISTINCT " + m_AD_PInstance_ID +", po.M_Product_ID " sqlins.append( " SELECT DISTINCT ").append(m_AD_PInstance_ID).append(", po.M_Product_ID ");
+ " FROM M_Product p, M_Product_PO po" sqlins.append(" FROM M_Product p, M_Product_PO po");
+ " WHERE p.M_Product_ID=po.M_Product_ID " sqlins.append(" WHERE p.M_Product_ID=po.M_Product_ID ");
+ " AND (p.AD_Client_ID=" + v.getInt("AD_Client_ID") + " OR p.AD_Client_ID=0)" sqlins.append(" AND (p.AD_Client_ID=").append(v.getInt("AD_Client_ID")).append(" OR p.AD_Client_ID=0)");
+ " AND p.IsActive='Y' AND po.IsActive='Y' AND po.IsCurrentVendor='Y' " sqlins.append(" AND p.IsActive='Y' AND po.IsActive='Y' AND po.IsCurrentVendor='Y' ");
// //
//Optional Restrictions //Optional Restrictions
// //
// globalqss - detected bug, JDBC returns zero for null values // globalqss - detected bug, JDBC returns zero for null values
// so we're going to use NULLIF(value, 0) // so we're going to use NULLIF(value, 0)
+ " AND (NULLIF(" + dl.getInt("M_Product_Category_ID") + ",0) IS NULL" sqlins.append(" AND (NULLIF(").append(dl.getInt("M_Product_Category_ID")).append(",0) IS NULL");
+ " OR p.M_Product_Category_ID IN (" + getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")) + "))"; sqlins.append(" OR p.M_Product_Category_ID IN (").append(getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")))
.append("))");
if(dl_Group1 != null) if(dl_Group1 != null)
sqlins = sqlins + " AND (p.Group1=?)"; sqlins.append(" AND (p.Group1=?)");
if (dl_Group2 != null) if (dl_Group2 != null)
sqlins = sqlins + " AND (p.Group2=?)"; sqlins.append(" AND (p.Group2=?)");
sqlins = sqlins + " AND (NULLIF(" + dl.getInt("C_BPartner_ID") + ",0) IS NULL " sqlins.append(" AND (NULLIF(").append(dl.getInt("C_BPartner_ID")).append(",0) IS NULL ");
+ " OR po.C_BPartner_ID=" + dl.getInt("C_BPartner_ID") + ")" sqlins.append(" OR po.C_BPartner_ID=").append(dl.getInt("C_BPartner_ID")).append(")");
+ " AND (NULLIF(" + dl.getInt("M_Product_ID") + ",0) IS NULL " sqlins.append(" AND (NULLIF(").append(dl.getInt("M_Product_ID")).append(",0) IS NULL ");
+ " OR p.M_Product_ID=" + dl.getInt("M_Product_ID") + ")"; sqlins.append(" OR p.M_Product_ID=").append(dl.getInt("M_Product_ID")).append(")");
CPreparedStatement stmt = DB.prepareStatement(sqlins, get_TrxName()); CPreparedStatement stmt = DB.prepareStatement(sqlins.toString(), get_TrxName());
int i = 1; int i = 1;
@ -315,7 +319,7 @@ public class M_PriceList_Create extends SvrProcess {
cnti = stmt.executeUpdate(); cnti = stmt.executeUpdate();
if (cnti == -1) if (cnti == -1)
raiseError(" INSERT INTO T_Selection ", sqlins); raiseError(" INSERT INTO T_Selection ", sqlins.toString());
toti += cnti; toti += cnti;
log.fine("Inserted " + cnti); log.fine("Inserted " + cnti);
@ -323,36 +327,37 @@ public class M_PriceList_Create extends SvrProcess {
// //
// Create Selection from existing PriceList // Create Selection from existing PriceList
// //
sqlins = "INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID)" sqlins = new StringBuilder("INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID)");
+ " SELECT DISTINCT " + m_AD_PInstance_ID +", p.M_Product_ID" sqlins.append(" SELECT DISTINCT ").append(m_AD_PInstance_ID).append(", p.M_Product_ID");
+ " FROM M_Product p, M_ProductPrice pp" sqlins.append(" FROM M_Product p, M_ProductPrice pp");
+ " WHERE p.M_Product_ID=pp.M_Product_ID" sqlins.append(" WHERE p.M_Product_ID=pp.M_Product_ID");
+ " AND pp.M_PriceList_Version_ID = " + v.getInt("M_PriceList_Version_Base_ID") sqlins.append(" AND pp.M_PriceList_Version_ID = ").append(v.getInt("M_PriceList_Version_Base_ID"));
+ " AND p.IsActive='Y' AND pp.IsActive='Y'" sqlins.append(" AND p.IsActive='Y' AND pp.IsActive='Y'");
// //
//Optional Restrictions //Optional Restrictions
// //
+ " AND (NULLIF(" + dl.getInt("M_Product_Category_ID") + ",0) IS NULL" sqlins.append(" AND (NULLIF(").append(dl.getInt("M_Product_Category_ID")).append(",0) IS NULL");
+ " OR p.M_Product_Category_ID IN (" + getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")) + "))"; sqlins.append(" OR p.M_Product_Category_ID IN (").append(getSubCategoryWhereClause(dl.getInt("M_Product_Category_ID")))
.append("))");
if(dl_Group1 != null) if(dl_Group1 != null)
sqlins = sqlins + " AND (p.Group1=?)"; sqlins.append(" AND (p.Group1=?)");
if (dl_Group2 != null) if (dl_Group2 != null)
sqlins = sqlins + " AND (p.Group2=?)"; sqlins.append(" AND (p.Group2=?)");
sqlins = sqlins + " AND (NULLIF(" + dl.getInt("C_BPartner_ID") + ",0) IS NULL OR EXISTS " sqlins.append(" AND (NULLIF(").append(dl.getInt("C_BPartner_ID")).append(",0) IS NULL OR EXISTS ");
+ "(SELECT m_product_id,c_bpartner_id,ad_client_id,ad_org_id,isactive" sqlins.append("(SELECT m_product_id,c_bpartner_id,ad_client_id,ad_org_id,isactive");
+ ",created,createdby,updated,updatedby,iscurrentvendor,c_uom_id" sqlins.append(",created,createdby,updated,updatedby,iscurrentvendor,c_uom_id");
+ ",c_currency_id,pricelist,pricepo,priceeffective,pricelastpo" sqlins.append(",c_currency_id,pricelist,pricepo,priceeffective,pricelastpo");
+ ",pricelastinv,vendorproductno,upc,vendorcategory,discontinued" sqlins.append(",pricelastinv,vendorproductno,upc,vendorcategory,discontinued");
+ ",discontinuedby,order_min,order_pack,costperorder" sqlins.append(",discontinuedby,order_min,order_pack,costperorder");
+ ",deliverytime_promised,deliverytime_actual,qualityrating" sqlins.append(",deliverytime_promised,deliverytime_actual,qualityrating");
+ ",royaltyamt,group1,group2" sqlins.append(",royaltyamt,group1,group2");
+ ",manufacturer FROM M_Product_PO po WHERE po.M_Product_ID=p.M_Product_ID" sqlins.append(",manufacturer FROM M_Product_PO po WHERE po.M_Product_ID=p.M_Product_ID");
+ " AND po.C_BPartner_ID=" + dl.getInt("C_BPartner_ID") + "))" sqlins.append(" AND po.C_BPartner_ID=").append(dl.getInt("C_BPartner_ID")).append("))");
+ " AND (NULLIF(" + dl.getInt("M_Product_ID") + ",0) IS NULL " sqlins.append(" AND (NULLIF(").append(dl.getInt("M_Product_ID")).append(",0) IS NULL ");
+ " OR p.M_Product_ID=" + dl.getInt("M_Product_ID") + ")"; sqlins.append(" OR p.M_Product_ID=").append(dl.getInt("M_Product_ID")).append(")");
CPreparedStatement stmt = DB.prepareStatement(sqlins, get_TrxName()); CPreparedStatement stmt = DB.prepareStatement(sqlins.toString(), get_TrxName());
int i = 1; int i = 1;
if (dl_Group1!=null) if (dl_Group1!=null)
@ -364,13 +369,13 @@ public class M_PriceList_Create extends SvrProcess {
if (cnti == -1) if (cnti == -1)
raiseError( raiseError(
" INSERT INTO T_Selection from existing PriceList", " INSERT INTO T_Selection from existing PriceList",
sqlins); sqlins.toString());
toti += cnti; toti += cnti;
log.fine("Inserted " + cnti); log.fine("Inserted " + cnti);
} }
Message = Message + "@Selected@=" + cnti; Message.append("@Selected@=").append(cnti);
// //
//Delete Prices in Selection, so that we can insert //Delete Prices in Selection, so that we can insert
@ -378,17 +383,17 @@ public class M_PriceList_Create extends SvrProcess {
V_temp = v.getInt("M_PriceList_Version_Base_ID"); V_temp = v.getInt("M_PriceList_Version_Base_ID");
if (v.wasNull() || V_temp != p_PriceList_Version_ID) { if (v.wasNull() || V_temp != p_PriceList_Version_ID) {
sqldel = "DELETE M_ProductPrice pp" sqldel = new StringBuilder("DELETE M_ProductPrice pp");
+ " WHERE pp.M_PriceList_Version_ID = " sqldel.append(" WHERE pp.M_PriceList_Version_ID = ");
+ p_PriceList_Version_ID sqldel.append(p_PriceList_Version_ID);
+ " AND EXISTS (SELECT t_selection_id FROM T_Selection s WHERE pp.M_Product_ID=s.T_Selection_ID" sqldel.append(" AND EXISTS (SELECT t_selection_id FROM T_Selection s WHERE pp.M_Product_ID=s.T_Selection_ID");
+ " AND s.AD_PInstance_ID=" + m_AD_PInstance_ID + ")"; sqldel.append(" AND s.AD_PInstance_ID=").append(m_AD_PInstance_ID).append(")");
cntd = DB.executeUpdate(sqldel, get_TrxName()); cntd = DB.executeUpdate(sqldel.toString(), get_TrxName());
if (cntd == -1) if (cntd == -1)
raiseError(" DELETE M_ProductPrice ", sqldel); raiseError(" DELETE M_ProductPrice ", sqldel.toString());
totd += cntd; totd += cntd;
Message = Message + ", @Deleted@=" + cntd; Message.append(", @Deleted@=").append(cntd);
log.fine("Deleted " + cntd); log.fine("Deleted " + cntd);
} }
@ -406,71 +411,71 @@ public class M_PriceList_Create extends SvrProcess {
//Copy and Convert from Product_PO //Copy and Convert from Product_PO
// //
{ {
sqlins = "INSERT INTO M_ProductPrice " sqlins = new StringBuilder("INSERT INTO M_ProductPrice ");
+ "(M_PriceList_Version_ID" sqlins.append("(M_PriceList_Version_ID");
+ " ,M_Product_ID " sqlins.append(" ,M_Product_ID ");
+ " ,AD_Client_ID" sqlins.append(" ,AD_Client_ID");
+ " , AD_Org_ID" sqlins.append(" , AD_Org_ID");
+ " , IsActive" sqlins.append(" , IsActive");
+ " , Created" sqlins.append(" , Created");
+ " , CreatedBy" sqlins.append(" , CreatedBy");
+ " , Updated" sqlins.append(" , Updated");
+ " , UpdatedBy" sqlins.append(" , UpdatedBy");
+ " , PriceList" sqlins.append(" , PriceList");
+ " , PriceStd" sqlins.append(" , PriceStd");
+ " , PriceLimit) " sqlins.append(" , PriceLimit) ");
+ "SELECT " sqlins.append("SELECT ");
+ p_PriceList_Version_ID sqlins.append(p_PriceList_Version_ID);
+ " ,po.M_Product_ID " sqlins.append(" ,po.M_Product_ID ");
+ " ," sqlins.append(" ,");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ " ," sqlins.append(" ,");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ " ,'Y'" sqlins.append(" ,'Y'");
+ " ,SysDate," sqlins.append(" ,SysDate,");
+ v.getInt("UpdatedBy") sqlins.append(v.getInt("UpdatedBy"));
+ " ,SysDate," sqlins.append(" ,SysDate,");
+ v.getInt("UpdatedBy") sqlins.append(v.getInt("UpdatedBy"));
// //
//Price List //Price List
// //
+ " ,COALESCE(currencyConvert(po.PriceList, po.C_Currency_ID, " sqlins.append(" ,COALESCE(currencyConvert(po.PriceList, po.C_Currency_ID, ");
+ v.getInt("C_Currency_ID") sqlins.append(v.getInt("C_Currency_ID"));
+ ", ? , " sqlins.append(", ? , ");
+ dl.getInt("C_ConversionType_ID") sqlins.append(dl.getInt("C_ConversionType_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ "),0)" sqlins.append("),0)");
// Price Std // Price Std
+ " ,COALESCE(currencyConvert(po.PriceList, po.C_Currency_ID, " sqlins.append(" ,COALESCE(currencyConvert(po.PriceList, po.C_Currency_ID, ");
+ v.getInt("C_Currency_ID") sqlins.append(v.getInt("C_Currency_ID"));
+ ", ? , " sqlins.append(", ? , ");
+ dl.getInt("C_ConversionType_ID") sqlins.append(dl.getInt("C_ConversionType_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ "),0)" sqlins.append("),0)");
// Price Limit // Price Limit
+ " ,COALESCE(currencyConvert(po.PricePO ,po.C_Currency_ID, " sqlins.append(" ,COALESCE(currencyConvert(po.PricePO ,po.C_Currency_ID, ");
+ v.getInt("C_Currency_ID") sqlins.append(v.getInt("C_Currency_ID"));
+ ",? , " sqlins.append(",? , ");
+ dl.getInt("C_ConversionType_ID") sqlins.append(dl.getInt("C_ConversionType_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ "),0)" sqlins.append("),0)");
+ " FROM M_Product_PO po " sqlins.append(" FROM M_Product_PO po ");
+ " WHERE EXISTS (SELECT * FROM T_Selection s WHERE po.M_Product_ID=s.T_Selection_ID" sqlins.append(" WHERE EXISTS (SELECT * FROM T_Selection s WHERE po.M_Product_ID=s.T_Selection_ID");
+ " AND s.AD_PInstance_ID=" + m_AD_PInstance_ID + ") " sqlins.append(" AND s.AD_PInstance_ID=").append(m_AD_PInstance_ID).append(") ");
+ " AND po.IsCurrentVendor='Y' AND po.IsActive='Y'"; sqlins.append(" AND po.IsCurrentVendor='Y' AND po.IsActive='Y'");
PreparedStatement pstmt = DB.prepareStatement(sqlins, PreparedStatement pstmt = DB.prepareStatement(sqlins.toString(),
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE, get_TrxName()); ResultSet.CONCUR_UPDATABLE, get_TrxName());
pstmt.setTimestamp(1, dl.getTimestamp("ConversionDate")); pstmt.setTimestamp(1, dl.getTimestamp("ConversionDate"));
@ -481,68 +486,68 @@ public class M_PriceList_Create extends SvrProcess {
if (cnti == -1) if (cnti == -1)
raiseError( raiseError(
" INSERT INTO T_Selection from existing PriceList", " INSERT INTO T_Selection from existing PriceList",
sqlins); sqlins.toString());
toti += cnti; toti += cnti;
log.fine("Inserted " + cnti); log.fine("Inserted " + cnti);
} else { } else {
// //
//Copy and Convert from other PriceList_Version //Copy and Convert from other PriceList_Version
// //
sqlins = "INSERT INTO M_ProductPrice " sqlins = new StringBuilder("INSERT INTO M_ProductPrice ");
+ " (M_PriceList_Version_ID, M_Product_ID," sqlins.append(" (M_PriceList_Version_ID, M_Product_ID,");
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," sqlins.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,");
+ " PriceList, PriceStd, PriceLimit)" sqlins.append(" PriceList, PriceStd, PriceLimit)");
+ " SELECT " sqlins.append(" SELECT ");
+ p_PriceList_Version_ID sqlins.append(p_PriceList_Version_ID);
+ ", pp.M_Product_ID," sqlins.append(", pp.M_Product_ID,");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ ", 'Y', SysDate, " sqlins.append(", 'Y', SysDate, ");
+ v.getInt("UpdatedBy") sqlins.append(v.getInt("UpdatedBy"));
+ ", SysDate, " sqlins.append(", SysDate, ");
+ v.getInt("UpdatedBy") sqlins.append(v.getInt("UpdatedBy"));
+ " ," sqlins.append(" ,");
// Price List // Price List
+ "COALESCE(currencyConvert(pp.PriceList, pl.C_Currency_ID, " sqlins.append("COALESCE(currencyConvert(pp.PriceList, pl.C_Currency_ID, ");
+ v.getInt("C_Currency_ID") sqlins.append(v.getInt("C_Currency_ID"));
+ ", ?, " sqlins.append(", ?, ");
+ dl.getInt("C_ConversionType_ID") sqlins.append(dl.getInt("C_ConversionType_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ "),0)," sqlins.append("),0),");
// Price Std // Price Std
+ "COALESCE(currencyConvert(pp.PriceStd,pl.C_Currency_ID, " sqlins.append("COALESCE(currencyConvert(pp.PriceStd,pl.C_Currency_ID, ");
+ v.getInt("C_Currency_ID") sqlins.append(v.getInt("C_Currency_ID"));
+ " , ? , " sqlins.append(" , ? , ");
+ dl.getInt("C_ConversionType_ID") sqlins.append(dl.getInt("C_ConversionType_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ "),0)," sqlins.append("),0),");
//Price Limit //Price Limit
+ " COALESCE(currencyConvert(pp.PriceLimit,pl.C_Currency_ID, " sqlins.append(" COALESCE(currencyConvert(pp.PriceLimit,pl.C_Currency_ID, ");
+ v.getInt("C_Currency_ID") sqlins.append(v.getInt("C_Currency_ID"));
+ " , ? , " sqlins.append(" , ? , ");
+ dl.getInt("C_ConversionType_ID") sqlins.append(dl.getInt("C_ConversionType_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Client_ID") sqlins.append(v.getInt("AD_Client_ID"));
+ ", " sqlins.append(", ");
+ v.getInt("AD_Org_ID") sqlins.append(v.getInt("AD_Org_ID"));
+ "),0)" sqlins.append("),0)");
+ " FROM M_ProductPrice pp" sqlins.append(" FROM M_ProductPrice pp");
+ " INNER JOIN M_PriceList_Version plv ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID)" sqlins.append(" INNER JOIN M_PriceList_Version plv ON (pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID)");
+ " INNER JOIN M_PriceList pl ON (plv.M_PriceList_ID=pl.M_PriceList_ID)" sqlins.append(" INNER JOIN M_PriceList pl ON (plv.M_PriceList_ID=pl.M_PriceList_ID)");
+ " WHERE pp.M_PriceList_Version_ID=" sqlins.append(" WHERE pp.M_PriceList_Version_ID=");
+ v.getInt("M_PriceList_Version_Base_ID") sqlins.append(v.getInt("M_PriceList_Version_Base_ID"));
+ " AND EXISTS (SELECT * FROM T_Selection s WHERE pp.M_Product_ID=s.T_Selection_ID" sqlins.append(" AND EXISTS (SELECT * FROM T_Selection s WHERE pp.M_Product_ID=s.T_Selection_ID");
+ " AND s.AD_PInstance_ID=" + m_AD_PInstance_ID + ")" sqlins.append(" AND s.AD_PInstance_ID=").append(m_AD_PInstance_ID).append(")");
+ "AND pp.IsActive='Y'"; sqlins.append("AND pp.IsActive='Y'");
PreparedStatement pstmt = DB.prepareStatement(sqlins, PreparedStatement pstmt = DB.prepareStatement(sqlins.toString(),
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE, get_TrxName()); ResultSet.CONCUR_UPDATABLE, get_TrxName());
pstmt.setTimestamp(1, dl.getTimestamp("ConversionDate")); pstmt.setTimestamp(1, dl.getTimestamp("ConversionDate"));
@ -554,32 +559,33 @@ public class M_PriceList_Create extends SvrProcess {
if (cnti == -1) if (cnti == -1)
raiseError( raiseError(
" INSERT INTO T_Selection from existing PriceList", " INSERT INTO T_Selection from existing PriceList",
sqlins); sqlins.toString());
toti += cnti; toti += cnti;
log.fine("Inserted " + cnti); log.fine("Inserted " + cnti);
} }
Message = Message + ", @Inserted@=" + cnti; Message.append(", @Inserted@=").append(cnti);
// //
// Calculation // Calculation
// //
sqlupd = "UPDATE M_ProductPrice p " sqlupd = new StringBuilder("UPDATE M_ProductPrice p ");
+ " SET PriceList = (DECODE( '" sqlupd.append(" SET PriceList = (DECODE( '");
+ dl.getString("List_Base") sqlupd.append(dl.getString("List_Base"));
+ "', 'S', PriceStd, 'X', PriceLimit, PriceList)" sqlupd.append("', 'S', PriceStd, 'X', PriceLimit, PriceList)");
+ " + ?) * (1 - ?/100)," + " PriceStd = (DECODE('" sqlupd.append(" + ?) * (1 - ?/100), PriceStd = (DECODE('");
+ dl.getString("Std_Base") sqlupd.append(dl.getString("Std_Base"));
+ "', 'L', PriceList, 'X', PriceLimit, PriceStd) " sqlupd.append("', 'L', PriceList, 'X', PriceLimit, PriceStd) ");
+ " + ?) * (1 - ?/100), " + " PriceLimit = (DECODE('" sqlupd.append(" + ?) * (1 - ?/100), ").append(" PriceLimit = (DECODE('");
+ dl.getString("Limit_Base") sqlupd.append(dl.getString("Limit_Base"));
+ "', 'L', PriceList, 'S', PriceStd, PriceLimit) " sqlupd.append("', 'L', PriceList, 'S', PriceStd, PriceLimit) ");
+ " + ?) * (1 - ? /100) " sqlupd.append(" + ?) * (1 - ? /100) ");
+ " WHERE M_PriceList_Version_ID = " sqlupd.append(" WHERE M_PriceList_Version_ID = ");
+ p_PriceList_Version_ID sqlupd.append(p_PriceList_Version_ID);
+ " AND EXISTS (SELECT * FROM T_Selection s " sqlupd.append(" AND EXISTS (SELECT * FROM T_Selection s ");
+ " WHERE s.T_Selection_ID = p.M_Product_ID" sqlupd.append(" WHERE s.T_Selection_ID = p.M_Product_ID");
+ " AND s.AD_PInstance_ID=" + m_AD_PInstance_ID + ")"; sqlupd.append(" AND s.AD_PInstance_ID=").append(m_AD_PInstance_ID).append(")");
PreparedStatement pstmu = DB.prepareStatement(sqlupd,
PreparedStatement pstmu = DB.prepareStatement(sqlupd.toString(),
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE, get_TrxName()); ResultSet.CONCUR_UPDATABLE, get_TrxName());
@ -593,90 +599,92 @@ public class M_PriceList_Create extends SvrProcess {
cntu = pstmu.executeUpdate(); cntu = pstmu.executeUpdate();
if (cntu == -1) if (cntu == -1)
raiseError("Update M_ProductPrice ", sqlupd); raiseError("Update M_ProductPrice ", sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
// //
//Rounding (AD_Reference_ID=155) //Rounding (AD_Reference_ID=155)
// //
sqlupd = "UPDATE M_ProductPrice p " sqlupd = new StringBuilder("UPDATE M_ProductPrice p ");
+ " SET PriceList = DECODE('" sqlupd.append(" SET PriceList = DECODE('");
+ dl.getString("List_Rounding") + "'," sqlupd.append(dl.getString("List_Rounding")).append("',");
+ " 'N', PriceList, " sqlupd.append(" 'N', PriceList, ");
+ " '0', ROUND(PriceList, 0)," //Even .00 sqlupd.append(" '0', ROUND(PriceList, 0),"); //Even .00
+ " 'D', ROUND(PriceList, 1)," //Dime .10 sqlupd.append(" 'D', ROUND(PriceList, 1),"); //Dime .10
+ " 'T', ROUND(PriceList, -1), " //Ten 10.00 sqlupd.append(" 'T', ROUND(PriceList, -1), "); //Ten 10.00
+ " '5', ROUND(PriceList*20,0)/20," //Nickle .05 sqlupd.append(" '5', ROUND(PriceList*20,0)/20,"); //Nickle .05
+ " 'Q', ROUND(PriceList*4,0)/4," //Quarter .25 sqlupd.append(" 'Q', ROUND(PriceList*4,0)/4,"); //Quarter .25
+ " '9', CASE" //Whole 9 or 5 sqlupd.append(" '9', CASE"); //Whole 9 or 5
+ " WHEN MOD(ROUND(PriceList),10)<=5 THEN ROUND(PriceList)+(5-MOD(ROUND(PriceList),10))" sqlupd.append(" WHEN MOD(ROUND(PriceList),10)<=5 THEN ROUND(PriceList)+(5-MOD(ROUND(PriceList),10))");
+ " WHEN MOD(ROUND(PriceList),10)>5 THEN ROUND(PriceList)+(9-MOD(ROUND(PriceList),10)) END," sqlupd.append(" WHEN MOD(ROUND(PriceList),10)>5 THEN ROUND(PriceList)+(9-MOD(ROUND(PriceList),10)) END,");
+ " ROUND(PriceList, " + v.getInt("StdPrecision") sqlupd.append(" ROUND(PriceList, ").append(v.getInt("StdPrecision"));
+ "))," //Currency sqlupd.append(")),");//Currency
+ " PriceStd = DECODE('" + dl.getString("Std_Rounding") sqlupd.append(" PriceStd = DECODE('").append(dl.getString("Std_Rounding"));
+ "'," + " 'N', PriceStd, " sqlupd.append("',").append(" 'N', PriceStd, ");
+ " '0', ROUND(PriceStd, 0), " //Even .00 sqlupd.append(" '0', ROUND(PriceStd, 0), "); //Even .00
+ " 'D', ROUND(PriceStd, 1), " //Dime .10 sqlupd.append(" 'D', ROUND(PriceStd, 1), "); //Dime .10
+ "'T', ROUND(PriceStd, -1)," //Ten 10.00 sqlupd.append("'T', ROUND(PriceStd, -1),"); //Ten 10.00)
+ "'5', ROUND(PriceStd*20,0)/20," //Nickle .05 sqlupd.append("'5', ROUND(PriceStd*20,0)/20,"); //Nickle .05
+ "'Q', ROUND(PriceStd*4,0)/4," //Quarter .25 sqlupd.append("'Q', ROUND(PriceStd*4,0)/4,"); //Quarter .25
+ " '9', CASE" //Whole 9 or 5 sqlupd.append(" '9', CASE"); //Whole 9 or 5
+ " WHEN MOD(ROUND(PriceStd),10)<=5 THEN ROUND(PriceStd)+(5-MOD(ROUND(PriceStd),10))" sqlupd.append(" WHEN MOD(ROUND(PriceStd),10)<=5 THEN ROUND(PriceStd)+(5-MOD(ROUND(PriceStd),10))");
+ " WHEN MOD(ROUND(PriceStd),10)>5 THEN ROUND(PriceStd)+(9-MOD(ROUND(PriceStd),10)) END," sqlupd.append(" WHEN MOD(ROUND(PriceStd),10)>5 THEN ROUND(PriceStd)+(9-MOD(ROUND(PriceStd),10)) END,");
+ "ROUND(PriceStd, " + v.getInt("StdPrecision") + "))," //Currency sqlupd.append("ROUND(PriceStd, ").append(v.getInt("StdPrecision")).append(")),"); //Currency
+ "PriceLimit = DECODE('" sqlupd.append("PriceLimit = DECODE('");
+ dl.getString("Limit_Rounding") + "', " sqlupd.append(dl.getString("Limit_Rounding")).append("', ");
+ " 'N', PriceLimit, " sqlupd.append(" 'N', PriceLimit, ");
+ " '0', ROUND(PriceLimit, 0), " // Even .00 sqlupd.append(" '0', ROUND(PriceLimit, 0), "); // Even .00
+ " 'D', ROUND(PriceLimit, 1), " // Dime .10 sqlupd.append(" 'D', ROUND(PriceLimit, 1), "); // Dime .10
+ " 'T', ROUND(PriceLimit, -1), " // Ten 10.00 sqlupd.append(" 'T', ROUND(PriceLimit, -1), "); // Ten 10.00
+ " '5', ROUND(PriceLimit*20,0)/20, " // Nickle .05 sqlupd.append(" '5', ROUND(PriceLimit*20,0)/20, "); // Nickle .05
+ " 'Q', ROUND(PriceLimit*4,0)/4, " //Quarter .25 sqlupd.append(" 'Q', ROUND(PriceLimit*4,0)/4, "); //Quarter .25
+ " '9', CASE" //Whole 9 or 5 sqlupd.append(" '9', CASE"); //Whole 9 or 5
+ " WHEN MOD(ROUND(PriceLimit),10)<=5 THEN ROUND(PriceLimit)+(5-MOD(ROUND(PriceLimit),10))" sqlupd.append(" WHEN MOD(ROUND(PriceLimit),10)<=5 THEN ROUND(PriceLimit)+(5-MOD(ROUND(PriceLimit),10))");
+ " WHEN MOD(ROUND(PriceLimit),10)>5 THEN ROUND(PriceLimit)+(9-MOD(ROUND(PriceLimit),10)) END," sqlupd.append(" WHEN MOD(ROUND(PriceLimit),10)>5 THEN ROUND(PriceLimit)+(9-MOD(ROUND(PriceLimit),10)) END,");
+ " ROUND(PriceLimit, " + v.getInt("StdPrecision") sqlupd.append(" ROUND(PriceLimit, ").append(v.getInt("StdPrecision"));
+ ")) " // Currency sqlupd.append(")) "); // Currency
+ " WHERE M_PriceList_Version_ID=" sqlupd.append(" WHERE M_PriceList_Version_ID=");
+ p_PriceList_Version_ID sqlupd.append(p_PriceList_Version_ID);
+ " AND EXISTS (SELECT * FROM T_Selection s " sqlupd.append(" AND EXISTS (SELECT * FROM T_Selection s ");
+ " WHERE s.T_Selection_ID=p.M_Product_ID" sqlupd.append(" WHERE s.T_Selection_ID=p.M_Product_ID");
+ " AND s.AD_PInstance_ID=" + m_AD_PInstance_ID + ")"; sqlupd.append(" AND s.AD_PInstance_ID=").append(m_AD_PInstance_ID).append(")");
cntu = DB.executeUpdate(sqlupd, get_TrxName());
cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError("Update M_ProductPrice ", sqlupd); raiseError("Update M_ProductPrice ", sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
Message = Message + ", @Updated@=" + cntu; Message.append(", @Updated@=").append(cntu);
// //
//Fixed Price overwrite //Fixed Price overwrite
// //
sqlupd = "UPDATE M_ProductPrice p " sqlupd = new StringBuilder("UPDATE M_ProductPrice p ");
+ " SET PriceList = DECODE('" sqlupd.append(" SET PriceList = DECODE('");
+ dl.getString("List_Base") + "', 'F', " sqlupd.append(dl.getString("List_Base")).append("', 'F', ");
+ dl.getDouble("List_Fixed") + ", PriceList), " sqlupd.append(dl.getDouble("List_Fixed")).append(", PriceList), ");
+ " PriceStd = DECODE('" sqlupd.append(" PriceStd = DECODE('");
+ dl.getString("Std_Base") + "', 'F', " sqlupd.append(dl.getString("Std_Base")).append("', 'F', ");
+ dl.getDouble("Std_Fixed") + ", PriceStd)," sqlupd.append(dl.getDouble("Std_Fixed")).append(", PriceStd),");
+ " PriceLimit = DECODE('" sqlupd.append(" PriceLimit = DECODE('");
+ dl.getString("Limit_Base") + "', 'F', " sqlupd.append(dl.getString("Limit_Base")).append("', 'F', ");
+ dl.getDouble("Limit_Fixed") + ", PriceLimit)" sqlupd.append(dl.getDouble("Limit_Fixed")).append(", PriceLimit)");
+ " WHERE M_PriceList_Version_ID=" sqlupd.append(" WHERE M_PriceList_Version_ID=");
+ p_PriceList_Version_ID sqlupd.append(p_PriceList_Version_ID);
+ " AND EXISTS (SELECT * FROM T_Selection s" sqlupd.append(" AND EXISTS (SELECT * FROM T_Selection s");
+ " WHERE s.T_Selection_ID=p.M_Product_ID" sqlupd.append(" WHERE s.T_Selection_ID=p.M_Product_ID");
+ " AND s.AD_PInstance_ID=" + m_AD_PInstance_ID + ")"; sqlupd.append(" AND s.AD_PInstance_ID=").append(m_AD_PInstance_ID).append(")");
cntu = DB.executeUpdate(sqlupd, get_TrxName());
cntu = DB.executeUpdate(sqlupd.toString(), get_TrxName());
if (cntu == -1) if (cntu == -1)
raiseError("Update M_ProductPrice ", sqlupd); raiseError("Update M_ProductPrice ", sqlupd.toString());
totu += cntu; totu += cntu;
log.fine("Updated " + cntu); log.fine("Updated " + cntu);
v_NextNo = v_NextNo + 1; v_NextNo = v_NextNo + 1;
addLog(0, null, null, Message); addLog(0, null, null, Message.toString());
Message = ""; Message = new StringBuilder();
} }
dl.close(); dl.close();
Cur_DiscountLine.close(); Cur_DiscountLine.close();
@ -685,10 +693,10 @@ public class M_PriceList_Create extends SvrProcess {
// //
// Delete Temporary Selection // Delete Temporary Selection
// //
sqldel = "DELETE FROM T_Selection "; sqldel = new StringBuilder("DELETE FROM T_Selection ");
cntd = DB.executeUpdate(sqldel, get_TrxName()); cntd = DB.executeUpdate(sqldel.toString(), get_TrxName());
if (cntd == -1) if (cntd == -1)
raiseError(" DELETE T_Selection ", sqldel); raiseError(" DELETE T_Selection ", sqldel.toString());
totd += cntd; totd += cntd;
log.fine("Deleted " + cntd); log.fine("Deleted " + cntd);
@ -710,12 +718,12 @@ public class M_PriceList_Create extends SvrProcess {
private void raiseError(String string, String sql) throws Exception { private void raiseError(String string, String sql) throws Exception {
// DB.rollback(false, get_TrxName()); // DB.rollback(false, get_TrxName());
String msg = string; StringBuilder msg = new StringBuilder(string);
ValueNamePair pp = CLogger.retrieveError(); ValueNamePair pp = CLogger.retrieveError();
if (pp != null) if (pp != null)
msg = pp.getName() + " - "; msg = new StringBuilder(pp.getName()).append(" - ");
msg += sql; msg.append(sql);
throw new AdempiereUserError(msg); throw new AdempiereUserError(msg.toString());
} }
/** /**
@ -727,7 +735,7 @@ public class M_PriceList_Create extends SvrProcess {
private String getSubCategoryWhereClause(int productCategoryId) throws SQLException, AdempiereSystemError{ private String getSubCategoryWhereClause(int productCategoryId) throws SQLException, AdempiereSystemError{
//if a node with this id is found later in the search we have a loop in the tree //if a node with this id is found later in the search we have a loop in the tree
int subTreeRootParentId = 0; int subTreeRootParentId = 0;
String retString = " "; StringBuilder retString = new StringBuilder();
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category"; String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100); final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
Statement stmt = DB.createStatement(); Statement stmt = DB.createStatement();
@ -738,10 +746,10 @@ public class M_PriceList_Create extends SvrProcess {
} }
categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2))); categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2)));
} }
retString += getSubCategoriesString(productCategoryId, categories, subTreeRootParentId); retString.append(getSubCategoriesString(productCategoryId, categories, subTreeRootParentId));
rs.close(); rs.close();
stmt.close(); stmt.close();
return retString; return retString.toString();
} }
/** /**
@ -753,7 +761,7 @@ public class M_PriceList_Create extends SvrProcess {
* @throws AdempiereSystemError if a loop is detected * @throws AdempiereSystemError if a loop is detected
*/ */
private String getSubCategoriesString(int productCategoryId, Vector<SimpleTreeNode> categories, int loopIndicatorId) throws AdempiereSystemError { private String getSubCategoriesString(int productCategoryId, Vector<SimpleTreeNode> categories, int loopIndicatorId) throws AdempiereSystemError {
String ret = ""; StringBuilder ret = new StringBuilder();
final Iterator iter = categories.iterator(); final Iterator iter = categories.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
SimpleTreeNode node = (SimpleTreeNode) iter.next(); SimpleTreeNode node = (SimpleTreeNode) iter.next();
@ -761,11 +769,12 @@ public class M_PriceList_Create extends SvrProcess {
if (node.getNodeId() == loopIndicatorId) { if (node.getNodeId() == loopIndicatorId) {
throw new AdempiereSystemError("The product category tree contains a loop on categoryId: " + loopIndicatorId); throw new AdempiereSystemError("The product category tree contains a loop on categoryId: " + loopIndicatorId);
} }
ret = ret + getSubCategoriesString(node.getNodeId(), categories, loopIndicatorId) + ","; ret.append(getSubCategoriesString(node.getNodeId(), categories, loopIndicatorId));
ret.append(",");
} }
} }
log.fine(ret); log.fine(ret.toString());
return ret + productCategoryId; return ret.toString() + productCategoryId;
} }
/** /**

View File

@ -73,7 +73,7 @@ public class M_Product_BOM_Check extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
StringBuffer sql1 = null; StringBuilder sql1 = null;
int no = 0; int no = 0;
log.info("Check BOM Structure"); log.info("Check BOM Structure");
@ -90,20 +90,20 @@ public class M_Product_BOM_Check extends SvrProcess
} }
// Table to put all BOMs - duplicate will cause exception // Table to put all BOMs - duplicate will cause exception
sql1 = new StringBuffer("DELETE FROM T_Selection2 WHERE Query_ID = 0 AND AD_PInstance_ID="+ m_AD_PInstance_ID); sql1 = new StringBuilder("DELETE FROM T_Selection2 WHERE Query_ID = 0 AND AD_PInstance_ID=").append(m_AD_PInstance_ID);
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
sql1 = new StringBuffer("INSERT INTO T_Selection2 (AD_PInstance_ID, Query_ID, T_Selection_ID) VALUES (" sql1 = new StringBuilder("INSERT INTO T_Selection2 (AD_PInstance_ID, Query_ID, T_Selection_ID) VALUES (")
+ m_AD_PInstance_ID .append(m_AD_PInstance_ID)
+ ", 0, " .append(", 0, ")
+ p_Record_ID + ")"); .append(p_Record_ID).append(")");
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
// Table of root modes // Table of root modes
sql1 = new StringBuffer("DELETE FROM T_Selection WHERE AD_PInstance_ID="+ m_AD_PInstance_ID); sql1 = new StringBuilder("DELETE FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID);
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
sql1 = new StringBuffer("INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) VALUES (" sql1 = new StringBuilder("INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) VALUES (")
+ m_AD_PInstance_ID .append(m_AD_PInstance_ID)
+ ", " .append(", ")
+ p_Record_ID + ")"); .append(p_Record_ID).append(")");
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
while (true) { while (true) {
@ -112,8 +112,8 @@ public class M_Product_BOM_Check extends SvrProcess
int countno = 0; int countno = 0;
try try
{ {
PreparedStatement pstmt = DB.prepareStatement StringBuilder dbpst = new StringBuilder("SELECT COUNT(*) FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID);
("SELECT COUNT(*) FROM T_Selection WHERE AD_PInstance_ID="+ m_AD_PInstance_ID, get_TrxName()); PreparedStatement pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
countno = rs.getInt(1); countno = rs.getInt(1);
@ -133,31 +133,31 @@ public class M_Product_BOM_Check extends SvrProcess
{ {
// if any command fails (no==-1) break and inform failure // if any command fails (no==-1) break and inform failure
// Insert BOM Nodes into "All" table // Insert BOM Nodes into "All" table
sql1 = new StringBuffer("INSERT INTO T_Selection2 (AD_PInstance_ID, Query_ID, T_Selection_ID) " sql1 = new StringBuilder("INSERT INTO T_Selection2 (AD_PInstance_ID, Query_ID, T_Selection_ID) ")
+ "SELECT " + m_AD_PInstance_ID + ", 0, p.M_Product_ID FROM M_Product p WHERE IsBOM='Y' AND EXISTS " .append("SELECT ").append(m_AD_PInstance_ID).append(", 0, p.M_Product_ID FROM M_Product p WHERE IsBOM='Y' AND EXISTS ")
//+ "(SELECT * FROM M_Product_BOM b WHERE p.M_Product_ID=b.M_ProductBOM_ID AND b.M_Product_ID IN " //+ "(SELECT * FROM M_Product_BOM b WHERE p.M_Product_ID=b.M_ProductBOM_ID AND b.M_Product_ID IN "
+ "(SELECT * FROM PP_Product_BOM b WHERE p.M_Product_ID=b.M_Product_ID AND b.M_Product_ID IN " .append("(SELECT * FROM PP_Product_BOM b WHERE p.M_Product_ID=b.M_Product_ID AND b.M_Product_ID IN ")
+ "(SELECT T_Selection_ID FROM T_Selection WHERE AD_PInstance_ID="+ m_AD_PInstance_ID + "))"); .append("(SELECT T_Selection_ID FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID).append("))");
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString()); if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString());
// Insert BOM Nodes into temporary table // Insert BOM Nodes into temporary table
sql1 = new StringBuffer("DELETE FROM T_Selection2 WHERE Query_ID = 1 AND AD_PInstance_ID="+ m_AD_PInstance_ID); sql1 = new StringBuilder("DELETE FROM T_Selection2 WHERE Query_ID = 1 AND AD_PInstance_ID=").append(m_AD_PInstance_ID);
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString()); if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString());
sql1 = new StringBuffer("INSERT INTO T_Selection2 (AD_PInstance_ID, Query_ID, T_Selection_ID) " sql1 = new StringBuilder("INSERT INTO T_Selection2 (AD_PInstance_ID, Query_ID, T_Selection_ID) ")
+ "SELECT " + m_AD_PInstance_ID + ", 1, p.M_Product_ID FROM M_Product p WHERE IsBOM='Y' AND EXISTS " .append("SELECT ").append(m_AD_PInstance_ID).append(", 1, p.M_Product_ID FROM M_Product p WHERE IsBOM='Y' AND EXISTS ")
//+ "(SELECT * FROM M_Product_BOM b WHERE p.M_Product_ID=b.M_ProductBOM_ID AND b.M_Product_ID IN " //+ "(SELECT * FROM M_Product_BOM b WHERE p.M_Product_ID=b.M_ProductBOM_ID AND b.M_Product_ID IN "
+ "(SELECT * FROM PP_Product_BOM b WHERE p.M_Product_ID=b.M_Product_ID AND b.M_Product_ID IN " .append("(SELECT * FROM PP_Product_BOM b WHERE p.M_Product_ID=b.M_Product_ID AND b.M_Product_ID IN ")
+ "(SELECT T_Selection_ID FROM T_Selection WHERE AD_PInstance_ID="+ m_AD_PInstance_ID + "))"); .append("(SELECT T_Selection_ID FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID).append("))");
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString()); if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString());
// Copy into root table // Copy into root table
sql1 = new StringBuffer("DELETE FROM T_Selection WHERE AD_PInstance_ID="+ m_AD_PInstance_ID); sql1 = new StringBuilder("DELETE FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID);
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString()); if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString());
sql1 = new StringBuffer("INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) " sql1 = new StringBuilder("INSERT INTO T_Selection (AD_PInstance_ID, T_Selection_ID) ")
+ "SELECT " + m_AD_PInstance_ID + ", T_Selection_ID " .append("SELECT ").append(m_AD_PInstance_ID).append(", T_Selection_ID ")
+ "FROM T_Selection2 WHERE Query_ID = 1 AND AD_PInstance_ID="+ m_AD_PInstance_ID); .append("FROM T_Selection2 WHERE Query_ID = 1 AND AD_PInstance_ID=").append(m_AD_PInstance_ID);
no = DB.executeUpdate(sql1.toString(), get_TrxName()); no = DB.executeUpdate(sql1.toString(), get_TrxName());
if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString()); if (no == -1) raiseError("InsertingRoot:ERROR", sql1.toString());
} }
@ -176,12 +176,12 @@ public class M_Product_BOM_Check extends SvrProcess
private void raiseError(String string, String sql) throws Exception { private void raiseError(String string, String sql) throws Exception {
DB.rollback(false, get_TrxName()); DB.rollback(false, get_TrxName());
String msg = string; StringBuilder msg = new StringBuilder(string);
ValueNamePair pp = CLogger.retrieveError(); ValueNamePair pp = CLogger.retrieveError();
if (pp != null) if (pp != null)
msg = pp.getName() + " - "; msg = new StringBuilder(pp.getName()).append(" - ");
msg += sql; msg.append(sql);
throw new AdempiereUserError (msg); throw new AdempiereUserError (msg.toString());
} }
} // M_Product_BOM_Check } // M_Product_BOM_Check

Some files were not shown because too many files have changed in this diff Show More