hg merge release-2.1 (merge release2.1 into development)

This commit is contained in:
Carlos Ruiz 2015-02-04 11:39:56 -05:00
commit 942ae9aed9
29 changed files with 526 additions and 302 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jan 16, 2015 5:50:47 PM COT
-- IDEMPIERE-2405 Implement SaaS support for Setup Wizard
UPDATE AD_Val_Rule SET Code='AD_Workflow.WorkflowType IN (''G'',''W'')',Updated=TO_DATE('2015-01-16 17:50:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52006
;
SELECT register_migration_script('201501161751_IDEMPIERE-2405.sql') FROM dual
;

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- 29/01/2015 08:52:11 AM COT
-- IDEMPIERE-2050 Improvement to Menu Lookup
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200060,0,0,TO_DATE('2015-01-29 08:52:10','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2015-01-29 08:52:10','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER','3','Max results in document controller search (IDEMPIERE-2050)','D','C','2342e731-5157-42c3-986b-28ed24862694')
;
SELECT register_migration_script('201501290852_IDEMPIERE-2050.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- Jan 16, 2015 5:50:47 PM COT
-- IDEMPIERE-2405 Implement SaaS support for Setup Wizard
UPDATE AD_Val_Rule SET Code='AD_Workflow.WorkflowType IN (''G'',''W'')',Updated=TO_TIMESTAMP('2015-01-16 17:50:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52006
;
SELECT register_migration_script('201501161751_IDEMPIERE-2405.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- 29/01/2015 08:52:11 AM COT
-- IDEMPIERE-2050 Improvement to Menu Lookup
INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200060,0,0,TO_TIMESTAMP('2015-01-29 08:52:10','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2015-01-29 08:52:10','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','MAX_RESULTS_PER_SEARCH_IN_DOCUMENT_CONTROLLER','3','Max results in document controller search (IDEMPIERE-2050)','D','C','2342e731-5157-42c3-986b-28ed24862694')
;
SELECT register_migration_script('201501290852_IDEMPIERE-2050.sql') FROM dual
;

View File

@ -463,11 +463,10 @@ public class GridTabCSVExporter implements IGridTabExporter
if (DisplayType.isLookup(column.getAD_Reference_ID())) { if (DisplayType.isLookup(column.getAD_Reference_ID())) {
// resolve to identifier - search for value first, if not search for name - if not use the ID // resolve to identifier - search for value first, if not search for name - if not use the ID
String foreignTable = column.getReferenceTableName(); String foreignTable = column.getReferenceTableName();
if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable))) { if ( ! ("AD_Language".equals(foreignTable) || "AD_EntityType".equals(foreignTable) || "AD_Ref_List".equals(foreignTable))) {
MTable fTable = MTable.get(Env.getCtx(), foreignTable); MTable fTable = MTable.get(Env.getCtx(), foreignTable);
// Hardcoded / do not check for Value on AD_Org, AD_User and AD_Ref_List, must use name for these two tables // Hardcoded / do not check for Value on AD_Org, AD_User and AD_Ref_List, must use name for these two tables
if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable) || "AD_Ref_List".equals(foreignTable)) if (! ("AD_Org".equals(foreignTable) || "AD_User".equals(foreignTable)) && fTable.getColumn("Value") != null) {
&& fTable.getColumn("Value") != null) {
name.append("[Value]"); // fully qualified name.append("[Value]"); // fully qualified
} else if (fTable.getColumn("Name") != null) { } else if (fTable.getColumn("Name") != null) {
name.append("[Name]"); name.append("[Name]");
@ -540,17 +539,17 @@ public class GridTabCSVExporter implements IGridTabExporter
int AD_Field_ID = Integer.parseInt(fieldIdStr); int AD_Field_ID = Integer.parseInt(fieldIdStr);
for (GridField gridField : tmpFields) for (GridField gridField : tmpFields)
{ {
if ( gridField.isVirtualColumn() if (gridField.getAD_Field_ID() == AD_Field_ID) {
|| gridField.isEncrypted() if ( gridField.isVirtualColumn()
|| gridField.isEncryptedColumn() || gridField.isEncrypted()
|| !(gridField.isDisplayed() || gridField.isDisplayedGrid())) || gridField.isEncryptedColumn()
continue; || !(gridField.isDisplayed() || gridField.isDisplayedGrid())
|| gridField.isReadOnly()
if (gridField.getAD_Field_ID() == AD_Field_ID) || (DisplayType.Button == MColumn.get(Env.getCtx(),gridField.getAD_Column_ID()).getAD_Reference_ID())
{ )
if (!gridField.isReadOnly() && gridField.isDisplayedGrid() && !(DisplayType.Button == MColumn.get(Env.getCtx(),gridField.getAD_Column_ID()).getAD_Reference_ID())) continue;
fieldList.add(gridField);
fieldList.add(gridField);
break; break;
} }
} }

View File

@ -866,7 +866,7 @@ public class GridTabCSVImporter implements IGridTabImporter
if(value == null) if(value == null)
continue; continue;
if(columnName.endsWith("_ID") && "0".equals(value)) if (columnName.endsWith("_ID") && "0".equals(value) && ! MTable.isZeroIDTable(gridTab.getTableName()))
continue; continue;
boolean isKeyColumn= columnName.indexOf("/") > 0; boolean isKeyColumn= columnName.indexOf("/") > 0;

View File

@ -577,12 +577,6 @@ public abstract class Convert
prm_COMMENT = MSysConfig.getValue(MSysConfig.PROJECT_ID_COMMENTS); prm_COMMENT = MSysConfig.getValue(MSysConfig.PROJECT_ID_COMMENTS);
else else
prm_COMMENT = MSysConfig.getValue(MSysConfig.DICTIONARY_ID_COMMENTS); prm_COMMENT = MSysConfig.getValue(MSysConfig.DICTIONARY_ID_COMMENTS);
// log time and date
SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.DateTime);
String dateTimeText = format.format(new Timestamp(System.currentTimeMillis()));
w.append("-- ");
w.append(dateTimeText);
w.append("\n");
if (prm_COMMENT != null && ! m_oldprm_COMMENT.equals(prm_COMMENT)) { if (prm_COMMENT != null && ! m_oldprm_COMMENT.equals(prm_COMMENT)) {
// log sysconfig comment // log sysconfig comment
w.append("-- "); w.append("-- ");
@ -591,6 +585,12 @@ public abstract class Convert
if (w == writerPg) if (w == writerPg)
m_oldprm_COMMENT = prm_COMMENT; m_oldprm_COMMENT = prm_COMMENT;
} }
// log time and date
SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.DateTime);
String dateTimeText = format.format(new Timestamp(System.currentTimeMillis()));
w.append("-- ");
w.append(dateTimeText);
w.append("\n");
// log statement // log statement
w.append(statement); w.append(statement);
// close statement // close statement

View File

@ -182,7 +182,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
/** A list of event listeners for this component. */ /** A list of event listeners for this component. */
protected EventListenerList m_listenerList = new EventListenerList(); protected EventListenerList m_listenerList = new EventListenerList();
/** Current Data Status Event */ /** Current Data Status Event */
private DataStatusEvent m_DataStatusEvent = null; private volatile DataStatusEvent m_DataStatusEvent = null;
/** Query */ /** Query */
private MQuery m_query = new MQuery(); private MQuery m_query = new MQuery();
private String m_oldQuery = "0=9"; private String m_oldQuery = "0=9";
@ -2346,6 +2346,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
*/ */
private void fireDataStatusChanged (DataStatusEvent e) private void fireDataStatusChanged (DataStatusEvent e)
{ {
if (e == null) {
log.warning("IDEMPIERE-2449 - event must not arrive null here -> " + Thread.currentThread().getStackTrace());
return; // avoid NPE below
}
DataStatusListener[] listeners = m_listenerList.getListeners(DataStatusListener.class); DataStatusListener[] listeners = m_listenerList.getListeners(DataStatusListener.class);
if (listeners.length == 0) if (listeners.length == 0)
return; return;

View File

@ -222,6 +222,7 @@ public class MConversionRate extends X_C_Conversion_Rate
+ " AND ? BETWEEN ValidFrom AND ValidTo" // #4 TRUNC (?) ORA-00932: inconsistent datatypes: expected NUMBER got TIMESTAMP + " AND ? BETWEEN ValidFrom AND ValidTo" // #4 TRUNC (?) ORA-00932: inconsistent datatypes: expected NUMBER got TIMESTAMP
+ " AND AD_Client_ID IN (0,?)" // #5 + " AND AD_Client_ID IN (0,?)" // #5
+ " AND AD_Org_ID IN (0,?) " // #6 + " AND AD_Org_ID IN (0,?) " // #6
+ " AND IsActive = 'Y' "
+ "ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, ValidFrom DESC"; + "ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, ValidFrom DESC";
BigDecimal retValue = null; BigDecimal retValue = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;

View File

@ -0,0 +1,62 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/**
* Context Help Model
*
* @author Carlos Ruiz
*/
public class MCtxHelp extends X_AD_CtxHelp {
/**
*
*/
private static final long serialVersionUID = 2824732566905179805L;
/**
* Standard Constructor
* @param ctx context
* @param AD_CtxHelp_ID
* @param trxName transaction
*/
public MCtxHelp (Properties ctx, int AD_CtxHelp_ID, String trxName) {
super (ctx, AD_CtxHelp_ID, trxName);
} // MCtxHelp
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MCtxHelp (Properties ctx, ResultSet rs, String trxName) {
super(ctx, rs, trxName);
} // MCtxHelp
} // MCtxHelp

View File

@ -0,0 +1,196 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz - globalqss *
**********************************************************************/
package org.compiere.model;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* Context Help Message Model
*
* @author Carlos Ruiz
*/
public class MCtxHelpMsg extends X_AD_CtxHelpMsg {
/**
*
*/
private static final long serialVersionUID = -7892179461720143685L;
/** Logging */
private static CLogger s_log = CLogger.getCLogger(MCtxHelpMsg.class);
/** Context Help Message Cache */
private static CCache<String, String> s_cache = new CCache<String, String>(Table_Name, 10);
/**
* Standard Constructor
* @param ctx context
* @param AD_CtxHelpMsg_ID
* @param trxName transaction
*/
public MCtxHelpMsg (Properties ctx, int AD_CtxHelpMsg_ID, String trxName) {
super (ctx, AD_CtxHelpMsg_ID, trxName);
} // MCtxHelpMsg
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MCtxHelpMsg (Properties ctx, ResultSet rs, String trxName) {
super(ctx, rs, trxName);
} // MCtxHelpMsg
/**
* Get the context help message defined for the type, recordid, language, client, org
* @param ctx
* @param ctxtype
* @param recordId
* @return the message translated
*/
public static String get(Properties ctx, String ctxType, int recordId) {
StringBuilder key = new StringBuilder()
.append(ctxType).append("|")
.append(recordId).append("|")
.append(Env.getAD_Client_ID(ctx)).append("|")
.append(Env.getAD_Org_ID(ctx)).append("|")
.append(Env.getAD_Language(Env.getCtx()));
String retValue = null;
if (s_cache.containsKey(key.toString())) {
retValue = s_cache.get(key.toString());
if (s_log.isLoggable(Level.FINEST)) s_log.finest("Cache: " + retValue);
return retValue;
}
int AD_CtxHelp_ID = getCtxHelpID(ctxType, recordId);
if (AD_CtxHelp_ID > 0) {
StringBuilder sql = new StringBuilder();
if (Env.isBaseLanguage(Env.getCtx(), X_AD_CtxHelpMsg.Table_Name)) {
sql.append("SELECT MsgText ");
sql.append("FROM AD_CtxHelpMsg ");
sql.append("WHERE IsActive = 'Y' ");
sql.append("AND AD_Client_ID IN (0, ?) ");
sql.append("AND AD_Org_ID IN (0, ?) ");
sql.append("AND AD_CtxHelp_ID = ? ");
sql.append("ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, AD_CtxHelpMsg_ID DESC");
} else {
sql.append("SELECT mt.MsgText ");
sql.append("FROM AD_CtxHelpMsg m ");
sql.append("LEFT JOIN AD_CtxHelpMsg_Trl mt ON (mt.AD_CtxHelpMsg_ID = m.AD_CtxHelpMsg_ID AND mt.AD_Language = ?) ");
sql.append("WHERE mt.IsActive = 'Y' ");
sql.append("AND m.AD_Client_ID IN (0, ?) ");
sql.append("AND m.AD_Org_ID IN (0, ?) ");
sql.append("AND m.AD_CtxHelp_ID = ? ");
sql.append("ORDER BY m.AD_Client_ID DESC, m.AD_Org_ID DESC, m.AD_CtxHelpMsg_ID DESC");
}
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sql.toString(), null);
int count = 1;
if (!Env.isBaseLanguage(Env.getCtx(), X_AD_CtxHelpMsg.Table_Name))
pstmt.setString(count++, Env.getAD_Language(Env.getCtx()));
pstmt.setInt(count++, Env.getAD_Client_ID(ctx));
pstmt.setInt(count++, Env.getAD_Org_ID(ctx));
pstmt.setInt(count++, AD_CtxHelp_ID);
rs = pstmt.executeQuery();
if (rs.next())
retValue = rs.getString(X_AD_CtxHelpMsg.COLUMNNAME_MsgText);
} catch (Exception e) {
throw new AdempiereException(e);
} finally {
DB.close(rs, pstmt);
rs=null; pstmt=null;
}
}
if (retValue == null)
retValue = "";
s_cache.put(key.toString(), retValue);
return retValue;
}
private static int getCtxHelpID(String ctxType, int recordId) {
Properties ctx = Env.getCtx();
String column;
String table;
if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab) {
column = X_AD_Tab.COLUMNNAME_AD_Tab_ID;
table = X_AD_Tab.Table_Name;
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Process) {
column = X_AD_Process.COLUMNNAME_AD_Process_ID;
table = X_AD_Process.Table_Name;
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Form) {
column = X_AD_Form.COLUMNNAME_AD_Form_ID;
table = X_AD_Form.Table_Name;
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Info) {
column = X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID;
table = X_AD_InfoWindow.Table_Name;
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Workflow) {
column = X_AD_Workflow.COLUMNNAME_AD_Workflow_ID;
table = X_AD_Workflow.Table_Name;
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Task) {
column = X_AD_Task.COLUMNNAME_AD_Task_ID;
table = X_AD_Task.Table_Name;
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Node) {
column = X_AD_WF_Node.COLUMNNAME_AD_WF_Node_ID;
table = X_AD_WF_Node.Table_Name;
} else {
column = "";
table = X_AD_CtxHelp.Table_Name;
}
StringBuilder sql = new StringBuilder();
sql.append("SELECT t.AD_CtxHelp_ID FROM ");
sql.append(table);
sql.append(" t, AD_CtxHelp h WHERE t.AD_CtxHelp_ID=h.AD_CtxHelp_ID AND t.IsActive='Y' AND h.IsActive='Y' AND h.AD_Client_ID IN (0, ?) AND h.AD_Org_ID IN (0, ?) ");
if (ctxType == X_AD_CtxHelp.CTXTYPE_Home) {
sql.append("AND h.CtxType");
} else if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab || ctxType == X_AD_CtxHelp.CTXTYPE_Process ||
ctxType == X_AD_CtxHelp.CTXTYPE_Form || ctxType == X_AD_CtxHelp.CTXTYPE_Info ||
ctxType == X_AD_CtxHelp.CTXTYPE_Workflow || ctxType == X_AD_CtxHelp.CTXTYPE_Task ||
ctxType == X_AD_CtxHelp.CTXTYPE_Node) {
sql.append("AND t.");
sql.append(column);
} else {
sql.append("AND 1"); // must not happen
}
sql.append("=? ");
sql.append("ORDER BY h.AD_Client_ID DESC, h.AD_Org_ID DESC, h.AD_CtxHelp_ID DESC");
return DB.getSQLValue(null, sql.toString(), Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx), ctxType == X_AD_CtxHelp.CTXTYPE_Home ? ctxType : recordId);
}
} // MCtxHelpMsg

