Attached Files | diff.patch [^] (6,581 bytes) 2009-01-26 12:35 [Show Content] [Hide Content]### Eclipse Workspace Patch 1.0
#P openbravo
Index: src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql
===================================================================
RCS file: /home/saci/cvs/openbravo/src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 WindowAccess_data.xsql
--- src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql 12 Nov 2008 10:34:54 -0000 1.1.1.1
+++ src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql 26 Jan 2009 11:34:16 -0000
@@ -81,6 +81,38 @@
<Parameter name="adRoleId"/>
<Parameter name="adTabId"/>
</SqlMethod>
+
+ <SqlMethod name="hasDeleteAccess" type="preparedStatement" return="boolean">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ SELECT COUNT(*) AS TOTAL
+ FROM (
+ SELECT 1
+ FROM AD_Table_Access t,
+ AD_Tab tb
+ WHERE t.AD_Table_ID = tb.AD_Table_ID
+ AND t.AD_Role_ID = ?
+ AND tb.AD_Tab_ID = ?
+ AND t.IsActive = 'Y'
+ AND t.IsExclude = 'N'
+ AND t.IsReadOnly = 'N'
+ UNION
+ SELECT 1
+ FROM AD_Window_Access w,
+ AD_Tab t
+ WHERE w.IsActive='Y'
+ AND w.AD_Window_ID = t.AD_Window_ID
+ AND w.AD_Role_ID = ?
+ AND t.AD_Tab_ID = ?
+ AND w.isReadWrite = 'Y'
+ AND w.isDelete = 'Y'
+ AND w.isActive='Y') t
+ </Sql>
+ <Parameter name="adRoleId"/>
+ <Parameter name="adTabId"/>
+ <Parameter name="adRoleId"/>
+ <Parameter name="adTabId"/>
+ </SqlMethod>
<SqlMethod name="hasProcessAccess" type="preparedStatement" return="boolean">
<SqlMethodComment></SqlMethodComment>
Index: src/org/openbravo/erpCommon/utility/DataGrid.java
===================================================================
RCS file: /home/saci/cvs/openbravo/src/org/openbravo/erpCommon/utility/DataGrid.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 DataGrid.java
--- src/org/openbravo/erpCommon/utility/DataGrid.java 12 Nov 2008 10:34:54 -0000 1.1.1.1
+++ src/org/openbravo/erpCommon/utility/DataGrid.java 26 Jan 2009 11:34:16 -0000
@@ -366,7 +366,8 @@
type="Error";
title="Error";
description=Utility.messageBD(this,"AccessCannotDelete", vars.getLanguage());
- } else if (WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), strTab)) {
+ } else if (WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), strTab)
+ || WindowAccessData.hasDeleteAccess(this, vars.getRole(), strTab) == false) {
result=0;
type="Error";
title="Error";
Index: src-wad/src/org/openbravo/wad/javasource.javaxml
===================================================================
RCS file: /home/saci/cvs/openbravo/src-wad/src/org/openbravo/wad/javasource.javaxml,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 javasource.javaxml
--- src-wad/src/org/openbravo/wad/javasource.javaxml 12 Nov 2008 10:34:32 -0000 1.1.1.1
+++ src-wad/src/org/openbravo/wad/javasource.javaxml 26 Jan 2009 11:34:16 -0000
@@ -384,7 +384,8 @@
//<PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>Data data = getEditVariables(vars<PARAMETER_TMP id="parent">, strP<PARENT_TMP id="keyParent">Almacen</PARENT_TMP></PARAMETER_TMP>);
int total = 0;
OBError myError = null;
- if (org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId)) {
+ if (org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId)
+ || org.openbravo.erpCommon.utility.WindowAccessData.hasDeleteAccess(this, vars.getRole(), tabId) == false) {
myError = Utility.translateError(this, vars, vars.getLanguage(), Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
vars.setMessage(tabId, myError);
} else {
@@ -927,13 +928,15 @@
String currentClient = (boolNew?"":(dataField!=null?dataField.getField("adClientId"):data[0].getField("adClientId")));
boolean editableTab = (!org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId) && (currentOrg.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Org", windowId, accesslevel),currentOrg)) && (currentClient.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel),currentClient)));
- if (editableTab)
+ boolean deleteableTab = org.openbravo.erpCommon.utility.WindowAccessData.hasDeleteAccess(this, vars.getRole(), tabId) && editableTab;
+ if (editableTab) {
xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/<PARAMETER_TMP id="package">Window</PARAMETER_TMP>/<PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>_Edition",discard).createXmlDocument();
- else
+ } else {
xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/<PARAMETER_TMP id="package">Window</PARAMETER_TMP>/<PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>_NonEditable",discard).createXmlDocument();
+ }
- ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "<PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inp<FIELD_TMP id="keyData">Clave</FIELD_TMP>", "", "..<PARAMETER_TMP id="paramReportPDF">xx</PARAMETER_TMP>", "<PARAMETER_TMP id="paramReportDirectPrint">xx</PARAMETER_TMP>".equals("Y"), "<PARAMETER_TMP id="package">Window</PARAMETER_TMP>", strReplaceWith, true);
+ ToolBar toolbar = new ToolBar(this, deleteableTab, vars.getLanguage(), "<PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inp<FIELD_TMP id="keyData">Clave</FIELD_TMP>", "", "..<PARAMETER_TMP id="paramReportPDF">xx</PARAMETER_TMP>", "<PARAMETER_TMP id="paramReportDirectPrint">xx</PARAMETER_TMP>".equals("Y"), "<PARAMETER_TMP id="package">Window</PARAMETER_TMP>", strReplaceWith, true);
toolbar.prepareEditionTemplate<PARAMETER_TMP id="sameParent">NoSearch</PARAMETER_TMP>("<PARAMETER_TMP id="paramHasTree">hasTree</PARAMETER_TMP>".equals("Y"), hasSearchCondition, vars.getSessionValue("#ShowTest", "N").equals("Y"), "<PARAMETER_TMP id="paramIsReadOnly">readonly</PARAMETER_TMP>".equals("Y"), Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
xmlDocument.setParameter("toolbar", toolbar.toString());
|