[ 1782412 ] Add Document Action Access Functionality

This commit is contained in:
Carlos Ruiz 2008-01-31 19:26:02 +00:00
parent 1b50451ee6
commit 27a5840282
1 changed files with 42 additions and 16 deletions

View File

@ -16,19 +16,33 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.grid.ed; package org.compiere.grid.ed;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.event.*; import java.awt.Dimension;
import java.util.*; import java.awt.FlowLayout;
import java.util.logging.*; import java.awt.event.ActionEvent;
import javax.swing.*; import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.logging.Level;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.adempiere.plaf.AdempierePLAF; import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.*; import org.compiere.apps.ADialog;
import org.compiere.model.*; import org.compiere.apps.AEnv;
import org.compiere.process.*; import org.compiere.apps.ConfirmPanel;
import org.compiere.swing.*; import org.compiere.model.GridTab;
import org.compiere.util.*; import org.compiere.process.DocumentEngine;
import org.compiere.wf.*; import org.compiere.swing.CComboBox;
import org.compiere.swing.CDialog;
import org.compiere.swing.CPanel;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.wf.MWFActivity;
/** /**
* Displays valid Document Action Options based on context * Displays valid Document Action Options based on context
@ -190,7 +204,7 @@ public class VDocAction extends CDialog
int index = 0; int index = 0;
/** /**
* Check Existence of Workflow Acrivities * Check Existence of Workflow Activities
*/ */
String wfStatus = MWFActivity.getActiveInfo(Env.getCtx(), m_AD_Table_ID, Record_ID); String wfStatus = MWFActivity.getActiveInfo(Env.getCtx(), m_AD_Table_ID, Record_ID);
if (wfStatus != null) if (wfStatus != null)
@ -212,6 +226,18 @@ public class VDocAction extends CDialog
String[] docActionHolder = new String[] {DocAction}; String[] docActionHolder = new String[] {DocAction};
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);
Integer doctypeId = (Integer)m_mTab.getValue("C_DocType_ID");
if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)m_mTab.getValue("C_DocTypeTarget_ID");
}
log.fine("get doctype: " + doctypeId);
if (doctypeId != null) {
index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),
Env.getAD_Role_ID(Env.getCtx()),
doctypeId, options, index);
}
DocAction = docActionHolder[0]; DocAction = docActionHolder[0];
/** /**
@ -219,7 +245,7 @@ public class VDocAction extends CDialog
*/ */
for (int i = 0; i < index; i++) for (int i = 0; i < index; i++)
{ {
// Serach for option and add it // Search for option and add it
boolean added = false; boolean added = false;
for (int j = 0; j < s_value.length && !added; j++) for (int j = 0; j < s_value.length && !added; j++)
if (options[i].equals(s_value[j])) if (options[i].equals(s_value[j]))
@ -337,7 +363,7 @@ public class VDocAction extends CDialog
* ActionCombo: display the description for the selection * ActionCombo: display the description for the selection
*/ */
int index = getSelectedIndex(); int index = getSelectedIndex();
// Display descriprion // Display description
if (index != -1) if (index != -1)
{ {
message.setText(s_description[index]); message.setText(s_description[index]);