View File

@ -617,8 +617,6 @@ public class MInventory extends X_M_Inventory implements DocAction
if(qtyDiff.compareTo(Env.ZERO)==0) if(qtyDiff.compareTo(Env.ZERO)==0)
return; return;
// Check Line
boolean needSave = false;
// Attribute Set Instance // Attribute Set Instance
if (line.getM_AttributeSetInstance_ID() == 0) if (line.getM_AttributeSetInstance_ID() == 0)
{ {
@ -693,11 +691,6 @@ public class MInventory extends X_M_Inventory implements DocAction
if (log.isLoggable(Level.FINE)) log.fine("##: " + lineMA); if (log.isLoggable(Level.FINE)) log.fine("##: " + lineMA);
} }
} // outgoing Trx } // outgoing Trx
if (needSave)
{
line.saveEx();
}
} // for all lines } // for all lines
} // checkMaterialPolicy } // checkMaterialPolicy

View File

@ -1957,13 +1957,14 @@ public class MPayment extends X_C_Payment
if (log.isLoggable(Level.INFO)) log.info(toString()); if (log.isLoggable(Level.INFO)) log.info(toString());
// Charge Handling // Charge Handling
boolean createdAllocationRecords = false;
if (getC_Charge_ID() != 0) if (getC_Charge_ID() != 0)
{ {
setIsAllocated(true); setIsAllocated(true);
} }
else else
{ {
allocateIt(); // Create Allocation Records createdAllocationRecords = allocateIt(); // Create Allocation Records
testAllocation(); testAllocation();
} }
@ -1973,7 +1974,7 @@ public class MPayment extends X_C_Payment
// MProject project = new MProject(getCtx(), getC_Project_ID()); // MProject project = new MProject(getCtx(), getC_Project_ID());
} }
// Update BP for Prepayments // Update BP for Prepayments
if (getC_BPartner_ID() != 0 && getC_Invoice_ID() == 0 && getC_Charge_ID() == 0 && MPaymentAllocate.get(this).length == 0) if (getC_BPartner_ID() != 0 && getC_Invoice_ID() == 0 && getC_Charge_ID() == 0 && MPaymentAllocate.get(this).length == 0 && !createdAllocationRecords)
{ {
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
DB.getDatabase().forUpdate(bp, 0); DB.getDatabase().forUpdate(bp, 0);
@ -2598,9 +2599,6 @@ public class MPayment extends X_C_Payment
} }
MPeriod.testPeriodOpen(getCtx(), dateAcct, getC_DocType_ID(), getAD_Org_ID()); MPeriod.testPeriodOpen(getCtx(), dateAcct, getC_DocType_ID(), getAD_Org_ID());
// Auto Reconcile if not on Bank Statement
boolean reconciled = getC_BankStatementLine_ID() == 0; //AZ Goodwill
// Create Reversal // Create Reversal
MPayment reversal = new MPayment (getCtx(), 0, get_TrxName()); MPayment reversal = new MPayment (getCtx(), 0, get_TrxName());
copyValues(this, reversal); copyValues(this, reversal);
@ -2619,7 +2617,7 @@ public class MPayment extends X_C_Payment
reversal.setOverUnderAmt(getOverUnderAmt().negate()); reversal.setOverUnderAmt(getOverUnderAmt().negate());
// //
reversal.setIsAllocated(true); reversal.setIsAllocated(true);
reversal.setIsReconciled(reconciled); // to put on bank statement reversal.setIsReconciled(false);
reversal.setIsOnline(false); reversal.setIsOnline(false);
reversal.setIsApproved(true); reversal.setIsApproved(true);
reversal.setR_PnRef(null); reversal.setR_PnRef(null);
@ -2649,7 +2647,6 @@ public class MPayment extends X_C_Payment
// Unlink & De-Allocate // Unlink & De-Allocate
deAllocate(accrual); deAllocate(accrual);
setIsReconciled (reconciled);
setIsAllocated (true); // the allocation below is overwritten setIsAllocated (true); // the allocation below is overwritten
// Set Status // Set Status
addDescription("(" + reversal.getDocumentNo() + "<-)"); addDescription("(" + reversal.getDocumentNo() + "<-)");

