From 47811f6a686bbef994a14ff5facaa87be52531c7 Mon Sep 17 00:00:00 2001 From: kthiemann Date: Wed, 28 Nov 2007 09:17:36 +0000 Subject: [PATCH] FR [1782412] Add Document Action Access Functionality --- .../model/I_AD_Document_Action_Access.java | 104 ++++++++++ base/src/org/compiere/model/MDocType.java | 63 +++++- base/src/org/compiere/model/MRole.java | 88 +++++++- .../model/X_AD_Document_Action_Access.java | 189 ++++++++++++++++++ .../org/compiere/process/DocumentEngine.java | 81 +++++++- migration/330-trunk/039_FR_1782412.sql | 129 ++++++++++++ .../postgresql/039_FR_1782412_PG.sql | 129 ++++++++++++ 7 files changed, 760 insertions(+), 23 deletions(-) create mode 100644 base/src/org/compiere/model/I_AD_Document_Action_Access.java create mode 100644 base/src/org/compiere/model/X_AD_Document_Action_Access.java create mode 100644 migration/330-trunk/039_FR_1782412.sql create mode 100644 migration/330-trunk/postgresql/039_FR_1782412_PG.sql diff --git a/base/src/org/compiere/model/I_AD_Document_Action_Access.java b/base/src/org/compiere/model/I_AD_Document_Action_Access.java new file mode 100644 index 0000000000..5b53aa158c --- /dev/null +++ b/base/src/org/compiere/model/I_AD_Document_Action_Access.java @@ -0,0 +1,104 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; + you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; + either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; + without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; + if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - Company (http://www.site.com) * + **********************************************************************/ +package org.compiere.model; + +import java.math.BigDecimal; + +import org.compiere.util.KeyNamePair; + +/** Generated Interface for AD_Document_Action_Access + * @author Trifon Trifonov (generated) + * @version Release 3.3.0 + */ +public interface I_AD_Document_Action_Access +{ + + /** TableName=AD_Document_Action_Access */ + public static final String Table_Name = "AD_Document_Action_Access"; + + /** AD_Table_ID=53012 */ + 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_Ref_List_ID */ + public static final String COLUMNNAME_AD_Ref_List_ID = "AD_Ref_List_ID"; + + /** Set Reference List. + * Reference List based on Table + */ + public void setAD_Ref_List_ID (int AD_Ref_List_ID); + + /** Get Reference List. + * Reference List based on Table + */ + public int getAD_Ref_List_ID(); + + public I_AD_Ref_List getAD_Ref_List() throws Exception; + + /** 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 Exception; + + /** Column name C_DocType_ID */ + public static final String COLUMNNAME_C_DocType_ID = "C_DocType_ID"; + + /** Set Document Type. + * Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID); + + /** Get Document Type. + * Document type or rules + */ + public int getC_DocType_ID(); + + public I_C_DocType getC_DocType() throws Exception; +} diff --git a/base/src/org/compiere/model/MDocType.java b/base/src/org/compiere/model/MDocType.java index 59af816f14..e1b97e006c 100644 --- a/base/src/org/compiere/model/MDocType.java +++ b/base/src/org/compiere/model/MDocType.java @@ -16,15 +16,22 @@ *****************************************************************************/ package org.compiere.model; -import java.sql.*; -import java.util.*; -import java.util.logging.*; -import org.compiere.util.*; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.util.CCache; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; /** * Document Type Model * * @author Jorg Janke + * @author Karsten Thiemann FR [ 1782412 ] * @version $Id: MDocType.java,v 1.3 2006/07/30 00:54:54 jjanke Exp $ */ public class MDocType extends X_C_DocType @@ -294,4 +301,52 @@ public class MDocType extends X_C_DocType return true; } // beforeSave + /** + * After Save + * @param newRecord new + * @param success success + * @return success + */ + protected boolean afterSave (boolean newRecord, boolean success) + { + if (newRecord && success) + { + // Add doctype/docaction access to all roles of client + String sqlDocAction = "INSERT INTO AD_Document_Action_Access " + + "(AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy," + + "C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) " + + "(SELECT " + + getAD_Client_ID() + ",0,'Y', SysDate," + + getUpdatedBy() + ", SysDate," + getUpdatedBy() + + ", doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID " + + "FROM AD_Client client " + + "INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) " + + "INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) " + + "INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID) " + + "WHERE client.AD_Client_ID=" + getAD_Client_ID() + + " AND doctype.C_DocType_ID=" + get_ID() + + " AND rol.IsManual='N'" + + ")"; + + int docact = DB.executeUpdate(sqlDocAction, get_TrxName()); + log.fine("AD_Document_Action_Access=" + docact); + } + return success; + } // afterSave + + /** + * Executed after Delete operation. + * @param success true if record deleted + * @return true if delete is a success + */ + protected boolean afterDelete (boolean success) + { + if(success) { + //delete access records + int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access WHERE C_DocType_ID=" + get_IDOld(), get_TrxName()); + log.fine("Delete AD_Document_Action_Access=" + docactDel + " for C_DocType_ID: " + get_IDOld()); + } + return success; + } // afterDelete + } // MDocType diff --git a/base/src/org/compiere/model/MRole.java b/base/src/org/compiere/model/MRole.java index c9dd5760f7..fc2131b9ff 100644 --- a/base/src/org/compiere/model/MRole.java +++ b/base/src/org/compiere/model/MRole.java @@ -16,17 +16,32 @@ *****************************************************************************/ package org.compiere.model; -import java.sql.*; -import java.util.*; -import java.util.logging.*; -import org.compiere.util.*; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Properties; +import java.util.Set; +import java.util.logging.Level; + +import org.compiere.util.CCache; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Ini; +import org.compiere.util.KeyNamePair; +import org.compiere.util.Msg; +import org.compiere.util.Trace; /** * Role Model. * Includes AD_User runtime info for Personal Access * The class is final, so that you cannot overwrite the security rules. * - * @author Jorg Janke + * @author Jorg Janke + * @author Karsten Thiemann FR [ 1782412 ] * @version $Id: MRole.java,v 1.5 2006/08/09 16:38:47 jjanke Exp $ */ public final class MRole extends X_AD_Role @@ -354,8 +369,22 @@ public final class MRole extends X_AD_Role && s_defaultRole.get_ID() == get_ID()) s_defaultRole = this; return success; - } // afterSave - + } // afterSave + + /** + * Executed after Delete operation. + * @param success true if record deleted + * @return true if delete is a success + */ + protected boolean afterDelete (boolean success) + { + if(success) { + deleteAccessRecords(); + } + return success; + } // afterDelete + + /** * Create Access Records * @return info @@ -400,7 +429,22 @@ public final class MRole extends X_AD_Role + " AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) " + "SELECT w.AD_WorkFlow_ID, " + roleClientOrgUser + "FROM AD_WorkFlow w " - + "WHERE AccessLevel IN "; + + "WHERE AccessLevel IN "; + + String sqlDocAction = "INSERT INTO AD_Document_Action_Access " + + "(AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy," + + "C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) " + + "(SELECT " + + getAD_Client_ID() + ",0,'Y', SysDate," + + getUpdatedBy() + ", SysDate," + getUpdatedBy() + + ", doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID " + + "FROM AD_Client client " + + "INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) " + + "INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) " + + "INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID " + + "AND rol.AD_Role_ID=" + getAD_Role_ID() + + ") )"; + /** * Fill AD_xx_Access @@ -443,19 +487,43 @@ public final class MRole extends X_AD_Role int form = DB.executeUpdate(sqlForm + roleAccessLevel, get_TrxName()); int wfDel = DB.executeUpdate("DELETE FROM AD_WorkFlow_Access" + whereDel, get_TrxName()); int wf = DB.executeUpdate(sqlWorkflow + roleAccessLevel, get_TrxName()); + int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access" + whereDel, get_TrxName()); + int docact = DB.executeUpdate(sqlDocAction, get_TrxName()); log.fine("AD_Window_ID=" + winDel + "+" + win + ", AD_Process_ID=" + procDel + "+" + proc + ", AD_Form_ID=" + formDel + "+" + form - + ", AD_Workflow_ID=" + wfDel + "+" + wf); + + ", AD_Workflow_ID=" + wfDel + "+" + wf + + ", AD_Document_Action_Access=" + docactDel + "+" + docact); loadAccess(true); return "@AD_Window_ID@ #" + win + " - @AD_Process_ID@ #" + proc + " - @AD_Form_ID@ #" + form - + " - @AD_Workflow_ID@ #" + wf; + + " - @AD_Workflow_ID@ #" + wf + + " - AD_Document_Action_Access #" + docact; + } // createAccessRecords + /** + * Delete Access Records of the role after the role was (successfully) deleted. + */ + private void deleteAccessRecords() { + String whereDel = " WHERE AD_Role_ID=" + getAD_Role_ID(); + // + int winDel = DB.executeUpdate("DELETE FROM AD_Window_Access" + whereDel, get_TrxName()); + int procDel = DB.executeUpdate("DELETE FROM AD_Process_Access" + whereDel, get_TrxName()); + int formDel = DB.executeUpdate("DELETE FROM AD_Form_Access" + whereDel, get_TrxName()); + int wfDel = DB.executeUpdate("DELETE FROM AD_WorkFlow_Access" + whereDel, get_TrxName()); + int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access" + whereDel, get_TrxName()); + + + log.fine("AD_Window_Access=" + winDel + + ", AD_Process_Access=" + procDel + + ", AD_Form_Access=" + formDel + + ", AD_Workflow_Access=" + wfDel + + ", AD_Document_Action_Access=" + docactDel); + } /** * String Representation diff --git a/base/src/org/compiere/model/X_AD_Document_Action_Access.java b/base/src/org/compiere/model/X_AD_Document_Action_Access.java new file mode 100644 index 0000000000..8cbe393880 --- /dev/null +++ b/base/src/org/compiere/model/X_AD_Document_Action_Access.java @@ -0,0 +1,189 @@ +/****************************************************************************** + * 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.lang.reflect.Constructor; +import java.sql.ResultSet; +import java.util.Properties; +import java.util.logging.Level; + +/** Generated Model for AD_Document_Action_Access + * @author Adempiere (generated) + * @version Release 3.3.0 - $Id$ */ +public class X_AD_Document_Action_Access extends PO implements I_AD_Document_Action_Access, I_Persistent +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Standard Constructor */ + public X_AD_Document_Action_Access (Properties ctx, int AD_Document_Action_Access_ID, String trxName) + { + super (ctx, AD_Document_Action_Access_ID, trxName); + /** if (AD_Document_Action_Access_ID == 0) + { + setAD_Ref_List_ID (0); + setAD_Role_ID (0); + setC_DocType_ID (0); + } */ + } + + /** Load Constructor */ + public X_AD_Document_Action_Access (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); + return poi; + } + + public String toString() + { + StringBuffer sb = new StringBuffer ("X_AD_Document_Action_Access[") + .append(get_ID()).append("]"); + return sb.toString(); + } + + public I_AD_Ref_List getAD_Ref_List() throws Exception + { + Class clazz = MTable.getClass(I_AD_Ref_List.Table_Name); + I_AD_Ref_List result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_AD_Ref_List)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_Ref_List_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Reference List. + @param AD_Ref_List_ID + Reference List based on Table + */ + public void setAD_Ref_List_ID (int AD_Ref_List_ID) + { + if (AD_Ref_List_ID < 1) + throw new IllegalArgumentException ("AD_Ref_List_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_AD_Ref_List_ID, Integer.valueOf(AD_Ref_List_ID)); + } + + /** Get Reference List. + @return Reference List based on Table + */ + public int getAD_Ref_List_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Ref_List_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + + public I_AD_Role getAD_Role() throws Exception + { + Class clazz = MTable.getClass(I_AD_Role.Table_Name); + I_AD_Role result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_AD_Role)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_Role_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Role. + @param AD_Role_ID + Responsibility Role + */ + public void setAD_Role_ID (int AD_Role_ID) + { + if (AD_Role_ID < 0) + throw new IllegalArgumentException ("AD_Role_ID is mandatory."); + 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_C_DocType getC_DocType() throws Exception + { + Class clazz = MTable.getClass(I_C_DocType.Table_Name); + I_C_DocType result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_C_DocType)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DocType_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw e; + } + return result; + } + + /** Set Document Type. + @param C_DocType_ID + Document type or rules + */ + public void setC_DocType_ID (int C_DocType_ID) + { + if (C_DocType_ID < 0) + throw new IllegalArgumentException ("C_DocType_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); + } + + /** Get Document Type. + @return Document type or rules + */ + public int getC_DocType_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); + if (ii == null) + return 0; + return ii.intValue(); + } +} \ No newline at end of file diff --git a/base/src/org/compiere/process/DocumentEngine.java b/base/src/org/compiere/process/DocumentEngine.java index 019f2af50f..c7d42e827b 100644 --- a/base/src/org/compiere/process/DocumentEngine.java +++ b/base/src/org/compiere/process/DocumentEngine.java @@ -16,25 +16,43 @@ *****************************************************************************/ package org.compiere.process; -import java.io.*; -import java.math.*; +import java.io.File; +import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.Properties; +import java.util.Vector; import java.util.logging.Level; -import javax.naming.*; +import javax.naming.InitialContext; -import org.compiere.db.*; -import org.compiere.interfaces.*; -import org.compiere.model.*; -import org.compiere.util.*; +import org.compiere.db.CConnection; +import org.compiere.interfaces.Server; +import org.compiere.interfaces.ServerHome; +import org.compiere.model.MAllocationHdr; +import org.compiere.model.MBankStatement; +import org.compiere.model.MClient; +import org.compiere.model.MInOut; +import org.compiere.model.MInventory; +import org.compiere.model.MInvoice; +import org.compiere.model.MJournal; +import org.compiere.model.MJournalBatch; +import org.compiere.model.MMovement; +import org.compiere.model.MOrder; +import org.compiere.model.MPayment; +import org.compiere.model.X_C_Order; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Ini; /** * Document Action Engine * - * @author Jorg Janke + * @author Jorg Janke + * @author Karsten Thiemann FR [ 1782412 ] * @version $Id: DocumentEngine.java,v 1.2 2006/07/30 00:54:44 jjanke Exp $ */ public class DocumentEngine implements DocAction @@ -1070,4 +1088,49 @@ public class DocumentEngine implements DocAction log.log(Level.SEVERE, sql, e); } } + + /** + * Checks the access rights of the given role/client for the given document actions. + * If no access rules can be found for a doctype/client/document action combination + * every role can access this combination (so no definition is needed for the default + * access rights). + * @param clientId + * @param roleId + * @param docTypeId + * @param options + * @param maxIndex + * @return number of valid actions in the String[] options + */ + public static int checkActionAccess(int clientId, int roleId, int docTypeId, String[] options, int maxIndex) { + final Vector validOptions = new Vector(); + String sql = "SELECT AD_Role_ID FROM AD_Document_Action_Access " + + "WHERE IsActive='Y' AND AD_Client_ID=? AND C_DocType_ID=? AND AD_Ref_List_ID=" + + "(SELECT AD_Ref_List_ID FROM AD_Ref_List WHERE AD_Reference_ID=135" + + " AND Value=?)"; + try + { + PreparedStatement pstmt = DB.prepareStatement(sql, null); + for (int i = 0; i < maxIndex; i++) { + pstmt.setInt(1, clientId); + pstmt.setInt(2, docTypeId); + pstmt.setString(3, options[i]); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + if(rs.getInt(1) == roleId){ + //is valid for role + validOptions.add(options[i]); + continue; + } + } + rs.close(); + } + validOptions.toArray(options); + pstmt.close(); + } + catch (SQLException e) + { + log.log(Level.SEVERE, sql, e); + } + return validOptions.size(); + } } // DocumentEnine diff --git a/migration/330-trunk/039_FR_1782412.sql b/migration/330-trunk/039_FR_1782412.sql new file mode 100644 index 0000000000..c25f2eef5e --- /dev/null +++ b/migration/330-trunk/039_FR_1782412.sql @@ -0,0 +1,129 @@ + +CREATE TABLE AD_Document_Action_Access ( + + AD_CLIENT_ID NUMBER(10,0) NOT NULL , + AD_ORG_ID NUMBER(10,0) NOT NULL , + ISACTIVE CHAR(1 BYTE) DEFAULT 'Y' NOT NULL , + CREATED DATE DEFAULT SYSDATE NOT NULL , + CREATEDBY NUMBER(10,0) NOT NULL , + UPDATED DATE DEFAULT SYSDATE NOT NULL , + UPDATEDBY NUMBER(10,0) NOT NULL , + + C_DocType_ID NUMBER(10,0) NOT NULL, + AD_Role_ID NUMBER(10,0) NOT NULL, + AD_Ref_List_ID NUMBER(10,0) NOT NULL + +); + +COMMIT; + +SET DEFINE OFF; +INSERT INTO AD_VAL_RULE(AD_VAL_RULE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,TYPE,CODE,ENTITYTYPE)values(51002,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),100,to_date('2007-08-27','RRRR-MM-DD'),100,'AD_Ref_List_ID (Document Actions)','all document actions','S','AD_Ref_List.AD_Reference_ID=135','D'); +INSERT INTO AD_TABLE(AD_TABLE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,TABLENAME,ISVIEW,ACCESSLEVEL,ENTITYTYPE,AD_WINDOW_ID,AD_VAL_RULE_ID,LOADSEQ,ISSECURITYENABLED,ISDELETEABLE,ISHIGHVOLUME,IMPORTTABLE,ISCHANGELOG,REPLICATIONTYPE,PO_WINDOW_ID,COPYCOLUMNSFROMTABLE)values(53012,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),100,to_date('2007-08-27','RRRR-MM-DD'),100,'Document Action Access','Define access to document type / document action / role combinations.','Define access rules (add roles with access) for client/role/doctype/document action combinations. If no rules are defined for a client/doctype/doc action combination all roles can access the document action.','AD_Document_Action_Access','N','6','D',null,null,0,'N','Y','N','N','N','L',null,'N'); +INSERT INTO AD_SEQUENCE(AD_SEQUENCE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,VFORMAT,ISAUTOSEQUENCE,INCREMENTNO,STARTNO,CURRENTNEXT,CURRENTNEXTSYS,ISAUDITED,ISTABLEID,PREFIX,SUFFIX,STARTNEWYEAR)values(53011,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),100,to_date('2007-08-27','RRRR-MM-DD'),100,'AD_Document_Action_Access','Table AD_Document_Action_Access',null,'Y',1,1000000,1000001,50000,'N','Y',null,null,'N'); + +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53222,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',0,'D','AD_Client_ID',53012,19,null,null,22,'@AD_Client_ID@','N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',102,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53223,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',0,'D','AD_Org_ID',53012,19,null,104,22,'@AD_Org_ID@','N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',113,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53224,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Active','The record is active in the system','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.',0,'D','IsActive',53012,20,null,null,1,null,'N','N','Y','Y',null,'N',null,'N','N',null,null,null,null,'N',348,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53225,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Created','Date this record was created','The Created field indicates the date that this record was created.',0,'D','Created',53012,16,null,null,7,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',245,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53226,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Created By','User who created this records','The Created By field indicates the user who created this record.',0,'D','CreatedBy',53012,18,110,null,22,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',246,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53227,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',0,'D','Updated',53012,16,null,null,7,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',607,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53228,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',0,'D','UpdatedBy',53012,18,110,null,22,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',608,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53229,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',0,'D','C_DocType_ID',53012,19,null,null,22,null,'N','Y','Y','N',null,'N',null,'N','N',null,null,null,null,'N',196,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53230,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.',0,'D','AD_Role_ID',53012,19,null,null,22,null,'N','Y','Y','N',null,'N',null,'N','N',null,null,null,null,'N',123,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53231,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Reference List','Reference List based on Table',null,0,'D','AD_Ref_List_ID',53012,19,null,51002,22,null,'N','Y','Y','N',null,'N',null,'N','N',null,null,null,null,'N',119,null,'N','N',null,null); + +INSERT INTO AD_TAB(AD_TAB_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,AD_TABLE_ID,AD_WINDOW_ID,SEQNO,TABLEVEL,ISSINGLEROW,ISINFOTAB,ISTRANSLATIONTAB,ISREADONLY,AD_COLUMN_ID,HASTREE,WHERECLAUSE,ORDERBYCLAUSE,COMMITWARNING,AD_PROCESS_ID,PROCESSING,AD_IMAGE_ID,IMPORTFIELDS,AD_COLUMNSORTORDER_ID,AD_COLUMNSORTYESNO_ID,ISSORTTAB,ENTITYTYPE,INCLUDED_TAB_ID,READONLYLOGIC,DISPLAYLOGIC,ISINSERTRECORD,ISADVANCEDTAB)values(53013,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Document Action Access','Define access to document type / document action / role combinations.','Define access to document type / document action / role combinations.',53012,111,90,1,'N','N','N','N',53230,'N',null,null,null,null,'N',null,'N',null,null,'N','D',null,null,null,'Y','N'); + +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53241,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Active','The record is active in the system','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',53013,53224,null,'Y',null,1,'N',50,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53242,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y',53013,53222,null,'Y',null,22,'N',10,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53244,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules','Y',53013,53229,null,'Y',null,22,'N',30,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53245,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y',53013,53223,null,'Y',null,22,'N',20,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53246,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Reference List','Reference List based on Table','The Reference List field indicates a list of reference values from a database tables. Reference lists populate drop down list boxes in data entry screens','Y',53013,53231,null,'Y',null,22,'N',40,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53247,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.','Y',53013,53230,null,'N',null,22,'N',0,null,'N','N','N','N','D',null,null,null); + + +COMMIT; + + +UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM ad_column + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Column'; + +UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_field_id) + 1 + FROM ad_field + WHERE ad_field_id < 1000000) + WHERE NAME = 'AD_Field'; + + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM ad_column + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Sequence'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_field_id) + 1 + FROM ad_field + WHERE ad_field_id < 1000000) + WHERE NAME = 'AD_Tab'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_message_id) + 1 + FROM ad_message + WHERE ad_message_id < 1000000) + WHERE NAME = 'AD_Table'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_element_id) + 1 + FROM ad_element + WHERE ad_element_id < 1000000) + WHERE NAME = 'AD_Window'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM ad_column + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Val_Rule'; + + + COMMIT; + + delete from AD_Document_Action_Access; + + Insert into AD_DOCUMENT_ACTION_ACCESS ( + AD_CLIENT_ID , + AD_ORG_ID , + ISACTIVE , + CREATED , + CREATEDBY , + UPDATED , + UPDATEDBY , + C_DOCTYPE_ID , + AD_ROLE_ID , + AD_REF_LIST_ID + ) + + ( + SELECT + client.AD_Client_ID, + 0, + 'Y', + SYSDATE, + 0, + SYSDATE, + 0, + doctype.C_DocType_ID, + rol.AD_Role_ID, + action.AD_Ref_List_ID + FROM AD_Client client + INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) + INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) + INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID) + ); + + +COMMIT; \ No newline at end of file diff --git a/migration/330-trunk/postgresql/039_FR_1782412_PG.sql b/migration/330-trunk/postgresql/039_FR_1782412_PG.sql new file mode 100644 index 0000000000..2e9867287b --- /dev/null +++ b/migration/330-trunk/postgresql/039_FR_1782412_PG.sql @@ -0,0 +1,129 @@ + +CREATE TABLE AD_Document_Action_Access ( + + AD_CLIENT_ID NUMERIC(10,0) NOT NULL , + AD_ORG_ID NUMERIC(10,0) NOT NULL , + ISACTIVE CHAR(1) DEFAULT 'Y' NOT NULL , + CREATED DATE DEFAULT SYSDATE NOT NULL , + CREATEDBY NUMERIC(10,0) NOT NULL , + UPDATED DATE DEFAULT SYSDATE NOT NULL , + UPDATEDBY NUMERIC(10,0) NOT NULL , + + C_DocType_ID NUMERIC(10,0) NOT NULL, + AD_Role_ID NUMERIC(10,0) NOT NULL, + AD_Ref_List_ID NUMERIC(10,0) NOT NULL + +); + +COMMIT; + +INSERT INTO AD_VAL_RULE(AD_VAL_RULE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,TYPE,CODE,ENTITYTYPE)values(51002,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),100,to_date('2007-08-27','RRRR-MM-DD'),100,'AD_Ref_List_ID (Document Actions)','all document actions','S','AD_Ref_List.AD_Reference_ID=135','D'); +INSERT INTO AD_TABLE(AD_TABLE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,TABLENAME,ISVIEW,ACCESSLEVEL,ENTITYTYPE,AD_WINDOW_ID,AD_VAL_RULE_ID,LOADSEQ,ISSECURITYENABLED,ISDELETEABLE,ISHIGHVOLUME,IMPORTTABLE,ISCHANGELOG,REPLICATIONTYPE,PO_WINDOW_ID,COPYCOLUMNSFROMTABLE)values(53012,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),100,to_date('2007-08-27','RRRR-MM-DD'),100,'Document Action Access','Define access to document type / document action / role combinations.','Define access rules (add roles with access) for client/role/doctype/document action combinations. If no rules are defined for a client/doctype/doc action combination all roles can access the document action.','AD_Document_Action_Access','N','6','D',null,null,0,'N','Y','N','N','N','L',null,'N'); +INSERT INTO AD_SEQUENCE(AD_SEQUENCE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,VFORMAT,ISAUTOSEQUENCE,INCREMENTNO,STARTNO,CURRENTNEXT,CURRENTNEXTSYS,ISAUDITED,ISTABLEID,PREFIX,SUFFIX,STARTNEWYEAR)values(53011,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),100,to_date('2007-08-27','RRRR-MM-DD'),100,'AD_Document_Action_Access','Table AD_Document_Action_Access',null,'Y',1,1000000,1000001,50000,'N','Y',null,null,'N'); + +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53222,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.',0,'D','AD_Client_ID',53012,19,null,null,22,'@AD_Client_ID@','N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',102,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53223,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.',0,'D','AD_Org_ID',53012,19,null,104,22,'@AD_Org_ID@','N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',113,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53224,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Active','The record is active in the system','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.',0,'D','IsActive',53012,20,null,null,1,null,'N','N','Y','Y',null,'N',null,'N','N',null,null,null,null,'N',348,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53225,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Created','Date this record was created','The Created field indicates the date that this record was created.',0,'D','Created',53012,16,null,null,7,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',245,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53226,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Created By','User who created this records','The Created By field indicates the user who created this record.',0,'D','CreatedBy',53012,18,110,null,22,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',246,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53227,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Updated','Date this record was updated','The Updated field indicates the date that this record was updated.',0,'D','Updated',53012,16,null,null,7,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',607,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53228,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Updated By','User who updated this records','The Updated By field indicates the user who updated this record.',0,'D','UpdatedBy',53012,18,110,null,22,null,'N','N','Y','N',null,'N',null,'N','N',null,null,null,null,'N',608,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53229,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',0,'D','C_DocType_ID',53012,19,null,null,22,null,'N','Y','Y','N',null,'N',null,'N','N',null,null,null,null,'N',196,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53230,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.',0,'D','AD_Role_ID',53012,19,null,null,22,null,'N','Y','Y','N',null,'N',null,'N','N',null,null,null,null,'N',123,null,'N','N',null,null); +INSERT INTO AD_COLUMN(AD_COLUMN_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,UPDATED,CREATEDBY,UPDATEDBY,NAME,DESCRIPTION,HELP,VERSION,ENTITYTYPE,COLUMNNAME,AD_TABLE_ID,AD_REFERENCE_ID,AD_REFERENCE_VALUE_ID,AD_VAL_RULE_ID,FIELDLENGTH,DEFAULTVALUE,ISKEY,ISPARENT,ISMANDATORY,ISUPDATEABLE,READONLYLOGIC,ISIDENTIFIER,SEQNO,ISTRANSLATED,ISENCRYPTED,CALLOUT,VFORMAT,VALUEMIN,VALUEMAX,ISSELECTIONCOLUMN,AD_ELEMENT_ID,AD_PROCESS_ID,ISSYNCDATABASE,ISALWAYSUPDATEABLE,COLUMNSQL,MANDATORYLOGIC)values(53231,0,0,'Y',to_date('2007-08-27','RRRR-MM-DD'),to_date('2007-08-27','RRRR-MM-DD'),100,100,'Reference List','Reference List based on Table',null,0,'D','AD_Ref_List_ID',53012,19,null,51002,22,null,'N','Y','Y','N',null,'N',null,'N','N',null,null,null,null,'N',119,null,'N','N',null,null); + +INSERT INTO AD_TAB(AD_TAB_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,AD_TABLE_ID,AD_WINDOW_ID,SEQNO,TABLEVEL,ISSINGLEROW,ISINFOTAB,ISTRANSLATIONTAB,ISREADONLY,AD_COLUMN_ID,HASTREE,WHERECLAUSE,ORDERBYCLAUSE,COMMITWARNING,AD_PROCESS_ID,PROCESSING,AD_IMAGE_ID,IMPORTFIELDS,AD_COLUMNSORTORDER_ID,AD_COLUMNSORTYESNO_ID,ISSORTTAB,ENTITYTYPE,INCLUDED_TAB_ID,READONLYLOGIC,DISPLAYLOGIC,ISINSERTRECORD,ISADVANCEDTAB)values(53013,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Document Action Access','Define access to document type / document action / role combinations.','Define access to document type / document action / role combinations.',53012,111,90,1,'N','N','N','N',53230,'N',null,null,null,null,'N',null,'N',null,null,'N','D',null,null,null,'Y','N'); + +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53241,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Active','The record is active in the system','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',53013,53224,null,'Y',null,1,'N',50,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53242,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Client','Client/Tenant for this installation.','A Client is a company or a legal entity. You cannot share data between Clients. Tenant is a synonym for Client.','Y',53013,53222,null,'Y',null,22,'N',10,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53244,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules','Y',53013,53229,null,'Y',null,22,'N',30,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53245,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Organization','Organizational entity within client','An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y',53013,53223,null,'Y',null,22,'N',20,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53246,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Reference List','Reference List based on Table','The Reference List field indicates a list of reference values from a database tables. Reference lists populate drop down list boxes in data entry screens','Y',53013,53231,null,'Y',null,22,'N',40,null,'N','N','N','N','D',null,null,null); +INSERT INTO AD_FIELD(AD_FIELD_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,UPDATED,UPDATEDBY,NAME,DESCRIPTION,HELP,ISCENTRALLYMAINTAINED,AD_TAB_ID,AD_COLUMN_ID,AD_FIELDGROUP_ID,ISDISPLAYED,DISPLAYLOGIC,DISPLAYLENGTH,ISREADONLY,SEQNO,SORTNO,ISSAMELINE,ISHEADING,ISFIELDONLY,ISENCRYPTED,ENTITYTYPE,OBSCURETYPE,AD_REFERENCE_ID,ISMANDATORY)values(53247,0,0,'Y',to_date('2007-08-29','RRRR-MM-DD'),100,to_date('2007-08-29','RRRR-MM-DD'),100,'Role','Responsibility Role','The Role determines security and access a user who has this Role will have in the System.','Y',53013,53230,null,'N',null,22,'N',0,null,'N','N','N','N','D',null,null,null); + + +COMMIT; + + +UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM ad_column + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Column'; + +UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_field_id) + 1 + FROM ad_field + WHERE ad_field_id < 1000000) + WHERE NAME = 'AD_Field'; + + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM ad_column + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Sequence'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_field_id) + 1 + FROM ad_field + WHERE ad_field_id < 1000000) + WHERE NAME = 'AD_Tab'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_message_id) + 1 + FROM ad_message + WHERE ad_message_id < 1000000) + WHERE NAME = 'AD_Table'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_element_id) + 1 + FROM ad_element + WHERE ad_element_id < 1000000) + WHERE NAME = 'AD_Window'; + + UPDATE ad_sequence + SET currentnextsys = (SELECT MAX (ad_column_id) + 1 + FROM ad_column + WHERE ad_column_id < 1000000) + WHERE NAME = 'AD_Val_Rule'; + + + COMMIT; + +delete from AD_Document_Action_Access; + +Insert into AD_Document_Action_Access ( + AD_CLIENT_ID , + AD_ORG_ID , + ISACTIVE , + CREATED , + CREATEDBY , + UPDATED , + UPDATEDBY , + C_DocType_ID , + AD_Role_ID , + AD_Ref_List_ID + ) + + ( + SELECT + client.AD_Client_ID, + 0, + 'Y', + now(), + 0, + now(), + 0, + doctype.C_DocType_ID, + rol.AD_Role_ID, + action.AD_Ref_List_ID + FROM AD_Client client + INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) + INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) + INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID) + ); + + + +COMMIT; \ No newline at end of file