From a21db5de0f6982708869cae8a7d0e85ba9e53d95 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 8 Apr 2010 20:10:54 +0000 Subject: [PATCH] FR [2976452] Implement included roles feature - thanks to Teo and Metas Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2976452 --- base/src/org/compiere/model/GridWindowVO.java | 36 +- .../compiere/model/I_AD_Role_Included.java | 150 +++++ base/src/org/compiere/model/MRole.java | 582 +++++++++++++++++- .../src/org/compiere/model/MRoleIncluded.java | 139 +++++ .../compiere/model/X_AD_Role_Included.java | 147 +++++ base/src/org/compiere/process/CopyRole.java | 62 +- .../org/compiere/process/DocumentEngine.java | 49 +- client/src/org/compiere/apps/ALogin.java | 22 +- .../src/org/compiere/apps/form/Archive.java | 20 +- .../oracle/705_AD_Role_Included.sql | 281 +++++++++ .../postgresql/705_AD_Role_Included.sql | 283 +++++++++ .../org/adempiere/webui/panel/RolePanel.java | 22 +- 12 files changed, 1681 insertions(+), 112 deletions(-) create mode 100644 base/src/org/compiere/model/I_AD_Role_Included.java create mode 100644 base/src/org/compiere/model/MRoleIncluded.java create mode 100644 base/src/org/compiere/model/X_AD_Role_Included.java create mode 100644 migration/354a-trunk/oracle/705_AD_Role_Included.sql create mode 100644 migration/354a-trunk/postgresql/705_AD_Role_Included.sql diff --git a/base/src/org/compiere/model/GridWindowVO.java b/base/src/org/compiere/model/GridWindowVO.java index a971589ae3..a20ca7ab17 100644 --- a/base/src/org/compiere/model/GridWindowVO.java +++ b/base/src/org/compiere/model/GridWindowVO.java @@ -36,6 +36,11 @@ import org.compiere.util.Env; */ public class GridWindowVO implements Serializable { + /** + * + */ + private static final long serialVersionUID = 6884332743173214735L; + /** * Create Window Value Object * @param ctx context @@ -105,23 +110,16 @@ public class GridWindowVO implements Serializable // -- Get Window StringBuffer sql = new StringBuffer("SELECT Name,Description,Help,WindowType, " - + "AD_Color_ID,AD_Image_ID, a.IsReadWrite, WinHeight,WinWidth, " + + "AD_Color_ID,AD_Image_ID,WinHeight,WinWidth, " + "IsSOTrx "); if (Env.isBaseLanguage(vo.ctx, "AD_Window")) - sql.append("FROM AD_Window w, AD_Window_Access a " - + "WHERE w.AD_Window_ID=?" - + " AND w.AD_Window_ID=a.AD_Window_ID AND a.AD_Role_ID=?" - + " AND w.IsActive='Y' AND a.IsActive='Y'"); + sql.append("FROM AD_Window w WHERE w.AD_Window_ID=? AND w.IsActive='Y'"); else - sql.append("FROM AD_Window_vt w, AD_Window_Access a " - + "WHERE w.AD_Window_ID=?" - + " AND w.AD_Window_ID=a.AD_Window_ID AND a.AD_Role_ID=?" - + " AND a.IsActive='Y'") + sql.append("FROM AD_Window_vt w WHERE w.AD_Window_ID=?") .append(" AND AD_Language='") .append(Env.getAD_Language(vo.ctx)).append("'"); - int AD_Role_ID = Env.getContextAsInt(vo.ctx, "#AD_Role_ID"); PreparedStatement pstmt = null; ResultSet rs = null; try @@ -129,7 +127,6 @@ public class GridWindowVO implements Serializable // create statement pstmt = DB.prepareStatement(sql.toString(), null); pstmt.setInt(1, vo.AD_Window_ID); - pstmt.setInt(2, AD_Role_ID); // get data rs = pstmt.executeQuery(); if (rs.next()) @@ -145,12 +142,12 @@ public class GridWindowVO implements Serializable // vo.AD_Color_ID = rs.getInt(5); vo.AD_Image_ID = rs.getInt(6); - vo.IsReadWrite = rs.getString(7); + //vo.IsReadWrite = rs.getString(7); // - vo.WinHeight = rs.getInt(8); - vo.WinWidth = rs.getInt(9); + vo.WinHeight = rs.getInt(7); + vo.WinWidth = rs.getInt(8); // - vo.IsSOTrx = "Y".equals(rs.getString(10)); + vo.IsSOTrx = "Y".equals(rs.getString(9)); } else vo = null; @@ -167,12 +164,15 @@ public class GridWindowVO implements Serializable } // Ensure ASP exceptions MRole role = MRole.getDefault(ctx, false); - if (vo != null && role.getWindowAccess(vo.AD_Window_ID) == null) + final Boolean windowAccess = role.getWindowAccess(vo.AD_Window_ID); + if (vo != null && windowAccess == null) vo = null; // Not found + if (vo != null && windowAccess != null) + vo.IsReadWrite = (windowAccess.booleanValue() ? "Y" : "N"); if (vo == null) { CLogger.get().log(Level.SEVERE, "No Window - AD_Window_ID=" + AD_Window_ID - + ", AD_Role_ID=" + AD_Role_ID + " - " + sql); + + ", AD_Role_ID=" + role + " - " + sql); CLogger.get().saveError("AccessTableNoView", "(Not found)"); return null; } @@ -267,8 +267,6 @@ public class GridWindowVO implements Serializable WindowNo = windowNo; } // MWindowVO - static final long serialVersionUID = 3802628212531678981L; - /** Properties */ public Properties ctx; /** Window Number */ diff --git a/base/src/org/compiere/model/I_AD_Role_Included.java b/base/src/org/compiere/model/I_AD_Role_Included.java new file mode 100644 index 0000000000..774e71da00 --- /dev/null +++ b/base/src/org/compiere/model/I_AD_Role_Included.java @@ -0,0 +1,150 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 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.model; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_Role_Included + * @author Adempiere (generated) + * @version Release 3.5.4a + */ +public interface I_AD_Role_Included +{ + + /** TableName=AD_Role_Included */ + public static final String Table_Name = "AD_Role_Included"; + + /** AD_Table_ID=53222 */ + public static final int Table_ID = MTable.getTable_ID(Table_Name); + + KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name); + + /** AccessLevel = 6 - System - Client + */ + BigDecimal accessLevel = BigDecimal.valueOf(6); + + /** Load Meta Data */ + + /** Column name AD_Client_ID */ + public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; + + /** Get Client. + * Client/Tenant for this installation. + */ + public int getAD_Client_ID(); + + /** Column name AD_Org_ID */ + public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID"; + + /** Set Organization. + * Organizational entity within client + */ + public void setAD_Org_ID (int AD_Org_ID); + + /** Get Organization. + * Organizational entity within client + */ + public int getAD_Org_ID(); + + /** Column name AD_Role_ID */ + public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID"; + + /** Set Role. + * Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID); + + /** Get Role. + * Responsibility Role + */ + public int getAD_Role_ID(); + + public I_AD_Role getAD_Role() throws RuntimeException; + + /** Column name Created */ + public static final String COLUMNNAME_Created = "Created"; + + /** Get Created. + * Date this record was created + */ + public Timestamp getCreated(); + + /** Column name CreatedBy */ + public static final String COLUMNNAME_CreatedBy = "CreatedBy"; + + /** Get Created By. + * User who created this records + */ + public int getCreatedBy(); + + /** Column name Included_Role_ID */ + public static final String COLUMNNAME_Included_Role_ID = "Included_Role_ID"; + + /** Set Included Role */ + public void setIncluded_Role_ID (int Included_Role_ID); + + /** Get Included Role */ + public int getIncluded_Role_ID(); + + public I_AD_Role getIncluded_Role() throws RuntimeException; + + /** Column name IsActive */ + public static final String COLUMNNAME_IsActive = "IsActive"; + + /** Set Active. + * The record is active in the system + */ + public void setIsActive (boolean IsActive); + + /** Get Active. + * The record is active in the system + */ + public boolean isActive(); + + /** Column name SeqNo */ + public static final String COLUMNNAME_SeqNo = "SeqNo"; + + /** Set Sequence. + * Method of ordering records; + lowest number comes first + */ + public void setSeqNo (int SeqNo); + + /** Get Sequence. + * Method of ordering records; + lowest number comes first + */ + public int getSeqNo(); + + /** Column name Updated */ + public static final String COLUMNNAME_Updated = "Updated"; + + /** Get Updated. + * Date this record was updated + */ + public Timestamp getUpdated(); + + /** Column name UpdatedBy */ + public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; + + /** Get Updated By. + * User who updated this records + */ + public int getUpdatedBy(); +} diff --git a/base/src/org/compiere/model/MRole.java b/base/src/org/compiere/model/MRole.java index 64183ad532..0678419b1e 100644 --- a/base/src/org/compiere/model/MRole.java +++ b/base/src/org/compiere/model/MRole.java @@ -17,16 +17,23 @@ package org.compiere.model; import java.io.Serializable; +import java.lang.reflect.Array; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Properties; import java.util.Set; +import java.util.Vector; +import java.util.Map.Entry; 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; @@ -51,8 +58,7 @@ public final class MRole extends X_AD_Role /** * */ - private static final long serialVersionUID = 8472593143421441965L; - + private static final long serialVersionUID = 3684323160980498188L; /** * Get Default (Client) Role @@ -138,6 +144,8 @@ public final class MRole extends X_AD_Role */ public static MRole get (Properties ctx, int AD_Role_ID) { + return get(ctx, AD_Role_ID, Env.getAD_User_ID(ctx), false); // metas-2009_0021_AP1_G94 - we need to use this method because we need to load/reload all accesses + /* metas-2009_0021_AP1_G94 String key = String.valueOf(AD_Role_ID); MRole role = (MRole)s_roles.get (key); String trxName = null; @@ -151,6 +159,7 @@ public final class MRole extends X_AD_Role } } return role; + /**/ // metas-2009_0021_AP1_G94 } // get /** @@ -657,6 +666,7 @@ public final class MRole extends X_AD_Role m_workflowAccess = null; m_formAccess = null; } + loadIncludedRoles(reload); // Load/Reload included roles - metas-2009_0021_AP1_G94 } // loadAccess /** @@ -1499,9 +1509,23 @@ public final class MRole extends X_AD_Role { DB.close(rs, pstmt); } + // log.fine("#" + m_windowAccess.size()); + mergeIncludedAccess("m_windowAccess"); // Load included accesses - metas-2009_0021_AP1_G94 } // reload - Boolean retValue = (Boolean)m_windowAccess.get(new Integer(AD_Window_ID)); + Boolean retValue = m_windowAccess.get(AD_Window_ID); + // + // Check included roles - metas-2009_0021_AP1_G94 + if (retValue == null) + { + for (MRole includedRole : getIncludedRoles(false)) + { + retValue = includedRole.getWindowAccess(AD_Window_ID); + if (retValue != null) + break; + } + } + // // log.fine("getWindowAccess - AD_Window_ID=" + AD_Window_ID + " - " + retValue); return retValue; } // getWindowAccess @@ -1570,8 +1594,10 @@ public final class MRole extends X_AD_Role { DB.close(rs, pstmt); } + mergeIncludedAccess("m_processAccess"); // Load included accesses - metas-2009_0021_AP1_G94 } // reload - return (Boolean)m_processAccess.get(new Integer(AD_Process_ID)); + Boolean retValue = m_processAccess.get(AD_Process_ID); + return retValue; } // getProcessAccess /** @@ -1635,8 +1661,10 @@ public final class MRole extends X_AD_Role { DB.close(rs, pstmt); } + mergeIncludedAccess("m_taskAccess"); // Load included accesses - metas-2009_0021_AP1_G94 } // reload - return (Boolean)m_taskAccess.get(new Integer(AD_Task_ID)); + Boolean retValue = m_taskAccess.get(AD_Task_ID); + return retValue; } // getTaskAccess /** @@ -1701,8 +1729,22 @@ public final class MRole extends X_AD_Role { DB.close(rs, pstmt); } + mergeIncludedAccess("m_formAccess"); // Load included accesses - metas-2009_0021_AP1_G94 } // reload - return (Boolean)m_formAccess.get(new Integer(AD_Form_ID)); + Boolean retValue = m_formAccess.get(AD_Form_ID); + // + // Check included roles - metas-2009_0021_AP1_G94 + if (retValue == null) + { + for (MRole includedRole : getIncludedRoles(false)) + { + retValue = includedRole.getFormAccess(AD_Form_ID); + if (retValue != null) + break; + } + } + // + return retValue; } // getTaskAccess /** @@ -1766,8 +1808,10 @@ public final class MRole extends X_AD_Role { DB.close(rs, pstmt); } + mergeIncludedAccess("m_workflowAccess"); // Load included accesses - metas-2009_0021_AP1_G94 } // reload - return (Boolean)m_workflowAccess.get(new Integer(AD_Workflow_ID)); + Boolean retValue = m_workflowAccess.get(AD_Workflow_ID); + return retValue; } // getTaskAccess @@ -2377,4 +2421,528 @@ public final class MRole extends X_AD_Role } // OrgAccess + /** + * Checks the access rights of the given role/client for the given document actions. + * @param clientId + * @param docTypeId + * @param options + * @param maxIndex + * @return number of valid actions in the String[] options + * @see metas-2009_0021_AP1_G94 + */ + public int checkActionAccess(int clientId, int docTypeId, String[] options, int maxIndex) + { + if (maxIndex <= 0) + return maxIndex; + // + final Vector validOptions = new Vector(); + final List params = new ArrayList(); + params.add(clientId); + params.add(docTypeId); + // + final StringBuffer sql_values = new StringBuffer(); + for (int i = 0; i < maxIndex; i++) + { + if (sql_values.length() > 0) + sql_values.append(","); + sql_values.append("?"); + params.add(options[i]); + } + // + final String sql = "SELECT rl.Value FROM AD_Document_Action_Access a" + + " INNER JOIN AD_Ref_List rl ON (rl.AD_Reference_ID=135 and rl.AD_Ref_List_ID=a.AD_Ref_List_ID)" + + " WHERE a.IsActive='Y' AND a.AD_Client_ID=? AND a.C_DocType_ID=?" // #1,2 + + " AND rl.Value IN ("+sql_values+")" + + " AND "+getIncludedRolesWhereClause("a.AD_Role_ID", params) + ; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, null); + DB.setParameters(pstmt, params); + rs = pstmt.executeQuery(); + while (rs.next()) + { + String op = rs.getString(1); + validOptions.add(op); + } + validOptions.toArray(options); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + // + int newMaxIndex = validOptions.size(); + return newMaxIndex; + } + + /** List of included roles. Do not access directly */ + private List m_includedRoles = null; + + /** + * Include role permissions + * @param role + * @param seqNo + * @see metas-2009_0021_AP1_G94 + */ + private void includeRole(MRole role, int seqNo) + { + if (this.getAD_Role_ID() == role.getAD_Role_ID()) + { + return; + } + if (this.m_includedRoles == null) + { + m_includedRoles = new ArrayList(); + } + for (MRole r : this.m_includedRoles) + { + if (r.getAD_Role_ID() == role.getAD_Role_ID()) + { + return; + } + } + + System.out.println("Include "+role); + this.m_includedRoles.add(role); + role.setParentRole(this); + role.m_includedSeqNo = seqNo; + } + + /** + * + * @return unmodifiable list of included roles + * @see metas-2009_0021_AP1_G94 + */ + public List getIncludedRoles(boolean recursive) + { + if (!recursive) + { + List list = this.m_includedRoles; + if (list == null) + list = new ArrayList(); + return Collections.unmodifiableList(list); + } + else + { + List list = new ArrayList(); + if (m_includedRoles != null) + { + for (MRole role : m_includedRoles) + { + list.add(role); + list.addAll(role.getIncludedRoles(true)); + } + } + return list; + } + } + + /** + * Load all included roles (direct inclusion or from user substitution) + * @param reload + * @see metas-2009_0021_AP1_G94 + */ + private void loadIncludedRoles(boolean reload) + { + loadChildRoles(reload); + loadSubstitutedRoles(reload); + // + if (this.m_parent == null) + { + mergeAccesses(reload); + } + } + + private void mergeAccesses(boolean reload) + { + OrgAccess[] orgAccess = new OrgAccess[]{}; + MTableAccess[] tableAccess = new MTableAccess[]{}; + MColumnAccess[] columnAccess = new MColumnAccess[]{}; + MRecordAccess[] recordAccess = new MRecordAccess[]{}; + MRecordAccess[] recordDependentAccess = new MRecordAccess[]{}; + // + MRole last_role = null; + for (MRole role : getIncludedRoles(false)) + { + boolean override = false; + // + // If roles have same SeqNo, then, the second role will override permissions from first role + if (last_role != null && last_role.m_includedSeqNo >= 0 + && role.m_includedSeqNo >= 0 + && last_role.m_includedSeqNo == role.m_includedSeqNo) + { + override = true; + } + // + role.loadAccess(reload); + role.mergeAccesses(reload); + orgAccess = mergeAccess(orgAccess, role.m_orgAccess, override); + tableAccess = mergeAccess(tableAccess, role.m_tableAccess, override); + columnAccess = mergeAccess(columnAccess, role.m_columnAccess, override); + recordAccess = mergeAccess(recordAccess, role.m_recordAccess, override); + recordDependentAccess = mergeAccess(recordDependentAccess, role.m_recordDependentAccess, override); + // + last_role = role; + } + // + // Merge permissions inside this role + this.m_orgAccess = mergeAccess(this.m_orgAccess, orgAccess, false); + this.m_tableAccess = mergeAccess(this.m_tableAccess, tableAccess, false); + this.m_columnAccess = mergeAccess(this.m_columnAccess, columnAccess, false); + this.m_recordAccess = mergeAccess(this.m_recordAccess, recordAccess, false); + this.m_recordDependentAccess = mergeAccess(this.m_recordDependentAccess, recordDependentAccess, false); + } + + /** + * Load Child Roles + * @param reload + * @see metas-2009_0021_AP1_G94 + */ + private void loadChildRoles(boolean reload) + { + m_includedRoles = null; // reset included roles + final int AD_User_ID = getAD_User_ID(); + if (AD_User_ID < 0) + { + //throw new IllegalStateException("AD_User_ID is not set"); + return ; + } + // + final String whereClause = X_AD_Role_Included.COLUMNNAME_AD_Role_ID+"=?"; + List list = new Query(getCtx(), X_AD_Role_Included.Table_Name, whereClause, get_TrxName()) + .setParameters(new Object[]{getAD_Role_ID()}) + .setOnlyActiveRecords(true) + .setOrderBy( + X_AD_Role_Included.COLUMNNAME_SeqNo + +","+X_AD_Role_Included.COLUMNNAME_Included_Role_ID) + .list(); + for (X_AD_Role_Included includedRole : list) + { + MRole role = MRole.get(getCtx(), includedRole.getIncluded_Role_ID()); + includeRole(role, includedRole.getSeqNo()); + } + } + + /** + * Load substituted roles + * @param reload + * @see metas-2009_0021_AP1_G94 + */ + private void loadSubstitutedRoles(boolean reload) + { + if (this.m_parent != null) + { + // load only if this is logged role (no parent roles) + return; + } + // + final int AD_User_ID = getAD_User_ID(); + if (AD_User_ID < 0) + { + //throw new IllegalStateException("AD_User_ID is not set"); + return; + } + // + final String whereClause = "EXISTS (" + +" SELECT 1 FROM AD_User_Roles ur" + +" INNER JOIN AD_User_Substitute us ON (us.AD_User_ID=ur.AD_User_ID)" + +" WHERE ur.AD_Role_ID=AD_Role.AD_Role_ID AND ur.IsActive='Y' AND us.IsActive='Y'" + +" AND (us.ValidFrom IS NULL OR us.ValidFrom <= getdate())" + +" AND (us.ValidTo IS NULL OR us.ValidTo >= getdate())" + +" AND us.Substitute_ID=?)"; + List list = new Query(getCtx(), Table_Name, whereClause, get_TrxName()) + .setParameters(new Object[]{AD_User_ID}) + .setClient_ID() + .setOrderBy(COLUMNNAME_AD_Role_ID) + .list(); + for (MRole role : list) + { + includeRole(role, -1); + } + } + + /** Parent Role */ + private MRole m_parent = null; + + /** + * Set parent role. This method is called when this role is included in a parent role. + * @param parent + * @see metas-2009_0021_AP1_G94 + */ + private void setParentRole(MRole parent) + { + this.setAD_User_ID(parent.getAD_User_ID()); + this.m_parent = parent; + } + + private int m_includedSeqNo = -1; + + /** + * Merge permissions access + * @param + * @param array1 + * @param array2 + * @return array of merged values + * @see metas-2009_0021_AP1_G94 + */ + @SuppressWarnings("unchecked") + private static final T[] mergeAccess(T[] array1, T[] array2, boolean override) + { + if (array1 == null) + { + System.out.println("null !!!"); + } + List list = new ArrayList(); + for (T po : array1) + { + list.add(po); + } + for (T o2 : array2) + { + boolean found = false; + for (int i = 0; i < array1.length; i++) + { + final T o1 = array1[i]; + if (o1 instanceof OrgAccess) + { + final OrgAccess oa1 = (OrgAccess)o1; + final OrgAccess oa2 = (OrgAccess)o2; + found = oa1.equals(oa2); + if (found && override) + { + // stronger permissions first + if (!oa2.readOnly) + oa1.readOnly = false; + } + } + else if (o1 instanceof MTableAccess) + { + final MTableAccess ta1 = (MTableAccess)o1; + final MTableAccess ta2 = (MTableAccess)o2; + found = ta1.getAD_Table_ID() == ta2.getAD_Table_ID(); + if (found && override) + { + // stronger permissions first + if (ta2.isCanReport()) + ta1.setIsCanExport(true); + if (ta2.isCanReport()) + ta1.setIsCanReport(true); + if (!ta2.isReadOnly()) + ta1.setIsCanExport(false); + if (!ta2.isExclude()) + ta1.setIsExclude(false); + } + } + else if (o1 instanceof MColumnAccess) + { + final MColumnAccess ca1 = (MColumnAccess)o1; + final MColumnAccess ca2 = (MColumnAccess)o2; + found = ca1.getAD_Column_ID() == ca2.getAD_Column_ID(); + if (found && override) + { + // stronger permissions first + if (!ca2.isReadOnly()) + ca1.setIsReadOnly(false); + if (!ca2.isExclude()) + ca1.setIsExclude(false); + } + } + else if (o1 instanceof MRecordAccess) + { + final MRecordAccess ra1 = (MRecordAccess)o1; + final MRecordAccess ra2 = (MRecordAccess)o2; + found = ra1.getAD_Table_ID() == ra2.getAD_Table_ID() + && ra1.getRecord_ID() == ra2.getRecord_ID(); + if (found && override) + { + // stronger permissions first + if(!ra2.isReadOnly()) + ra1.setIsReadOnly(false); + if (!ra2.isDependentEntities()) + ra1.setIsDependentEntities(false); + if (!ra2.isExclude()) + ra1.setIsExclude(false); + } + } + else + { + throw new AdempiereException("Not supported objects - "+o1+", "+o2); + } + // + if (found) + { + break; + } + } // end for array1 + if (!found) + { + //System.out.println("add "+o2); + list.add(o2); + } + } + T[] arr = (T[]) Array.newInstance(array1.getClass().getComponentType(), list.size()); + return list.toArray(arr); + } + + private static final HashMap mergeAccess( + HashMap map1, HashMap map2, + boolean override) + { + final HashMap map = new HashMap(); + if (map1 != null) + { + map.putAll(map1); + } + // + for (final Entry e : map2.entrySet()) + { + final Integer key = e.getKey(); + final Boolean b2 = e.getValue(); + if (b2 == null) + { + continue; + } + final Boolean b1 = map.get(key); + if (b1 == null) + { + map.put(key, b2); + } + else + { + if (override && b2 == true && b1 == false) + { + map.put(key, b2); + } + } + } + // + return map; + } + + private void mergeIncludedAccess(String varname) + { + HashMap includedAccess = new HashMap(); + MRole last_role = null; + for (MRole role : getIncludedRoles(false)) + { + boolean override = false; + // + // If roles have same SeqNo, then, the second role will override permissions from first role + if (last_role != null && last_role.m_includedSeqNo >= 0 + && role.m_includedSeqNo >= 0 + && last_role.m_includedSeqNo == role.m_includedSeqNo) + { + override = true; + } + includedAccess = mergeAccess(includedAccess, role.getAccessMap(varname), override); + last_role = role; + } + setAccessMap(varname, mergeAccess(getAccessMap(varname), includedAccess, false)); + } + + private HashMap getAccessMap(String varname) + { + if ("m_windowAccess".equals(varname)) + { + getWindowAccess(-1); + return m_windowAccess; + } + else if ("m_processAccess".equals(varname)) + { + getProcessAccess(-1); + return m_processAccess; + } + else if ("m_taskAccess".equals(varname)) + { + getTaskAccess(-1); + return m_taskAccess; + } + else if ("m_workflowAccess".equals(varname)) + { + getWorkflowAccess(-1); + return m_workflowAccess; + } + else if ("m_formAccess".equals(varname)) + { + getFormAccess(-1); + return m_formAccess; + } + else + { + throw new IllegalArgumentException("varname not supported - "+varname); + } + } + private void setAccessMap(String varname, HashMap map) + { + if ("m_windowAccess".equals(varname)) + { + m_windowAccess = map; + } + else if ("m_processAccess".equals(varname)) + { + m_processAccess = map; + } + else if ("m_taskAccess".equals(varname)) + { + m_taskAccess = map; + } + else if ("m_workflowAccess".equals(varname)) + { + m_workflowAccess = map; + } + else if ("m_formAccess".equals(varname)) + { + m_formAccess = map; + } + else + { + throw new IllegalArgumentException("varname not supported - "+varname); + } + } + + /** + * Get Role Where Clause. + * It will look something like myalias.AD_Role_ID IN (?, ?, ?). + * @param roleColumnSQL role columnname or role column SQL (e.g. myalias.AD_Role_ID) + * @param params a list where the method will put SQL parameters. + * If null, this method will generate a not parametrized query + * @return role SQL where clause + */ + public String getIncludedRolesWhereClause(String roleColumnSQL, List params) + { + StringBuffer whereClause = new StringBuffer(); + if (params != null) + { + whereClause.append("?"); + params.add(getAD_Role_ID()); + } + else + { + whereClause.append(getAD_Role_ID()); + } + // + for (MRole role : getIncludedRoles(true)) + { + if (params != null) + { + whereClause.append(",?"); + params.add(role.getAD_Role_ID()); + } + else + { + whereClause.append(",").append(role.getAD_Role_ID()); + } + } + // + whereClause.insert(0, roleColumnSQL+" IN (").append(")"); + return whereClause.toString(); + } } // MRole diff --git a/base/src/org/compiere/model/MRoleIncluded.java b/base/src/org/compiere/model/MRoleIncluded.java new file mode 100644 index 0000000000..52c6903ee8 --- /dev/null +++ b/base/src/org/compiere/model/MRoleIncluded.java @@ -0,0 +1,139 @@ +/** + * + */ +package org.compiere.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.adempiere.exceptions.AdempiereException; +import org.adempiere.exceptions.DBException; +import org.compiere.util.DB; + +/** + * Included Role Model + * @author teo.sarca@gmail.com + */ +public class MRoleIncluded extends X_AD_Role_Included +{ + /** + * + */ + private static final long serialVersionUID = -3284165639631581484L; + + public MRoleIncluded(Properties ctx, int AD_Role_Included_ID, String trxName) + { + super(ctx, AD_Role_Included_ID, trxName); + } + + public MRoleIncluded(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + @Override + protected boolean beforeSave(boolean newRecord) + { + if (getAD_Role_ID() == getIncluded_Role_ID()) + { + throw new AdempiereException("@AD_Role_ID@ == @Included_Role_ID@"); + } + return true; + } + + @Override + protected boolean afterSave(boolean newRecord, boolean success) + { + if (!success) + return success; + // + if (newRecord || is_ValueChanged(COLUMNNAME_Included_Role_ID)) + { + List trace = new ArrayList(); + if (hasLoop(Table_Name, COLUMNNAME_Included_Role_ID, COLUMNNAME_AD_Role_ID, getIncluded_Role_ID(), trace, get_TrxName())) + { + StringBuffer roles = new StringBuffer(); + for (int role_id : trace) + { + MRole role = MRole.get(getCtx(), role_id); + if (roles.length() > 0) + roles.append(" - "); + roles.append(role.getName()); + } + throw new AdempiereException("Loop has detected "+roles); + } + } + // + return true; + } + + /** + * Check if there is a loop in the tree defined in given table + * @param tableName + * @param idColumnName Node_ID column name + * @param parentIdColumnName Parent_ID column name + * @param nodeId current Node_ID + * @param trace current tree path (optional) + * @param trxName transaction name + * @return true if loop detected. If you specified not null trace, you will have in that list the IDs from the loop + */ + // TODO: refactor this method and move into org.compiere.util.DB class because it's general and usefull of others too + private static boolean hasLoop(String tableName, String idColumnName, String parentIdColumnName, + int nodeId, List trace, + String trxName) + { + final List trace2; + if (trace == null) + { + trace2 = new ArrayList(10); + } + else + { + trace2 = new ArrayList(trace); + } + trace2.add(nodeId); + // + final String sql = "SELECT "+idColumnName+","+parentIdColumnName+" FROM "+tableName+" WHERE "+parentIdColumnName+"=?"; + PreparedStatement pstmt = null; + ResultSet rs = null; + try + { + pstmt = DB.prepareStatement(sql, trxName); + pstmt.setInt(1, nodeId); + rs = pstmt.executeQuery(); + while(rs.next()) + { + final int childId = rs.getInt(1); + if (trace2.contains(childId)) + { + trace.clear(); + trace.addAll(trace2); + trace.add(childId); + return true; + } + if (hasLoop(tableName, idColumnName, parentIdColumnName, childId, trace2, trxName)) + { + trace.clear(); + trace.addAll(trace2); + return true; + } + } + } + catch(SQLException e) + { + throw new DBException(e, sql); + } + finally + { + DB.close(rs, pstmt); + rs = null; pstmt = null; + } + // + return false; + } + +} diff --git a/base/src/org/compiere/model/X_AD_Role_Included.java b/base/src/org/compiere/model/X_AD_Role_Included.java new file mode 100644 index 0000000000..c5fd2997dc --- /dev/null +++ b/base/src/org/compiere/model/X_AD_Role_Included.java @@ -0,0 +1,147 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2007 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 * + *****************************************************************************/ +/** Generated Model - DO NOT CHANGE */ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +/** Generated Model for AD_Role_Included + * @author Adempiere (generated) + * @version Release 3.5.4a - $Id$ */ +public class X_AD_Role_Included extends PO implements I_AD_Role_Included, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 20100325L; + + /** Standard Constructor */ + public X_AD_Role_Included (Properties ctx, int AD_Role_Included_ID, String trxName) + { + super (ctx, AD_Role_Included_ID, trxName); + /** if (AD_Role_Included_ID == 0) + { + setAD_Role_ID (0); + setIncluded_Role_ID (0); + setSeqNo (0); +// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_Role_Included WHERE AD_Role_ID=@AD_Role_ID@ + } */ + } + + /** Load Constructor */ + public X_AD_Role_Included (Properties ctx, ResultSet rs, String trxName) + { + super (ctx, rs, trxName); + } + + /** AccessLevel + * @return 6 - System - Client + */ + protected int get_AccessLevel() + { + return accessLevel.intValue(); + } + + /** Load Meta Data */ + protected POInfo initPO (Properties ctx) + { + POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName()); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_AD_Role_Included[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + public I_AD_Role getAD_Role() throws RuntimeException + { + return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name) + .getPO(getAD_Role_ID(), get_TrxName()); } + + /** Set Role. + @param AD_Role_ID + Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID) + { + if (AD_Role_ID < 0) + set_ValueNoCheck (COLUMNNAME_AD_Role_ID, null); + else + set_ValueNoCheck (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID)); + } + + /** Get Role. + @return Responsibility Role + */ + public int getAD_Role_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_AD_Role getIncluded_Role() throws RuntimeException + { + return (I_AD_Role)MTable.get(getCtx(), I_AD_Role.Table_Name) + .getPO(getIncluded_Role_ID(), get_TrxName()); } + + /** Set Included Role. + @param Included_Role_ID Included Role */ + public void setIncluded_Role_ID (int Included_Role_ID) + { + if (Included_Role_ID < 1) + set_ValueNoCheck (COLUMNNAME_Included_Role_ID, null); + else + set_ValueNoCheck (COLUMNNAME_Included_Role_ID, Integer.valueOf(Included_Role_ID)); + } + + /** Get Included Role. + @return Included Role */ + public int getIncluded_Role_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_Included_Role_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + /** Set Sequence. + @param SeqNo + Method of ordering records; lowest number comes first + */ + public void setSeqNo (int SeqNo) + { + set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); + } + + /** Get Sequence. + @return Method of ordering records; lowest number comes first + */ + public int getSeqNo () + { + Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/base/src/org/compiere/process/CopyRole.java b/base/src/org/compiere/process/CopyRole.java index 04fe4b5511..3e44b87133 100755 --- a/base/src/org/compiere/process/CopyRole.java +++ b/base/src/org/compiere/process/CopyRole.java @@ -13,15 +13,15 @@ * 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 * - * - * Copyright (C) 2005 Robert KLEIN. robeklein@gmail.com * - * Contributor(s): ______________________________________. + * * + * Copyright (C) 2005 Robert KLEIN. robeklein@gmail.com * + * Contributor(s): ______________________________________. * *****************************************************************************/ package org.compiere.process; import java.math.BigDecimal; -import org.adempiere.exceptions.AdempiereException; +import org.compiere.model.I_AD_Role_Included; import org.compiere.util.DB; import org.compiere.util.Env; @@ -73,12 +73,13 @@ public class CopyRole extends SvrProcess protected String doIt() throws Exception { String[] tables = new String[] {"AD_Window_Access", "AD_Process_Access", "AD_Form_Access", - "AD_Workflow_Access", "AD_Task_Access", "AD_Document_Action_Access"}; + "AD_Workflow_Access", "AD_Task_Access", "AD_Document_Action_Access", + I_AD_Role_Included.Table_Name, + }; String[] keycolumns = new String[] {"AD_Window_ID", "AD_Process_ID", "AD_Form_ID", - "AD_Workflow_ID", "AD_Task_ID", "C_DocType_ID, AD_Ref_List_ID"}; - - if ( m_AD_Role_ID_From == m_AD_Role_ID_To ) - throw new AdempiereException("Cannot copy role to itself"); + "AD_Workflow_ID", "AD_Task_ID", "C_DocType_ID, AD_Ref_List_ID", + I_AD_Role_Included.COLUMNNAME_Included_Role_ID, + }; int action = 0; @@ -89,25 +90,34 @@ public class CopyRole extends SvrProcess String sql = "DELETE FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_To; int no = DB.executeUpdateEx(sql, get_TrxName()); - addLog(action++, null, new BigDecimal(no), "Old records deleted from " + table ); + addLog(action++, null, BigDecimal.valueOf(no), "Old records deleted from " + table ); + + final boolean column_IsReadWrite = + !table.equals("AD_Document_Action_Access") + && !table.equals(I_AD_Role_Included.Table_Name); + final boolean column_SeqNo = table.equals(I_AD_Role_Included.Table_Name); sql = "INSERT INTO " + table - + " (AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " - + "AD_Role_ID, " + keycolumn +", isActive"; - if ( ! table.equals("AD_Document_Action_Access")) - sql += ", isReadWrite) "; - else - sql += ") "; - sql += "SELECT " + m_AD_Client_ID - + ", "+ m_AD_Org_ID - + ", "+ Env.getAD_User_ID(Env.getCtx()) - + ", "+ Env.getAD_User_ID(Env.getCtx()) - + ", " + m_AD_Role_ID_To - + ", " + keycolumn - + ", IsActive "; - if ( ! table.equals("AD_Document_Action_Access") ) - sql += ", isReadWrite "; - sql += "FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_From; + + " (AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, " + + "AD_Role_ID, " + keycolumn +", isActive"; + if (column_SeqNo) + sql += ", SeqNo "; + if (column_IsReadWrite) + sql += ", isReadWrite) "; + else + sql += ") "; + sql += "SELECT " + m_AD_Client_ID + + ", "+ m_AD_Org_ID + + ", getdate(), "+ Env.getAD_User_ID(Env.getCtx()) + + ", getdate(), "+ Env.getAD_User_ID(Env.getCtx()) + + ", " + m_AD_Role_ID_To + + ", " + keycolumn + + ", IsActive "; + if (column_SeqNo) + sql += ", SeqNo "; + if (column_IsReadWrite) + sql += ", isReadWrite "; + sql += "FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_From; no = DB.executeUpdateEx (sql, get_TrxName()); diff --git a/base/src/org/compiere/process/DocumentEngine.java b/base/src/org/compiere/process/DocumentEngine.java index 810dadd554..54b4293c55 100644 --- a/base/src/org/compiere/process/DocumentEngine.java +++ b/base/src/org/compiere/process/DocumentEngine.java @@ -23,7 +23,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Properties; -import java.util.Vector; import java.util.logging.Level; import org.compiere.acct.Doc; @@ -43,6 +42,7 @@ import org.compiere.model.MJournalBatch; import org.compiere.model.MMovement; import org.compiere.model.MOrder; import org.compiere.model.MPayment; +import org.compiere.model.MRole; import org.compiere.model.MTable; import org.compiere.model.PO; import org.compiere.util.CLogger; @@ -320,6 +320,7 @@ public class DocumentEngine implements DocAction if (m_document instanceof PO && docsPostProcess.size() > 0) { for (PO docafter : docsPostProcess) { + @SuppressWarnings("unused") String ignoreError = DocumentEngine.postImmediate(docafter.getCtx(), docafter.getAD_Client_ID(), docafter.get_Table_ID(), docafter.get_ID(), true, docafter.get_TrxName()); } } @@ -1195,51 +1196,9 @@ public class DocumentEngine implements DocAction * @return number of valid actions in the String[] options */ public static int checkActionAccess(int clientId, int roleId, int docTypeId, String[] options, int maxIndex) { - if (maxIndex <= 0) - return maxIndex; - // - final Vector validOptions = new Vector(); - StringBuffer sql_values = new StringBuffer(); - for (int i = 0; i < maxIndex; i++) { - if (sql_values.length() > 0) - sql_values.append(","); - sql_values.append("?"); - } - String sql = "SELECT rl.Value FROM AD_Document_Action_Access a" - + " INNER JOIN AD_Ref_List rl ON (rl.AD_Reference_ID=135 and rl.AD_Ref_List_ID=a.AD_Ref_List_ID)" - + " WHERE a.IsActive='Y' AND a.AD_Client_ID=? AND a.C_DocType_ID=? AND a.AD_Role_ID=?" // #1,2,3 - + " AND rl.Value IN ("+sql_values.toString()+")"; // #4... - PreparedStatement pstmt = null; - ResultSet rs = null; - try - { - pstmt = DB.prepareStatement(sql, null); - int para_idx = 1; - pstmt.setInt(para_idx++, clientId); - pstmt.setInt(para_idx++, docTypeId); - pstmt.setInt(para_idx++, roleId); - for (int i = 0; i < maxIndex; i++) { - pstmt.setString(para_idx++, options[i]); - } - rs = pstmt.executeQuery(); - while (rs.next()) { - String op = rs.getString(1); - validOptions.add(op); - } - validOptions.toArray(options); - } - catch (SQLException e) - { - log.log(Level.SEVERE, sql, e); - } - finally - { - DB.close(rs, pstmt); - rs = null; pstmt = null; - } - return validOptions.size(); + return MRole.get(Env.getCtx(), roleId).checkActionAccess(clientId, docTypeId, options, maxIndex); } - + /** * Post Immediate * diff --git a/client/src/org/compiere/apps/ALogin.java b/client/src/org/compiere/apps/ALogin.java index de34509e85..13ae81530d 100644 --- a/client/src/org/compiere/apps/ALogin.java +++ b/client/src/org/compiere/apps/ALogin.java @@ -34,7 +34,6 @@ import java.util.ResourceBundle; import javax.swing.JOptionPane; import javax.swing.JPasswordField; -import javax.swing.JScrollPane; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -45,6 +44,7 @@ import org.compiere.db.CConnection; import org.compiere.db.CConnectionEditor; import org.compiere.grid.ed.VComboBox; import org.compiere.grid.ed.VDate; +import org.compiere.model.MSysConfig; import org.compiere.model.MSystem; import org.compiere.model.MUser; import org.compiere.print.CPrinter; @@ -76,8 +76,7 @@ public final class ALogin extends CDialog /** * */ - private static final long serialVersionUID = 7789299589024390163L; - + private static final long serialVersionUID = -3057525535969948097L; /** * Construct the dialog. @@ -150,8 +149,8 @@ public final class ALogin extends CDialog private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false, false); //private OnlineHelp onlineHelp = new OnlineHelp(true); //private CPanel helpPanel = new CPanel(); - private JScrollPane helpScollPane = new JScrollPane(); - private BorderLayout helpLayout = new BorderLayout(); + // private JScrollPane helpScrollPane = new JScrollPane(); + // private BorderLayout helpLayout = new BorderLayout(); /** Server Connection */ private CConnection m_cc; @@ -693,6 +692,19 @@ public final class ALogin extends CDialog } if (iniValue != null) roleCombo.setSelectedItem(iniValue); + + // If we have only one role, we can hide the combobox - metas-2009_0021_AP1_G94 + if (roleCombo.getItemCount() == 1 && ! MSysConfig.getBooleanValue("ALogin_ShowOneRole", true)) + { + roleCombo.setSelectedIndex(0); + roleLabel.setVisible(false); + roleCombo.setVisible(false); + } + else + { + roleLabel.setVisible(true); + roleCombo.setVisible(true); + } userTextField.setBackground(AdempierePLAF.getFieldBackground_Normal()); passwordField.setBackground(AdempierePLAF.getFieldBackground_Normal()); diff --git a/client/src/org/compiere/apps/form/Archive.java b/client/src/org/compiere/apps/form/Archive.java index a521f3ae70..5c0300489f 100644 --- a/client/src/org/compiere/apps/form/Archive.java +++ b/client/src/org/compiere/apps/form/Archive.java @@ -43,7 +43,8 @@ public class Archive { public KeyNamePair[] getProcessData() { // Processes - int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); + final MRole role = MRole.getDefault(); // metas +// int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Process"); String lang = Env.getAD_Language(Env.getCtx()); @@ -52,7 +53,7 @@ public class Archive { + (trl ? "trl.Name" : "p.Name ") + " FROM AD_Process p INNER JOIN AD_Process_Access pa ON (p.AD_Process_ID=pa.AD_Process_ID) " + (trl ? "LEFT JOIN AD_Process_Trl trl on (trl.AD_Process_ID=p.AD_Process_ID and trl.AD_Language=" + DB.TO_STRING(lang) + ")" : "") - + " WHERE pa.AD_Role_ID=" + AD_Role_ID + + " WHERE "+role.getIncludedRolesWhereClause("pa.AD_Role_ID", null) // metas: use included roles + " AND p.IsReport='Y' AND p.IsActive='Y' AND pa.IsActive='Y' " + "ORDER BY 2"; return DB.getKeyNamePairs(sql, true); @@ -61,7 +62,8 @@ public class Archive { public KeyNamePair[] getTableData() { // Tables - int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); + final MRole role = MRole.getDefault(); // metas +// int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx()); boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Table"); String lang = Env.getAD_Language(Env.getCtx()); String sql = "SELECT DISTINCT t.AD_Table_ID," @@ -69,7 +71,7 @@ public class Archive { + " FROM AD_Table t INNER JOIN AD_Tab tab ON (tab.AD_Table_ID=t.AD_Table_ID)" + " INNER JOIN AD_Window_Access wa ON (tab.AD_Window_ID=wa.AD_Window_ID) " + (trl ? "LEFT JOIN AD_Table_Trl trl on (trl.AD_Table_ID=t.AD_Table_ID and trl.AD_Language=" + DB.TO_STRING(lang) + ")" : "") - + " WHERE wa.AD_Role_ID=" + AD_Role_ID + + " WHERE "+role.getIncludedRolesWhereClause("wa.AD_Role_ID", null) // metas + " AND t.IsActive='Y' AND tab.IsActive='Y' " + "ORDER BY 2"; return DB.getKeyNamePairs(sql, true); @@ -192,18 +194,24 @@ public class Archive { log.fine(sql.toString()); + //metas: Bugfix zu included_Role // Process Access sql.append(" AND (AD_Process_ID IS NULL OR AD_Process_ID IN " + "(SELECT AD_Process_ID FROM AD_Process_Access WHERE AD_Role_ID=") - .append(role.getAD_Role_ID()).append("))"); + .append(role.getAD_Role_ID()) + .append(" OR ").append(role.getIncludedRolesWhereClause("AD_Role_ID", null)) + .append("))"); // Table Access sql.append(" AND (AD_Table_ID IS NULL " + "OR (AD_Table_ID IS NOT NULL AND AD_Process_ID IS NOT NULL) " // Menu Reports + "OR AD_Table_ID IN " + "(SELECT t.AD_Table_ID FROM AD_Tab t" + " INNER JOIN AD_Window_Access wa ON (t.AD_Window_ID=wa.AD_Window_ID) " - + "WHERE wa.AD_Role_ID=").append(role.getAD_Role_ID()).append("))"); + + "WHERE wa.AD_Role_ID=").append(role.getAD_Role_ID()) + .append(" OR ").append(role.getIncludedRolesWhereClause("wa.AD_Role_ID", null)) + .append("))"); log.finest(sql.toString()); + //metas: Bugfix zu included_Role ende // m_archives = MArchive.get(Env.getCtx(), sql.toString()); log.info("Length=" + m_archives.length); diff --git a/migration/354a-trunk/oracle/705_AD_Role_Included.sql b/migration/354a-trunk/oracle/705_AD_Role_Included.sql new file mode 100644 index 0000000000..eb071d04b4 --- /dev/null +++ b/migration/354a-trunk/oracle/705_AD_Role_Included.sql @@ -0,0 +1,281 @@ +-- Jul 27, 2009 7:44:04 PM EEST +-- FR2976452_Implement included roles feature +INSERT INTO AD_Table (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Table_ID,AD_Window_ID,CopyColumnsFromTable,Created,CreatedBy,EntityType,ImportTable,IsActive,IsChangeLog,IsDeleteable,IsHighVolume,IsSecurityEnabled,IsView,LoadSeq,Name,ReplicationType,TableName,Updated,UpdatedBy) VALUES ('6',0,0,53222,111,'N',TO_DATE('2009-07-27 19:43:49','YYYY-MM-DD HH24:MI:SS'),0,'D','N','Y','N','Y','N','N','N',0,'Included Role','L','AD_Role_Included',TO_DATE('2009-07-27 19:43:49','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:44:04 PM EEST +INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=53222 AND EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Table_ID!=t.AD_Table_ID) +; + +-- Jul 27, 2009 7:44:05 PM EEST +INSERT INTO AD_Sequence (AD_Client_ID,AD_Org_ID,AD_Sequence_ID,Created,CreatedBy,CurrentNext,CurrentNextSys,Description,IncrementNo,IsActive,IsAudited,IsAutoSequence,IsTableID,Name,StartNewYear,StartNo,Updated,UpdatedBy) VALUES (0,0,53330,TO_DATE('2009-07-27 19:44:04','YYYY-MM-DD HH24:MI:SS'),0,1000000,50000,'Table AD_Role_Included',1,'Y','N','Y','Y','AD_Role_Included','N',1000000,TO_DATE('2009-07-27 19:44:04','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:46:10 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57940,102,0,19,53222,'AD_Client_ID',TO_DATE('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,'@AD_Client_ID@','Client/Tenant for this installation.','D',22,'A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y','N','N','N','N','Y','N','N','N','N','N','Client',0,TO_DATE('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:10 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57940 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:11 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57941,113,0,19,53222,148,'AD_Org_ID',TO_DATE('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,'@AD_Org_ID@','Organizational entity within client','D',22,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','N','N','N','N','Y','Y','N','N','N','N','Organization',0,TO_DATE('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:11 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57941 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57942,123,0,19,53222,'AD_Role_ID',TO_DATE('2009-07-27 19:46:11','YYYY-MM-DD HH24:MI:SS'),0,'Responsibility Role','D',22,'The Role determines security and access a user who has this Role will have in the System.','Y','N','N','N','N','Y','Y','N','N','N','N','Role',0,TO_DATE('2009-07-27 19:46:11','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57942 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57943,245,0,16,53222,'Created',TO_DATE('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,'Date this record was created','D',7,'The Created field indicates the date that this record was created.','Y','N','N','N','N','Y','N','N','N','N','N','Created',0,TO_DATE('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57943 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57944,246,0,18,110,53222,'CreatedBy',TO_DATE('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,'User who created this records','D',22,'The Created By field indicates the user who created this record.','Y','N','N','N','N','Y','N','N','N','N','N','Created By',0,TO_DATE('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57944 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57945,348,0,20,53222,'IsActive',TO_DATE('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,'Y','The record is active in the system','D',1,'There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','Y','N','N','N','N','Y','N','N','N','N','Y','Active',0,TO_DATE('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57945 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57946,405,0,20,53222,'IsReadOnly',TO_DATE('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,'Field is read only','D',1,'The Read Only indicates that this field may only be Read. It may not be updated.','Y','N','N','N','N','Y','N','N','N','N','Y','Read Only',0,TO_DATE('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57946 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57947,607,0,16,53222,'Updated',TO_DATE('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,'Date this record was updated','D',7,'The Updated field indicates the date that this record was updated.','Y','N','N','N','N','Y','N','N','N','N','N','Updated',0,TO_DATE('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57947 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:16 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57948,608,0,18,110,53222,'UpdatedBy',TO_DATE('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,'User who updated this records','D',22,'The Updated By field indicates the user who updated this record.','Y','N','N','N','N','Y','N','N','N','N','N','Updated By',0,TO_DATE('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:16 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57948 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:41 PM EEST +UPDATE AD_Column SET IsParent='N', IsUpdateable='Y',Updated=TO_DATE('2009-07-27 19:46:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:47:35 PM EEST +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53896,0,'Included_Role_ID',TO_DATE('2009-07-27 19:47:34','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Included Role','Included Role',TO_DATE('2009-07-27 19:47:34','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:47:35 PM EEST +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53896 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jul 27, 2009 7:48:09 PM EEST +UPDATE AD_Column SET IsUpdateable='N',Updated=TO_DATE('2009-07-27 19:48:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:49:08 PM EEST +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,53317,TO_DATE('2009-07-27 19:49:07','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','N','AD_Role',TO_DATE('2009-07-27 19:49:07','YYYY-MM-DD HH24:MI:SS'),0,'T') +; + +-- Jul 27, 2009 7:49:08 PM EEST +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53317 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jul 27, 2009 7:50:13 PM EEST +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,532,531,0,53317,156,TO_DATE('2009-07-27 19:50:13','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','N',TO_DATE('2009-07-27 19:50:13','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:50:45 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57949,53896,0,18,53317,53222,'Included_Role_ID',TO_DATE('2009-07-27 19:50:44','YYYY-MM-DD HH24:MI:SS'),0,'D',10,'Y','Y','N','N','N','N','N','Y','Y','N','N','N','N','Included Role',0,TO_DATE('2009-07-27 19:50:44','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Jul 27, 2009 7:50:45 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57949 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:51:15 PM EEST +DELETE FROM AD_Column_Trl WHERE AD_Column_ID=57946 +; + +-- Jul 27, 2009 7:51:16 PM EEST +DELETE FROM AD_Column WHERE AD_Column_ID=57946 +; + +-- Jul 27, 2009 7:53:08 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57950,566,0,11,53222,'SeqNo',TO_DATE('2009-07-27 19:53:07','YYYY-MM-DD HH24:MI:SS'),0,'@SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_Role_Included WHERE AD_Role_ID=@AD_Role_ID@','Method of ordering records; lowest number comes first','D',10,'The Sequence indicates the order of records','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Sequence',0,TO_DATE('2009-07-27 19:53:07','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Jul 27, 2009 7:53:08 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57950 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:53:22 PM EEST +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2009-07-27 19:53:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57950 +; + +-- Jul 27, 2009 7:54:10 PM EEST +UPDATE AD_Column SET AD_Val_Rule_ID=NULL,Updated=TO_DATE('2009-07-27 19:54:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:54:14 PM EEST +UPDATE AD_Column SET AD_Reference_ID=30,Updated=TO_DATE('2009-07-27 19:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:54:20 PM EEST +UPDATE AD_Column SET AD_Reference_ID=30,Updated=TO_DATE('2009-07-27 19:54:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57940 +; + +-- Jul 27, 2009 7:54:32 PM EEST +UPDATE AD_Column SET AD_Reference_ID=30, IsUpdateable='N',Updated=TO_DATE('2009-07-27 19:54:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57942 +; + +-- Jul 27, 2009 7:55:39 PM EEST +INSERT INTO AD_Tab (AD_Client_ID,AD_Column_ID,AD_Org_ID,AD_Tab_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,HasTree,ImportFields,IsActive,IsAdvancedTab,IsInfoTab,IsInsertRecord,IsReadOnly,IsSingleRow,IsSortTab,IsTranslationTab,Name,Processing,SeqNo,TabLevel,Updated,UpdatedBy) VALUES (0,57942,0,53240,53222,111,TO_DATE('2009-07-27 19:55:38','YYYY-MM-DD HH24:MI:SS'),0,'D','N','N','Y','N','N','Y','N','N','N','N','Included roles','N',100,0,TO_DATE('2009-07-27 19:55:38','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:39 PM EEST +INSERT INTO AD_Tab_Trl (AD_Language,AD_Tab_ID, CommitWarning,Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Tab_ID, t.CommitWarning,t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Tab t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Tab_ID=53240 AND EXISTS (SELECT * FROM AD_Tab_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Tab_ID!=t.AD_Tab_ID) +; + +-- Jul 27, 2009 7:55:42 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57945,57371,0,53240,TO_DATE('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0,'The record is active in the system',1,'D','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','Y','Y','Y','N','N','N','N','N','Active',TO_DATE('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:42 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57371 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:43 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57940,57372,0,53240,TO_DATE('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0,'Client/Tenant for this installation.',22,'D','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y','Y','Y','N','N','N','N','N','Client',TO_DATE('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:43 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57372 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57949,57373,0,53240,TO_DATE('2009-07-27 19:55:43','YYYY-MM-DD HH24:MI:SS'),0,10,'D','Y','Y','Y','N','N','N','N','N','Included Role',TO_DATE('2009-07-27 19:55:43','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57373 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57941,57374,0,53240,TO_DATE('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0,'Organizational entity within client',22,'D','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','Y','Y','N','N','N','N','N','Organization',TO_DATE('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57374 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:45 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57942,57375,0,53240,TO_DATE('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0,'Responsibility Role',22,'D','The Role determines security and access a user who has this Role will have in the System.','Y','Y','Y','N','N','N','N','N','Role',TO_DATE('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:45 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57375 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:46 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57950,57376,0,53240,TO_DATE('2009-07-27 19:55:45','YYYY-MM-DD HH24:MI:SS'),0,'Method of ordering records; lowest number comes first',10,'D','The Sequence indicates the order of records','Y','Y','Y','N','N','N','N','N','Sequence',TO_DATE('2009-07-27 19:55:45','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:46 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57376 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:51 PM EEST +UPDATE AD_Tab SET TabLevel=1,Updated=TO_DATE('2009-07-27 19:55:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=53240 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57372 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57374 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=57376 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=57371 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=57375 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=57373 +; + +-- Jul 27, 2009 7:56:17 PM EEST +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2009-07-27 19:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57371 +; + +-- Jul 27, 2009 7:56:22 PM EEST +UPDATE AD_Field SET DisplayLength=10,Updated=TO_DATE('2009-07-27 19:56:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57375 +; + +-- Jul 27, 2009 7:56:25 PM EEST +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2009-07-27 19:56:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57373 +; + +-- Jul 27, 2009 7:59:00 PM EEST +UPDATE AD_Column SET IsParent='N',Updated=TO_DATE('2009-07-27 19:59:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57949 +; + +-- Jul 27, 2009 7:59:42 PM EEST +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_DATE('2009-07-27 19:59:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57949 +; + +CREATE TABLE AD_Role_Included (AD_Client_ID NUMBER(10) NOT NULL, AD_Org_ID NUMBER(10) NOT NULL, AD_Role_ID NUMBER(10) NOT NULL, Created DATE NOT NULL, CreatedBy NUMBER(10) NOT NULL, Included_Role_ID NUMBER(10) NOT NULL, IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, SeqNo NUMBER(10) NOT NULL, Updated DATE NOT NULL, UpdatedBy NUMBER(10) NOT NULL, CONSTRAINT AD_Role_Included_Key PRIMARY KEY (AD_Role_ID, Included_Role_ID)) +; + +ALTER TABLE AD_Role_Included ADD CONSTRAINT AD_Role_Included_Parent FOREIGN KEY (AD_Role_ID) + REFERENCES AD_Role(AD_Role_ID) ON DELETE CASCADE; + +ALTER TABLE AD_Role_Included ADD CONSTRAINT AD_Role_Included_Role FOREIGN KEY (Included_Role_ID) + REFERENCES AD_Role(AD_Role_ID); + +-- Mar 25, 2010 10:30:48 AM COT +-- FR2976452_Implement included roles feature +INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50041,'S',TO_DATE('2010-03-25 10:30:46','YYYY-MM-DD HH24:MI:SS'),100,'Show Role List Box when there is just one role to select','D','Y','ALogin_ShowOneRole',TO_DATE('2010-03-25 10:30:46','YYYY-MM-DD HH24:MI:SS'),100,'Y') +; + diff --git a/migration/354a-trunk/postgresql/705_AD_Role_Included.sql b/migration/354a-trunk/postgresql/705_AD_Role_Included.sql new file mode 100644 index 0000000000..0fa1e78755 --- /dev/null +++ b/migration/354a-trunk/postgresql/705_AD_Role_Included.sql @@ -0,0 +1,283 @@ +-- Jul 27, 2009 7:44:04 PM EEST +-- FR2976452_Implement included roles feature +INSERT INTO AD_Table (AccessLevel,AD_Client_ID,AD_Org_ID,AD_Table_ID,AD_Window_ID,CopyColumnsFromTable,Created,CreatedBy,EntityType,ImportTable,IsActive,IsChangeLog,IsDeleteable,IsHighVolume,IsSecurityEnabled,IsView,LoadSeq,Name,ReplicationType,TableName,Updated,UpdatedBy) VALUES ('6',0,0,53222,111,'N',TO_TIMESTAMP('2009-07-27 19:43:49','YYYY-MM-DD HH24:MI:SS'),0,'D','N','Y','N','Y','N','N','N',0,'Included Role','L','AD_Role_Included',TO_TIMESTAMP('2009-07-27 19:43:49','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:44:04 PM EEST +INSERT INTO AD_Table_Trl (AD_Language,AD_Table_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Table_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Table t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Table_ID=53222 AND EXISTS (SELECT * FROM AD_Table_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Table_ID!=t.AD_Table_ID) +; + +-- Jul 27, 2009 7:44:05 PM EEST +INSERT INTO AD_Sequence (AD_Client_ID,AD_Org_ID,AD_Sequence_ID,Created,CreatedBy,CurrentNext,CurrentNextSys,Description,IncrementNo,IsActive,IsAudited,IsAutoSequence,IsTableID,Name,StartNewYear,StartNo,Updated,UpdatedBy) VALUES (0,0,53330,TO_TIMESTAMP('2009-07-27 19:44:04','YYYY-MM-DD HH24:MI:SS'),0,1000000,50000,'Table AD_Role_Included',1,'Y','N','Y','Y','AD_Role_Included','N',1000000,TO_TIMESTAMP('2009-07-27 19:44:04','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:46:10 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57940,102,0,19,53222,'AD_Client_ID',TO_TIMESTAMP('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,'@AD_Client_ID@','Client/Tenant for this installation.','D',22,'A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y','N','N','N','N','Y','N','N','N','N','N','Client',0,TO_TIMESTAMP('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:10 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57940 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:11 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57941,113,0,19,53222,148,'AD_Org_ID',TO_TIMESTAMP('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,'@AD_Org_ID@','Organizational entity within client','D',22,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','N','N','N','N','Y','Y','N','N','N','N','Organization',0,TO_TIMESTAMP('2009-07-27 19:46:10','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:11 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57941 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57942,123,0,19,53222,'AD_Role_ID',TO_TIMESTAMP('2009-07-27 19:46:11','YYYY-MM-DD HH24:MI:SS'),0,'Responsibility Role','D',22,'The Role determines security and access a user who has this Role will have in the System.','Y','N','N','N','N','Y','Y','N','N','N','N','Role',0,TO_TIMESTAMP('2009-07-27 19:46:11','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57942 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57943,245,0,16,53222,'Created',TO_TIMESTAMP('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,'Date this record was created','D',7,'The Created field indicates the date that this record was created.','Y','N','N','N','N','Y','N','N','N','N','N','Created',0,TO_TIMESTAMP('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:12 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57943 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57944,246,0,18,110,53222,'CreatedBy',TO_TIMESTAMP('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,'User who created this records','D',22,'The Created By field indicates the user who created this record.','Y','N','N','N','N','Y','N','N','N','N','N','Created By',0,TO_TIMESTAMP('2009-07-27 19:46:12','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57944 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57945,348,0,20,53222,'IsActive',TO_TIMESTAMP('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,'Y','The record is active in the system','D',1,'There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','Y','N','N','N','N','Y','N','N','N','N','Y','Active',0,TO_TIMESTAMP('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:13 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57945 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57946,405,0,20,53222,'IsReadOnly',TO_TIMESTAMP('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,'Field is read only','D',1,'The Read Only indicates that this field may only be Read. It may not be updated.','Y','N','N','N','N','Y','N','N','N','N','Y','Read Only',0,TO_TIMESTAMP('2009-07-27 19:46:13','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57946 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57947,607,0,16,53222,'Updated',TO_TIMESTAMP('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,'Date this record was updated','D',7,'The Updated field indicates the date that this record was updated.','Y','N','N','N','N','Y','N','N','N','N','N','Updated',0,TO_TIMESTAMP('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:15 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57947 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:16 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAlwaysUpdateable,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57948,608,0,18,110,53222,'UpdatedBy',TO_TIMESTAMP('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,'User who updated this records','D',22,'The Updated By field indicates the user who updated this record.','Y','N','N','N','N','Y','N','N','N','N','N','Updated By',0,TO_TIMESTAMP('2009-07-27 19:46:15','YYYY-MM-DD HH24:MI:SS'),0,1) +; + +-- Jul 27, 2009 7:46:16 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57948 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:46:41 PM EEST +UPDATE AD_Column SET IsParent='N', IsUpdateable='Y',Updated=TO_TIMESTAMP('2009-07-27 19:46:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:47:35 PM EEST +INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,EntityType,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,53896,0,'Included_Role_ID',TO_TIMESTAMP('2009-07-27 19:47:34','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','Included Role','Included Role',TO_TIMESTAMP('2009-07-27 19:47:34','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:47:35 PM EEST +INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53896 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID) +; + +-- Jul 27, 2009 7:48:09 PM EEST +UPDATE AD_Column SET IsUpdateable='N',Updated=TO_TIMESTAMP('2009-07-27 19:48:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:49:08 PM EEST +INSERT INTO AD_Reference (AD_Client_ID,AD_Org_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,IsOrderByValue,Name,Updated,UpdatedBy,ValidationType) VALUES (0,0,53317,TO_TIMESTAMP('2009-07-27 19:49:07','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','N','AD_Role',TO_TIMESTAMP('2009-07-27 19:49:07','YYYY-MM-DD HH24:MI:SS'),0,'T') +; + +-- Jul 27, 2009 7:49:08 PM EEST +INSERT INTO AD_Reference_Trl (AD_Language,AD_Reference_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Reference_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Reference t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Reference_ID=53317 AND EXISTS (SELECT * FROM AD_Reference_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Reference_ID!=t.AD_Reference_ID) +; + +-- Jul 27, 2009 7:50:13 PM EEST +INSERT INTO AD_Ref_Table (AD_Client_ID,AD_Display,AD_Key,AD_Org_ID,AD_Reference_ID,AD_Table_ID,Created,CreatedBy,EntityType,IsActive,IsValueDisplayed,Updated,UpdatedBy) VALUES (0,532,531,0,53317,156,TO_TIMESTAMP('2009-07-27 19:50:13','YYYY-MM-DD HH24:MI:SS'),0,'D','Y','N',TO_TIMESTAMP('2009-07-27 19:50:13','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:50:45 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Reference_Value_ID,AD_Table_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57949,53896,0,18,53317,53222,'Included_Role_ID',TO_TIMESTAMP('2009-07-27 19:50:44','YYYY-MM-DD HH24:MI:SS'),0,'D',10,'Y','Y','N','N','N','N','N','Y','Y','N','N','N','N','Included Role',0,TO_TIMESTAMP('2009-07-27 19:50:44','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Jul 27, 2009 7:50:45 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57949 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:51:15 PM EEST +DELETE FROM AD_Column_Trl WHERE AD_Column_ID=57946 +; + +-- Jul 27, 2009 7:51:16 PM EEST +DELETE FROM AD_Column WHERE AD_Column_ID=57946 +; + +-- Jul 27, 2009 7:53:08 PM EEST +INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,57950,566,0,11,53222,'SeqNo',TO_TIMESTAMP('2009-07-27 19:53:07','YYYY-MM-DD HH24:MI:SS'),0,'@SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_Role_Included WHERE AD_Role_ID=@AD_Role_ID@','Method of ordering records; lowest number comes first','D',10,'The Sequence indicates the order of records','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Sequence',0,TO_TIMESTAMP('2009-07-27 19:53:07','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +-- Jul 27, 2009 7:53:08 PM EEST +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57950 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Jul 27, 2009 7:53:22 PM EEST +UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2009-07-27 19:53:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57950 +; + +-- Jul 27, 2009 7:54:10 PM EEST +UPDATE AD_Column SET AD_Val_Rule_ID=NULL,Updated=TO_TIMESTAMP('2009-07-27 19:54:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:54:14 PM EEST +UPDATE AD_Column SET AD_Reference_ID=30,Updated=TO_TIMESTAMP('2009-07-27 19:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57941 +; + +-- Jul 27, 2009 7:54:20 PM EEST +UPDATE AD_Column SET AD_Reference_ID=30,Updated=TO_TIMESTAMP('2009-07-27 19:54:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57940 +; + +-- Jul 27, 2009 7:54:32 PM EEST +UPDATE AD_Column SET AD_Reference_ID=30, IsUpdateable='N',Updated=TO_TIMESTAMP('2009-07-27 19:54:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57942 +; + +-- Jul 27, 2009 7:55:39 PM EEST +INSERT INTO AD_Tab (AD_Client_ID,AD_Column_ID,AD_Org_ID,AD_Tab_ID,AD_Table_ID,AD_Window_ID,Created,CreatedBy,EntityType,HasTree,ImportFields,IsActive,IsAdvancedTab,IsInfoTab,IsInsertRecord,IsReadOnly,IsSingleRow,IsSortTab,IsTranslationTab,Name,Processing,SeqNo,TabLevel,Updated,UpdatedBy) VALUES (0,57942,0,53240,53222,111,TO_TIMESTAMP('2009-07-27 19:55:38','YYYY-MM-DD HH24:MI:SS'),0,'D','N','N','Y','N','N','Y','N','N','N','N','Included roles','N',100,0,TO_TIMESTAMP('2009-07-27 19:55:38','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:39 PM EEST +INSERT INTO AD_Tab_Trl (AD_Language,AD_Tab_ID, CommitWarning,Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Tab_ID, t.CommitWarning,t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Tab t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Tab_ID=53240 AND EXISTS (SELECT * FROM AD_Tab_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Tab_ID!=t.AD_Tab_ID) +; + +-- Jul 27, 2009 7:55:42 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57945,57371,0,53240,TO_TIMESTAMP('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0,'The record is active in the system',1,'D','There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reports. +There are two reasons for de-activating and not deleting records: +(1) The system requires the record for audit purposes. +(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are invoices for this partner record existing. You de-activate the Business Partner and prevent that this record is used for future entries.','Y','Y','Y','N','N','N','N','N','Active',TO_TIMESTAMP('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:42 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57371 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:43 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57940,57372,0,53240,TO_TIMESTAMP('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0,'Client/Tenant for this installation.',22,'D','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y','Y','Y','N','N','N','N','N','Client',TO_TIMESTAMP('2009-07-27 19:55:42','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:43 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57372 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57949,57373,0,53240,TO_TIMESTAMP('2009-07-27 19:55:43','YYYY-MM-DD HH24:MI:SS'),0,10,'D','Y','Y','Y','N','N','N','N','N','Included Role',TO_TIMESTAMP('2009-07-27 19:55:43','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57373 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57941,57374,0,53240,TO_TIMESTAMP('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0,'Organizational entity within client',22,'D','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','Y','Y','N','N','N','N','N','Organization',TO_TIMESTAMP('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:44 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57374 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:45 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57942,57375,0,53240,TO_TIMESTAMP('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0,'Responsibility Role',22,'D','The Role determines security and access a user who has this Role will have in the System.','Y','Y','Y','N','N','N','N','N','Role',TO_TIMESTAMP('2009-07-27 19:55:44','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:45 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57375 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:46 PM EEST +INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,Updated,UpdatedBy) VALUES (0,57950,57376,0,53240,TO_TIMESTAMP('2009-07-27 19:55:45','YYYY-MM-DD HH24:MI:SS'),0,'Method of ordering records; lowest number comes first',10,'D','The Sequence indicates the order of records','Y','Y','Y','N','N','N','N','N','Sequence',TO_TIMESTAMP('2009-07-27 19:55:45','YYYY-MM-DD HH24:MI:SS'),0) +; + +-- Jul 27, 2009 7:55:46 PM EEST +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=57376 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Jul 27, 2009 7:55:51 PM EEST +UPDATE AD_Tab SET TabLevel=1,Updated=TO_TIMESTAMP('2009-07-27 19:55:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Tab_ID=53240 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57372 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57374 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=57376 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=57371 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=57375 +; + +-- Jul 27, 2009 7:56:08 PM EEST +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=57373 +; + +-- Jul 27, 2009 7:56:17 PM EEST +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2009-07-27 19:56:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57371 +; + +-- Jul 27, 2009 7:56:22 PM EEST +UPDATE AD_Field SET DisplayLength=10,Updated=TO_TIMESTAMP('2009-07-27 19:56:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57375 +; + +-- Jul 27, 2009 7:56:25 PM EEST +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2009-07-27 19:56:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=57373 +; + +-- Jul 27, 2009 7:59:00 PM EEST +UPDATE AD_Column SET IsParent='N',Updated=TO_TIMESTAMP('2009-07-27 19:59:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57949 +; + +-- Jul 27, 2009 7:59:42 PM EEST +UPDATE AD_Column SET IsParent='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2009-07-27 19:59:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=57949 +; + +CREATE TABLE AD_Role_Included (AD_Client_ID NUMERIC(10) NOT NULL, AD_Org_ID NUMERIC(10) NOT NULL, AD_Role_ID NUMERIC(10) NOT NULL, Created TIMESTAMP NOT NULL, CreatedBy NUMERIC(10) NOT NULL, Included_Role_ID NUMERIC(10) NOT NULL, IsActive CHAR(1) DEFAULT 'Y' CHECK (IsActive IN ('Y','N')) NOT NULL, SeqNo NUMERIC(10) NOT NULL, Updated TIMESTAMP NOT NULL, UpdatedBy NUMERIC(10) NOT NULL, CONSTRAINT AD_Role_Included_Key PRIMARY KEY (AD_Role_ID, Included_Role_ID)) +; + +ALTER TABLE AD_Role_Included ADD CONSTRAINT AD_Role_Included_Parent FOREIGN KEY (AD_Role_ID) + REFERENCES AD_Role(AD_Role_ID) ON DELETE CASCADE +; + +ALTER TABLE AD_Role_Included ADD CONSTRAINT AD_Role_Included_Role FOREIGN KEY (Included_Role_ID) + REFERENCES AD_Role(AD_Role_ID) +; + +-- Mar 25, 2010 10:30:48 AM COT +-- FR2976452_Implement included roles feature +INSERT INTO AD_SysConfig (AD_Client_ID,AD_Org_ID,AD_SysConfig_ID,ConfigurationLevel,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,50041,'S',TO_TIMESTAMP('2010-03-25 10:30:46','YYYY-MM-DD HH24:MI:SS'),100,'Show Role List Box when there is just one role to select','D','Y','ALogin_ShowOneRole',TO_TIMESTAMP('2010-03-25 10:30:46','YYYY-MM-DD HH24:MI:SS'),100,'Y') +; + diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index 552ed38640..8031a89004 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -38,8 +38,8 @@ import org.adempiere.webui.theme.ITheme; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.UserPreference; import org.adempiere.webui.window.LoginWindow; -import org.compiere.db.CConnection; import org.compiere.model.MRole; +import org.compiere.model.MSysConfig; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Language; @@ -70,10 +70,10 @@ import org.zkoss.zul.Image; */ public class RolePanel extends Window implements EventListener, Deferrable { - /** - * + /** + * */ - private static final long serialVersionUID = 2808473294679524383L; + private static final long serialVersionUID = -2210467236654772389L; private static final String RESOURCE = "org.compiere.apps.ALoginRes"; @@ -261,6 +261,20 @@ public class RolePanel extends Window implements EventListener, Deferrable if (lstRole.getSelectedIndex() == -1 && lstRole.getItemCount() > 0) lstRole.setSelectedIndex(0); // + + // If we have only one role, we can hide the combobox - metas-2009_0021_AP1_G94 + if (lstRole.getItemCount() == 1 && ! MSysConfig.getBooleanValue("ALogin_ShowOneRole", true)) + { + lstRole.setSelectedIndex(0); + lblRole.setVisible(false); + lstRole.setVisible(false); + } + else + { + lblRole.setVisible(true); + lstRole.setVisible(true); + } + updateClientList(); }