View File

@ -1496,7 +1496,7 @@ public final class MRole extends X_AD_Role
// first get the window access from the included and substitute roles // first get the window access from the included and substitute roles
mergeIncludedAccess("m_windowAccess"); // Load included accesses - metas-2009_0021_AP1_G94 mergeIncludedAccess("m_windowAccess"); // Load included accesses - metas-2009_0021_AP1_G94
// and now get the window access directly from this role // and now get the window access directly from this role
MClient client = MClient.get(getCtx(), getAD_Client_ID()); MClient client = MClient.get(Env.getCtx());
String ASPFilter = ""; String ASPFilter = "";
if (client.isUseASP()) if (client.isUseASP())
ASPFilter = ASPFilter =
@ -1583,7 +1583,7 @@ public final class MRole extends X_AD_Role
// first get the process access from the included and substitute roles // first get the process access from the included and substitute roles
mergeIncludedAccess("m_processAccess"); // Load included accesses - metas-2009_0021_AP1_G94 mergeIncludedAccess("m_processAccess"); // Load included accesses - metas-2009_0021_AP1_G94
// and now get the process access directly from this role // and now get the process access directly from this role
MClient client = MClient.get(getCtx(), getAD_Client_ID()); MClient client = MClient.get(Env.getCtx());
String ASPFilter = ""; String ASPFilter = "";
if (client.isUseASP()) if (client.isUseASP())
ASPFilter = ASPFilter =
@ -1665,7 +1665,7 @@ public final class MRole extends X_AD_Role
// first get the task access from the included and substitute roles // first get the task access from the included and substitute roles
mergeIncludedAccess("m_taskAccess"); // Load included accesses - metas-2009_0021_AP1_G94 mergeIncludedAccess("m_taskAccess"); // Load included accesses - metas-2009_0021_AP1_G94
// and now get the task access directly from this role // and now get the task access directly from this role
MClient client = MClient.get(getCtx(), getAD_Client_ID()); MClient client = MClient.get(Env.getCtx());
String ASPFilter = ""; String ASPFilter = "";
if (client.isUseASP()) if (client.isUseASP())
ASPFilter = ASPFilter =
@ -1745,7 +1745,7 @@ public final class MRole extends X_AD_Role
// first get the form access from the included and substitute roles // first get the form access from the included and substitute roles
mergeIncludedAccess("m_formAccess"); // Load included accesses - metas-2009_0021_AP1_G94 mergeIncludedAccess("m_formAccess"); // Load included accesses - metas-2009_0021_AP1_G94
// and now get the form access directly from this role // and now get the form access directly from this role
MClient client = MClient.get(getCtx(), getAD_Client_ID()); MClient client = MClient.get(Env.getCtx());
String ASPFilter = ""; String ASPFilter = "";
if (client.isUseASP()) if (client.isUseASP())
ASPFilter = ASPFilter =
@ -1825,7 +1825,7 @@ public final class MRole extends X_AD_Role
// first get the workflow access from the included and substitute roles // first get the workflow access from the included and substitute roles
mergeIncludedAccess("m_workflowAccess"); // Load included accesses - metas-2009_0021_AP1_G94 mergeIncludedAccess("m_workflowAccess"); // Load included accesses - metas-2009_0021_AP1_G94
// and now get the workflow access directly from this role // and now get the workflow access directly from this role
MClient client = MClient.get(getCtx(), getAD_Client_ID()); MClient client = MClient.get(Env.getCtx());
String ASPFilter = ""; String ASPFilter = "";
if (client.isUseASP()) if (client.isUseASP())
ASPFilter = ASPFilter =

View File

