1002538 fitnesse improvements:
- validate ID is valid in client - validate process parameter is valid - improve updaterecord logic
This commit is contained in:
parent
c20b775176
commit
86668972d0
|
@ -131,6 +131,5 @@ Check existance of cash payment (now on payment table)
|
|||
|*Read* | |
|
||||
|documentno | |
|
||||
|description | |
|
||||
|amount | |
|
||||
|processed | |
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|IdempiereSuite.TestCashPosOrder||22:32:07 mié, jul 10, 2013|
|
||||
|IdempiereSuite.TestInitialClientSetup||17:03:35 vie, jun 28, 2013|
|
||||
|IdempiereSuite.TestPostInternalInventory||15:31:05 vie, jun 28, 2013|
|
||||
|IdempiereSuite.TestCreateReference||14:44:52 vie, jun 28, 2013|
|
||||
|IdempiereSuite.TestCashPosOrder||14:42:20 vie, jun 28, 2013|
|
||||
|ZkSuite.ZkGardenAdminLogin||13:02:13 vie, jun 28, 2013|
|
||||
|ZkSuite.ZkSystemAdminLogin||13:00:38 vie, jun 28, 2013|
|
||||
|||12:04:00 jue, dic 20, 2012|
|
||||
|
|
|
@ -681,18 +681,32 @@ public class MColumn extends X_AD_Column
|
|||
|
||||
public String getReferenceTableName() {
|
||||
String foreignTable = null;
|
||||
if (DisplayType.TableDir == getAD_Reference_ID()
|
||||
|| (DisplayType.Search == getAD_Reference_ID() && getAD_Reference_Value_ID() == 0)) {
|
||||
int refid = getAD_Reference_ID();
|
||||
if (DisplayType.TableDir == refid || (DisplayType.Search == refid && getAD_Reference_Value_ID() == 0)) {
|
||||
foreignTable = getColumnName().substring(0, getColumnName().length()-3);
|
||||
} else if (DisplayType.Table == getAD_Reference_ID() || DisplayType.Search == getAD_Reference_ID()) {
|
||||
} else if (DisplayType.Table == refid || DisplayType.Search == refid) {
|
||||
X_AD_Reference ref = new X_AD_Reference(getCtx(), getAD_Reference_Value_ID(), get_TrxName());
|
||||
if (X_AD_Reference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) {
|
||||
MRefTable rt = new MRefTable(getCtx(), getAD_Reference_Value_ID(), get_TrxName());
|
||||
if (rt != null)
|
||||
foreignTable = rt.getAD_Table().getTableName();
|
||||
}
|
||||
} else if (DisplayType.List == getAD_Reference_ID()) {
|
||||
} else if (DisplayType.List == refid) {
|
||||
foreignTable = "AD_Ref_List";
|
||||
} else if (DisplayType.Location == refid) {
|
||||
foreignTable = "C_Location";
|
||||
} else if (DisplayType.Account == refid) {
|
||||
foreignTable = "C_ValidCombination";
|
||||
} else if (DisplayType.Locator == refid) {
|
||||
foreignTable = "M_Locator";
|
||||
} else if (DisplayType.PAttribute == refid) {
|
||||
foreignTable = "M_AttributeSetInstance";
|
||||
} else if (DisplayType.Assignment == refid) {
|
||||
foreignTable = "S_ResourceAssignment";
|
||||
} else if (DisplayType.Image == refid) {
|
||||
foreignTable = "AD_Image";
|
||||
} else if (DisplayType.Color == refid) {
|
||||
foreignTable = "AD_Color";
|
||||
}
|
||||
|
||||
return foreignTable;
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AssertRecord extends TableFixture {
|
|||
MTable table = null;
|
||||
POInfo poinfo = null;
|
||||
boolean alreadyread = false;
|
||||
StringBuilder whereclause = new StringBuilder("");
|
||||
StringBuilder whereclause = new StringBuilder();
|
||||
boolean isErrorExpected = false;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
String cell_title = getText(i, 0);
|
||||
|
@ -104,6 +104,8 @@ public class AssertRecord extends TableFixture {
|
|||
wrong(i, 1);
|
||||
return;
|
||||
}
|
||||
whereclause.insert(0, "(");
|
||||
whereclause.append(") AND AD_Client_ID IN (0,").append(Env.getAD_Client_ID(ctx)).append(")");
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE " + whereclause;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -166,13 +168,18 @@ public class AssertRecord extends TableFixture {
|
|||
if (! alreadyread) {
|
||||
// not read yet - add value to where clause
|
||||
String value_evaluated = Util.evaluate(ctx, windowNo, cell_value, getCell(i, 1));
|
||||
if (whereclause.length() > 0)
|
||||
whereclause.append(" AND ");
|
||||
if (whereclause.length() > 0) {
|
||||
whereclause.insert(0, "(");
|
||||
whereclause.append(") AND ");
|
||||
}
|
||||
whereclause.append(cell_title).append("=").append(value_evaluated);
|
||||
} else {
|
||||
// already read, compare the value of db with the context variable or formula
|
||||
String title_evaluated = "";
|
||||
if (gpo != null) {
|
||||
if (poinfo.getColumnIndex(cell_title) < 0) {
|
||||
wrong(i, 0);
|
||||
} else {
|
||||
Object result = gpo.get_Value(cell_title);
|
||||
if (result != null) {
|
||||
getCell(i, 0).addToBody("<hr/>" + result.toString());
|
||||
|
@ -194,6 +201,7 @@ public class AssertRecord extends TableFixture {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// set the variables at the end
|
||||
// read - set context variables
|
||||
for (int idx = 0; idx < poinfo.getColumnCount(); idx++) {
|
||||
|
|
|
@ -30,9 +30,12 @@ import java.math.BigDecimal;
|
|||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.POInfo;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
||||
|
@ -65,6 +68,7 @@ public class CreateRecord extends TableFixture {
|
|||
boolean tableOK = false;
|
||||
boolean columnsOK = true;
|
||||
boolean isErrorExpected = "*Save*Error*".equalsIgnoreCase(getText(rows-1, 0));
|
||||
String msgerror1 = getText(rows-1, 1);
|
||||
MTable table = null;
|
||||
POInfo poinfo = null;
|
||||
|
||||
|
@ -145,7 +149,7 @@ public class CreateRecord extends TableFixture {
|
|||
columnName = cell_title;
|
||||
int idxcol = gpo.get_ColumnIndex(columnName);
|
||||
if (idxcol < 0) {
|
||||
wrong(i,1);
|
||||
wrong(i,0);
|
||||
// column does not exist in dictionary - anyways try custom column in case it exists in table
|
||||
gpo.set_CustomColumnReturningBoolean(columnName, cell_value);
|
||||
} else {
|
||||
|
@ -153,8 +157,16 @@ public class CreateRecord extends TableFixture {
|
|||
String value_evaluated = Util.evaluate(ctx, windowNo, cell_value, getCell(i, 1));
|
||||
// set value according to class
|
||||
Object value = null;
|
||||
if (value_evaluated == null || value_evaluated.length() == 0) {
|
||||
if (org.compiere.util.Util.isEmpty(cell_value)) {
|
||||
value = null;
|
||||
} else if (org.compiere.util.Util.isEmpty(value_evaluated)) {
|
||||
boolean ok = Util.evaluateError("Data not found",msgerror1,isErrorExpected);
|
||||
if (ok)
|
||||
right(i,1);
|
||||
else
|
||||
wrong(i,1);
|
||||
columnsOK = false;
|
||||
continue;
|
||||
} else if (columnClass == Boolean.class) {
|
||||
if ("Y".equalsIgnoreCase(value_evaluated) || "true".equalsIgnoreCase(value_evaluated))
|
||||
value = new Boolean(true);
|
||||
|
@ -166,7 +178,27 @@ public class CreateRecord extends TableFixture {
|
|||
}
|
||||
} else if (columnClass == Integer.class) {
|
||||
try {
|
||||
value = Integer.parseInt(value_evaluated);
|
||||
Integer intid = Integer.parseInt(value_evaluated);
|
||||
MColumn column = table.getColumn(cell_title);
|
||||
if (intid > 0 && (DisplayType.isID(column.getAD_Reference_ID()) || column.getAD_Reference_ID() != DisplayType.ID)) {
|
||||
// Evaluate the ID is from the actual client or system
|
||||
String foreignTable = column.getReferenceTableName();
|
||||
if (foreignTable != null) {
|
||||
int foreignClient = DB.getSQLValueEx(null,
|
||||
"SELECT AD_Client_ID FROM " + foreignTable + " WHERE " + foreignTable + "_ID=?",
|
||||
intid);
|
||||
if (foreignClient != 0 && foreignClient != Env.getAD_Client_ID(ctx)) {
|
||||
boolean ok = Util.evaluateError("Data not found", msgerror1, isErrorExpected);
|
||||
if (ok)
|
||||
right(i, 1);
|
||||
else
|
||||
wrong(i, 1);
|
||||
columnsOK = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
value = intid;
|
||||
} catch (NumberFormatException e) {
|
||||
exception(getCell(i, 1), e);
|
||||
continue;
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Properties;
|
|||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
import fitnesse.fixtures.TableFixture;
|
||||
|
||||
|
@ -65,7 +66,7 @@ public class DeleteRecord extends TableFixture {
|
|||
MTable table = null;
|
||||
|
||||
boolean alreadyread = false;
|
||||
StringBuilder whereclause = new StringBuilder("");
|
||||
StringBuilder whereclause = new StringBuilder();
|
||||
boolean isErrorExpected = false;
|
||||
String msgerror = null;
|
||||
|
||||
|
@ -105,6 +106,8 @@ public class DeleteRecord extends TableFixture {
|
|||
wrong(i, 1);
|
||||
return;
|
||||
}
|
||||
whereclause.insert(0, "(");
|
||||
whereclause = whereclause.append(") AND AD_Client_ID=").append(Env.getAD_Client_ID(ctx));
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE "+ whereclause;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -159,8 +162,10 @@ public class DeleteRecord extends TableFixture {
|
|||
String value_evaluated = Util.evaluate(ctx, windowNo,cell_value, getCell(i, 1));
|
||||
if (!alreadyread) {
|
||||
// not read yet - add value to where clause
|
||||
if (whereclause.length() > 0)
|
||||
whereclause.append(" AND ");
|
||||
if (whereclause.length() > 0) {
|
||||
whereclause.insert(0, "(");
|
||||
whereclause.append(") AND ");
|
||||
}
|
||||
whereclause.append(cell_title).append("=").append(value_evaluated);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ReadRecord extends TableFixture {
|
|||
MTable table = null;
|
||||
POInfo poinfo = null;
|
||||
boolean alreadyread = false;
|
||||
String whereclause = new String("");
|
||||
StringBuilder whereclause = new StringBuilder();
|
||||
boolean isErrorExpected = false;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
String cell_title = getText(i, 0);
|
||||
|
@ -90,7 +90,7 @@ public class ReadRecord extends TableFixture {
|
|||
exception(getCell(i, 1), new Exception("*Where* must be defined in second row"));
|
||||
return;
|
||||
}
|
||||
whereclause = cell_value;
|
||||
whereclause.append(cell_value);
|
||||
} else if (cell_title.equalsIgnoreCase("*Read*") || cell_title.equalsIgnoreCase("*Read*Error*")) {
|
||||
if (! tableOK) {
|
||||
getCell(i, 1).addToBody("Table " + tableName + " does not exist");
|
||||
|
@ -103,6 +103,8 @@ public class ReadRecord extends TableFixture {
|
|||
wrong(i, 1);
|
||||
return;
|
||||
}
|
||||
whereclause.insert(0, "(");
|
||||
whereclause.append(") AND AD_Client_ID IN (0,").append(Env.getAD_Client_ID(ctx)).append(")");
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE " + whereclause;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -170,12 +172,17 @@ public class ReadRecord extends TableFixture {
|
|||
if (! alreadyread) {
|
||||
// not read yet - add value to where clause
|
||||
String value_evaluated = Util.evaluate(ctx, windowNo, cell_value, getCell(i, 1));
|
||||
if (whereclause.length() > 0)
|
||||
whereclause = whereclause + " AND ";
|
||||
whereclause = whereclause + cell_title + "=" + value_evaluated;
|
||||
if (whereclause.length() > 0) {
|
||||
whereclause.insert(0, "(");
|
||||
whereclause.append(") AND ");
|
||||
}
|
||||
whereclause.append(cell_title).append("=").append(value_evaluated);
|
||||
} else {
|
||||
// already read, show the value of context variable
|
||||
if (gpo != null) {
|
||||
if (poinfo.getColumnIndex(cell_title) < 0) {
|
||||
wrong(i, 0);
|
||||
} else {
|
||||
Object result = gpo.get_Value(cell_title);
|
||||
if (result != null)
|
||||
getCell(i, 1).addToBody(result.toString());
|
||||
|
@ -184,6 +191,7 @@ public class ReadRecord extends TableFixture {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // doStaticTable
|
||||
|
||||
} // AdempiereReadRecord
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.compiere.model.MTable;
|
|||
import org.compiere.model.PO;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -293,11 +294,27 @@ public class RunProcess extends TableFixture {
|
|||
exception(getCell(i, 1), e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (parameterName.equalsIgnoreCase("*DocAction*"))
|
||||
} else {
|
||||
if (parameterName.equalsIgnoreCase("*DocAction*")) {
|
||||
docAction = value_evaluated;
|
||||
else
|
||||
fmap.put(parameterName, value_evaluated);
|
||||
} else {
|
||||
String param = DB.getSQLValueStringEx(null,
|
||||
"SELECT ColumnName " +
|
||||
"FROM AD_Process_Para " +
|
||||
"WHERE IsActive='Y' AND AD_Process_ID=? AND LOWER(ColumnName)=?",
|
||||
process.getAD_Process_ID(), parameterName.toLowerCase());
|
||||
if (param == null) {
|
||||
boolean ok = Util.evaluateError(msgerror1,"Parameter Not Found", isErrorExpected);
|
||||
if (ok) {
|
||||
right(getCell(i, 1));
|
||||
} else {
|
||||
exception(getCell(i, 1), new Exception("Parameter Not Found"));
|
||||
}
|
||||
} else {
|
||||
fmap.put(param, value_evaluated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,21 @@
|
|||
|
||||
package org.idempiere.fitnesse.fixture;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.model.PO;
|
||||
import org.compiere.model.POInfo;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
|
||||
import fitnesse.fixtures.TableFixture;
|
||||
|
||||
|
@ -66,10 +73,12 @@ public class UpdateRecord extends TableFixture {
|
|||
PO gpo = null;
|
||||
String tableName = new String("");
|
||||
boolean tableOK = false;
|
||||
boolean columnsOK = true;
|
||||
MTable table = null;
|
||||
POInfo poinfo = null;
|
||||
|
||||
boolean alreadyread = false;
|
||||
StringBuilder whereclause = new StringBuilder("");
|
||||
StringBuilder whereclause = new StringBuilder();
|
||||
boolean isErrorExpected = false;
|
||||
String msgerror = null;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
|
@ -88,6 +97,7 @@ public class UpdateRecord extends TableFixture {
|
|||
} else {
|
||||
tableOK = true;
|
||||
}
|
||||
poinfo = POInfo.getPOInfo(ctx, table!=null ? table.getAD_Table_ID() : 0);
|
||||
|
||||
} else if (cell_title.equalsIgnoreCase("*Where*")) {
|
||||
if (i != 1) {
|
||||
|
@ -108,6 +118,7 @@ public class UpdateRecord extends TableFixture {
|
|||
wrong(i, 1);
|
||||
return;
|
||||
}
|
||||
whereclause = whereclause.append(" AND AD_Client_ID=").append(Env.getAD_Client_ID(ctx));
|
||||
String sql = "SELECT * FROM " + tableName + " WHERE "+ whereclause;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -160,34 +171,145 @@ public class UpdateRecord extends TableFixture {
|
|||
String value_evaluated = Util.evaluate(ctx, windowNo,cell_value, getCell(i, 1));
|
||||
if (!alreadyread) {
|
||||
// not read yet - add value to where clause
|
||||
if (whereclause.length() > 0)
|
||||
whereclause.append(" AND ");
|
||||
if (whereclause.length() > 0) {
|
||||
whereclause.insert(0, "(");
|
||||
whereclause.append(") AND ");
|
||||
}
|
||||
whereclause.append(cell_title).append("=").append(value_evaluated);
|
||||
} else {
|
||||
if (gpo != null) {
|
||||
if (gpo.set_ValueOfColumnReturningBoolean(cell_title, value_evaluated)) {
|
||||
if (isErrorExpected) {
|
||||
wrong(getCell(i, 1));
|
||||
String columnName = cell_title;
|
||||
int idxcol = gpo.get_ColumnIndex(columnName);
|
||||
if (idxcol < 0) {
|
||||
wrong(i,0);
|
||||
// column does not exist in dictionary - anyways try custom column in case it exists in table
|
||||
gpo.set_CustomColumnReturningBoolean(columnName, cell_value);
|
||||
} else {
|
||||
right(getCell(i, 1));
|
||||
Class<?> columnClass = poinfo.getColumnClass(idxcol);
|
||||
// set value according to class
|
||||
Object value = null;
|
||||
if (org.compiere.util.Util.isEmpty(cell_value)) {
|
||||
value = null;
|
||||
} else if (org.compiere.util.Util.isEmpty(value_evaluated)) {
|
||||
boolean ok = Util.evaluateError("Data not found",msgerror,isErrorExpected);
|
||||
if (ok)
|
||||
right(i,1);
|
||||
else
|
||||
wrong(i,1);
|
||||
columnsOK = false;
|
||||
continue;
|
||||
} else if (columnClass == Boolean.class) {
|
||||
if ("Y".equalsIgnoreCase(value_evaluated) || "true".equalsIgnoreCase(value_evaluated))
|
||||
value = new Boolean(true);
|
||||
else if ("N".equalsIgnoreCase(value_evaluated) || "false".equalsIgnoreCase(value_evaluated))
|
||||
value = new Boolean(false);
|
||||
else {
|
||||
exception(getCell(i, 1), new Exception("Wrong value for boolean, allowed Y/N/true/false"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (columnClass == Integer.class) {
|
||||
try {
|
||||
gpo.saveEx();
|
||||
Integer intid = Integer.parseInt(value_evaluated);
|
||||
MColumn column = table.getColumn(cell_title);
|
||||
if (intid > 0 && (DisplayType.isID(column.getAD_Reference_ID()) || column.getAD_Reference_ID() != DisplayType.ID)) {
|
||||
// Evaluate the ID is from the actual client or system
|
||||
String foreignTable = column.getReferenceTableName();
|
||||
if (foreignTable != null) {
|
||||
int foreignClient = DB.getSQLValueEx(null,
|
||||
"SELECT AD_Client_ID FROM " + foreignTable + " WHERE " + foreignTable + "_ID=?",
|
||||
intid);
|
||||
if (foreignClient != 0 && foreignClient != Env.getAD_Client_ID(ctx)) {
|
||||
boolean ok = Util.evaluateError("Data not found", msgerror, isErrorExpected);
|
||||
if (ok)
|
||||
right(i, 1);
|
||||
else
|
||||
wrong(i, 1);
|
||||
columnsOK = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
value = intid;
|
||||
} catch (NumberFormatException e) {
|
||||
exception(getCell(i, 1), e);
|
||||
continue;
|
||||
}
|
||||
} else if (columnClass == BigDecimal.class) {
|
||||
try {
|
||||
value = new BigDecimal(value_evaluated);
|
||||
} catch (Exception e) {
|
||||
boolean ok = Util.evaluateError(e.getMessage(),msgerror, isErrorExpected);
|
||||
exception(getCell(i, 1), e);
|
||||
continue;
|
||||
}
|
||||
} else if (columnClass == Timestamp.class) {
|
||||
try {
|
||||
value = Timestamp.valueOf(value_evaluated);
|
||||
} catch (Exception e) {
|
||||
exception(getCell(i, 1), e);
|
||||
continue;
|
||||
}
|
||||
} else if (columnClass == byte[].class) {
|
||||
exception(getCell(i, 1), new Exception("LOB not supported"));
|
||||
continue;
|
||||
} else {
|
||||
value = value_evaluated;
|
||||
}
|
||||
try {
|
||||
if (!gpo.set_ValueOfColumnReturningBoolean(columnName, value)) {
|
||||
columnsOK = false;
|
||||
boolean ok = Util.evaluateError("Cannot set value of column", cell_value, isErrorExpected);
|
||||
if (ok)
|
||||
right(getCell(i, 1));
|
||||
else
|
||||
exception(getCell(i, 1), new Exception("Cannot set value of column"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
columnsOK = false;
|
||||
boolean ok = Util.evaluateError(e.getMessage(), cell_value, isErrorExpected);
|
||||
if (ok)
|
||||
right(getCell(i, 1));
|
||||
else
|
||||
exception(getCell(i, 1), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}//end while
|
||||
}
|
||||
} //end for
|
||||
if (tableOK && columnsOK && gpo != null) {
|
||||
int i = rows-1;
|
||||
if (!gpo.save()) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
Exception e = (Exception) ctx.get("org.compiere.util.CLogger.lastException");
|
||||
if (e != null)
|
||||
msg.append("Exception: "+ e.getMessage());
|
||||
else {
|
||||
ValueNamePair vnp = (ValueNamePair) ctx.get("org.compiere.util.CLogger.lastError");
|
||||
if (vnp != null)
|
||||
msg.append("Error: " + vnp.getName());
|
||||
}
|
||||
getCell(i, 1).addToBody(msg.toString());
|
||||
boolean ok = Util.evaluateError(msg.toString(),msgerror,isErrorExpected);
|
||||
if (ok)
|
||||
right(i,1);
|
||||
else
|
||||
wrong(i,1);
|
||||
} else {
|
||||
if (isErrorExpected) {
|
||||
wrong(i,1);
|
||||
} else {
|
||||
right(i, 1);
|
||||
}
|
||||
getCell(i, 1).addToBody(gpo.toString());
|
||||
for (int idx = 0; idx < poinfo.getColumnCount(); idx++) {
|
||||
String colname = poinfo.getColumnName(idx);
|
||||
Object result = gpo.get_Value(colname);
|
||||
if (result != null)
|
||||
Env.setContext(ctx, windowNo, poinfo.getTableName().toLowerCase() + "." + colname.toLowerCase(), result.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ public class Util {
|
|||
String tablename = cell_value.substring(5, pos_opsqb);
|
||||
String where = cell_value.substring(pos_opsqb+1, pos_clsqb);
|
||||
String whereParsed = Env.parseContext(ctx, windowNo, where, false);
|
||||
if (ctx != null)
|
||||
whereParsed = "(" + whereParsed + ") AND AD_Client_ID IN (0,"+Env.getAD_Client_ID(ctx)+")";
|
||||
String columnname = cell_value.substring(pos_clsqb+2);
|
||||
String newval = DB.getSQLValueStringEx(null, "SELECT " + columnname + " FROM " + tablename + " WHERE " + whereParsed);
|
||||
if (parse != null)
|
||||
|
|
Loading…
Reference in New Issue