FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows

This commit is contained in:
teo_sarca 2008-08-12 17:36:15 +00:00
parent 47324c4dbd
commit 643a60cb98
4 changed files with 126 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import java.util.*;
import java.util.logging.*;
import javax.swing.*;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.*;
import org.compiere.apps.form.*;
@ -37,17 +38,23 @@ import org.compiere.wf.*;
*
* @author Jorg Janke
* @version $Id: WFPanel.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
*
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
*/
public class WFPanel extends CPanel
implements PropertyChangeListener, ActionListener, FormPanel
{
private static final long serialVersionUID = 1L;
/**
* Create Workflow Panel.
* FormPanel
*/
public WFPanel()
{
this (null);
this (null, null, -1);
} // WFPanel
/**
@ -55,9 +62,20 @@ public class WFPanel extends CPanel
* @param menu menu
*/
public WFPanel (AMenu menu)
{
this(menu, null, -1);
}
/**
* Create Workflow Panel
* @param menu menu
*/
public WFPanel (AMenu menu, String wfWhereClause, int wfWindow_ID)
{
m_menu = menu;
m_readWrite = (menu == null);
m_WF_whereClause = wfWhereClause;
m_WF_Window_ID = wfWindow_ID;
log.info("RW=" + m_readWrite);
try
{
@ -85,11 +103,16 @@ public class WFPanel extends CPanel
private WFNode m_activeNode = null;
/** ReadWrite Mode (see WFNode) */
private boolean m_readWrite = false;
/** Workflows List Where Clause */
private String m_WF_whereClause = null;
/** Workflow Window ID */
private int m_WF_Window_ID = -1;
/** Logger */
private static CLogger log = CLogger.getCLogger(WFPanel.class);
// IO
// UI
private BorderLayout mainLayout = new BorderLayout();
private CPanel southPanel = new CPanel();
private WFContentPanel centerPanel = new WFContentPanel(this);
@ -208,7 +231,9 @@ public class WFPanel extends CPanel
private void loadPanel()
{
String sql = MRole.getDefault().addAccessSQL(
"SELECT AD_Workflow_ID, Name FROM AD_Workflow ORDER BY 2",
"SELECT AD_Workflow_ID, Name FROM AD_Workflow "
+(!Util.isEmpty(m_WF_whereClause, true) ? " WHERE "+m_WF_whereClause : "")
+" ORDER BY 2",
"AD_Workflow", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); // all
KeyNamePair[] pp = DB.getKeyNamePairs(sql, true);
//
@ -425,12 +450,18 @@ public class WFPanel extends CPanel
*/
private void zoom()
{
int AD_Window_ID = 113;
if (m_WF_Window_ID <= 0) {
m_WF_Window_ID = MTable.get(m_ctx, MWorkflow.Table_ID).getAD_Window_ID();
}
if (m_WF_Window_ID <= 0) {
throw new AdempiereException("@NotFound@ @AD_Window_ID@");
}
MQuery query = null;
if (m_wf != null)
query = MQuery.getEqualQuery("AD_Workflow_ID", m_wf.getAD_Workflow_ID());
AWindow frame = new AWindow();
if (!frame.initWindow (AD_Window_ID, query))
if (!frame.initWindow (m_WF_Window_ID, query))
return;
AEnv.addToWindowManager(frame);
AEnv.showCenterScreen(frame);
@ -450,7 +481,6 @@ public class WFPanel extends CPanel
return sb.toString();
} // toString
/**************************************************************************
* Test
* @param args ignored

View File

@ -0,0 +1,40 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2008 SC ARHIPAC SERVICE SRL. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.eevolution.form;
import org.compiere.apps.wf.WFPanel;
import org.compiere.util.DB;
import org.compiere.wf.MWorkflow;
/**
* Manufacturing WorkFlow Editor
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
*/
public class WFPanelManufacturing extends WFPanel {
private static final long serialVersionUID = 1L;
private static final String WF_WhereClause = MWorkflow.COLUMNNAME_WorkflowType+" IN ("
+ DB.TO_STRING(MWorkflow.WORKFLOWTYPE_Manufacturing)
+","+DB.TO_STRING(MWorkflow.WORKFLOWTYPE_Quality)
+")";
private static final int WF_Window_ID = 53005; // TODO: HARDCODED (Manufacturing Workflows)
/**
* Default constructor
*/
public WFPanelManufacturing() {
super(null, WF_WhereClause, WF_Window_ID);
}
}

View File

@ -0,0 +1,25 @@
-- 12.08.2008 18:05:13 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
INSERT INTO AD_Form (AD_Client_ID,AD_Form_ID,AD_Org_ID,AccessLevel,Classname,Created,CreatedBy,Description,EntityType,Help,IsActive,IsBetaFunctionality,Name,Updated,UpdatedBy) VALUES (0,53013,0,'6','org.eevolution.form.WFPanelManufacturing',TO_DATE('2008-08-12 18:05:12','YYYY-MM-DD HH24:MI:SS'),0,'Edit Manufacturing Workflows','D','Edit the graphical layout of manufacturing workflows','Y','N','Manufacturing Workflow Editor',TO_DATE('2008-08-12 18:05:12','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 12.08.2008 18:05:13 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Form_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=53013 AND EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Form_ID!=t.AD_Form_ID)
;
-- 12.08.2008 18:05:13 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
INSERT INTO AD_Form_Access (AD_Client_ID,AD_Form_ID,AD_Org_ID,AD_Role_ID,Created,CreatedBy,IsActive,Updated,UpdatedBy) VALUES (0,53013,0,0,TO_DATE('2008-08-12 18:05:13','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2008-08-12 18:05:13','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 12.08.2008 18:07:33 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
UPDATE AD_Menu SET AD_Form_ID=53013, Description='Edit Manufacturing Workflows', Name='Manufacturing Workflow Editor',Updated=TO_DATE('2008-08-12 18:07:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53128
;
-- 12.08.2008 18:07:33 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53128
;

View File

@ -0,0 +1,25 @@
-- 12.08.2008 18:05:13 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
INSERT INTO AD_Form (AD_Client_ID,AD_Form_ID,AD_Org_ID,AccessLevel,Classname,Created,CreatedBy,Description,EntityType,Help,IsActive,IsBetaFunctionality,Name,Updated,UpdatedBy) VALUES (0,53013,0,'6','org.eevolution.form.WFPanelManufacturing',TO_TIMESTAMP('2008-08-12 18:05:12','YYYY-MM-DD HH24:MI:SS'),0,'Edit Manufacturing Workflows','D','Edit the graphical layout of manufacturing workflows','Y','N','Manufacturing Workflow Editor',TO_TIMESTAMP('2008-08-12 18:05:12','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 12.08.2008 18:05:13 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Form_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=53013 AND EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Form_ID!=t.AD_Form_ID)
;
-- 12.08.2008 18:05:13 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
INSERT INTO AD_Form_Access (AD_Client_ID,AD_Form_ID,AD_Org_ID,AD_Role_ID,Created,CreatedBy,IsActive,Updated,UpdatedBy) VALUES (0,53013,0,0,TO_TIMESTAMP('2008-08-12 18:05:13','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2008-08-12 18:05:13','YYYY-MM-DD HH24:MI:SS'),0)
;
-- 12.08.2008 18:07:33 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
UPDATE AD_Menu SET AD_Form_ID=53013, Description='Edit Manufacturing Workflows', Name='Manufacturing Workflow Editor',Updated=TO_TIMESTAMP('2008-08-12 18:07:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Menu_ID=53128
;
-- 12.08.2008 18:07:33 EEST
-- FR [ 2048081 ] Mf. Workflow editor should display only mf. workflows
UPDATE AD_Menu_Trl SET IsTranslated='N' WHERE AD_Menu_ID=53128
;