@ -375,7 +375,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
MProduct product = MProduct.get(Env.getCtx(), M_Product_ID); MProduct product = MProduct.get(Env.getCtx(), M_Product_ID);
if(product.isUseGuaranteeDateForMPolicy()){ if(product.isUseGuaranteeDateForMPolicy()){
sql += "ORDER BY l.PriorityNo DESC, asi.GuaranteeDate"; sql += "ORDER BY l.PriorityNo DESC, COALESCE(asi.GuaranteeDate,s.DateMaterialPolicy)";
if (!FiFo) if (!FiFo)
sql += " DESC"; sql += " DESC";
} }

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/** /**
* *
*/ */
private static final long serialVersionUID = -1248226696518701944L; private static final long serialVersionUID = 6107779915945715515L;
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
@ -118,6 +118,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String RecentItems_MaxShown = "RecentItems_MaxShown"; public static final String RecentItems_MaxShown = "RecentItems_MaxShown";
public static final String REPORT_SWAP_MAX_ROWS = "REPORT_SWAP_MAX_ROWS"; public static final String REPORT_SWAP_MAX_ROWS = "REPORT_SWAP_MAX_ROWS";
public static final String SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE = "SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE"; public static final String SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE = "SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE";
public static final String STANDARD_REPORT_FOOTER_TRADEMARK_TEXT = "STANDARD_REPORT_FOOTER_TRADEMARK_TEXT";
public static final String START_VALUE_BPLOCATION_NAME = "START_VALUE_BPLOCATION_NAME"; public static final String START_VALUE_BPLOCATION_NAME = "START_VALUE_BPLOCATION_NAME";
public static final String SWING_LOGIN_ALLOW_REMEMBER_ME = "SWING_LOGIN_ALLOW_REMEMBER_ME"; public static final String SWING_LOGIN_ALLOW_REMEMBER_ME = "SWING_LOGIN_ALLOW_REMEMBER_ME";
public static final String SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR = "SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR"; public static final String SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR = "SWING_OVERRIDE_TEXT_AREA_BEHAVIOUR";
@ -142,6 +143,8 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL"; public static final String ZK_DASHBOARD_REFRESH_INTERVAL = "ZK_DASHBOARD_REFRESH_INTERVAL";
public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD"; public static final String ZK_DECIMALBOX_PROCESS_DOTKEYPAD = "ZK_DECIMALBOX_PROCESS_DOTKEYPAD";
public static final String ZK_DESKTOP_CLASS = "ZK_DESKTOP_CLASS"; public static final String ZK_DESKTOP_CLASS = "ZK_DESKTOP_CLASS";
public static final String ZK_FOOTER_SERVER_DATETIME_FORMAT = "ZK_FOOTER_SERVER_DATETIME_FORMAT";
public static final String ZK_FOOTER_SERVER_MSG = "ZK_FOOTER_SERVER_MSG";
public static final String ZK_GRID_EDIT_MODELESS = "ZK_GRID_EDIT_MODELESS"; public static final String ZK_GRID_EDIT_MODELESS = "ZK_GRID_EDIT_MODELESS";
public static final String ZK_LOGIN_ALLOW_REMEMBER_ME = "ZK_LOGIN_ALLOW_REMEMBER_ME"; public static final String ZK_LOGIN_ALLOW_REMEMBER_ME = "ZK_LOGIN_ALLOW_REMEMBER_ME";
public static final String ZK_LOGO_LARGE = "ZK_LOGO_LARGE"; public static final String ZK_LOGO_LARGE = "ZK_LOGO_LARGE";

View File

@ -50,6 +50,7 @@ public class SystemIDs
public final static int FORM_PAYMENT_PRINT_EXPORT = 106; public final static int FORM_PAYMENT_PRINT_EXPORT = 106;
public final static int FORM_ARCHIVEVIEWER = 118; public final static int FORM_ARCHIVEVIEWER = 118;
public final static int FORM_REPORT_WIZARD = 200002; public final static int FORM_REPORT_WIZARD = 200002;
public final static int FORM_SETUP_WIZARD = 200000;
public final static int MENU_NOTICE = 233; public final static int MENU_NOTICE = 233;

View File

@ -37,6 +37,7 @@ import java.io.Reader;
import java.io.Serializable; import java.io.Serializable;
import java.net.URL; import java.net.URL;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Properties; import java.util.Properties;
@ -48,6 +49,7 @@ import javax.print.attribute.DocAttributeSet;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PrintInfo; import org.compiere.model.PrintInfo;
import org.compiere.print.ArchiveEngine; import org.compiere.print.ArchiveEngine;
@ -70,6 +72,7 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.Util;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
/** /**
@ -969,12 +972,19 @@ public class LayoutEngine implements Pageable, Printable, Doc
element.setLocation(ft); element.setLocation(ft);
m_headerFooter.addElement(element); m_headerFooter.addElement(element);
// //
element = new StringElement("@*Header@", font, color, null, true); String s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_MSG, "@*Header@", Env.getAD_Client_ID(Env.getCtx()));
element = new StringElement(s, font, color, null, true);
element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center); element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_Center);
element.setLocation(ft); element.setLocation(ft);
m_headerFooter.addElement(element); m_headerFooter.addElement(element);
// //
element = new StringElement("@*CurrentDateTime@", font, color, null, true); String timestamp = "";
s = MSysConfig.getValue(MSysConfig.ZK_FOOTER_SERVER_DATETIME_FORMAT, Env.getAD_Client_ID(Env.getCtx()));
if (!Util.isEmpty(s))
timestamp = new SimpleDateFormat(s).format(System.currentTimeMillis());
else
timestamp = "@*CurrentDateTime@";
element = new StringElement(timestamp, font, color, null, true);
element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight); element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight);
element.setLocation(ft); element.setLocation(ft);
m_headerFooter.addElement(element); m_headerFooter.addElement(element);

View File

@ -59,6 +59,7 @@ import org.compiere.model.MLookupCache;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MSession; import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.MZoomCondition; import org.compiere.model.MZoomCondition;
import org.compiere.model.PO; import org.compiere.model.PO;
@ -1849,8 +1850,12 @@ public final class Env
* @return trademark text for standard report footer * @return trademark text for standard report footer
*/ */
public static String getStandardReportFooterTrademarkText() { public static String getStandardReportFooterTrademarkText() {
String s = Env.getContext(Env.getCtx(), STANDARD_REPORT_FOOTER_TRADEMARK_TEXT); String s = MSysConfig.getValue(MSysConfig.STANDARD_REPORT_FOOTER_TRADEMARK_TEXT, Env.getAD_Client_ID(Env.getCtx()));
return Util.isEmpty(s) ? Adempiere.ADEMPIERE_R : s; if (Util.isEmpty(s))
s = Env.getContext(Env.getCtx(), STANDARD_REPORT_FOOTER_TRADEMARK_TEXT);
if (Util.isEmpty(s))
s = Adempiere.ADEMPIERE_R;
return s;
} }
public static int getZoomWindowID(MQuery query) public static int getZoomWindowID(MQuery query)

View File

@ -189,7 +189,7 @@ public class BankTransfer extends SvrProcess
paymentBankTo.setC_BPartner_ID (p_C_BPartner_ID); paymentBankTo.setC_BPartner_ID (p_C_BPartner_ID);
paymentBankTo.setC_Currency_ID(p_C_Currency_ID); paymentBankTo.setC_Currency_ID(p_C_Currency_ID);
if (p_C_ConversionType_ID > 0) if (p_C_ConversionType_ID > 0)
paymentBankFrom.setC_ConversionType_ID(p_C_ConversionType_ID); paymentBankTo.setC_ConversionType_ID(p_C_ConversionType_ID);
paymentBankTo.setPayAmt(p_Amount); paymentBankTo.setPayAmt(p_Amount);
paymentBankTo.setOverUnderAmt(Env.ZERO); paymentBankTo.setOverUnderAmt(Env.ZERO);
paymentBankTo.setC_DocType_ID(true); paymentBankTo.setC_DocType_ID(true);

View File

