Implement [2892393] - Flexibilize DocumentEngine getValidActions

https://sourceforge.net/tracker/?func=detail&aid=2892393&group_id=176962&atid=879335
This commit is contained in:
Carlos Ruiz 2009-11-05 05:53:57 +00:00
parent 5562699088
commit d8d2972ba6
3 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,42 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.process;
/**
* Document Options Interface
*
* @author Carlos Ruiz
*/
public interface DocOptions
{
/**
* Customize Valid Actions
* @param docStatus
* @param processing
* @param orderType
* @param isSOTrx
* @param AD_Table_ID
* @param docAction
* @param options
* @param index
* @return Number of valid options
*/
public int customizeValidActions (String docStatus, Object processing,
String orderType, String isSOTrx, int AD_Table_ID, String[] docAction, String[] options, int index);
} // DocAction

View File

@ -34,6 +34,9 @@ import org.compiere.apps.ADialog;
import org.compiere.apps.AEnv; import org.compiere.apps.AEnv;
import org.compiere.apps.ConfirmPanel; import org.compiere.apps.ConfirmPanel;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.process.DocOptions;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.swing.CComboBox; import org.compiere.swing.CComboBox;
import org.compiere.swing.CDialog; import org.compiere.swing.CDialog;
@ -232,6 +235,12 @@ public class VDocAction extends CDialog
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx, m_AD_Table_ID, index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx, m_AD_Table_ID,
docActionHolder, options); docActionHolder, options);
MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID);
PO po = table.getPO(Record_ID, null);
if (po instanceof DocOptions)
index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options, index);
Integer doctypeId = (Integer)m_mTab.getValue("C_DocType_ID"); Integer doctypeId = (Integer)m_mTab.getValue("C_DocType_ID");
if(doctypeId==null || doctypeId.intValue()==0){ if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID"); doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID");

View File

@ -29,6 +29,9 @@ import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.process.DocOptions;
import org.compiere.process.DocumentEngine; import org.compiere.process.DocumentEngine;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -150,6 +153,12 @@ public class WDocActionPanel extends Window implements EventListener
index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx, index = DocumentEngine.getValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options); m_AD_Table_ID, docActionHolder, options);
MTable table = MTable.get(Env.getCtx(), m_AD_Table_ID);
PO po = table.getPO(gridTab.getRecord_ID(), null);
if (po instanceof DocOptions)
index = ((DocOptions) po).customizeValidActions(DocStatus, Processing, OrderType, IsSOTrx,
m_AD_Table_ID, docActionHolder, options, index);
Integer doctypeId = (Integer)gridTab.getValue("C_DocType_ID"); Integer doctypeId = (Integer)gridTab.getValue("C_DocType_ID");
if(doctypeId==null || doctypeId.intValue()==0){ if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID"); doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID");