Merge release-7.1 into master

This commit is contained in:
Carlos Ruiz 2020-03-21 17:45:25 +01:00
commit b6898a8f99
6 changed files with 46 additions and 15 deletions

View File

@ -105,7 +105,6 @@ public class MaintainSupportRoles extends SvrProcess {
} else if (ACTION_DELETE.equals(p_IsActive)) { } else if (ACTION_DELETE.equals(p_IsActive)) {
if (ur != null) { if (ur != null) {
ur.deleteEx(true); ur.deleteEx(true);
ur.saveEx();
cnt++; cnt++;
} }
} }

View File

@ -2271,7 +2271,8 @@ public abstract class PO
msg = (val != null ? val + ": " : "") + err.getName(); msg = (val != null ? val + ": " : "") + err.getName();
if (msg == null || msg.length() == 0) if (msg == null || msg.length() == 0)
msg = "SaveError"; msg = "SaveError";
throw new AdempiereException(msg); Exception ex = CLogger.retrieveException();
throw new AdempiereException(msg, ex);
} }
} }
@ -3563,7 +3564,8 @@ public abstract class PO
msg = err.getName(); msg = err.getName();
if (msg == null || msg.length() == 0) if (msg == null || msg.length() == 0)
msg = "DeleteError"; msg = "DeleteError";
throw new AdempiereException(msg); Exception ex = CLogger.retrieveException();
throw new AdempiereException(msg, ex);
} }
} }
@ -4846,7 +4848,7 @@ public abstract class PO
if ("DBExecuteError".equals(msg)) if ("DBExecuteError".equals(msg))
info = "DBExecuteError:" + info; info = "DBExecuteError:" + info;
// Unique Constraint // Unique Constraint
Exception e = CLogger.retrieveException(); Exception e = CLogger.peekException();
if (DBException.isUniqueContraintError(e)) if (DBException.isUniqueContraintError(e))
{ {
boolean found = false; boolean found = false;

View File

@ -199,7 +199,7 @@ public class CLogger extends Logger
{ {
ValueNamePair vp = (ValueNamePair) Env.getCtx().get(LAST_ERROR); ValueNamePair vp = (ValueNamePair) Env.getCtx().get(LAST_ERROR);
return vp; return vp;
} // retrieveError } // peekError
/** /**
* Get Error message from stack * Get Error message from stack
@ -225,6 +225,16 @@ public class CLogger extends Logger
return ex; return ex;
} // retrieveError } // retrieveError
/**
* Peek Exception from Stack
* @return last exception
*/
public static Exception peekException()
{
Exception ex = (Exception) Env.getCtx().get(LAST_EXCEPTION);
return ex;
} // peekException
/** /**
* Save Warning as ValueNamePair. * Save Warning as ValueNamePair.
* @param AD_Message message key * @param AD_Message message key

View File

@ -1665,14 +1665,25 @@ public final class Env
else else
tableName = foreignTable; tableName = foreignTable;
MTable table = MTable.get(ctx, tableName); MTable table = MTable.get(ctx, tableName);
if (table != null && (tableName.equalsIgnoreCase(foreignTable) || tableName.equalsIgnoreCase(po.get_TableName()))) { String keyCol = tableName + "_ID";
boolean isSubTypeTable = false;
if (! Util.isEmpty(foreignTable) && ! tableName.equalsIgnoreCase(foreignTable)) {
// verify if is a subtype table
if ( table.getKeyColumns() != null
&& table.getKeyColumns().length == 1
&& table.getKeyColumns()[0].equals(foreignTable + "_ID")) {
isSubTypeTable = true;
keyCol = foreignTable + "_ID";
}
}
if (table != null && (isSubTypeTable || tableName.equalsIgnoreCase(foreignTable) || tableName.equalsIgnoreCase(po.get_TableName()))) {
String columnName = tblIndex > 0 ? format.substring(tblIndex + 1) : format; String columnName = tblIndex > 0 ? format.substring(tblIndex + 1) : format;
MColumn column = table.getColumn(columnName); MColumn column = table.getColumn(columnName);
if (column != null) { if (column != null) {
if (column.isSecure()) { if (column.isSecure()) {
outStr.append("********"); outStr.append("********");
} else { } else {
String value = DB.getSQLValueString(trxName,"SELECT " + columnName + " FROM " + tableName + " WHERE " + tableName + "_ID = ?", (Integer)v); String value = DB.getSQLValueString(trxName,"SELECT " + columnName + " FROM " + tableName + " WHERE " + keyCol + "=?", (Integer)v);
if (value != null) if (value != null)
outStr.append(value); outStr.append(value);
} }

View File

@ -58,6 +58,7 @@ import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.ToolBar; import org.adempiere.webui.component.ToolBar;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
@ -716,11 +717,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
GridField mField = m_findFields[i]; GridField mField = m_findFields[i];
boolean isDisplayed = mField.isDisplayed(); boolean isDisplayed = mField.isDisplayed();
if (DisplayType.isText(mField.getVO().displayType)) {
// for string fields allow searching long strings - useful for like and similar to searches
mField.getVO().FieldLength = 32767; // a conservative max literal string - like oracle extended
mField.getVO().DisplayLength = mField.getVO().FieldLength;
}
if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted() || mField.isEncryptedColumn()) { if (mField.getVO().displayType == DisplayType.YesNo || mField.isEncrypted() || mField.isEncryptedColumn()) {
// Make Yes-No searchable as list // Make Yes-No searchable as list
GridFieldVO vo = mField.getVO(); GridFieldVO vo = mField.getVO();
@ -1191,7 +1187,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
editor.addValueChangeListener(this); editor.addValueChangeListener(this);
Label label = editor.getLabel(); Label label = editor.getLabel();
Component fieldEditor = editor.getComponent(); Component fieldEditor = editor.getComponent();
//Fix miss lable of checkbox setLengthStringField(mField, fieldEditor);
//Fix miss label of checkbox
label.setValue(mField.getHeader()); label.setValue(mField.getHeader());
// //
if (displayLength > 0) // set it back if (displayLength > 0) // set it back
@ -1256,6 +1253,13 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
return true; return true;
} // addSelectionColumn } // addSelectionColumn
private void setLengthStringField(GridField field, Component fieldEditor) {
if (DisplayType.isText(field.getVO().displayType) && fieldEditor instanceof Textbox) {
// for string fields allow searching long strings - useful for like and similar to searches
((Textbox) fieldEditor).setMaxlength(32767); // a conservative max literal string - like oracle extended
}
}
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
{ {
m_createNew = false; m_createNew = false;
@ -2191,6 +2195,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
editor = new WStringEditor(findField); editor = new WStringEditor(findField);
findField.addPropertyChangeListener(editor); findField.addPropertyChangeListener(editor);
} }
setLengthStringField(findField, editor.getComponent());
editor.addValueChangeListener(this); editor.addValueChangeListener(this);
editor.setValue(null); editor.setValue(null);

View File

@ -273,7 +273,11 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
.and(Sanitizers.LINKS) .and(Sanitizers.LINKS)
.and(Sanitizers.STYLES) .and(Sanitizers.STYLES)
.and(Sanitizers.TABLES); .and(Sanitizers.TABLES);
return policy.sanitize(untrustedHTML);
}
String ret = policy.sanitize(untrustedHTML);
ret = ret.replaceAll("&#35;", "#");
ret = ret.replaceAll("&#64;", "@");
return ret;
}
} }