@ -195,14 +195,16 @@ public class PoFiller{
String sAD_Client_ID = clientElement != null ? clientElement.contents.toString() : null; String sAD_Client_ID = clientElement != null ? clientElement.contents.toString() : null;
if (sAD_Client_ID != null && sAD_Client_ID.equals("0")) if (sAD_Client_ID != null && sAD_Client_ID.equals("0"))
{ {
po.set_ValueNoCheck("AD_Client_ID", 0); if (po.getAD_Client_ID() != 0)
po.setAD_Org_ID(0); po.set_ValueNoCheck("AD_Client_ID", 0);
if (po.getAD_Org_ID() != 0)
po.setAD_Org_ID(0);
} }
else else
{ {
Element orgElement = element.properties.get("AD_Org_ID"); Element orgElement = element.properties.get("AD_Org_ID");
String sAD_Org_ID = orgElement != null ? orgElement.contents.toString() : null; String sAD_Org_ID = orgElement != null ? orgElement.contents.toString() : null;
if (sAD_Org_ID != null && sAD_Org_ID.equals("0")) if (sAD_Org_ID != null && sAD_Org_ID.equals("0") && po.getAD_Org_ID() != 0)
po.setAD_Org_ID(0); po.setAD_Org_ID(0);
else if (sAD_Org_ID != null && sAD_Org_ID.equals("@AD_Org_ID@")) else if (sAD_Org_ID != null && sAD_Org_ID.equals("@AD_Org_ID@"))
po.setAD_Org_ID(Env.getAD_Org_ID(ctx.ctx)); po.setAD_Org_ID(Env.getAD_Org_ID(ctx.ctx));

View File

@ -43,6 +43,7 @@ import org.adempiere.webui.util.TreeUtils;
import org.compiere.apps.form.SetupWizard; import org.compiere.apps.form.SetupWizard;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
import org.compiere.model.MRole;
import org.compiere.model.X_AD_CtxHelp; import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -68,6 +69,7 @@ import org.zkoss.zul.Treechildren;
import org.zkoss.zul.Treeitem; import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow; import org.zkoss.zul.Treerow;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/** /**
* View for Setup Wizard * View for Setup Wizard
* *
@ -80,12 +82,16 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
private Borderlayout mainLayout = new Borderlayout(); private Borderlayout mainLayout = new Borderlayout();
private Panel northPanel = new Panel(); private Panel northPanel = new Panel();
private Progressmeter progressbar = new Progressmeter(); private Progressmeter progressbar = new Progressmeter();
private Label progressLabel = new Label(); private Label progressLabel = new Label();
// //
private Tree wfnodeTree; private Tree wfnodeTree;
private Treeitem prevti = null; private Treeitem prevti = null;
private Treeitem firstti = null; private Treeitem firstOpenNode = null;
private Treeitem firstOpenWF = null;
private Treeitem firstWF = null;
private int cntNodes = 0;
private int cntSolved = 0;
private Label pretitleLabel = new Label(Msg.getMsg(Env.getCtx(), "SetupTask")); private Label pretitleLabel = new Label(Msg.getMsg(Env.getCtx(), "SetupTask"));
private Label titleLabel = new Label(); private Label titleLabel = new Label();
@ -131,7 +137,7 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
} }
catch (Exception ex) catch (Exception ex)
{ {
log.log(Level.SEVERE, "VTreeMaintenance.init", ex); log.log(Level.SEVERE, "WSetupWizard.init", ex);
} }
} // init } // init
@ -179,6 +185,8 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
* Load Wizard Nodes * Load Wizard Nodes
*/ */
private void loadWizardNodes() { private void loadWizardNodes() {
cntNodes = 0;
cntSolved = 0;
nextItems.removeAll(nextItems); nextItems.removeAll(nextItems);
Treechildren treeChildren = wfnodeTree.getTreechildren(); Treechildren treeChildren = wfnodeTree.getTreechildren();
List<MWorkflow> wfwizards = getWfWizards(); List<MWorkflow> wfwizards = getWfWizards();
@ -198,18 +206,29 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
protected void addWfEntry(MWorkflow wfwizard) { protected void addWfEntry(MWorkflow wfwizard) {
allFinished = true; allFinished = true;
allPending = true; allPending = true;
Treechildren treeChildren = wfnodeTree.getTreechildren();
Treeitem treeitemwf = new Treeitem(); Treeitem treeitemwf = new Treeitem();
Treechildren treeChildren = wfnodeTree.getTreechildren();
treeChildren.appendChild(treeitemwf); treeChildren.appendChild(treeitemwf);
if (firstti == null) nextItems.add(treeitemwf);
firstti = treeitemwf; addNodes(wfwizard, treeitemwf);
if ( treeitemwf.getTreechildren() == null
|| treeitemwf.getTreechildren().getChildren() == null
|| treeitemwf.getTreechildren().getChildren().size() == 0) {
// no nodes
treeChildren.removeChild(treeitemwf);
nextItems.remove(treeitemwf);
treeitemwf = null;
return;
}
if (firstWF == null)
firstWF = treeitemwf;
Label wizardLabel = new Label(wfwizard.getName(true)); Label wizardLabel = new Label(wfwizard.getName(true));
wizardLabel.setStyle(WIZARD_LABEL_STYLE); wizardLabel.setStyle(WIZARD_LABEL_STYLE);
Div div = new Div(); Div div = new Div();
div.setStyle("display:inline;"); div.setStyle("display:inline;");
div.appendChild(wizardLabel); div.appendChild(wizardLabel);
Treerow treerow = new Treerow(); Treerow treerow = new Treerow();
treerow.setStyle("vertical-align:top;"); treerow.setStyle("vertical-align:top;");
treeitemwf.appendChild(treerow); treeitemwf.appendChild(treerow);
@ -217,13 +236,19 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
Treecell treecell = new Treecell(); Treecell treecell = new Treecell();
treerow.appendChild(treecell); treerow.appendChild(treecell);
treecell.appendChild(div); treecell.appendChild(div);
nextItems.add(treeitemwf);
if (openNodes.contains(wfwizard.getAD_Workflow_ID())) if (openNodes.contains(wfwizard.getAD_Workflow_ID()))
treeitemwf.setOpen(true); treeitemwf.setOpen(true);
addNodes(wfwizard, treeitemwf); if (firstOpenWF == treeitemwf && allPending) {
firstOpenNode = firstOpenWF;
}
if (showColors.isChecked() && (allFinished || !allPending)) if (showColors.isChecked()) {
wizardLabel.setZclass(allFinished ? "tree-wsetupwizard-finished-all" : "tree-wsetupwizard-open-tasks"); if (allFinished) {
wizardLabel.setZclass("tree-wsetupwizard-finished-all");
} else if (!allPending) {
wizardLabel.setZclass("tree-wsetupwizard-open-tasks");
}
}
treeitemwf.setAttribute("AD_Workflow_ID", wfwizard.getAD_Workflow_ID()); treeitemwf.setAttribute("AD_Workflow_ID", wfwizard.getAD_Workflow_ID());
if (prevti != null && prevti.getAttribute("AD_Workflow_ID") != null) { if (prevti != null && prevti.getAttribute("AD_Workflow_ID") != null) {
@ -241,40 +266,48 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
} }
private void addWfNode(MWFNode node, Treeitem treeitemwf) { private void addWfNode(MWFNode node, Treeitem treeitemwf) {
/* TODO: Color of node according to wizard status */ if (MWFNode.ACTION_UserWindow.equals(node.getAction()) && node.getAD_Window_ID() > 0) {
Label nodeLabel = new Label(node.getName(true)); if (MRole.getDefault().getWindowAccess(node.getAD_Window_ID()) == null)
if (node != null && showColors.isChecked()) { return;
MWizardProcess wp = MWizardProcess.get(Env.getCtx(), node.getAD_WF_Node_ID(), Env.getAD_Client_ID(Env.getCtx())); } else if (MWFNode.ACTION_UserForm.equals(node.getAction()) && node.getAD_Form_ID() > 0) {
String status = wp.getWizardStatus(); if (MRole.getDefault().getFormAccess(node.getAD_Form_ID()) == null)
if (MWizardProcess.WIZARDSTATUS_Finished.equals(status)){ return;
nodeLabel.setZclass("tree-wsetupwizard-finished"); } else if ((MWFNode.ACTION_AppsProcess.equals(node.getAction()) || MWFNode.ACTION_AppsReport.equals(node.getAction())) && node.getAD_Process_ID() > 0) {
allFinished = allFinished && true; if (MRole.getDefault().getProcessAccess(node.getAD_Process_ID()) == null)
allPending = allPending && false; return;
}else if (MWizardProcess.WIZARDSTATUS_Skipped.equals(status)) { } else if (MWFNode.ACTION_AppsTask.equals(node.getAction()) && node.getAD_Task_ID() > 0) {
nodeLabel.setZclass("tree-wsetupwizard-skipped"); if (MRole.getDefault().getTaskAccess(node.getAD_Task_ID()) == null)
allFinished = allFinished && true; return;
allPending = allPending && false;
}else if (MWizardProcess.WIZARDSTATUS_Delayed.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-delayed");
allFinished = allFinished && false;
allPending = allPending && false;
}else if (MWizardProcess.WIZARDSTATUS_In_Progress.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-in-progress");
allFinished = allFinished && false;
allPending = allPending && false;
}else if (MWizardProcess.WIZARDSTATUS_Pending.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-pending");
allFinished = allFinished && false;
allPending = allPending && true;
}else {
nodeLabel.setZclass("tree-setupwizard-nostatus");
allFinished = false;
allPending = allPending && true;
}
}else{
nodeLabel.setStyle("margin-left:20px;");
} }
/* Color of node according to wizard status */
Label nodeLabel = new Label(node.getName(true));
MWizardProcess wp = MWizardProcess.get(Env.getCtx(), node.getAD_WF_Node_ID(), Env.getAD_Client_ID(Env.getCtx()));
String status = wp.getWizardStatus();
if (showColors.isChecked()) {
if (MWizardProcess.WIZARDSTATUS_Finished.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-finished");
} else if (MWizardProcess.WIZARDSTATUS_Skipped.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-skipped");
} else if (MWizardProcess.WIZARDSTATUS_Delayed.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-delayed");
} else if (MWizardProcess.WIZARDSTATUS_In_Progress.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-in-progress");
} else if (MWizardProcess.WIZARDSTATUS_Pending.equals(status)) {
nodeLabel.setZclass("tree-wsetupwizard-pending");
} else {
nodeLabel.setZclass("tree-setupwizard-nostatus");
}
}
cntNodes++;
if ( MWizardProcess.WIZARDSTATUS_Finished.equals(status)
|| MWizardProcess.WIZARDSTATUS_Skipped.equals(status)) {
allPending = false;
cntSolved++;
} else {
allFinished = false;
}
Div div = new Div(); Div div = new Div();
div.setStyle("display:inline;"); div.setStyle("display:inline;");
div.appendChild(nodeLabel); div.appendChild(nodeLabel);
@ -300,13 +333,20 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
wfnodeTree.setSelectedItem(childItem); wfnodeTree.setSelectedItem(childItem);
} }
nextItems.add(childItem); nextItems.add(childItem);
if (firstOpenNode == null) {
if (! ( MWizardProcess.WIZARDSTATUS_Finished.equals(status)
|| MWizardProcess.WIZARDSTATUS_Skipped.equals(status))) {
firstOpenWF = treeitemwf;
firstOpenNode = childItem;
}
}
} }
/** /**
* Static init * Static init
* @throws Exception * @throws Exception
*/ */
@SuppressWarnings("deprecation")
private void jbInit () throws Exception private void jbInit () throws Exception
{ {
form.setWidth("99%"); form.setWidth("99%");
@ -428,7 +468,7 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
westdown.appendChild(bOK); westdown.appendChild(bOK);
westdown.appendChild(bNext); westdown.appendChild(bNext);
Div divButton = new Div(); Div divButton = new Div();
divButton.setAlign("right"); divButton.setStyle("display: inline-block; float: right;");
divButton.appendChild(westdown); divButton.appendChild(westdown);
East east = new East(); East east = new East();
@ -443,19 +483,25 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
setNotesPanelVisible(false); setNotesPanelVisible(false);
wfnodeTree.setSelectedItem(firstti); if (firstOpenNode == null) {
showItem(firstti); firstOpenWF = firstWF;
firstOpenNode = firstWF;
}
if (firstOpenWF != null)
firstOpenWF.setOpen(true);
if (firstOpenNode != null) {
wfnodeTree.setSelectedItem(firstOpenNode);
showItem(firstOpenNode);
}
} // jbInit } // jbInit
private void refreshProgress() { private void refreshProgress() {
int nodes = getNodesCnt(); int percent = cntSolved * 100;
int solved = getWizardCnt(); if (cntNodes > 0)
int percent = solved * 100; percent = percent / cntNodes;
if (nodes > 0)
percent = percent / nodes;
else else
percent = 0; percent = 0;
Object[] args = new Object[] {solved, nodes, percent}; Object[] args = new Object[] {cntSolved, cntNodes, percent};
String msg = Msg.getMsg(Env.getCtx(), "SetupWizardProgress", args); String msg = Msg.getMsg(Env.getCtx(), "SetupWizardProgress", args);
progressLabel.setText(msg); progressLabel.setText(msg);
progressbar.setValue(percent); progressbar.setValue(percent);
@ -479,7 +525,7 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
if (e.getTarget() == wfnodeTree) { if (e.getTarget() == wfnodeTree) {
onTreeSelection(e); onTreeSelection(e);
} else if (e.getTarget() == bRefresh) { } else if (e.getTarget() == bRefresh) {
showInRightPanel(0, m_node.getAD_WF_Node_ID()); repaintTree();
} else if (e.getTarget() == bOK) { } else if (e.getTarget() == bOK) {
int userid = 0; int userid = 0;
allFinished=true; allFinished=true;
@ -615,6 +661,7 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Workflow, wfid); SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Workflow, wfid);
} else if (ti.getAttribute("AD_WF_Node_ID") != null) { } else if (ti.getAttribute("AD_WF_Node_ID") != null) {
// MWFNode // MWFNode
((Treeitem)ti.getParent().getParent()).setOpen(true);
int nodeid = (Integer) ti.getAttribute("AD_WF_Node_ID"); int nodeid = (Integer) ti.getAttribute("AD_WF_Node_ID");
showInRightPanel(0, nodeid); showInRightPanel(0, nodeid);
SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Node, nodeid); SessionManager.getAppDesktop().updateHelpContext(X_AD_CtxHelp.CTXTYPE_Node, nodeid);
@ -655,7 +702,6 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL
private void setNotesPanelVisible(boolean visible) { private void setNotesPanelVisible(boolean visible) {
notesLabel.setVisible(visible); notesLabel.setVisible(visible);
notesField.setVisible(visible); notesField.setVisible(visible);
bRefresh.setVisible(visible);
bOK.setVisible(visible); bOK.setVisible(visible);
statusLabel.setVisible(visible); statusLabel.setVisible(visible);
statusField.setVisible(visible); statusField.setVisible(visible);

View File

@ -24,6 +24,7 @@ import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.ServerPushTemplate;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRecentItem; import org.compiere.model.MRecentItem;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -227,6 +228,8 @@ public class DPRecentItems extends DashboardPanel implements EventListener<Event
List<MRecentItem> ris = MRecentItem.getFromUser(ctx, AD_User_ID); List<MRecentItem> ris = MRecentItem.getFromUser(ctx, AD_User_ID);
int riShown = 0; int riShown = 0;
for (MRecentItem ri : ris) { for (MRecentItem ri : ris) {
if (ri.getAD_Window_ID() > 0 && MRole.getDefault().getWindowAccess(ri.getAD_Window_ID()) == null)
continue;
String label = ri.getLabel(); String label = ri.getLabel();
if (label == null) if (label == null)
continue; continue;

View File

@ -61,6 +61,7 @@ import org.compiere.model.GridTab;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.SystemIDs;
import org.compiere.model.X_AD_CtxHelp; import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -668,6 +669,10 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
@Override @Override
public void updateHelpContext(String ctxType, int recordId) { public void updateHelpContext(String ctxType, int recordId) {
// don't show context for SetupWizard Form, is managed internally using wf and node ctxhelp
if (recordId == SystemIDs.FORM_SETUP_WIZARD && X_AD_CtxHelp.CTXTYPE_Form.equals(ctxType))
return;
Clients.response(new AuScript("zWatch.fire('onFieldTooltip', this);")); Clients.response(new AuScript("zWatch.fire('onFieldTooltip', this);"));
helpController.renderCtxHelp(ctxType, recordId); helpController.renderCtxHelp(ctxType, recordId);

View File

@ -14,29 +14,18 @@
package org.adempiere.webui.panel; package org.adempiere.webui.panel;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties; import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.desktop.IDesktop; import org.adempiere.webui.desktop.IDesktop;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MCtxHelpMsg;
import org.compiere.model.MForm; import org.compiere.model.MForm;
import org.compiere.model.MInfoWindow; import org.compiere.model.MInfoWindow;
import org.compiere.model.MProcess; import org.compiere.model.MProcess;
import org.compiere.model.MTab; import org.compiere.model.MTab;
import org.compiere.model.MTask; import org.compiere.model.MTask;
import org.compiere.model.X_AD_CtxHelp; import org.compiere.model.X_AD_CtxHelp;
import org.compiere.model.X_AD_CtxHelpMsg;
import org.compiere.model.X_AD_Form;
import org.compiere.model.X_AD_InfoWindow;
import org.compiere.model.X_AD_Process;
import org.compiere.model.X_AD_Tab;
import org.compiere.model.X_AD_Task;
import org.compiere.model.X_AD_WF_Node;
import org.compiere.model.X_AD_Workflow;
import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.wf.MWFNode; import org.compiere.wf.MWFNode;
@ -500,145 +489,14 @@ public class HelpController
.replace("<", "&lt;"); .replace("<", "&lt;");
return htmlString; return htmlString;
} }
private int getCtxHelpID(String ctxType, int recordId) private String getCtxHelpMsgList(String ctxType, int recordId)
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
String retValue = MCtxHelpMsg.get(ctx, ctxType, recordId);
StringBuilder sql = new StringBuilder(); return retValue;
sql.append("SELECT t.");
if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab)
sql.append(X_AD_Tab.COLUMNNAME_AD_CtxHelp_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Process)
sql.append(X_AD_Process.COLUMNNAME_AD_CtxHelp_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Form)
sql.append(X_AD_Form.COLUMNNAME_AD_CtxHelp_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Info)
sql.append(X_AD_InfoWindow.COLUMNNAME_AD_CtxHelp_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Workflow)
sql.append(X_AD_Workflow.COLUMNNAME_AD_CtxHelp_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Task)
sql.append(X_AD_Task.COLUMNNAME_AD_CtxHelp_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Node)
sql.append(X_AD_WF_Node.COLUMNNAME_AD_CtxHelp_ID);
else
sql.append(X_AD_CtxHelp.COLUMNNAME_AD_CtxHelp_ID);
sql.append(" FROM ");
if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab)
sql.append(X_AD_Tab.Table_Name);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Process)
sql.append(X_AD_Process.Table_Name);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Form)
sql.append(X_AD_Form.Table_Name);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Info)
sql.append(X_AD_InfoWindow.Table_Name);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Workflow)
sql.append(X_AD_Workflow.Table_Name);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Task)
sql.append(X_AD_Task.Table_Name);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Node)
sql.append(X_AD_WF_Node.Table_Name);
else
sql.append(X_AD_CtxHelp.Table_Name);
sql.append(" t, AD_CtxHelp h ");
sql.append("WHERE t.AD_CtxHelp_ID = h.AD_CtxHelp_ID ");
sql.append("AND t.IsActive = 'Y' ");
sql.append("AND h.IsActive = 'Y' ");
sql.append("AND h.AD_Client_ID IN (0, ?) ");
sql.append("AND h.AD_Org_ID IN (0, ?) ");
if (ctxType == X_AD_CtxHelp.CTXTYPE_Home)
sql.append("AND h." + X_AD_CtxHelp.COLUMNNAME_CtxType);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab || ctxType == X_AD_CtxHelp.CTXTYPE_Process ||
ctxType == X_AD_CtxHelp.CTXTYPE_Form || ctxType == X_AD_CtxHelp.CTXTYPE_Info ||
ctxType == X_AD_CtxHelp.CTXTYPE_Workflow || ctxType == X_AD_CtxHelp.CTXTYPE_Task ||
ctxType == X_AD_CtxHelp.CTXTYPE_Node)
{
sql.append("AND t.");
if (ctxType == X_AD_CtxHelp.CTXTYPE_Tab)
sql.append(X_AD_Tab.COLUMNNAME_AD_Tab_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Process)
sql.append(X_AD_Process.COLUMNNAME_AD_Process_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Form)
sql.append(X_AD_Form.COLUMNNAME_AD_Form_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Info)
sql.append(X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Workflow)
sql.append(X_AD_Workflow.COLUMNNAME_AD_Workflow_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Task)
sql.append(X_AD_Task.COLUMNNAME_AD_Task_ID);
else if (ctxType == X_AD_CtxHelp.CTXTYPE_Node)
sql.append(X_AD_WF_Node.COLUMNNAME_AD_WF_Node_ID);
}
else
sql.append("1");
sql.append(" = ? ");
sql.append("ORDER BY h.AD_Client_ID DESC, h.AD_Org_ID DESC, h.AD_CtxHelp_ID DESC");
return DB.getSQLValue(null, sql.toString(), Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx), ctxType == X_AD_CtxHelp.CTXTYPE_Home ? ctxType : recordId);
} }
private String getCtxHelpMsgList(String ctxType, int recordId)
{
Properties ctx = Env.getCtx();
int AD_CtxHelp_ID = getCtxHelpID(ctxType, recordId);
if (AD_CtxHelp_ID > 0)
{
StringBuilder sql = new StringBuilder();
if (Env.isBaseLanguage(Env.getCtx(), X_AD_CtxHelpMsg.Table_Name))
{
sql.append("SELECT MsgText ");
sql.append("FROM AD_CtxHelpMsg ");
sql.append("WHERE IsActive = 'Y' ");
sql.append("AND AD_Client_ID IN (0, ?) ");
sql.append("AND AD_Org_ID IN (0, ?) ");
sql.append("AND AD_CtxHelp_ID = ? ");
sql.append("ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, AD_CtxHelpMsg_ID DESC");
}
else
{
sql.append("SELECT mt.MsgText ");
sql.append("FROM AD_CtxHelpMsg m ");
sql.append("LEFT JOIN AD_CtxHelpMsg_Trl mt ON (mt.AD_CtxHelpMsg_ID = m.AD_CtxHelpMsg_ID AND mt.AD_Language = ?) ");
sql.append("WHERE mt.IsActive = 'Y' ");
sql.append("AND m.AD_Client_ID IN (0, ?) ");
sql.append("AND m.AD_Org_ID IN (0, ?) ");
sql.append("AND m.AD_CtxHelp_ID = ? ");
sql.append("ORDER BY m.AD_Client_ID DESC, m.AD_Org_ID DESC, m.AD_CtxHelpMsg_ID DESC");
}
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql.toString(), null);
int count = 1;
if (!Env.isBaseLanguage(Env.getCtx(), X_AD_CtxHelpMsg.Table_Name))
pstmt.setString(count++, Env.getAD_Language(Env.getCtx()));
pstmt.setInt(count++, Env.getAD_Client_ID(ctx));
pstmt.setInt(count++, Env.getAD_Org_ID(ctx));
pstmt.setInt(count++, AD_CtxHelp_ID);
rs = pstmt.executeQuery();
if (rs.next())
return rs.getString(X_AD_CtxHelpMsg.COLUMNNAME_MsgText);
}
catch (Exception e)
{
throw new AdempiereException(e);
}
finally
{
DB.close(rs, pstmt);
rs=null; pstmt=null;
}
}
return "";
}
/** /**
* @param content content * @param content content
* @return masked content or empty string if the <code>content</code> is null * @return masked content or empty string if the <code>content</code> is null

View File

@ -214,7 +214,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
infoWindow = MInfoWindow.get(p_keyColumn.replace("_ID", ""), null); infoWindow = MInfoWindow.get(p_keyColumn.replace("_ID", ""), null);
addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this);
addEventListener(ON_RUN_PROCESS, this); addEventListener(ON_RUN_PROCESS, this);
} // InfoPanel } // InfoPanel
private void init() private void init()
@ -257,7 +257,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
this.setMaximizable(true); this.setMaximizable(true);
this.addEventListener(Events.ON_OK, this); this.addEventListener(Events.ON_OK, this);
if (isLookup())
addEventListener(Events.ON_CANCEL, this);
contentPanel.setOddRowSclass(null); contentPanel.setOddRowSclass(null);
// contentPanel.setSizedByContent(true); // contentPanel.setSizedByContent(true);
contentPanel.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infoListbox"); contentPanel.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, "infoListbox");
@ -1441,6 +1442,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
// do nothing when parameter not change and at window mode, or at dialog mode but select non record // do nothing when parameter not change and at window mode, or at dialog mode but select non record
onOk(); onOk();
} }
}else if (event.getName().equals(Events.ON_CANCEL)){
m_cancel = true;
dispose(false);
} }
//when user push enter keyboard at input parameter field //when user push enter keyboard at input parameter field
else else
@ -1462,10 +1466,6 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
} }
} else if (keyEvent.getKeyCode() == VK_ENTER) { // Enter } else if (keyEvent.getKeyCode() == VK_ENTER) { // Enter
// do nothing, let on_ok at infoWindo do, at this is too soon to get value from control, it's not bind // do nothing, let on_ok at infoWindo do, at this is too soon to get value from control, it's not bind
} else if (keyEvent.getKeyCode() == VK_ESCAPE) { // Escape
// Escape for cancel
m_cancel = true;
dispose(false);
} }
} }

View File

@ -30,7 +30,9 @@ import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.SimpleListModel; import org.adempiere.webui.component.SimpleListModel;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.compiere.print.MPrintFormatItem; import org.compiere.print.MPrintFormatItem;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.DropEvent;
@ -39,7 +41,6 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Hlayout; import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event> public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener<Event>
@ -47,7 +48,7 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
/** /**
* *
*/ */
private static final long serialVersionUID = -2798618953887598651L; private static final long serialVersionUID = -3178046711328450398L;
// UI variables // UI variables
private Label noLabel = new Label(); private Label noLabel = new Label();
@ -71,8 +72,8 @@ public class WRC3SortCriteriaPanel extends WRCTabPanel implements EventListener
public void init() public void init()
{ {
// //
noLabel.setValue("Available"); noLabel.setValue(Msg.getMsg(Env.getCtx(), "Available"));
yesLabel.setValue("Order By"); yesLabel.setValue(Msg.getMsg(Env.getCtx(), "OrderBy"));
yesList.setVflex(true); yesList.setVflex(true);
noList.setVflex(true); noList.setVflex(true);

View File

@ -185,13 +185,13 @@ public class FileImportAction implements EventListener<Event>
Row row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType"))); row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "FilesOfType", true)));
row.appendChild(cboType); row.appendChild(cboType);
cboType.setHflex("1"); cboType.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "Charset", false) + ": ")); row.appendChild(new Label(Msg.getMsg(Env.getCtx(), "Charset", true) + ": "));
fCharset.setMold("select"); fCharset.setMold("select");
fCharset.setRows(0); fCharset.setRows(0);
fCharset.setTooltiptext(Msg.getMsg(Env.getCtx(), "Charset", false)); fCharset.setTooltiptext(Msg.getMsg(Env.getCtx(), "Charset", false));

