IDEMPIERE-2103 Process for run import csv
This commit is contained in:
parent
b6ede5ee21
commit
899c60b041
|
@ -0,0 +1,211 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Dec 2, 2014 4:51:26 PM COT
|
||||
-- IDEMPIERE-2103 Process for run import/export csv
|
||||
INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,Name,AD_Org_ID,UpdatedBy,IsActive,CreatedBy,Classname,Value,AD_Client_ID,EntityType,Created,Updated) VALUES ('N',200076,'N','N','95ee94ea-d050-4f20-b4f3-1b6776df6d62','7','N','N',0,0,'Y','Import CSV Process',0,100,'Y',100,'org.idempiere.process.ImportCSVProcess','ImportCSVProcess',0,'D',TO_DATE('2014-12-02 16:51:25','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-12-02 16:51:25','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:52:29 PM COT
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,IsMandatory,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID,AD_Reference_ID,EntityType,Created) VALUES ('N',200111,'a75e1a11-f9e5-4d1f-9140-dde15f7c4c61',200076,'Y','Import Template','AD_ImportTemplate_ID',0,'Y',10,'Y',100,TO_DATE('2014-12-02 16:52:28','YYYY-MM-DD HH24:MI:SS'),100,0,'N',0,202793,19,'D',TO_DATE('2014-12-02 16:52:28','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:53:00 PM COT
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Process_ID,IsMandatory,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID,AD_Reference_ID,EntityType,Created) VALUES ('N',200112,'11253af5-7dd2-441a-b1c1-2b1350e99e4e','Name of a file in the local directory space - or URL (file://.., http://.., ftp://..)',200076,'Y','File Name','FileName','Name of the local file or URL',0,'Y',20,'Y',100,TO_DATE('2014-12-02 16:52:59','YYYY-MM-DD HH24:MI:SS'),100,0,'N',0,2295,38,'D',TO_DATE('2014-12-02 16:52:59','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:07 PM COT
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created) VALUES ('ImportMode',202807,'Import Mode','Import Mode','fef3fdab-e970-4c03-8789-1ae1c944ea5a',TO_DATE('2014-12-02 16:55:06','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D',TO_DATE('2014-12-02 16:55:06','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:29 PM COT
|
||||
INSERT INTO AD_Reference (AD_Reference_ID,AD_Reference_UU,Name,EntityType,IsOrderByValue,ValidationType,AD_Org_ID,CreatedBy,Updated,IsActive,UpdatedBy,AD_Client_ID,Created) VALUES (200098,'3892e140-7f08-4f89-a510-493e0f7cb775','Import Mode','D','N','L',0,100,TO_DATE('2014-12-02 16:55:29','YYYY-MM-DD HH24:MI:SS'),'Y',100,0,TO_DATE('2014-12-02 16:55:29','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:46 PM COT
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,UpdatedBy,Updated,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200281,200098,'39b8fe8e-3d83-419d-96ce-519550cc5baf','Insert','I',100,100,TO_DATE('2014-12-02 16:55:44','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_DATE('2014-12-02 16:55:44','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:54 PM COT
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,UpdatedBy,Updated,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200282,200098,'17e4b7b0-3699-4b98-ab13-c19fe531d4de','Update','U',100,100,TO_DATE('2014-12-02 16:55:53','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_DATE('2014-12-02 16:55:53','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:59 PM COT
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,UpdatedBy,Updated,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200283,200098,'9d47e0f4-0ed4-41bb-a7d5-8dd7dc120394','Merge','M',100,100,TO_DATE('2014-12-02 16:55:59','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_DATE('2014-12-02 16:55:59','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:56:37 PM COT
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,IsMandatory,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID,AD_Reference_ID,AD_Reference_Value_ID,EntityType,Created) VALUES ('N',200113,'7c2d264e-2622-494a-81a4-03f84ea99061',200076,'Y','Import Mode','ImportMode',0,'Y',30,'I','Y',100,TO_DATE('2014-12-02 16:56:36','YYYY-MM-DD HH24:MI:SS'),100,0,'N',0,202807,17,200098,'D',TO_DATE('2014-12-02 16:56:36','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:56:59 PM COT
|
||||
INSERT INTO AD_Menu (AD_Menu_ID,IsSummary,IsSOTrx,IsReadOnly,IsCentrallyMaintained,Name,AD_Menu_UU,Action,IsActive,CreatedBy,Updated,UpdatedBy,AD_Org_ID,AD_Client_ID,AD_Process_ID,EntityType,Created) VALUES (200096,'N','N','N','Y','Import CSV Process','06345362-8973-4923-85a7-e41f61289953','P','Y',100,TO_DATE('2014-12-02 16:56:59','YYYY-MM-DD HH24:MI:SS'),100,0,0,200076,'D',TO_DATE('2014-12-02 16:56:59','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:56:59 PM COT
|
||||
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, 200096, 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=200096)
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=218
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=153
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=263
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=166
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=203
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53242
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=236
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=183
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=160
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=278
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=345
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53296
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53014
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53108
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000000
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=1000003
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=0, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=222
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=1, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=223
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=2, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=185
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=3, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=340
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=4, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53264
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=5, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53206
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=6, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=339
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=7, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=338
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=8, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53282
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=9, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=363
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=10, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=376
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=11, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=382
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=12, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=486
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=13, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=425
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=14, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=378
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=15, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=374
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=16, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53284
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=17, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=423
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=18, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=53263
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=19, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=373
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=20, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=424
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=21, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200095
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=22, Updated=SysDate WHERE AD_Tree_ID=10 AND Node_ID=200096
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 6:04:14 PM COT
|
||||
UPDATE AD_Process_Para SET AD_Reference_ID=39,Updated=TO_DATE('2014-12-02 18:04:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200112
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201412021658_IDEMPIERE-2103.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
-- Dec 2, 2014 4:51:26 PM COT
|
||||
-- IDEMPIERE-2103 Process for run import/export csv
|
||||
INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,Name,AD_Org_ID,UpdatedBy,IsActive,CreatedBy,Classname,Value,AD_Client_ID,EntityType,Created,Updated) VALUES ('N',200076,'N','N','95ee94ea-d050-4f20-b4f3-1b6776df6d62','7','N','N',0,0,'Y','Import CSV Process',0,100,'Y',100,'org.idempiere.process.ImportCSVProcess','ImportCSVProcess',0,'D',TO_TIMESTAMP('2014-12-02 16:51:25','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-12-02 16:51:25','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:52:29 PM COT
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,IsMandatory,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID,AD_Reference_ID,EntityType,Created) VALUES ('N',200111,'a75e1a11-f9e5-4d1f-9140-dde15f7c4c61',200076,'Y','Import Template','AD_ImportTemplate_ID',0,'Y',10,'Y',100,TO_TIMESTAMP('2014-12-02 16:52:28','YYYY-MM-DD HH24:MI:SS'),100,0,'N',0,202793,19,'D',TO_TIMESTAMP('2014-12-02 16:52:28','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:53:00 PM COT
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,Help,AD_Process_ID,IsMandatory,Name,ColumnName,Description,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID,AD_Reference_ID,EntityType,Created) VALUES ('N',200112,'11253af5-7dd2-441a-b1c1-2b1350e99e4e','Name of a file in the local directory space - or URL (file://.., http://.., ftp://..)',200076,'Y','File Name','FileName','Name of the local file or URL',0,'Y',20,'Y',100,TO_TIMESTAMP('2014-12-02 16:52:59','YYYY-MM-DD HH24:MI:SS'),100,0,'N',0,2295,38,'D',TO_TIMESTAMP('2014-12-02 16:52:59','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:07 PM COT
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Name,PrintName,AD_Element_UU,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive,AD_Client_ID,EntityType,Created) VALUES ('ImportMode',202807,'Import Mode','Import Mode','fef3fdab-e970-4c03-8789-1ae1c944ea5a',TO_TIMESTAMP('2014-12-02 16:55:06','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y',0,'D',TO_TIMESTAMP('2014-12-02 16:55:06','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:29 PM COT
|
||||
INSERT INTO AD_Reference (AD_Reference_ID,AD_Reference_UU,Name,EntityType,IsOrderByValue,ValidationType,AD_Org_ID,CreatedBy,Updated,IsActive,UpdatedBy,AD_Client_ID,Created) VALUES (200098,'3892e140-7f08-4f89-a510-493e0f7cb775','Import Mode','D','N','L',0,100,TO_TIMESTAMP('2014-12-02 16:55:29','YYYY-MM-DD HH24:MI:SS'),'Y',100,0,TO_TIMESTAMP('2014-12-02 16:55:29','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:46 PM COT
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,UpdatedBy,Updated,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200281,200098,'39b8fe8e-3d83-419d-96ce-519550cc5baf','Insert','I',100,100,TO_TIMESTAMP('2014-12-02 16:55:44','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_TIMESTAMP('2014-12-02 16:55:44','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:54 PM COT
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,UpdatedBy,Updated,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200282,200098,'17e4b7b0-3699-4b98-ab13-c19fe531d4de','Update','U',100,100,TO_TIMESTAMP('2014-12-02 16:55:53','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_TIMESTAMP('2014-12-02 16:55:53','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:55:59 PM COT
|
||||
INSERT INTO AD_Ref_List (AD_Ref_List_ID,AD_Reference_ID,AD_Ref_List_UU,Name,Value,CreatedBy,UpdatedBy,Updated,IsActive,EntityType,AD_Client_ID,AD_Org_ID,Created) VALUES (200283,200098,'9d47e0f4-0ed4-41bb-a7d5-8dd7dc120394','Merge','M',100,100,TO_TIMESTAMP('2014-12-02 16:55:59','YYYY-MM-DD HH24:MI:SS'),'Y','D',0,0,TO_TIMESTAMP('2014-12-02 16:55:59','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:56:37 PM COT
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,IsMandatory,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,DefaultValue,IsActive,UpdatedBy,Updated,CreatedBy,AD_Org_ID,IsEncrypted,AD_Client_ID,AD_Element_ID,AD_Reference_ID,AD_Reference_Value_ID,EntityType,Created) VALUES ('N',200113,'7c2d264e-2622-494a-81a4-03f84ea99061',200076,'Y','Import Mode','ImportMode',0,'Y',30,'I','Y',100,TO_TIMESTAMP('2014-12-02 16:56:36','YYYY-MM-DD HH24:MI:SS'),100,0,'N',0,202807,17,200098,'D',TO_TIMESTAMP('2014-12-02 16:56:36','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:56:59 PM COT
|
||||
INSERT INTO AD_Menu (AD_Menu_ID,IsSummary,IsSOTrx,IsReadOnly,IsCentrallyMaintained,Name,AD_Menu_UU,"action",IsActive,CreatedBy,Updated,UpdatedBy,AD_Org_ID,AD_Client_ID,AD_Process_ID,EntityType,Created) VALUES (200096,'N','N','N','Y','Import CSV Process','06345362-8973-4923-85a7-e41f61289953','P','Y',100,TO_TIMESTAMP('2014-12-02 16:56:59','YYYY-MM-DD HH24:MI:SS'),100,0,0,200076,'D',TO_TIMESTAMP('2014-12-02 16:56:59','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:56:59 PM COT
|
||||
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', statement_timestamp(), 100, statement_timestamp(), 100,t.AD_Tree_ID, 200096, 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=200096)
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=218
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=153
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=263
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=166
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=203
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53242
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=236
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=183
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=160
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=278
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=345
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53296
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53014
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53108
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000000
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=0, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=1000003
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=0, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=222
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=1, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=223
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=2, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=185
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=3, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=340
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=4, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53264
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=5, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53206
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=6, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=339
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=7, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=338
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=8, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53282
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=9, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=363
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=10, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=376
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=11, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=382
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=12, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=486
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=13, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=425
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=14, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=378
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=15, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=374
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=16, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53284
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=17, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=423
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=18, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=53263
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=19, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=373
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=20, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=424
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=21, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200095
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 4:57:23 PM COT
|
||||
UPDATE AD_TreeNodeMM SET Parent_ID=163, SeqNo=22, Updated=statement_timestamp() WHERE AD_Tree_ID=10 AND Node_ID=200096
|
||||
;
|
||||
|
||||
-- Dec 2, 2014 6:04:14 PM COT
|
||||
UPDATE AD_Process_Para SET AD_Reference_ID=39,Updated=TO_TIMESTAMP('2014-12-02 18:04:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200112
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201412021658_IDEMPIERE-2103.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
/**********************************************************************
|
||||
* This file is part of iDempiere ERP Open Source *
|
||||
* http://www.idempiere.org *
|
||||
* *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* - Hiep Le Quy *
|
||||
* - Thomas Bayen *
|
||||
* - Carlos Ruiz *
|
||||
**********************************************************************/
|
||||
|
||||
package org.idempiere.process;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.base.IGridTabImporter;
|
||||
import org.adempiere.base.equinox.EquinoxExtensionLocator;
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.GridWindow;
|
||||
import org.compiere.model.MImportTemplate;
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
public class ImportCSVProcess extends SvrProcess {
|
||||
|
||||
private InputStream m_file_istream = null;
|
||||
private int p_AD_ImportTemplate_ID = 0;
|
||||
private MImportTemplate m_importTemplate;
|
||||
private String p_FileName = "";
|
||||
private String p_ImportMode = "I";
|
||||
|
||||
@Override
|
||||
protected void prepare() {
|
||||
for (ProcessInfoParameter para : getParameter()) {
|
||||
String name = para.getParameterName();
|
||||
if ("AD_ImportTemplate_ID".equals(name)) {
|
||||
p_AD_ImportTemplate_ID = para.getParameterAsInt();
|
||||
} else if ("FileName".equals(name)) {
|
||||
p_FileName = para.getParameterAsString();
|
||||
} else if ("ImportMode".equals(name)) {
|
||||
p_ImportMode = para.getParameterAsString();
|
||||
} else {
|
||||
log.log(Level.SEVERE, "Unknown Parameter: " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GridTab m_gridTab = null;
|
||||
List<GridTab> m_Childs = null;
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception {
|
||||
|
||||
try {
|
||||
initGridTab();
|
||||
IGridTabImporter csvImport = initImporter();
|
||||
importFile (p_FileName, csvImport, m_gridTab, m_Childs);
|
||||
} finally {
|
||||
Env.clearWinContext(-1);
|
||||
}
|
||||
|
||||
return "@OK@";
|
||||
}
|
||||
|
||||
protected void initGridTab() throws Exception {
|
||||
m_importTemplate = new MImportTemplate(getCtx(), p_AD_ImportTemplate_ID, get_TrxName());
|
||||
int l_AD_Window_ID = m_importTemplate.getAD_Window_ID();
|
||||
int l_AD_Tab_ID = m_importTemplate.getAD_Tab_ID();
|
||||
|
||||
// Verify ImportMode permission for the role on the template
|
||||
if (!m_importTemplate.isAllowed(p_ImportMode, Env.getAD_Role_ID(Env.getCtx())))
|
||||
throw new AdempiereException("Template/Mode not allowed for this role");
|
||||
|
||||
GridWindow gWin = GridWindow.get(getCtx(), -1, l_AD_Window_ID);
|
||||
Env.setContext(getCtx(), -1, "IsSOTrx", gWin.isSOTrx());
|
||||
m_Childs = new ArrayList<GridTab>();
|
||||
for (int i = 0; i < gWin.getTabCount(); i++) {
|
||||
GridTab gridtab = gWin.getTab(i);
|
||||
if (!gridtab.isLoadComplete())
|
||||
gWin.initTab(i);
|
||||
if (gWin.getTab(i).getAD_Tab_ID() == l_AD_Tab_ID) {
|
||||
m_gridTab = gWin.getTab(i);
|
||||
} else {
|
||||
if (m_gridTab != null && gridtab.getTabLevel() > m_gridTab.getTabLevel())
|
||||
m_Childs.add(gridtab);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_gridTab == null)
|
||||
throw new Exception("No Active Tab");
|
||||
}
|
||||
|
||||
protected IGridTabImporter initImporter() throws Exception {
|
||||
IGridTabImporter csvImport = null;
|
||||
List<IGridTabImporter> importerList = EquinoxExtensionLocator.instance().list(IGridTabImporter.class).getExtensions();
|
||||
for (IGridTabImporter importer : importerList){
|
||||
if ("csv".equals(importer.getFileExtension())) {
|
||||
csvImport = importer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (csvImport == null)
|
||||
throw new Exception ("No CSV importer");
|
||||
|
||||
return csvImport;
|
||||
}
|
||||
|
||||
protected void importFile(String filePath, IGridTabImporter csvImporter, GridTab activeTab, List<GridTab> childTabs) throws Exception {
|
||||
m_file_istream = new FileInputStream(filePath);
|
||||
|
||||
File outFile = csvImporter.fileImport(activeTab, childTabs, m_file_istream, Charset.forName(m_importTemplate.getCharacterSet()), p_ImportMode);
|
||||
// TODO: Potential improvement - traverse the outFile and call addLog with the results
|
||||
|
||||
if (processUI != null)
|
||||
processUI.download(outFile);
|
||||
|
||||
m_file_istream.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -599,8 +599,9 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
} catch (IOException e) {
|
||||
throw new AdempiereException(e);
|
||||
}
|
||||
finally {
|
||||
} catch (Exception ex) {
|
||||
throw new AdempiereException(ex);
|
||||
} finally {
|
||||
try {
|
||||
if (mapReader != null)
|
||||
mapReader.close();
|
||||
|
@ -1296,6 +1297,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
|
||||
//Copy from GridTable
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean isValueChanged(Object oldValue, Object value)
|
||||
{
|
||||
if ( isNotNullAndIsEmpty(oldValue) ) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Properties;
|
|||
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
||||
|
@ -33,7 +34,7 @@ public class MImportTemplate extends X_AD_ImportTemplate
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3316290883489953101L;
|
||||
private static final long serialVersionUID = -1207697938690504067L;
|
||||
|
||||
/** Logger */
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -96,4 +97,21 @@ public class MImportTemplate extends X_AD_ImportTemplate
|
|||
return retValue;
|
||||
}
|
||||
|
||||
public boolean isAllowed(String importMode, int roleID) {
|
||||
StringBuilder sql= new StringBuilder(
|
||||
"SELECT COUNT(*) FROM AD_ImportTemplateAccess WHERE IsActive='Y' AND AD_ImportTemplate_ID=? AND AD_Role_ID=? AND IsAllow");
|
||||
if ("I".equals(importMode))
|
||||
sql.append("Insert");
|
||||
else if ("U".equals(importMode))
|
||||
sql.append("Update");
|
||||
else if ("M".equals(importMode))
|
||||
sql.append("Merge");
|
||||
else
|
||||
return false;
|
||||
sql.append("='Y'");
|
||||
|
||||
int cnt = DB.getSQLValueEx(get_TrxName(), sql.toString(), getAD_ImportTemplate_ID(), roleID);
|
||||
return cnt > 0;
|
||||
}
|
||||
|
||||
} // MImportTemplate
|
||||
|
|
|
@ -122,6 +122,7 @@ public class SystemIDs
|
|||
public final static int REFERENCE_YESNO = 319;
|
||||
public final static int REFERENCE_WIZARDSTATUS = 200003;
|
||||
public final static int REFERENCE_WFINSTANCE_STATE = 305;
|
||||
public final static int REFERENCE_IMPORT_MODE = 200098;
|
||||
|
||||
public final static int TABLE_AD_TABLE = 100;
|
||||
public final static int TABLE_AD_WF_PROCESS = 645;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.panel.action;
|
||||
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_IMPORT_MODE;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
@ -44,13 +46,18 @@ import org.adempiere.webui.component.Listbox;
|
|||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.util.ReaderInputStream;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MLookupInfo;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.util.media.Media;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
@ -80,7 +87,7 @@ public class FileImportAction implements EventListener<Event>
|
|||
private Listbox cboType = new Listbox();
|
||||
private Button bFile = new Button();
|
||||
private Listbox fCharset = new Listbox();
|
||||
private Listbox fImportMode = new Listbox();
|
||||
private WTableDirEditor fImportMode;
|
||||
private InputStream m_file_istream = null;
|
||||
|
||||
/**
|
||||
|
@ -115,10 +122,9 @@ public class FileImportAction implements EventListener<Event>
|
|||
}
|
||||
fCharset.addEventListener(Events.ON_SELECT, this);
|
||||
|
||||
fImportMode.appendItem("Insert","I");
|
||||
fImportMode.appendItem("Update","U");
|
||||
fImportMode.appendItem("Merge","M");
|
||||
fImportMode.setSelectedIndex(0);
|
||||
MLookupInfo lookupInfo = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), REFERENCE_IMPORT_MODE);
|
||||
MLookup lookup = new MLookup(lookupInfo, 0);
|
||||
fImportMode = new WTableDirEditor("ImportMode",true,false,true,lookup);
|
||||
|
||||
importerMap = new HashMap<String, IGridTabImporter>();
|
||||
extensionMap = new HashMap<String, String>();
|
||||
|
@ -195,11 +201,7 @@ public class FileImportAction implements EventListener<Event>
|
|||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "import.mode", true)));
|
||||
fImportMode.setMold("select");
|
||||
fImportMode.setRows(0);
|
||||
fImportMode.setTooltiptext(Msg.getMsg(Env.getCtx(), "import.mode", false));
|
||||
row.appendChild(fImportMode);
|
||||
fImportMode.setHflex("1");
|
||||
row.appendChild(fImportMode.getComponent());
|
||||
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
|
@ -242,7 +244,7 @@ public class FileImportAction implements EventListener<Event>
|
|||
Executions.getCurrent().getDesktop().getWebApp().getConfiguration().setUploadCharset(charset.name());
|
||||
bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile"));
|
||||
} else if (event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
|
||||
if (m_file_istream == null || fCharset.getSelectedItem() == null)
|
||||
if (m_file_istream == null || fCharset.getSelectedItem() == null || Util.isEmpty((String)fImportMode.getValue()))
|
||||
return;
|
||||
importFile();
|
||||
} else if (event.getName().equals(DialogEvents.ON_WINDOW_CLOSE)) {
|
||||
|
@ -321,11 +323,7 @@ public class FileImportAction implements EventListener<Event>
|
|||
return;
|
||||
charset = (Charset)listitem.getValue();
|
||||
|
||||
ListItem importItem = fImportMode.getSelectedItem();
|
||||
if (importItem == null)
|
||||
return;
|
||||
|
||||
String iMode = (String)importItem.getValue();
|
||||
String iMode = (String) fImportMode.getValue();
|
||||
File outFile = importer.fileImport(panel.getActiveGridTab(), childs, m_file_istream, charset,iMode);
|
||||
winImportFile.onClose();
|
||||
winImportFile = null;
|
||||
|
|
Loading…
Reference in New Issue