IDEMPIERE-5079 Improvements for Workflow Editor (#1033)

This commit is contained in:
Carlos Ruiz 2021-12-08 10:12:57 +01:00 committed by GitHub
parent db4087f878
commit 497398857e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import org.compiere.model.PO;
import org.compiere.model.Query;
import org.compiere.model.X_AD_WF_NodeNext;
import org.compiere.process.DocAction;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.idempiere.cache.ImmutablePOSupport;
@ -40,7 +41,7 @@ public class MWFNodeNext extends X_AD_WF_NodeNext implements ImmutablePOSupport
/**
*
*/
private static final long serialVersionUID = -7758585369030074980L;
private static final long serialVersionUID = 5965306487040965994L;
/**
* Standard Costructor
@ -298,4 +299,20 @@ public class MWFNodeNext extends X_AD_WF_NodeNext implements ImmutablePOSupport
return this;
}
/**************************************************************************
* Before Save
* @param newRecord
* @return true if it can be saved
*/
@Override
protected boolean beforeSave(boolean newRecord) {
// Get Line No
if (getSeqNo() == 0) {
String sql = "SELECT COALESCE(MAX(SeqNo),0)+10 FROM AD_WF_NodeNext WHERE AD_WF_Node_ID=?";
int ii = DB.getSQLValue (get_TrxName(), sql, getAD_WF_Node_ID());
setSeqNo(ii);
}
return true;
}
} // MWFNodeNext

View File

@ -33,7 +33,9 @@ import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.apps.wf.WFGraphLayout;
import org.compiere.apps.wf.WFNodeWidget;
import org.compiere.model.MEntityType;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
@ -256,6 +258,8 @@ public class WFEditor extends ADForm {
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
MWFNode node = new MWFNode(m_wf, name, name);
node.setClientOrg(AD_Client_ID, 0);
if (AD_Client_ID > 11)
node.setEntityType(MSysConfig.getValue(MSysConfig.DEFAULT_ENTITYTYPE, MEntityType.ENTITYTYPE_UserMaintained));
node.saveEx();
reload(m_wf.getAD_Workflow_ID(), true);
}
@ -385,10 +389,10 @@ public class WFEditor extends ADForm {
if (widget != null) {
MWFNode node = widget.getModel();
Menupopup popupMenu = new Menupopup();
// Zoom
addMenuItem(popupMenu, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Zoom")), node, WFPopupItem.WFPOPUPITEM_ZOOM);
if (node.getAD_Client_ID() == Env.getAD_Client_ID(Env.getCtx()))
{
// Zoom
addMenuItem(popupMenu, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Zoom")), node, WFPopupItem.WFPOPUPITEM_ZOOM);
// Properties
addMenuItem(popupMenu, Msg.getMsg(Env.getCtx(), "Properties"), node, WFPopupItem.WFPOPUPITEM_PROPERTIES);
// Delete node

View File

@ -5,7 +5,9 @@ import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
import org.compiere.model.MEntityType;
import org.compiere.model.MQuery;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
@ -80,6 +82,9 @@ public class WFPopupItem extends Menuitem {
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
MWFNodeNext newLine = new MWFNodeNext(m_node, m_AD_WF_NodeTo_ID);
newLine.setClientOrg(AD_Client_ID, 0);
newLine.setSeqNo(0);
if (AD_Client_ID > 11)
newLine.setEntityType(MSysConfig.getValue(MSysConfig.DEFAULT_ENTITYTYPE, MEntityType.ENTITYTYPE_UserMaintained));
newLine.saveEx();
log.info("Add Line to " + m_node + " -> " + newLine);
wfp.reload(m_AD_Workflow_ID, true);