View File

@ -18,9 +18,9 @@ package org.compiere.apps.form;
import java.util.List; import java.util.List;
import org.adempiere.model.MWizardProcess; import org.adempiere.model.MWizardProcess;
import org.compiere.model.MClient;
import org.compiere.model.Query; import org.compiere.model.Query;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.wf.MWFNode; import org.compiere.wf.MWFNode;
import org.compiere.wf.MWorkflow; import org.compiere.wf.MWorkflow;
@ -39,41 +39,41 @@ public class SetupWizard
public MWFNode m_node; public MWFNode m_node;
/**
* Get the number of workflow wizard nodes
*/
public int getNodesCnt() {
/* TODO: SaaS filter */
final String sql = "SELECT COUNT(1) " +
"FROM AD_Workflow w " +
"JOIN AD_WF_Node n ON (n.AD_Workflow_ID=w.AD_Workflow_ID) " +
"WHERE w.WorkflowType='W' " + // Wizard
"AND w.IsActive='Y' " +
"AND n.IsActive='Y'";
return DB.getSQLValue(null, sql);
}
/**
* Get the number of wizard nodes that has been finished or skipped by user
*/
public int getWizardCnt() {
/* TODO: SaaS filter */
final String sql = "SELECT COUNT(DISTINCT z.AD_WF_Node_ID) " +
"FROM AD_Workflow w " +
"JOIN AD_WF_Node n ON (n.AD_Workflow_ID=w.AD_Workflow_ID) " +
"JOIN AD_WizardProcess z ON (n.AD_WF_Node_ID=z.AD_WF_Node_ID) " +
"WHERE w.WorkflowType='W' " + // Wizard
"AND w.IsActive='Y' " +
"AND n.IsActive='Y' " +
"AND z.AD_Client_ID=" + Env.getAD_Client_ID(Env.getCtx()) +
" AND z.IsActive='Y' " +
"AND z.WizardStatus IN ('F','S')"; // Finished/Skipped
return DB.getSQLValue(null, sql);
}
public List<MWorkflow> getWfWizards() { public List<MWorkflow> getWfWizards() {
/* TODO: SaaS filter */ MClient client = MClient.get(Env.getCtx());
return new Query(Env.getCtx(), MWorkflow.Table_Name, "WorkflowType=? AND IsActive='Y' AND AD_Client_ID IN (0, ?)", null) String ASPFilter = "";
if (client.isUseASP())
ASPFilter =
" AND ( AD_Workflow.AD_Workflow_ID IN ( "
// Just ASP subscribed workflows for client "
+ " SELECT w.AD_Workflow_ID "
+ " FROM ASP_Workflow w, ASP_Level l, ASP_ClientLevel cl "
+ " WHERE w.ASP_Level_ID = l.ASP_Level_ID "
+ " AND cl.AD_Client_ID = " + client.getAD_Client_ID()
+ " AND cl.ASP_Level_ID = l.ASP_Level_ID "
+ " AND w.IsActive = 'Y' "
+ " AND l.IsActive = 'Y' "
+ " AND cl.IsActive = 'Y' "
+ " AND w.ASP_Status = 'S') " // Show
+ " OR AD_Workflow.AD_Workflow_ID IN ( "
// + show ASP exceptions for client
+ " SELECT AD_Workflow_ID "
+ " FROM ASP_ClientException ce "
+ " WHERE ce.AD_Client_ID = " + client.getAD_Client_ID()
+ " AND ce.IsActive = 'Y' "
+ " AND ce.AD_Workflow_ID IS NOT NULL "
+ " AND ce.ASP_Status = 'S') " // Show
+ " ) "
+ " AND AD_Workflow.AD_Workflow_ID NOT IN ( "
// minus hide ASP exceptions for client
+ " SELECT AD_Workflow_ID "
+ " FROM ASP_ClientException ce "
+ " WHERE ce.AD_Client_ID = " + client.getAD_Client_ID()
+ " AND ce.IsActive = 'Y' "
+ " AND ce.AD_Workflow_ID IS NOT NULL "
+ " AND ce.ASP_Status = 'H')"; // Hide
String where = "WorkflowType=? AND IsActive='Y' AND AD_Client_ID IN (0, ?)" + ASPFilter;
return new Query(Env.getCtx(), MWorkflow.Table_Name, where, null)
.setParameters(MWorkflow.WORKFLOWTYPE_Wizard, Env.getAD_Client_ID(Env.getCtx())) .setParameters(MWorkflow.WORKFLOWTYPE_Wizard, Env.getAD_Client_ID(Env.getCtx()))
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setOrderBy(MWorkflow.COLUMNNAME_Priority) .setOrderBy(MWorkflow.COLUMNNAME_Priority)