Merge 0f7409018e45

This commit is contained in:
Heng Sin Low 2013-09-04 23:51:34 +08:00
commit 90d2b6e605
9 changed files with 71 additions and 20 deletions

View File

@ -0,0 +1,7 @@
-- IDEMPIERE-1324 Menu entries with summary and centrally maintained are not translated
update ad_menu set iscentrallymaintained='N' where issummary='Y'
;
SELECT register_migration_script('201309030837_IDEMPIERE-1324.sql') FROM dual
;

View File

@ -0,0 +1,7 @@
-- IDEMPIERE-1324 Menu entries with summary and centrally maintained are not translated
update ad_menu set iscentrallymaintained='N' where issummary='Y'
;
SELECT register_migration_script('201309030837_IDEMPIERE-1324.sql') FROM dual
;

View File

@ -56,7 +56,7 @@ public class GridFieldVO implements Serializable
public static String getSQL (Properties ctx) public static String getSQL (Properties ctx)
{ {
// IsActive is part of View // IsActive is part of View
MRole role = MRole.getDefault(ctx, true); MRole role = MRole.getDefault(ctx, false);
String advancedFilter=" AND IsAdvancedField='N' "; String advancedFilter=" AND IsAdvancedField='N' ";
StringBuilder sql; StringBuilder sql;
if (!Env.isBaseLanguage(ctx, "AD_Tab")){ if (!Env.isBaseLanguage(ctx, "AD_Tab")){

View File

@ -370,7 +370,7 @@ public class GridTabVO implements Evaluatee, Serializable
+ " AND ce.AD_Field_ID IS NULL " + " AND ce.AD_Field_ID IS NULL "
+ " AND ce.ASP_Status = 'H')"; // Hide + " AND ce.ASP_Status = 'H')"; // Hide
// View only returns IsActive='Y' // View only returns IsActive='Y'
MRole role = MRole.getDefault(ctx, true); MRole role = MRole.getDefault(ctx, false);
String advancedFilter=" AND IsAdvancedTab='N' "; String advancedFilter=" AND IsAdvancedTab='N' ";
StringBuilder sql; StringBuilder sql;
if (!Env.isBaseLanguage(ctx, "AD_Window")) { if (!Env.isBaseLanguage(ctx, "AD_Window")) {

View File

@ -114,6 +114,8 @@ public class MMenu extends X_AD_Menu
// Reset info // Reset info
if (isSummary() && getAction() != null) if (isSummary() && getAction() != null)
setAction(null); setAction(null);
if (isSummary() && isCentrallyMaintained())
setIsCentrallyMaintained(false);
String action = getAction(); String action = getAction();
if (action == null) if (action == null)
action = ""; action = "";

View File

@ -61,7 +61,7 @@ public final class MRole extends X_AD_Role
/** /**
* *
*/ */
private static final long serialVersionUID = -1135628544466487086L; private static final long serialVersionUID = 3608297024439006903L;
/** /**
* Get Default (Client) Role * Get Default (Client) Role
@ -3148,4 +3148,23 @@ public final class MRole extends X_AD_Role
return retValue; return retValue;
} }
private Boolean m_canAccess_Info_Product = null;
public boolean canAccess_Info_Product() {
if (m_canAccess_Info_Product == null) {
String sql = ""
+ "SELECT COUNT(*) "
+ "FROM AD_InfoWindow iw "
+ " JOIN AD_InfoWindow_Access iwa "
+ " ON ( iwa.AD_InfoWindow_ID = iw.AD_InfoWindow_ID ) "
+ "WHERE AD_Table_ID = ? "
+ " AND iw.IsActive = 'Y' "
+ " AND iwa.IsActive = 'Y' "
+ " AND iwa.AD_Role_ID = ?";
int cnt = DB.getSQLValueEx(null, sql, I_M_Product.Table_ID, getAD_Role_ID());
m_canAccess_Info_Product = new Boolean(cnt > 0);
}
return m_canAccess_Info_Product.booleanValue();
}
} // MRole } // MRole

View File

@ -104,7 +104,6 @@ public class MenuElementHandler extends AbstractElementHandler {
parentId = ReferenceUtils.resolveReference(ctx.ctx, parentElement, getTrxName(ctx)); parentId = ReferenceUtils.resolveReference(ctx.ctx, parentElement, getTrxName(ctx));
} }
if (parentId > 0) {
StringBuffer updateSQL = null; StringBuffer updateSQL = null;
int AD_Tree_ID = getDefaultMenuTreeId(); int AD_Tree_ID = getDefaultMenuTreeId();
String sql = "SELECT count(Parent_ID) FROM AD_TREENODEMM WHERE AD_Tree_ID = "+AD_Tree_ID String sql = "SELECT count(Parent_ID) FROM AD_TREENODEMM WHERE AD_Tree_ID = "+AD_Tree_ID
@ -169,7 +168,7 @@ public class MenuElementHandler extends AbstractElementHandler {
" WHERE AD_Tree_ID = "+AD_Tree_ID).append( " WHERE AD_Tree_ID = "+AD_Tree_ID).append(
" AND Node_ID = " + mMenu.getAD_Menu_ID()); " AND Node_ID = " + mMenu.getAD_Menu_ID());
} else { } else {
updateSQL = new StringBuffer("Insert INTO AD_TREENODEMM").append( updateSQL = new StringBuffer("INSERT INTO AD_TREENODEMM").append(
"(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, ").append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, ").append(
"Parent_ID, SeqNo, AD_Tree_ID, Node_ID)").append( "Parent_ID, SeqNo, AD_Tree_ID, Node_ID)").append(
"VALUES(0, 0, 0, 0, ").append( "VALUES(0, 0, 0, 0, ").append(
@ -177,7 +176,6 @@ public class MenuElementHandler extends AbstractElementHandler {
+ mMenu.getAD_Menu_ID() + ")"); + mMenu.getAD_Menu_ID() + ")");
} }
DB.executeUpdate(updateSQL.toString(), getTrxName(ctx)); DB.executeUpdate(updateSQL.toString(), getTrxName(ctx));
}
} }
private int getDefaultMenuTreeId() { private int getDefaultMenuTreeId() {

View File

@ -39,6 +39,7 @@ import org.compiere.model.GridTab;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MToolBarButton; import org.compiere.model.MToolBarButton;
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.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
@ -70,7 +71,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
/** /**
* *
*/ */
private static final long serialVersionUID = 3390505814516682801L; private static final long serialVersionUID = -367141745573893540L;
public static final String BTNPREFIX = "Btn"; public static final String BTNPREFIX = "Btn";
@ -118,7 +119,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
// Elaine 2008/12/04 // Elaine 2008/12/04
/** Show Personal Lock */ /** Show Personal Lock */
public boolean isPersonalLock = MRole.getDefault().isPersonalLock(); public boolean isPersonalLock = MRole.getDefault().isPersonalLock();
private boolean isAllowProductInfo = MRole.getDefault().isAllow_Info_Product(); private boolean isAllowProductInfo = MRole.getDefault().canAccess_Info_Product();
private int windowNo = 0; private int windowNo = 0;
@ -176,13 +177,19 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
btnArchive = createButton("Archive", "Archive", "Archive"); btnArchive = createButton("Archive", "Archive", "Archive");
btnPrint = createButton("Print", "Print", "Print"); btnPrint = createButton("Print", "Print", "Print");
btnPrint.setTooltiptext(btnPrint.getTooltiptext()+ " Alt+P"); btnPrint.setTooltiptext(btnPrint.getTooltiptext()+ " Alt+P");
btnLock = createButton("Lock", "Lock", "Lock"); // Elaine 2008/12/04 if (isPersonalLock) {
btnLock.setVisible(isPersonalLock); btnLock = createButton("Lock", "Lock", "Lock"); // Elaine 2008/12/04
btnLock.setDisabled(!isPersonalLock); // Elaine 2008/12/04
btnLock.setVisible(isPersonalLock);
}
btnZoomAcross = createButton("ZoomAcross", "ZoomAcross", "ZoomAcross"); btnZoomAcross = createButton("ZoomAcross", "ZoomAcross", "ZoomAcross");
btnActiveWorkflows = createButton("ActiveWorkflows", "WorkFlow", "WorkFlow"); btnActiveWorkflows = createButton("ActiveWorkflows", "WorkFlow", "WorkFlow");
btnRequests = createButton("Requests", "Request", "Request"); btnRequests = createButton("Requests", "Request", "Request");
btnProductInfo = createButton("ProductInfo", "Product", "InfoProduct"); if (isAllowProductInfo) {
btnProductInfo.setVisible(isAllowProductInfo); btnProductInfo = createButton("ProductInfo", "Product", "InfoProduct");
btnProductInfo.setDisabled(!isAllowProductInfo); // Elaine 2008/07/22
btnProductInfo.setVisible(isAllowProductInfo);
}
btnCustomize= createButton("Customize", "Customize", "Customize"); btnCustomize= createButton("Customize", "Customize", "Customize");
btnCustomize.setDisabled(false); btnCustomize.setDisabled(false);
@ -199,9 +206,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
btnActiveWorkflows.setDisabled(false); // Elaine 2008/07/17 btnActiveWorkflows.setDisabled(false); // Elaine 2008/07/17
btnRequests.setDisabled(false); // Elaine 2008/07/22 btnRequests.setDisabled(false); // Elaine 2008/07/22
btnProductInfo.setDisabled(!isAllowProductInfo); // Elaine 2008/07/22
btnArchive.setDisabled(false); // Elaine 2008/07/28 btnArchive.setDisabled(false); // Elaine 2008/07/28
btnLock.setDisabled(!isPersonalLock); // Elaine 2008/12/04
if (MRole.getDefault().isCanExport()) if (MRole.getDefault().isCanExport())
{ {
@ -594,9 +599,22 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
} // All restrictions } // All restrictions
dynamicDisplay(); dynamicDisplay();
// If no workflow set for the table => disable btnWorkflow
if (!btnActiveWorkflows.isDisabled()) {
GridTab gridTab = adwindow.getADWindowContent().getActiveGridTab();
if (gridTab != null)
btnActiveWorkflows.setDisabled(!hasWorkflow(gridTab));
}
ToolBarMenuRestictionLoaded = true; ToolBarMenuRestictionLoaded = true;
} }
/** btnActiveWorkflow should be disabled when table has not workflow defined */
boolean hasWorkflow(GridTab gridTab)
{
String sql = "SELECT COUNT(*) FROM AD_Workflow WHERE IsActive='Y' AND AD_Table_ID=? AND AD_Client_ID IN (0,?)";
return (DB.getSQLValueEx(null, sql, gridTab.getAD_Table_ID(), Env.getAD_Client_ID(Env.getCtx())) > 0);
}
private void loadCustomButton(int AD_Window_ID) { private void loadCustomButton(int AD_Window_ID) {
MToolBarButton[] mToolbarButtons = MToolBarButton.getOfWindow(AD_Window_ID, null); MToolBarButton[] mToolbarButtons = MToolBarButton.getOfWindow(AD_Window_ID, null);
if (mToolbarButtons != null && mToolbarButtons.length > 0) { if (mToolbarButtons != null && mToolbarButtons.length > 0) {

View File

@ -77,18 +77,18 @@ public class AboutWindow extends Window implements EventListener<Event> {
/** /**
* *
*/ */
private static final long serialVersionUID = 6573804051552633150L; private static final long serialVersionUID = -305598686065143269L;
private Checkbox bErrorsOnly; private Checkbox bErrorsOnly;
private Listbox logTable; private Listbox logTable;
private Tabbox tabbox; private Tabbox tabbox;
protected Tabpanels tabPanels; protected Tabpanels tabPanels;
private Button btnDownload; protected Button btnDownload;
private Button btnErrorEmail; protected Button btnErrorEmail;
private Button btnViewLog; protected Button btnViewLog;
protected Tab tabLog; protected Tab tabLog;
private Button btnAdempiereLog; protected Button btnAdempiereLog;
private Listbox levelListBox; private Listbox levelListBox;