Merge cc8299e9ea58
This commit is contained in:
commit
9e2ed40587
|
@ -0,0 +1,5 @@
|
|||
CREATE OR REPLACE VIEW t_rv_reconciliation AS
|
||||
SELECT f.*, t.ad_pinstance_id, t.matchcode
|
||||
FROM rv_fact_acct f
|
||||
JOIN t_reconciliation t ON f.fact_acct_id = t.fact_acct_id
|
||||
;
|
|
@ -0,0 +1,5 @@
|
|||
CREATE OR REPLACE VIEW t_rv_reconciliation AS
|
||||
SELECT f.*, t.ad_pinstance_id, t.matchcode
|
||||
FROM rv_fact_acct f
|
||||
JOIN t_reconciliation t ON f.fact_acct_id = t.fact_acct_id
|
||||
;
|
|
@ -0,0 +1,10 @@
|
|||
-- Mar 18, 2013 10:41:19 AM COT
|
||||
-- IDEMPIERE-704 Fix Scheduler window
|
||||
UPDATE AD_Column SET DefaultValue='1',Updated=TO_DATE('2013-03-18 10:41:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200484
|
||||
;
|
||||
|
||||
-- Mar 18, 2013 10:42:09 AM COT
|
||||
UPDATE AD_Column SET DefaultValue='1',Updated=TO_DATE('2013-03-18 10:42:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11523
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201303181045_IDEMPIERE-704.sql') FROM dual
|
|
@ -0,0 +1,21 @@
|
|||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Complete Plan, must be greater that Start Plan',200171,'D','aa911a40-6c9d-42fa-8a9c-1d95b86013eb','DateCompletePlan','Y',TO_DATE('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
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=200171 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)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Start Time, must be less than End Time',200172,'D','f0740826-d6c9-4606-821c-6b3b147b1a18','CheckTime','Y',TO_DATE('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_DATE('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
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=200172 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('201304081425_IDEMPIERE-832.sql') FROM dual;
|
|
@ -0,0 +1,20 @@
|
|||
-- Apr 20, 2013 11:34:34 AM COT
|
||||
-- IDEMPIERE-796 All Fixed Asset Related Document Must Use New DocBaseType FAA
|
||||
UPDATE AD_Column SET IsMandatory='N', IsActive='Y',Updated=TO_DATE('2013-04-20 11:34:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55559
|
||||
;
|
||||
|
||||
-- Apr 20, 2013 11:34:42 AM COT
|
||||
ALTER TABLE A_Depreciation_Entry MODIFY GL_Category_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Apr 20, 2013 11:34:42 AM COT
|
||||
ALTER TABLE A_Depreciation_Entry MODIFY GL_Category_ID NULL
|
||||
;
|
||||
|
||||
-- Apr 20, 2013 11:34:55 AM COT
|
||||
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2013-04-20 11:34:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55559
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304201135_IDEMPIERE-796.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
-- 821_IDEMPIERE-137_GLReconciliation.sql
|
||||
CREATE OR REPLACE VIEW t_rv_reconciliation AS
|
||||
SELECT f.*, t.ad_pinstance_id, t.matchcode
|
||||
FROM rv_fact_acct f
|
||||
JOIN t_reconciliation t ON f.fact_acct_id = t.fact_acct_id
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304201736_IDEMPIERE-849.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
-- Mar 18, 2013 10:41:19 AM COT
|
||||
-- IDEMPIERE-704 Fix Scheduler window
|
||||
UPDATE AD_Column SET DefaultValue='1',Updated=TO_TIMESTAMP('2013-03-18 10:41:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=200484
|
||||
;
|
||||
|
||||
-- Mar 18, 2013 10:42:09 AM COT
|
||||
UPDATE AD_Column SET DefaultValue='1',Updated=TO_TIMESTAMP('2013-03-18 10:42:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11523
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201303181045_IDEMPIERE-704.sql') FROM dual
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Complete Plan, must be greater that Start Plan',200171,'D','aa911a40-6c9d-42fa-8a9c-1d95b86013eb','DateCompletePlan','Y',TO_TIMESTAMP('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-04-08 14:05:42','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:05:44 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
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=200171 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)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Org_ID,Created,AD_Client_ID) VALUES ('I','Start Time, must be less than End Time',200172,'D','f0740826-d6c9-4606-821c-6b3b147b1a18','CheckTime','Y',TO_TIMESTAMP('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),100,100,0,TO_TIMESTAMP('2013-04-08 14:07:55','YYYY-MM-DD HH24:MI:SS'),0)
|
||||
;
|
||||
|
||||
-- Apr 8, 2013 2:07:56 PM COT
|
||||
-- IDEMPIERE-832 , not shows the new request created in the Calendar
|
||||
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=200172 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('201304081425_IDEMPIERE-832.sql') FROM dual;
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
-- Apr 20, 2013 11:34:34 AM COT
|
||||
-- IDEMPIERE-796 All Fixed Asset Related Document Must Use New DocBaseType FAA
|
||||
UPDATE AD_Column SET IsMandatory='N', IsActive='Y',Updated=TO_TIMESTAMP('2013-04-20 11:34:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55559
|
||||
;
|
||||
|
||||
-- Apr 20, 2013 11:34:42 AM COT
|
||||
INSERT INTO t_alter_column values('a_depreciation_entry','GL_Category_ID','NUMERIC(10)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Apr 20, 2013 11:34:42 AM COT
|
||||
INSERT INTO t_alter_column values('a_depreciation_entry','GL_Category_ID',null,'NULL',null)
|
||||
;
|
||||
|
||||
-- Apr 20, 2013 11:34:55 AM COT
|
||||
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2013-04-20 11:34:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=55559
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304201135_IDEMPIERE-796.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
-- 821_IDEMPIERE-137_GLReconciliation.sql
|
||||
DROP VIEW t_rv_reconciliation;
|
||||
|
||||
CREATE OR REPLACE VIEW t_rv_reconciliation AS
|
||||
SELECT f.*, t.ad_pinstance_id, t.matchcode
|
||||
FROM rv_fact_acct f
|
||||
JOIN t_reconciliation t ON f.fact_acct_id = t.fact_acct_id
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201304201736_IDEMPIERE-849.sql') FROM dual
|
||||
;
|
||||
|
|
@ -14,6 +14,8 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.impexp;
|
||||
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
@ -93,23 +95,23 @@ public class GridTabCSVExporter implements IGridTabExporter
|
|||
GridField field = gridFields[idxfld];
|
||||
MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
|
||||
//Special Columns
|
||||
if(DisplayType.Location == column.getAD_Reference_ID()){
|
||||
if(DisplayType.Location == field.getDisplayType()){
|
||||
specialHDispayType = DisplayType.Location;
|
||||
continue;
|
||||
}
|
||||
String headName = resolveColumnName(table, column);
|
||||
headArray.add(headName);
|
||||
if (DisplayType.Date == column.getAD_Reference_ID()) {
|
||||
if (DisplayType.Date == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtDate(DisplayType.DEFAULT_DATE_FORMAT)));
|
||||
} else if (DisplayType.DateTime == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.DateTime == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtDate(DisplayType.DEFAULT_TIMESTAMP_FORMAT)));
|
||||
} else if (DisplayType.Time == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.Time == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtDate("DisplayType.DEFAULT_TIME_FORMAT")));
|
||||
} else if (DisplayType.Integer == column.getAD_Reference_ID() || DisplayType.isNumeric(column.getAD_Reference_ID())) {
|
||||
DecimalFormat nf = DisplayType.getNumberFormat(column.getAD_Reference_ID());
|
||||
} else if (DisplayType.Integer == field.getDisplayType() || DisplayType.isNumeric(field.getDisplayType())) {
|
||||
DecimalFormat nf = DisplayType.getNumberFormat(field.getDisplayType());
|
||||
nf.setGroupingUsed(false);
|
||||
procArray.add(new Optional(new FmtNumber(nf)));
|
||||
} else if (DisplayType.YesNo == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.YesNo == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtBool("Y", "N")));
|
||||
} else { // lookups
|
||||
procArray.add(new Optional());
|
||||
|
@ -153,23 +155,23 @@ public class GridTabCSVExporter implements IGridTabExporter
|
|||
gridFields = getFields(detail);
|
||||
for(GridField field : gridFields){
|
||||
MColumn columnDetail = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
|
||||
if(DisplayType.Location == columnDetail.getAD_Reference_ID()){
|
||||
if(DisplayType.Location == field.getDisplayType()){
|
||||
specialDetDispayType = DisplayType.Location;
|
||||
continue;
|
||||
}
|
||||
String headNameDetail= detail.getTableName()+">"+resolveColumnName(tableDetail, columnDetail);
|
||||
headArray.add(headNameDetail);
|
||||
if (DisplayType.Date == columnDetail.getAD_Reference_ID()) {
|
||||
if (DisplayType.Date == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtDate(DisplayType.DEFAULT_DATE_FORMAT)));
|
||||
} else if (DisplayType.DateTime == columnDetail.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.DateTime == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtDate(DisplayType.DEFAULT_TIMESTAMP_FORMAT)));
|
||||
} else if (DisplayType.Time == columnDetail.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.Time == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtDate("DisplayType.DEFAULT_TIME_FORMAT")));
|
||||
} else if (DisplayType.Integer == columnDetail.getAD_Reference_ID() || DisplayType.isNumeric(columnDetail.getAD_Reference_ID())) {
|
||||
DecimalFormat nf = DisplayType.getNumberFormat(columnDetail.getAD_Reference_ID());
|
||||
} else if (DisplayType.Integer == field.getDisplayType() || DisplayType.isNumeric(field.getDisplayType())) {
|
||||
DecimalFormat nf = DisplayType.getNumberFormat(field.getDisplayType());
|
||||
nf.setGroupingUsed(false);
|
||||
procArray.add(new Optional(new FmtNumber(nf)));
|
||||
} else if (DisplayType.YesNo == columnDetail.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.YesNo == field.getDisplayType()) {
|
||||
procArray.add(new Optional(new FmtBool("Y", "N")));
|
||||
} else { // lookups and text
|
||||
procArray.add(new Optional());
|
||||
|
@ -212,16 +214,19 @@ public class GridTabCSVExporter implements IGridTabExporter
|
|||
|
||||
for(GridField field : getFields(gridTab)){
|
||||
MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
|
||||
|
||||
if(DisplayType.Location == column.getAD_Reference_ID()){
|
||||
Object value = null;
|
||||
String headName = header[idxfld];
|
||||
if(DisplayType.Location == field.getDisplayType()){
|
||||
Object fResolved =resolveValue(gridTab, table, column, idxrow, column.getColumnName());
|
||||
if (fResolved!=null)
|
||||
record_Id= Integer.parseInt(fResolved.toString());
|
||||
|
||||
continue;
|
||||
}else if (DisplayType.Payment == field.getDisplayType()){
|
||||
value = MRefList.getListName(Env.getCtx(),REFERENCE_PAYMENTRULE, gridTab.getValue(idxrow, header[idxfld]).toString());
|
||||
}else{
|
||||
value = resolveValue(gridTab, table, column, idxrow, headName);
|
||||
}
|
||||
String headName = header[idxfld];
|
||||
Object value = resolveValue(gridTab, table, column, idxrow, headName);
|
||||
//Ignore row
|
||||
if("IsActive".equals(headName) && value!=null && Boolean.valueOf((Boolean)value)==false){
|
||||
isActiveRow=false;
|
||||
|
@ -342,6 +347,10 @@ public class GridTabCSVExporter implements IGridTabExporter
|
|||
MTable tableDetail = MTable.get(Env.getCtx(), childTab.getTableName());
|
||||
String headName = headArray.get(headArray.indexOf(childTab.getTableName()+">"+resolveColumnName(tableDetail,column)));
|
||||
value = resolveValue(childTab, MTable.get(Env.getCtx(),childTab.getTableName()), column, currentDetRow, headName.substring(headName.indexOf(">")+ 1,headName.length()));
|
||||
|
||||
if(DisplayType.Payment == field.getDisplayType())
|
||||
value = MRefList.getListName(Env.getCtx(),REFERENCE_PAYMENTRULE, value.toString());
|
||||
|
||||
row.put(headName,value);
|
||||
if(value!=null)
|
||||
hasDetails = true;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.impexp;
|
||||
|
||||
import static org.compiere.model.SystemIDs.REFERENCE_PAYMENTRULE;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -43,6 +45,7 @@ import org.compiere.model.GridWindowVO;
|
|||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLocation;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRefList;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.tools.FileUtil;
|
||||
|
@ -113,6 +116,10 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
//Mapping header
|
||||
for(int idx = 0; idx < header.size(); idx++) {
|
||||
String headName = header.get(idx);
|
||||
|
||||
if (headName==null)
|
||||
throw new AdempiereException("Header column cannot be empty, Col: " + (idx + 1));
|
||||
|
||||
if (headName.equals(ERROR_HEADER) || headName.equals(LOG_HEADER)){
|
||||
header.set(idx, null);
|
||||
readProcArray.add(null);
|
||||
|
@ -124,7 +131,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}else if (headName.contains(MTable.getTableName(Env.getCtx(), MLocation.Table_ID)) && locationFields==null){
|
||||
locationFields = getSpecialMColumn(header,MTable.getTableName(Env.getCtx(), MLocation.Table_ID),idx);
|
||||
for(GridField sField:locationFields){
|
||||
readProcArray.add(getProccesorFromColumn(MColumn.get(Env.getCtx(),sField.getAD_Column_ID())));
|
||||
readProcArray.add(getProccesorFromColumn(sField));
|
||||
indxDetail++;
|
||||
}
|
||||
idx=indxDetail;
|
||||
|
@ -142,7 +149,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
else if(isKeyColumn && !isThereKey)
|
||||
isThereKey =true;
|
||||
|
||||
readProcArray.add(getProccesorFromColumn(MColumn.get(Env.getCtx(),field.getAD_Column_ID())));
|
||||
readProcArray.add(getProccesorFromColumn(field));
|
||||
indxDetail++;
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +195,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
if (columnName.contains(MTable.getTableName(Env.getCtx(), MLocation.Table_ID)) && locationFields==null){
|
||||
locationFields = getSpecialMColumn(header,MTable.getTableName(Env.getCtx(), MLocation.Table_ID),idx);
|
||||
for(GridField sField:locationFields){
|
||||
readProcArray.add(getProccesorFromColumn(MColumn.get(Env.getCtx(),sField.getAD_Column_ID())));
|
||||
readProcArray.add(getProccesorFromColumn(sField));
|
||||
idx++;
|
||||
}
|
||||
idx--;
|
||||
|
@ -203,7 +210,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
else if(isKeyColumn && !isThereKey)
|
||||
isThereKey =true;
|
||||
|
||||
readProcArray.add(getProccesorFromColumn(MColumn.get(Env.getCtx(),field.getAD_Column_ID())));
|
||||
readProcArray.add(getProccesorFromColumn(field));
|
||||
}
|
||||
}else
|
||||
throw new AdempiereException(Msg.getMsg(Env.getCtx(),"WrongDetailName",new Object[] {" col("+idx+") ",detailName}));
|
||||
|
@ -294,14 +301,16 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
logFileW.write(rawHeader + delimiter + LOG_HEADER + "\n");
|
||||
// no errors found - process header and then details
|
||||
boolean isMasterok = true;
|
||||
boolean isDetailok = true;
|
||||
boolean error=false;
|
||||
Trx trx = null;
|
||||
String trxName= null;
|
||||
List<String> rowsTmpResult = new ArrayList<String>();
|
||||
for (int idx = 0; idx < data.size(); idx++) {
|
||||
String rawLine = rawData.get(idx);
|
||||
String logMsg = null;
|
||||
StringBuilder rowResult = new StringBuilder();
|
||||
Trx trx = null;
|
||||
StringBuilder rowResult = new StringBuilder();
|
||||
GridTab currentGridTab=null;
|
||||
boolean error=false;
|
||||
boolean isDetail=false;
|
||||
int currentColumn=0;
|
||||
|
||||
|
@ -316,20 +325,47 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
}
|
||||
}
|
||||
//if master failed, then ignore any detail from it.
|
||||
|
||||
if (!isMasterok && isDetail){
|
||||
rawLine = rawLine + delimiter + quoteChar + Msg.getMsg(Env.getCtx(),"NotProccesed") + quoteChar + "\n";
|
||||
logFileW.write(rawLine);
|
||||
continue;
|
||||
}
|
||||
rawLine = rawLine + delimiter + quoteChar + Msg.getMsg(Env.getCtx(),"NotProccesed") + quoteChar + "\n";
|
||||
rowsTmpResult.add(rawLine);
|
||||
continue;
|
||||
}else if(isMasterok && isDetail && !isDetailok){
|
||||
rawLine = rawLine + delimiter + quoteChar + "Record not proccesed due to detail record failure" + quoteChar + "\n";
|
||||
rowsTmpResult.add(rawLine);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
isMasterok = true;
|
||||
|
||||
if(!isDetail){
|
||||
masterRecord = null;
|
||||
trxName = "Import_" + gridTab.getTableName() + "_" + UUID.randomUUID();
|
||||
}else if (trxName == null){
|
||||
trxName ="Import_" + gridTab.getTableName() + "_" + UUID.randomUUID();
|
||||
if(trx!=null){
|
||||
if(error){
|
||||
trx.rollback();
|
||||
for(String row:rowsTmpResult){
|
||||
row =row.replaceAll("Updated","RolledBack");
|
||||
row =row.replaceAll("Inserted","RolledBack");
|
||||
logFileW.write(row);
|
||||
}
|
||||
trx.close();
|
||||
trx=null;
|
||||
error =false;
|
||||
}else {
|
||||
trx.commit();
|
||||
for(String row:rowsTmpResult)
|
||||
logFileW.write(row);
|
||||
|
||||
trx.close();
|
||||
trx=null;
|
||||
}
|
||||
}
|
||||
trxName = "Import_" + gridTab.getTableName() + "_" + UUID.randomUUID();
|
||||
gridTab.getTableModel().setImportingMode(true,trxName);
|
||||
trx = Trx.get(trxName,true);
|
||||
masterRecord = null;
|
||||
rowsTmpResult.clear();
|
||||
isMasterok = true;
|
||||
isDetailok = true;
|
||||
}
|
||||
|
||||
for(Map.Entry<GridTab, Integer> tabIndex : sortedtTabMapIndexes.entrySet()) {
|
||||
|
@ -340,11 +376,14 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
continue;
|
||||
}
|
||||
|
||||
currentGridTab.getTableModel().setImportingMode(true,trxName);
|
||||
trx = Trx.get(trxName,true);
|
||||
int j = tabIndex.getValue();
|
||||
//Assign master trx to its children
|
||||
if(!gridTab.equals(currentGridTab)){
|
||||
currentGridTab.getTableModel().setImportingMode(true,trxName);
|
||||
isDetail=true;
|
||||
}
|
||||
|
||||
logMsg = areValidKeysAndColumns(currentGridTab,data.get(idx),header,currentColumn,j,masterRecord);
|
||||
int j = tabIndex.getValue();
|
||||
logMsg = areValidKeysAndColumns(currentGridTab,data.get(idx),header,currentColumn,j,masterRecord,trx);
|
||||
|
||||
if (logMsg == null){
|
||||
if (isInsertMode()){
|
||||
|
@ -359,7 +398,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
}
|
||||
|
||||
if(logMsg==null)
|
||||
logMsg = proccessRow(currentGridTab,header,data.get(idx),currentColumn,j,masterRecord);
|
||||
logMsg = proccessRow(currentGridTab,header,data.get(idx),currentColumn,j,masterRecord,trx);
|
||||
|
||||
currentColumn = j + 1;
|
||||
if(!(logMsg == null)){
|
||||
|
@ -387,7 +426,6 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
else
|
||||
logMsg = Msg.getMsg(Env.getCtx(), "Updated")+" "+ po.toString();
|
||||
|
||||
trx.commit();
|
||||
//if it's parent record and there are details, parent needs to be refreshed
|
||||
if(currentGridTab.equals(gridTab) && sortedtTabMapIndexes.size()>1)
|
||||
currentGridTab.dataRefresh(false);
|
||||
|
@ -405,20 +443,22 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
|
||||
logMsg = Msg.getMsg(Env.getCtx(), "Error") + " " + Msg.getMsg(Env.getCtx(), "SaveError") + " (" + info + ")";
|
||||
currentGridTab.dataIgnore();
|
||||
trx.rollback();
|
||||
|
||||
|
||||
if(currentGridTab.equals(gridTab) && masterRecord==null){
|
||||
isMasterok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!currentGridTab.equals(gridTab) && masterRecord!=null){
|
||||
isDetailok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rowResult.append("<"+currentGridTab.getTableName()+">: ");
|
||||
rowResult.append(logMsg);
|
||||
rowResult.append(" / ");
|
||||
} else {
|
||||
currentGridTab.dataIgnore();
|
||||
error = false;
|
||||
trx.rollback();
|
||||
|
||||
rowResult.append("<"+currentGridTab.getTableName()+">: ");
|
||||
rowResult.append(logMsg);
|
||||
|
@ -429,31 +469,67 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
isMasterok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!currentGridTab.equals(gridTab) && masterRecord!=null){
|
||||
isDetailok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_import_mode = importMode;
|
||||
currentGridTab.getTableModel().setImportingMode(false, null);
|
||||
m_import_mode = importMode;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rowResult.append("<"+currentGridTab.getTableName()+">: ");
|
||||
rowResult.append(Msg.getMsg(Env.getCtx(), "Error") + " " + e);
|
||||
rowResult.append(" / ");
|
||||
currentGridTab.dataIgnore();
|
||||
trx.rollback();
|
||||
|
||||
error = true;
|
||||
//Master Failed, thus details cannot be imported
|
||||
if(currentGridTab.equals(gridTab) && masterRecord==null){
|
||||
if(currentGridTab.equals(gridTab) && masterRecord==null)
|
||||
isMasterok = false;
|
||||
}
|
||||
|
||||
if(!currentGridTab.equals(gridTab) && masterRecord!=null)
|
||||
isDetailok = false;
|
||||
|
||||
} finally {
|
||||
if (trx != null) {
|
||||
trx.close();
|
||||
trx = null;
|
||||
}
|
||||
m_import_mode =importMode;
|
||||
}
|
||||
// write
|
||||
rawLine = rawLine + delimiter + quoteChar + rowResult.toString().replaceAll(delimiter, "") + quoteChar + "\n";
|
||||
logFileW.write(rawLine);
|
||||
rowsTmpResult.add(rawLine);
|
||||
}
|
||||
|
||||
if(trx!=null){
|
||||
if(error){
|
||||
trx.rollback();
|
||||
for(String row:rowsTmpResult){
|
||||
row =row.replaceAll("Updated","RolledBack");
|
||||
row =row.replaceAll("Inserted","RolledBack");
|
||||
logFileW.write(row);
|
||||
}
|
||||
gridTab.dataRefreshAll();
|
||||
}else{
|
||||
trx.commit();
|
||||
for(String row:rowsTmpResult)
|
||||
logFileW.write(row);
|
||||
|
||||
if(masterRecord!=null){
|
||||
gridTab.getTableModel().dataRequery(masterRecord.get_WhereClause(true),false,0,false);
|
||||
gridTab.dataRefresh();
|
||||
}
|
||||
}
|
||||
trx.close();
|
||||
trx=null;
|
||||
|
||||
gridTab.getTableModel().setImportingMode(false, null);
|
||||
Env.clearTabContext(Env.getCtx(),gridTab.getWindowNo(),gridTab.getTabNo());
|
||||
for(GridTab detail: childs){
|
||||
if(detail.getTableModel().isOpen()){
|
||||
detail.getTableModel().setImportingMode(false,null);
|
||||
Env.clearTabContext(Env.getCtx(),detail.getWindowNo(),detail.getTabNo());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -474,11 +550,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(masterRecord!=null){
|
||||
Env.setContext(Env.getCtx(),gridTab.getWindowNo(),gridTab.getTabNo(),GridTab.CTX_SQL,masterRecord.get_WhereClause(true));
|
||||
gridTab.dataRefresh();
|
||||
}
|
||||
}
|
||||
if (logFile != null)
|
||||
return logFile;
|
||||
else
|
||||
|
@ -620,9 +692,9 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
String idS = null;
|
||||
int id = -1;
|
||||
if("AD_Ref_List".equals(foreignTable))
|
||||
idS= resolveForeignList(column,foreignColumn,value);
|
||||
idS= resolveForeignList(column,foreignColumn,value,null);
|
||||
else
|
||||
id = resolveForeign(foreignTable,foreignColumn,value);
|
||||
id = resolveForeign(foreignTable,foreignColumn,value,null);
|
||||
|
||||
if(idS == null && id < 0){
|
||||
//it could be that record still doesn't exist if import mode is inserting or merging
|
||||
|
@ -688,7 +760,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
|
||||
if(isForeing && !"(null)".equals(value)){
|
||||
String foreignTable = columnName.substring(0,columnName.length()-3);
|
||||
if(resolveForeign(foreignTable,foreignColumn,value) < 0)
|
||||
if(resolveForeign(foreignTable,foreignColumn,value,null) < 0)
|
||||
return new StringBuilder(Msg.getMsg(Env.getCtx(), "ForeignNotResolved" ,new Object[]{header.get(j),value}));
|
||||
}
|
||||
isEmptyRow=false;
|
||||
|
@ -700,7 +772,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
return null;
|
||||
}
|
||||
|
||||
private String proccessRow(GridTab gridTab,List<String> header, Map<String, Object> map,int startindx,int endindx,PO masterRecord){
|
||||
private String proccessRow(GridTab gridTab,List<String> header, Map<String, Object> map,int startindx,int endindx,PO masterRecord,Trx trx){
|
||||
|
||||
String logMsg = null;
|
||||
boolean isThereRow = false;
|
||||
|
@ -729,20 +801,19 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
if(header.get(i).contains(MTable.getTableName(Env.getCtx(),MLocation.Table_ID))){
|
||||
|
||||
if(address == null){
|
||||
String trxName= (masterRecord==null?null:masterRecord.get_TrxName());
|
||||
if(isInsertMode()){
|
||||
address = new MLocation (Env.getCtx(),0,trxName);
|
||||
address = new MLocation (Env.getCtx(),0,trx.getTrxName());
|
||||
}else{
|
||||
Object location = gridTab.getValue("C_Location_ID")==null?0:gridTab.getValue("C_Location_ID").toString();
|
||||
int C_Location_ID = Integer.parseInt(location.toString());
|
||||
address = new MLocation (Env.getCtx(),C_Location_ID,trxName);
|
||||
address = new MLocation (Env.getCtx(),C_Location_ID,trx.getTrxName());
|
||||
}
|
||||
}
|
||||
|
||||
if(!"(null)".equals(value.toString().trim())){
|
||||
if(isForeing) {
|
||||
String foreignTable = columnName.substring(0,columnName.length()-3);
|
||||
setValue = resolveForeign(foreignTable,foreignColumn,value);
|
||||
setValue = resolveForeign(foreignTable,foreignColumn,value,trx);
|
||||
if("C_City".equals(foreignTable))
|
||||
address.setCity(value.toString());
|
||||
}else
|
||||
|
@ -780,9 +851,9 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
int id = -1;
|
||||
|
||||
if ("AD_Ref_List".equals(foreignTable))
|
||||
idS= resolveForeignList(column, foreignColumn, value);
|
||||
idS= resolveForeignList(column, foreignColumn, value,trx);
|
||||
else
|
||||
id = resolveForeign(foreignTable, foreignColumn, value);
|
||||
id = resolveForeign(foreignTable,foreignColumn,value,trx);
|
||||
|
||||
if(idS == null && id < 0)
|
||||
return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value});
|
||||
|
@ -818,14 +889,15 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
if (isForeing){
|
||||
String foreignTable = column.getReferenceTableName();
|
||||
if ("AD_Ref_List".equals(foreignTable)) {
|
||||
String idS = resolveForeignList(column, foreignColumn, value);
|
||||
String idS = resolveForeignList(column, foreignColumn, value,trx);
|
||||
if(idS == null)
|
||||
return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value});
|
||||
|
||||
setValue = idS;
|
||||
isThereRow =true;
|
||||
} else {
|
||||
int id = resolveForeign(foreignTable, foreignColumn, value);
|
||||
|
||||
int id = resolveForeign(foreignTable, foreignColumn, value,trx);
|
||||
if(id < 0)
|
||||
return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value});
|
||||
|
||||
|
@ -844,6 +916,19 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
if(value instanceof java.util.Date)
|
||||
value = new Timestamp(((java.util.Date)value).getTime());
|
||||
|
||||
if(DisplayType.Payment == field.getDisplayType()){
|
||||
String oldValue = value.toString();
|
||||
for(ValueNamePair pList: MRefList.getList(Env.getCtx(),REFERENCE_PAYMENTRULE,false)){
|
||||
if(pList.getName().equals(oldValue.toString())){
|
||||
oldValue = pList.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!value.toString().equals(oldValue))
|
||||
value = oldValue;
|
||||
else
|
||||
return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{header.get(i),value});
|
||||
}
|
||||
setValue = value;
|
||||
isThereRow =true;
|
||||
}
|
||||
|
@ -863,7 +948,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
if (!address.save()){
|
||||
logMsg = CLogger.retrieveError()+" Address : "+address;
|
||||
}else {
|
||||
logMsg = gridTab.setValue("C_Location_ID",address.get_ID());
|
||||
logMsg = gridTab.setValue("C_Location_ID",address.getC_Location_ID());
|
||||
if(logMsg.equals(""))
|
||||
logMsg= null;
|
||||
else
|
||||
|
@ -899,13 +984,13 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
if (isForeing){
|
||||
String foreignTable = column.getReferenceTableName();
|
||||
if ("AD_Ref_List".equals(foreignTable)) {
|
||||
String idS = resolveForeignList(column,foreignColumn,setValue);
|
||||
String idS = resolveForeignList(column,foreignColumn,setValue,trx);
|
||||
if(idS == null)
|
||||
return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{columnName,setValue});
|
||||
|
||||
setValue = idS;
|
||||
} else {
|
||||
int id = resolveForeign(foreignTable, foreignColumn, setValue);
|
||||
int id = resolveForeign(foreignTable, foreignColumn, setValue,trx);
|
||||
if(id < 0)
|
||||
return Msg.getMsg(Env.getCtx(),"ForeignNotResolved",new Object[]{columnName,setValue});
|
||||
|
||||
|
@ -930,28 +1015,28 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
return logMsg;
|
||||
}
|
||||
|
||||
private CellProcessor getProccesorFromColumn(MColumn column) {
|
||||
private CellProcessor getProccesorFromColumn(GridField field) {
|
||||
// TODO: List columns can use RequireSubStr constraint
|
||||
if (DisplayType.Date == column.getAD_Reference_ID()) {
|
||||
if (DisplayType.Date == field.getDisplayType()) {
|
||||
return (new Optional(new ParseDate(DisplayType.DEFAULT_DATE_FORMAT)));
|
||||
} else if (DisplayType.DateTime == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.DateTime == field.getDisplayType()) {
|
||||
return (new Optional(new ParseDate(DisplayType.DEFAULT_TIMESTAMP_FORMAT)));
|
||||
} else if (DisplayType.Time == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.Time == field.getDisplayType()) {
|
||||
return (new Optional(new ParseDate("DisplayType.DEFAULT_TIME_FORMAT")));
|
||||
} else if (DisplayType.Integer == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.Integer == field.getDisplayType()) {
|
||||
return (new Optional(new ParseInt()));
|
||||
} else if (DisplayType.isNumeric(column.getAD_Reference_ID())) {
|
||||
} else if (DisplayType.isNumeric(field.getDisplayType())) {
|
||||
return (new Optional(new ParseBigDecimal(new DecimalFormatSymbols(Language.getLoginLanguage().getLocale()))));
|
||||
} else if (DisplayType.YesNo == column.getAD_Reference_ID()) {
|
||||
} else if (DisplayType.YesNo == field.getDisplayType()) {
|
||||
return (new Optional(new ParseBool("y", "n")));
|
||||
} else if (DisplayType.isText(column.getAD_Reference_ID())) {
|
||||
return (new Optional(new StrMinMax(1, column.getFieldLength())));
|
||||
} else if (DisplayType.isText(field.getDisplayType())) {
|
||||
return (new Optional(new StrMinMax(1, field.getFieldLength())));
|
||||
} else { // optional lookups and text
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String areValidKeysAndColumns(GridTab gridTab, Map<String, Object> map,List<String> header,int startindx,int endindx, PO masterRecord){
|
||||
private String areValidKeysAndColumns(GridTab gridTab, Map<String, Object> map,List<String> header,int startindx,int endindx,PO masterRecord,Trx trx){
|
||||
MQuery pquery = new MQuery(gridTab.getAD_Table_ID());
|
||||
String logMsg= null;
|
||||
Object tmpValue=null;
|
||||
|
@ -984,10 +1069,10 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
foreignColumn = header.get(i).substring(header.get(i).indexOf("[")+1,header.get(i).indexOf("]"));
|
||||
String foreignTable = column.getReferenceTableName();
|
||||
if ("AD_Ref_List".equals(foreignTable)) {
|
||||
String idS = resolveForeignList(column, foreignColumn, tmpValue);
|
||||
String idS = resolveForeignList(column, foreignColumn, tmpValue,trx);
|
||||
setValue = idS;
|
||||
}else {
|
||||
int id = resolveForeign(foreignTable, foreignColumn, tmpValue);
|
||||
int id = resolveForeign(foreignTable, foreignColumn, tmpValue,trx);
|
||||
setValue = id;
|
||||
}
|
||||
}else{
|
||||
|
@ -1022,10 +1107,10 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
foreignColumn = columnName.substring(columnName.indexOf("[")+1,columnName.indexOf("]"));
|
||||
String foreignTable = column.getReferenceTableName();
|
||||
if ("AD_Ref_List".equals(foreignTable)) {
|
||||
String idS = resolveForeignList(column,foreignColumn,value);
|
||||
String idS = resolveForeignList(column,foreignColumn,value,trx);
|
||||
value = idS;
|
||||
}else {
|
||||
int id = resolveForeign(foreignTable,foreignColumn,value);
|
||||
int id = resolveForeign(foreignTable,foreignColumn,value,trx);
|
||||
value = id;
|
||||
}
|
||||
}
|
||||
|
@ -1069,21 +1154,23 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
return logMsg;
|
||||
}
|
||||
|
||||
private String resolveForeignList(MColumn column, String foreignColumn, Object value) {
|
||||
private String resolveForeignList(MColumn column, String foreignColumn, Object value ,Trx trx) {
|
||||
String idS = null;
|
||||
String trxName = (trx!=null?trx.getTrxName():null);
|
||||
StringBuilder select = new StringBuilder("SELECT Value FROM AD_Ref_List WHERE ")
|
||||
.append(foreignColumn).append("=? AND AD_Reference_ID=? AND IsActive='Y'");
|
||||
idS = DB.getSQLValueStringEx(null, select.toString(), value, column.getAD_Reference_Value_ID());
|
||||
idS = DB.getSQLValueStringEx(trxName, select.toString(), value, column.getAD_Reference_Value_ID());
|
||||
return idS;
|
||||
}
|
||||
|
||||
private int resolveForeign(String foreignTable, String foreignColumn, Object value) {
|
||||
private int resolveForeign(String foreignTable, String foreignColumn, Object value,Trx trx) {
|
||||
int id = -1;
|
||||
String trxName = (trx!=null?trx.getTrxName():null);
|
||||
StringBuilder select = new StringBuilder("SELECT ")
|
||||
.append(foreignTable).append("_ID FROM ")
|
||||
.append(foreignTable).append(" WHERE ")
|
||||
.append(foreignColumn).append("=? AND IsActive='Y' AND AD_Client_ID=?");
|
||||
id = DB.getSQLValueEx(null, select.toString(), value, Env.getAD_Client_ID(Env.getCtx()));
|
||||
id = DB.getSQLValueEx(trxName, select.toString(), value, Env.getAD_Client_ID(Env.getCtx()));
|
||||
if (id == -1 && !"AD_Client".equals(foreignTable)) {
|
||||
MTable ft = MTable.get(Env.getCtx(), foreignTable);
|
||||
String accessLevel = ft.getAccessLevel();
|
||||
|
@ -1091,7 +1178,7 @@ public class GridTabCSVImporter implements IGridTabImporter
|
|||
|| MTable.ACCESSLEVEL_SystemOnly.equals(accessLevel)
|
||||
|| MTable.ACCESSLEVEL_SystemPlusClient.equals(accessLevel)) {
|
||||
// try System client if the table has System access
|
||||
id = DB.getSQLValueEx(null, select.toString(), value, 0);
|
||||
id = DB.getSQLValueEx(trxName, select.toString(), value, 0);
|
||||
}
|
||||
}
|
||||
return id;
|
||||
|
|
|
@ -3822,4 +3822,7 @@ public class GridTable extends AbstractTableModel
|
|||
return m_importing;
|
||||
}
|
||||
|
||||
public String get_TrxName() {
|
||||
return m_trxName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.base.Service;
|
||||
import org.adempiere.base.ServiceQuery;
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
|
||||
public class MStorageProvider extends X_AD_StorageProvider {
|
||||
/**
|
||||
|
@ -43,8 +44,8 @@ public class MStorageProvider extends X_AD_StorageProvider {
|
|||
method = "DB";
|
||||
query.put("method", method);
|
||||
IAttachmentStore store = Service.locator().locate(IAttachmentStore.class, query).getService();
|
||||
if (store == null){
|
||||
log.saveError("Error", "No attachment storage provider found");
|
||||
if (store == null) {
|
||||
throw new AdempiereException("No attachment storage provider found");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
@ -56,8 +57,8 @@ public class MStorageProvider extends X_AD_StorageProvider {
|
|||
method = "DB";
|
||||
query.put("method", method);
|
||||
IArchiveStore store = Service.locator().locate(IArchiveStore.class, query).getService();
|
||||
if (store == null){
|
||||
log.saveError("Error", "No archive storage provider found");
|
||||
if (store == null) {
|
||||
throw new AdempiereException("No archive storage provider found");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.adempiere.webui.adwindow;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -36,6 +35,7 @@ import org.adempiere.webui.component.ToolBarButton;
|
|||
import org.adempiere.webui.event.ToolbarListener;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.theme.ThemeManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MToolBarButton;
|
||||
import org.compiere.model.MToolBarButtonRestrict;
|
||||
|
@ -43,6 +43,7 @@ import org.compiere.model.X_AD_ToolBarButton;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.zkoss.image.AImage;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
@ -355,25 +356,24 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
|||
Method method = tListener.getClass().getMethod(methodName, (Class[]) null);
|
||||
method.invoke(tListener, (Object[]) null);
|
||||
}
|
||||
catch(SecurityException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e);
|
||||
}
|
||||
catch(NoSuchMethodException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e);
|
||||
}
|
||||
catch(IllegalArgumentException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e);
|
||||
}
|
||||
catch(IllegalAccessException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e);
|
||||
}
|
||||
catch(InvocationTargetException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e);
|
||||
String msg = null;
|
||||
ValueNamePair vp = CLogger.retrieveError();
|
||||
if (vp != null) {
|
||||
msg = vp.getName();
|
||||
}
|
||||
if (msg == null) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null) {
|
||||
msg = cause.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
if (msg == null) {
|
||||
msg = "Could not invoke Toolbar listener method: " + methodName + "()";
|
||||
}
|
||||
FDialog.error(windowNo, this, "Error", msg);
|
||||
log.log(Level.SEVERE, msg, e);
|
||||
}
|
||||
}
|
||||
this.event = null;
|
||||
|
|
|
@ -282,11 +282,11 @@ public class ProcessParameterPanel extends Panel implements
|
|||
editor.getComponent().addEventListener(Events.ON_BLUR, this);
|
||||
editor.addValueChangeListener(this);
|
||||
editor.dynamicDisplay();
|
||||
// MField => VEditor - New Field value to be updated to editor
|
||||
mField.addPropertyChangeListener(editor);
|
||||
// Set Default
|
||||
Object defaultObject = mField.getDefault();
|
||||
mField.setValue(defaultObject, true);
|
||||
// MField => VEditor - New Field value to be updated to editor
|
||||
mField.addPropertyChangeListener(editor);
|
||||
// streach component to fill grid cell
|
||||
editor.fillHorizontal();
|
||||
// setup editor context menu
|
||||
|
|
|
@ -68,7 +68,7 @@ public class WStatementCreateFromBatch extends StatementCreateFromBatch implemen
|
|||
public WStatementCreateFromBatch()
|
||||
{
|
||||
form = new WCreateFromForm(this);
|
||||
p_WindowNo = form.getGridTab().getWindowNo();
|
||||
p_WindowNo = form.getWindowNo();
|
||||
}
|
||||
|
||||
public void initForm()
|
||||
|
|
|
@ -254,10 +254,7 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
|||
}
|
||||
|
||||
if (dateStartPlan != null && dateCompletePlan != null) {
|
||||
|
||||
boolean isBeginFullDay = false;
|
||||
boolean isEndFullDay = false;
|
||||
|
||||
|
||||
Calendar calBegin = Calendar.getInstance();
|
||||
calBegin.setTime(dateStartPlan);
|
||||
if (startTime != null) {
|
||||
|
@ -268,18 +265,15 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
|||
calBegin.set(Calendar.SECOND, 0);
|
||||
calBegin.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if(calBegin.get(Calendar.HOUR_OF_DAY) == 0 && calBegin.get(Calendar.MINUTE) == 0)
|
||||
isBeginFullDay = true;
|
||||
} else {
|
||||
calBegin.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calBegin.set(Calendar.MINUTE, 0);
|
||||
calBegin.set(Calendar.SECOND, 0);
|
||||
calBegin.set(Calendar.MILLISECOND, 0);
|
||||
isBeginFullDay = true;
|
||||
}
|
||||
|
||||
Calendar calEnd = Calendar.getInstance();
|
||||
calEnd.setTime(dateStartPlan);
|
||||
calEnd.setTime(dateCompletePlan);
|
||||
if (endTime != null) {
|
||||
Calendar cal1 = Calendar.getInstance();
|
||||
cal1.setTimeInMillis(endTime.getTime());
|
||||
|
@ -288,66 +282,25 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
|||
calEnd.set(Calendar.SECOND, 0);
|
||||
calEnd.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if(calEnd.get(Calendar.HOUR_OF_DAY) == 0 && calEnd.get(Calendar.MINUTE) == 0)
|
||||
isEndFullDay = true;
|
||||
} else {
|
||||
calEnd.add(Calendar.HOUR_OF_DAY, 24);
|
||||
isEndFullDay = true;
|
||||
}
|
||||
|
||||
ADCalendarEvent event = new ADCalendarEvent();
|
||||
event.setR_Request_ID(R_Request_ID);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(dateCompletePlan);
|
||||
if (endTime != null) {
|
||||
Calendar cal1 = Calendar.getInstance();
|
||||
cal1.setTimeInMillis(endTime.getTime());
|
||||
cal.set(Calendar.HOUR_OF_DAY, cal1.get(Calendar.HOUR_OF_DAY));
|
||||
cal.set(Calendar.MINUTE, cal1.get(Calendar.MINUTE));
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
} else {
|
||||
cal.add(Calendar.HOUR_OF_DAY, 24);
|
||||
}
|
||||
dateCompletePlan.setTime(cal.getTimeInMillis());
|
||||
event.setBeginDate(calBegin.getTime());
|
||||
event.setEndDate(calEnd.getTime());
|
||||
|
||||
if(isBeginFullDay && isEndFullDay)
|
||||
{
|
||||
ADCalendarEvent event = new ADCalendarEvent();
|
||||
event.setR_Request_ID(R_Request_ID);
|
||||
|
||||
event.setBeginDate(calBegin.getTime());
|
||||
event.setEndDate(cal.getTime());
|
||||
|
||||
if(event.getBeginDate().compareTo(event.getEndDate()) >= 0)
|
||||
continue;
|
||||
if(event.getBeginDate().compareTo(event.getEndDate()) >= 0)
|
||||
continue;
|
||||
|
||||
event.setContent(summary);
|
||||
event.setHeaderColor(headerColor);
|
||||
event.setContentColor(contentColor);
|
||||
event.setR_RequestType_ID(R_RequestType_ID);
|
||||
event.setLocked(true);
|
||||
events.add(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(; calBegin.getTime().compareTo(dateCompletePlan) <= 0; calBegin.add(Calendar.DATE, 1), calEnd.add(Calendar.DATE, 1))
|
||||
{
|
||||
ADCalendarEvent event = new ADCalendarEvent();
|
||||
event.setR_Request_ID(R_Request_ID);
|
||||
|
||||
event.setBeginDate(calBegin.getTime());
|
||||
event.setEndDate(calEnd.getTime());
|
||||
|
||||
if(event.getBeginDate().compareTo(event.getEndDate()) >= 0)
|
||||
continue;
|
||||
|
||||
event.setContent(summary);
|
||||
event.setHeaderColor(headerColor);
|
||||
event.setContentColor(contentColor);
|
||||
event.setR_RequestType_ID(R_RequestType_ID);
|
||||
event.setLocked(true);
|
||||
events.add(event);
|
||||
}
|
||||
}
|
||||
event.setContent(summary);
|
||||
event.setHeaderColor(headerColor);
|
||||
event.setContentColor(contentColor);
|
||||
event.setR_RequestType_ID(R_RequestType_ID);
|
||||
event.setLocked(true);
|
||||
events.add(event);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
package org.adempiere.webui.dashboard;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -232,11 +233,13 @@ public class RequestWindow extends Window implements EventListener<Event> {
|
|||
rows.appendChild(row);
|
||||
row.appendChild(lblStartTime.rightAlign());
|
||||
row.appendChild(tbxStartTime);
|
||||
tbxStartTime.setWidth("40%");
|
||||
|
||||
row = new Row();
|
||||
rows.appendChild(row);
|
||||
row.appendChild(lblEndTime.rightAlign());
|
||||
row.appendChild(tbxEndTime);
|
||||
tbxEndTime.setWidth("40%");
|
||||
|
||||
Borderlayout borderlayout = new Borderlayout();
|
||||
appendChild(borderlayout);
|
||||
|
@ -277,7 +280,11 @@ public class RequestWindow extends Window implements EventListener<Event> {
|
|||
throw new WrongValueException(salesRepField.getComponent(), fillMandatory);
|
||||
if (entryConfidentialField.getValue() == null || entryConfidentialField.getValue().equals(""))
|
||||
throw new WrongValueException(entryConfidentialField.getComponent(), fillMandatory);
|
||||
|
||||
if (dbxStartPlan.getValue().compareTo(dbxCompletePlan.getValue()) > 0)
|
||||
throw new WrongValueException(dbxCompletePlan, Msg.translate(Env.getCtx(), "DateCompletePlan"));
|
||||
if (checkTime() && (dbxStartPlan.getValue().compareTo(dbxCompletePlan.getValue()) == 0))
|
||||
throw new WrongValueException(tbxStartTime, Msg.translate(Env.getCtx(), "CheckTime"));
|
||||
|
||||
MRequest request = new MRequest(Env.getCtx(), 0, null);
|
||||
request.setAD_Org_ID(Env.getAD_Org_ID(Env.getCtx()));
|
||||
request.setDueType((String) dueTypeField.getValue());
|
||||
|
@ -309,4 +316,17 @@ public class RequestWindow extends Window implements EventListener<Event> {
|
|||
else if (e.getTarget() == confirmPanel.getButton(ConfirmPanel.A_CANCEL))
|
||||
this.detach();
|
||||
}
|
||||
|
||||
//Check, Start time is not >= End time, when Start Plan == Complete Plan
|
||||
private boolean checkTime()
|
||||
{
|
||||
Calendar cal =Calendar.getInstance();
|
||||
cal.setTimeInMillis(tbxStartTime.getValue().getTime());
|
||||
Calendar cal2 = Calendar.getInstance();
|
||||
cal2.setTimeInMillis(tbxEndTime.getValue().getTime());
|
||||
if ((cal.get(Calendar.HOUR_OF_DAY) >= cal2.get(Calendar.HOUR_OF_DAY)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,8 @@ public class WLocationEditor extends WEditor implements EventListener<Event>, Pr
|
|||
}
|
||||
else
|
||||
{
|
||||
m_value = m_Location.getLocation(value, null);
|
||||
String trxName = this.gridField.getGridTab().getTableModel().get_TrxName();
|
||||
m_value = m_Location.getLocation(value, trxName);
|
||||
if (m_value == null)
|
||||
getComponent().setText("<" + value + ">");
|
||||
else
|
||||
|
|
|
@ -210,6 +210,7 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
Vector<String> columnNames = new Vector<String>();
|
||||
columnNames.add(Msg.translate(Env.getCtx(), m_C_BPartner_ID == 0 ? "C_BPartner_ID" : "M_Product_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "PriceActual"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "C_Currency_ID"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "QtyInvoiced"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "Discount"));
|
||||
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
|
||||
|
@ -229,11 +230,12 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
//
|
||||
m_tablePrice.setColumnClass(0, String.class, true); // Product/Partner
|
||||
m_tablePrice.setColumnClass(1, Double.class, true); // Price
|
||||
m_tablePrice.setColumnClass(2, Double.class, true); // Quantity
|
||||
m_tablePrice.setColumnClass(3, BigDecimal.class, true); // Discount (%) to limit precision
|
||||
m_tablePrice.setColumnClass(4, String.class, true); // DocNo
|
||||
m_tablePrice.setColumnClass(5, Timestamp.class, true); // Date
|
||||
m_tablePrice.setColumnClass(6, String.class, true); // Org
|
||||
m_tablePrice.setColumnClass(2, String.class, true); // Currency
|
||||
m_tablePrice.setColumnClass(3, Double.class, true); // Quantity
|
||||
m_tablePrice.setColumnClass(4, BigDecimal.class, true); // Discount (%) to limit precision
|
||||
m_tablePrice.setColumnClass(5, String.class, true); // DocNo
|
||||
m_tablePrice.setColumnClass(6, Timestamp.class, true); // Date
|
||||
m_tablePrice.setColumnClass(7, String.class, true); // Org
|
||||
//
|
||||
m_tablePrice.autoSize();
|
||||
//
|
||||
|
@ -247,15 +249,16 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
*/
|
||||
private Vector<Vector<Object>> queryProduct ()
|
||||
{
|
||||
String sql = "SELECT p.Name,l.PriceActual,l.PriceList,l.QtyInvoiced," // 1,2,3,4
|
||||
+ "i.DateInvoiced,dt.PrintName || ' ' || i.DocumentNo As DocumentNo," // 5,6
|
||||
+ "o.Name, " // 7
|
||||
+ "NULL, i.M_PriceList_ID " // 8,9
|
||||
String sql = "SELECT p.Name,l.PriceActual,c.Iso_Code,l.PriceList,l.QtyInvoiced," // 1,2,3,4,5
|
||||
+ "i.DateInvoiced,dt.PrintName || ' ' || i.DocumentNo As DocumentNo," // 6,7
|
||||
+ "o.Name, " // 8
|
||||
+ "NULL, i.M_PriceList_ID " // 9,10
|
||||
+ "FROM C_Invoice i"
|
||||
+ " INNER JOIN C_InvoiceLine l ON (i.C_Invoice_ID=l.C_Invoice_ID)"
|
||||
+ " INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)"
|
||||
+ " INNER JOIN AD_Org o ON (i.AD_Org_ID=o.AD_Org_ID)"
|
||||
+ " INNER JOIN M_Product p ON (l.M_Product_ID=p.M_Product_ID) "
|
||||
+ " INNER JOIN C_Currency c ON (i.C_Currency_ID=c.C_Currency_ID) "
|
||||
+ "WHERE i.C_BPartner_ID=? "
|
||||
+ "ORDER BY i.DateInvoiced DESC";
|
||||
|
||||
|
@ -271,15 +274,16 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
*/
|
||||
private Vector<Vector<Object>> queryBPartner ()
|
||||
{
|
||||
String sql = "SELECT bp.Name,l.PriceActual,l.PriceList,l.QtyInvoiced," // 1,2,3,4
|
||||
+ "i.DateInvoiced,dt.PrintName || ' ' || i.DocumentNo As DocumentNo," // 5,6
|
||||
+ "o.Name," // 7
|
||||
+ "NULL, i.M_PriceList_ID" // 8,9
|
||||
String sql = "SELECT bp.Name,l.PriceActual,c.Iso_Code,l.PriceList,l.QtyInvoiced," // 1,2,3,4,5
|
||||
+ "i.DateInvoiced,dt.PrintName || ' ' || i.DocumentNo As DocumentNo," // 6,7
|
||||
+ "o.Name," // 8
|
||||
+ "NULL, i.M_PriceList_ID" // 9,10
|
||||
+ " FROM C_Invoice i"
|
||||
+ " INNER JOIN C_InvoiceLine l ON (i.C_Invoice_ID=l.C_Invoice_ID)"
|
||||
+ " INNER JOIN C_DocType dt ON (i.C_DocType_ID=dt.C_DocType_ID)"
|
||||
+ " INNER JOIN AD_Org o ON (i.AD_Org_ID=o.AD_Org_ID)"
|
||||
+ " INNER JOIN C_BPartner bp ON (i.C_BPartner_ID=bp.C_BPartner_ID) "
|
||||
+ " INNER JOIN C_Currency c ON (i.C_Currency_ID=c.C_Currency_ID) "
|
||||
+ "WHERE l.M_Product_ID=? "
|
||||
+ "ORDER BY i.DateInvoiced DESC";
|
||||
|
||||
|
@ -310,15 +314,16 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
// 0-Name, 1-PriceActual, 2-QtyInvoiced, 3-Discount, 4-DocumentNo, 5-DateInvoiced
|
||||
line.add(rs.getString(1)); // Name
|
||||
line.add(rs.getBigDecimal(2)); // Price
|
||||
line.add(new Double(rs.getDouble(4))); // Qty
|
||||
BigDecimal discountBD = rs.getBigDecimal(8);
|
||||
line.add(rs.getString(3)); // Currency
|
||||
line.add(new Double(rs.getDouble(5))); // Qty
|
||||
BigDecimal discountBD = rs.getBigDecimal(9);
|
||||
if (discountBD == null) {
|
||||
double priceList = rs.getDouble(3);
|
||||
double priceList = rs.getDouble(4);
|
||||
double priceActual = rs.getDouble(2);
|
||||
if (priceList != 0) {
|
||||
discountBD = BigDecimal.valueOf((priceList - priceActual)/priceList * 100);
|
||||
// Rounding:
|
||||
int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(9));
|
||||
int precision = MPriceList.getStandardPrecision(Env.getCtx(), rs.getInt(10));
|
||||
if (discountBD.scale() > precision)
|
||||
discountBD = discountBD.setScale(precision, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
@ -326,9 +331,9 @@ public class InvoiceHistory extends Window implements EventListener<Event>
|
|||
discountBD = Env.ZERO;
|
||||
}
|
||||
line.add(discountBD); // Discount
|
||||
line.add(rs.getString(6)); // DocNo
|
||||
line.add(rs.getTimestamp(5)); // Date
|
||||
line.add(rs.getString(7)); // Org/Warehouse
|
||||
line.add(rs.getString(7)); // DocNo
|
||||
line.add(rs.getTimestamp(6)); // Date
|
||||
line.add(rs.getString(8)); // Org/Warehouse
|
||||
data.add(line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.apps.form;
|
||||
|
||||
import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATERMA_MANUAL;
|
||||
import static org.compiere.model.SystemIDs.PROCESS_C_INVOICE_GENERATE_MANUAL;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -29,7 +32,6 @@ import org.compiere.model.MPInstance;
|
|||
import org.compiere.model.MPInstancePara;
|
||||
import org.compiere.model.MPrivateAccess;
|
||||
import org.compiere.model.MRMA;
|
||||
import static org.compiere.model.SystemIDs.*;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -127,23 +129,23 @@ public class InvoiceGen extends GenForm
|
|||
private String getRMASql()
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
|
||||
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
|
||||
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
|
||||
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
|
||||
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
|
||||
sql.append("WHERE rma.DocStatus='CO' ");
|
||||
sql.append("AND dt.DocBaseType = 'SOO' ");
|
||||
// sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
|
||||
// sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
|
||||
// sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
|
||||
// sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
|
||||
// sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
|
||||
// sql.append("AND iol.M_InOutLine_ID IN ");
|
||||
// sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
|
||||
// sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
|
||||
sql.append("AND rma.AD_Client_ID=?");
|
||||
|
||||
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
|
||||
sql.append("FROM M_RMA rma INNER JOIN AD_Org org ON rma.AD_Org_ID=org.AD_Org_ID ");
|
||||
sql.append("INNER JOIN C_DocType dt ON rma.C_DocType_ID=dt.C_DocType_ID ");
|
||||
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
|
||||
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
|
||||
sql.append("WHERE rma.DocStatus='CO' ");
|
||||
sql.append("AND dt.DocBaseType = 'SOO' ");
|
||||
sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
|
||||
sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
|
||||
sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
|
||||
sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
|
||||
sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
|
||||
sql.append("AND iol.M_InOutLine_ID IN ");
|
||||
sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
|
||||
sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
|
||||
sql.append("AND rma.AD_Client_ID=?");
|
||||
|
||||
if (m_AD_Org_ID != null)
|
||||
sql.append(" AND rma.AD_Org_ID=").append(m_AD_Org_ID);
|
||||
if (m_C_BPartner_ID != null)
|
||||
|
|
Loading…
Reference in New Issue