IDEMPIERE-5633 Check tableId <=0 in PO.checkRecordIDCrossTenant() (#1745)
IDEMPIERE-5238 Thanks to Ken Longnan
This commit is contained in:
parent
92ac50e21f
commit
2d928ed37e
|
@ -5686,6 +5686,8 @@ public abstract class PO
|
||||||
if (recordId <= 0)
|
if (recordId <= 0)
|
||||||
return;
|
return;
|
||||||
int tableId = get_ValueAsInt(idxTableId);
|
int tableId = get_ValueAsInt(idxTableId);
|
||||||
|
if (tableId <= 0)
|
||||||
|
return;
|
||||||
MTable ft = MTable.get(getCtx(), tableId);
|
MTable ft = MTable.get(getCtx(), tableId);
|
||||||
boolean systemAccess = false;
|
boolean systemAccess = false;
|
||||||
String accessLevel = ft.getAccessLevel();
|
String accessLevel = ft.getAccessLevel();
|
||||||
|
|
|
@ -273,10 +273,11 @@ public class WRecordIDEditor extends WEditor implements ContextMenuListener, IZo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void setValue (Object value, boolean fire) {
|
private void setValue (Object value, boolean fire) {
|
||||||
recordTextBox.setValue("");
|
|
||||||
if (value == null || Util.isEmpty(value.toString(), true)) {
|
if (value == null || Util.isEmpty(value.toString(), true)) {
|
||||||
|
recordTextBox.setValue("");
|
||||||
value = null;
|
value = null;
|
||||||
} else {
|
} else {
|
||||||
|
recordTextBox.setValue(value.toString());
|
||||||
//get initial ad_table_id value
|
//get initial ad_table_id value
|
||||||
if (tableIDValue == null && tableIDGridField != null) {
|
if (tableIDValue == null && tableIDGridField != null) {
|
||||||
tableIDValue = tableIDGridField.getValue();
|
tableIDValue = tableIDGridField.getValue();
|
||||||
|
@ -289,7 +290,12 @@ public class WRecordIDEditor extends WEditor implements ContextMenuListener, IZo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fire) {
|
if (fire
|
||||||
|
&&
|
||||||
|
( (value == null && recordIDValue != null)
|
||||||
|
|| (value != null && recordIDValue == null)
|
||||||
|
|| !value.equals(recordIDValue)
|
||||||
|
)) {
|
||||||
// Record_ID
|
// Record_ID
|
||||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), recordIDValue, value);
|
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), recordIDValue, value);
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
|
@ -304,26 +310,42 @@ public class WRecordIDEditor extends WEditor implements ContextMenuListener, IZo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplay() {
|
public String getDisplay() {
|
||||||
|
if (recordIDValue == null)
|
||||||
|
return "";
|
||||||
if((tableIDValue != null) && (recordIDValue != null)) {
|
if((tableIDValue != null) && (recordIDValue != null)) {
|
||||||
int tableID = Integer.parseInt(String.valueOf(tableIDValue));
|
int tableID;
|
||||||
int recordID = Integer.parseInt(String.valueOf(recordIDValue));
|
int recordID;
|
||||||
|
try {
|
||||||
|
tableID = Integer.parseInt(String.valueOf(tableIDValue));
|
||||||
|
recordID = Integer.parseInt(String.valueOf(recordIDValue));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return recordIDValue.toString();
|
||||||
|
}
|
||||||
return getIdentifier(tableID, recordID);
|
return getIdentifier(tableID, recordID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "";
|
return recordIDValue.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayTextForGridView(GridRowCtx gridRowCtx, Object value) {
|
public String getDisplayTextForGridView(GridRowCtx gridRowCtx, Object value) {
|
||||||
|
if (value == null)
|
||||||
|
return "";
|
||||||
if (gridTab != null) {
|
if (gridTab != null) {
|
||||||
String key = gridTab.getWindowNo() + "|AD_Table_ID";
|
String key = gridTab.getWindowNo() + "|AD_Table_ID";
|
||||||
Object rowTableIdValue = gridRowCtx.get(key);
|
Object rowTableIdValue = gridRowCtx.get(key);
|
||||||
int rowTableID = Integer.parseInt(String.valueOf(rowTableIdValue));
|
int rowTableID;
|
||||||
int rowRecordID = Integer.parseInt(String.valueOf(value));
|
int rowRecordID;
|
||||||
|
try {
|
||||||
|
rowTableID = Integer.parseInt(String.valueOf(rowTableIdValue));
|
||||||
|
rowRecordID = Integer.parseInt(String.valueOf(value));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
return getIdentifier(rowTableID, rowRecordID);
|
return getIdentifier(rowTableID, rowRecordID);
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return value.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue