Location: PHPKode > projects > Cowtacular > cowtacular-0.51/scripts/createemptydatabase.php
<?php
// ******************************************************************
//  Cowtacular
//  (c) 2010 - Cowtacular LLC
//
//  http://www.cowtacular.com
//
// ******************************************************************

  // Change the working directory to the proper location
  $scriptspath = $_SERVER["PWD"] ."/". $_SERVER["PHP_SELF"];
  if (! file_exists($scriptspath))
    die("\n\nStopping!  Could not find script at ". $scriptspath ."\n\n");
  $scriptspath = str_replace("/scripts/". basename($scriptspath), "", $scriptspath);
  chdir($scriptspath);

  // Local Variables
  $db_ignoreversion = 1;
  $db_skipreadconfig = 1;
  
  // Load the configuration
  include_once('cow-config.php');

  // Include the global libraries
  include_once('global/lib.php');
        
  // Checking that this is the first time this is being run
  if (db_tableexists("CONF")) {
  
    echo "This script has already been run.  Quitting... <br />\n";
    die();
  
  }

  // --------------------
  //  CONF
  // --------------------
  echo "  Creating Table: CONF <br/>\n";
  db_query("CREATE TABLE CONF (
                  ID INTEGER PRIMARY KEY AUTOINCREMENT,
                  TAG VARCHAR(25),
                  OBJECTTYPE VARCHAR(25),
                  DATATYPE VARCHAR(25),
                  PARRENTID INTEGER,
                  SYSTEMVALUE INTEGER,
                  ARCHIVED INTEGER,
                  MINVALUE INTEGER,
                  MAXVALUE INTEGER,
                  POSITION INTEGER,
                  REQUIRED INTEGER,
                  DEFAULTVALUE VARCHAR(1024),
                  CURRENTVALUE VARCHAR(1024),
                  TITLE VARCHAR(80),
                  TOOLTIPS CARCHAR(255))");
      
  // --------------------
  //  MULTIVALS
  // --------------------
  echo "  Creating Table: MULTIVALS <br/>\n";
  db_query("CREATE TABLE MULTIVALS (
                  ID INTEGER,
                  OBJECTTYPE VARCHAR(25),
                  TAG VARCHAR(25),
                  POSITION INTEGER,
                  CURRENTVALUE INTEGER)");
  db_query("CREATE INDEX MULTIVALS_IDX ON MULTIVALS(ID, OBJECTTYPE, TAG, CURRENTVALUE)");
  db_query("CREATE TABLE ARCHIVED.MULTIVALS (
                  ID INTEGER,
                  OBJECTTYPE VARCHAR(25),
                  TAG VARCHAR(25),
                  POSITION INTEGER,
                  CURRENTVALUE INTEGER)");
  db_query("CREATE INDEX ARCHIVED.MULTIVALS_IDX ON MULTIVALS(ID, OBJECTTYPE, TAG, CURRENTVALUE)");
  
  
  // --------------------
  //  EVENTLOG
  // --------------------
  echo "  Creating Table: EVENTLOG <br/>\n";
  db_query("CREATE TABLE EVENTLOG.EVENTLOG (
                  OBJECTID INTEGER,
                  OBJECTTYPE VARCHAR(20),
                  DATEOCCURED INTEGER,
                  REPID INTEGER,
                  IPADDR INTEGER,
                  MODULE VARCHAR(40),
                  DESCRIPTION VARCHAR(254))");
  db_query("CREATE INDEX EVENTLOG.EVENTLOG_IDX ON EVENTLOG(OBJECTID, OBJECTTYPE, DATEOCCURED, REPID, IPADDR, MODULE, DESCRIPTION)");

  
  // --------------------
  //  AUTHCODES
  // --------------------
  echo "  Creating Table: AUTHCODES <br/>\n";
  db_query("CREATE TABLE AUTHCODES(
                  REPID INTEGER,
                  DATECREATED INTEGER,
                  AUTHCODE VARCHAR(40))");
                  
  
  
  // *************************************************************************************************************
  // Set the default lists
  // *************************************************************************************************************
  
  
  echo "  Setting the default lists <br />\n";
  $tempid=db_createconfigvalue(20, "GROUPLIST", "GLOBAL", "SELECTROOT", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Group List");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(21, "GROUP21", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Undefined");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Undefined");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  
  $tempid=db_createconfigvalue(30, "DEVICETYPELIST", "GLOBAL", "SELECTROOT", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Device Type List");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(31, "DEVICETYPE31", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 30);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Unknown");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Unknown");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  
  $tempid=db_createconfigvalue(40, "OSLIST", "GLOBAL", "SELECTROOT", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Operating System List");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(41, "OS41", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Unknown");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Unknown");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(42, "OS42", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Windows NT");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Windows NT");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(43, "OS43", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Windows 2000");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Windows 2000");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(44, "OS44", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Windows XP");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Windows XP");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(45, "OS45", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Windows 2003");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Windows 2003");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(46, "OS46", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Windows Vista");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Windows Vista");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(47, "OS48", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Mac OSX");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Mac OSX");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(48, "OS48", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Linux");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Linux");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(49, "OS49", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Windows 2008");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Windows 2008");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  
  $tempid=db_createconfigvalue(50, "TICKETPRIORITYLIST", "GLOBAL", "SELECTROOT", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Ticket Priority List");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(51, "TICKETPRIORITY51", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Low");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Low");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(52, "TICKETPRIORITY52", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Medium");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Medium");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(53, "TICKETPRIORITY53", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "High");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "High");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  
  $tempid=db_createconfigvalue(60, "TICKETCATEGORYLIST", "GLOBAL", "SELECTROOT", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Ticket Category List");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(61, "TICKETCATEGORY61", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 60);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Uncategorized");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Uncategorized");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  
  $tempid=db_createconfigvalue(70, "TICKETSTATUSLIST", "GLOBAL", "SELECTROOT", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Ticket Status List");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(71, "TICKETSTATUS71", "GLOBAL", "SELECTOPTION", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 70);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Open");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Open");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(72, "TICKETSTATUS72", "GLOBAL", "SELECTOPTION", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 70);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Closed");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Closed");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }

  // *************************************************************************************************************  
  // Set the default global system values
  // *************************************************************************************************************

  echo "  Setting the default global system values <br />\n";
  $tempid=db_createconfigvalue(0, "ORGNAME", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Cowtacular");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Cowtacular");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Organization Name");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SYSTEMEMAILADDR", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "hide@address.com");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "hide@address.com");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "System Email Address");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MINPASSWORDLENGTH", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 30);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "8");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "8");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Minimum Password Length");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "REQUIRECOMPLEXPASSWORDS", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Require Complex Passwords");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TIMEZONE", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 30); 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "UTC");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "UTC");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Timezone");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EVENTLOGRETENTION", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1825);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "365");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "365");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Days to retain logged events");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "AUTOARCHIVETICKETS", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1825);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "365");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "365");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Auto archive tickets x days old");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAILSENTRETENTION", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 365);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "7");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "7");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Days to retain sent emails");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "HTTPLOCATION", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "http://cowtacular.com");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "http://cowtacular.com");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "http:// address to system");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "AUTHSESSIONTIMEOUT", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1800);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "60");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "60");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Authenticated session timeout");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "AUTHENABLE3RDPARTY", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Use 3rd party authentication");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "AUTHHTTP3RDPARTY", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 120);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "http://");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "http://");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "3rd party auth web address");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "APIIPADDRS", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 200);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "127.0.0.1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "127.0.0.1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "API: Allowed IP Addresses");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "APIPASSWORD", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", mt_rand(10000000, 99999999));
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", mt_rand(10000000, 99999999));
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "API Password");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ALLOWUSERSSETTICKETCATEGORY", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Allow user to select ticket category");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAILSUBJECT", "GLOBAL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Cowtacular Ticket");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Cowtacular Ticket");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Email Subject");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "RESPONDWITHREPEMAIL", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Respond using the Rep Email");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAILNEWTICKET", "GLOBAL", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Hi %firstname%,\n\nThanks for submitting a ticket.  It has been assigned #%ticketid%.  We will try to respond in a timely matter.  If you wish to update this ticket, please reply to this email or click on the link below.\n\n%ticketlink%\n\nTicket ID: %ticketid%\nStatus: %status%\nPriority: %priority%\nAssigned to: %assignedto%\nCategory: %category%\nSubject: %subject%\n\nDescription:\n------------------------------------\n%description%\n------------------------------------\n\n- Support");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Hi %firstname%,\n\nThanks for submitting a ticket.  It has been assigned #%ticketid%.  We will try to respond in a timely matter.  If you wish to update this ticket, please reply to this email or click on the link below.\n\n%ticketlink%\n\nTicket ID: %ticketid%\nStatus: %status%\nPriority: %priority%\nAssigned to: %assignedto%\nCategory: %category%\nSubject: %subject%\n\nDescription:\n------------------------------------\n%description%\n------------------------------------\n\n- Support");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "New Ticket Email to Submitter");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAILUPDATETICKET", "GLOBAL", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Hello %firstname%, \n\nYour ticket #%ticketid% has been updated with the following information:\n\n===============================================\n%recentnote%\n===============================================\n\nCurrent Ticket Status and Original Ticket ID: %ticketid%\nStatus: %status%\nPriority: %priority%\nAssigned to: %assignedto%\nCategory: %category%\nSubject: %subject%\n\nDescription:\n------------------------------------\n%description%\n------------------------------------\n\nYou can view, close or re-open this ticket using the following link:\n\n%ticketlink%\n\n- Support");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Hello %firstname%, \n\nYour ticket #%ticketid% has been updated with the following information:\n\n===============================================\n%recentnote%\n===============================================\n\nCurrent Ticket Status and Original Ticket ID: %ticketid%\nStatus: %status%\nPriority: %priority%\nAssigned to: %assignedto%\nCategory: %category%\nSubject: %subject%\n\nDescription:\n------------------------------------\n%description%\n------------------------------------\n\nYou can view, close or re-open this ticket using the following link:\n\n%ticketlink%\n\n- Support");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Updated Ticket Email to Submitter");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PAGENEWTICKET", "GLOBAL", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "NEW TICKET#%ticketid% - %priority% - %firstname% %lastname% - %phone% - %description%");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "NEW TICKET#%ticketid% - %priority% - %firstname% %lastname% - %phone% - %description%");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Rep Page for New Ticket");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PAGEASSIGNEDTICKET", "GLOBAL", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "ASSIGNED TICKET#%ticketid% - %priority% - %firstname% %lastname% - %phone% - %description%");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "ASSIGNED TICKET#%ticketid% - %priority% - %firstname% %lastname% - %phone% - %description%");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Rep Page for Assigned Ticket");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTDEVICEGROUPID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Device Group");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTDEVICEOSID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "41");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "41");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Device OS");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTDEVICETYPEID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 30);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "31");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "31");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Device Type");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTTICKETGROUPID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Ticket Group");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTTICKETCATEGORYID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 60);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "61");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "61");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Ticket Category");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTTICKETPRIORITYID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "51");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "51");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Ticket Priority");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTTICKETSTATUSID", "GLOBAL", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 70);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "71");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "71");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Ticket Status");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTHELPPAGETITLE", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 70);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 30);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "Help Request");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "Help Request");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Help Page Title");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }

  $tempid=db_createconfigvalue(0, "MAINTMODE", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Maintenance Mode");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEBUGMODE", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Debugging");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ENABLEDEVICES", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Enable Devices Module");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ENABLESOFTWARE", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Enable Software Module");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ENABLEEMAILFUNCTIONS", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Enable Email Functions");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ENABLECUSTOMFIELDS", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Enable Custom Fields");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ENABLETICKETTEMPLATES", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Enable Ticket Templates");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEFAULTTICKETTEMPLATEID", "GLOBAL", "TICKETTEMPLATEID", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Default Ticket Template");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILSERVER", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Incoming mail server");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILPROTOCOL", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "pop3");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "pop3");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Incoming mail protocol");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILSSL", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Incoming mail using ssl");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILPORT", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "110");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "110");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Incoming mail port");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILUSERNAME", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Incoming mail username");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILPASSWORD", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Incoming mail password");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "INCOMINGMAILAUTOGENERATETICKET", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Auto-create new tickets from emails");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }

  $tempid=db_createconfigvalue(0, "OUTGOINGMAILSERVER", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Outgoing mail server");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "OUTGOINGMAILPROTOCOL", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "smtp");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "smtp");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Outgoing mail protocol");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "OUTGOINGMAILSSL", "GLOBAL", "BOOLEAN", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Outgoing mail using ssl");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "OUTGOINGMAILPORT", "GLOBAL", "INTEGER", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "25");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "25");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Ougoing mail port");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "OUTGOINGMAILUSERNAME", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Outgoing mail username");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "OUTGOINGMAILPASSWORD", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 64);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Outgoing mail password");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }


  
  // *************************************************************************************************************
  // Configuring the Ticket object type
  // *************************************************************************************************************


  echo "  Configuring the Ticket object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "TICKET", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "TICKET", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "TICKET", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TICKETKEY", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Ticket Security Key");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FIRSTNAME", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "First Name");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTNAME", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Last Name");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAIL", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Email");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PHONE", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Phone");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LOCATION", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Location");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "GROUPID", "TICKET", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED",1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Group");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ASSIGNEDTOID", "TICKET", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Assigned to");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PRIORITYID", "TICKET", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "51");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "51");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Priority");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "STATUSID", "TICKET", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 70);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "71");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "71");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Status");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "CATEGORYID", "TICKET", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 60);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "61");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "61");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Category");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "IPADDR", "TICKET", "IPADDR", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Submitter IP");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DESCRIPTION", "TICKET", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Description");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEVICEID", "TICKET", "DEVICEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Submitter Device");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "CLOSEDBYID", "TICKET", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Closed By");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PRIVATE", "TICKET", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Private");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUBJECT", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Subject");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ALTCONTACTS", "TICKET", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "Alternate Email");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FILEID", "TICKET", "MULTIFILEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKET", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKET", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TITLE", "File Attachments");
    db_setconfigfieldvalue((int)$tempid, "TICKET", "TOOLTIPS", "");
  }
  
  
  // *************************************************************************************************************
  // Configuring the Ticket Notes object type
  // *************************************************************************************************************


  echo "  Configuring the Ticket Notes object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "TICKETNOTE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "TICKETNOTE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "TICKETNOTE", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TICKETID", "TICKETNOTE", "TICKETID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Ticket ID");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TIMESPENT", "TICKETNOTE", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Time Spent");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PRIVATE", "TICKETNOTE", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Private");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DESCRIPTION", "TICKETNOTE", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TITLE", "Description");
    db_setconfigfieldvalue((int)$tempid, "TICKETNOTE", "TOOLTIPS", "");
  }
  

  // *************************************************************************************************************
  // Configuring the Ticket Users object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the Ticket Users object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "TICKETUSER", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "TICKETUSER", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "TICKETUSER", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAIL", "TICKETUSER", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Email");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FIRSTNAME", "TICKETUSER", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "First Name");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTNAME", "TICKETUSER", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Last Name");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LOCATION", "TICKETUSER", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Location");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PHONE", "TICKETUSER", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Phone");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "GROUPID", "TICKETUSER", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Group");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PASSWORDHASH", "TICKETUSER", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TITLE", "Password hash");
    db_setconfigfieldvalue((int)$tempid, "TICKETUSER", "TOOLTIPS", "");
  }
  
  
  // *************************************************************************************************************
  // Configure the Ticket Template object
  // *************************************************************************************************************
  
  
  echo "  Configuring the Ticket Template object <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "TICKETTEMPLATE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "TICKETTEMPLATE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "TICKETTEMPLATE", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TITLE", "TICKETTEMPLATE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TITLE", "Template Name");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "HEADER", "TICKETTEMPLATE", "BLOCK", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "MAXVALUE", 8000);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TITLE", "Template Header");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATE", "TOOLTIPS", "");
  }

  
  
  // *************************************************************************************************************
  // Configured the Ticket Template Field object
  // *************************************************************************************************************
  
  
  echo "  Configuring the Ticket Template Field object <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "TICKETTEMPLATEFIELD", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "TICKETTEMPLATEFIELD", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "TICKETTEMPLATEFIELD", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TICKETTEMPLATEID", "TICKETTEMPLATEFIELD", "TICKETTEMPLATEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Ticket Template ID");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TITLE", "TICKETTEMPLATEFIELD", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Title");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "POSITION", "TICKETTEMPLATEFIELD", "INTEGER", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Position");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  } 
  $tempid=db_createconfigvalue(0, "REQUIRED", "TICKETTEMPLATEFIELD", "INTEGER", 0);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0); 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Required");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  } 
  $tempid=db_createconfigvalue(0, "DATATYPE", "TICKETTEMPLATEFIELD", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Datatype");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TARGETID", "TICKETTEMPLATEFIELD", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Target");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MIN", "TICKETTEMPLATEFIELD", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 8000);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Min size");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MAX", "TICKETTEMPLATEFIELD", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "MAXVALUE", 8000);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TITLE", "Max size");
    db_setconfigfieldvalue((int)$tempid, "TICKETTEMPLATEFIELD", "TOOLTIPS", "");
  }
  

  // *************************************************************************************************************
  // Configuring the Device object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the Device object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "DEVICE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "DEVICE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "DEVICE", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "WINDOWSUID", "DEVICE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 30);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Windows UID");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SERIALNUM", "DEVICE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Serial Number");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MACHINENAME", "DEVICE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Machine Name");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TYPEID", "DEVICE", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 30);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "31");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "31");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Type");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "OSID", "DEVICE", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 40);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "41");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "41");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Operating System");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MEMORY", "DEVICE", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Memory");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PROCESSOR", "DEVICE", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Processor");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "STORAGE", "DEVICE", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Storage");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "GROUPID", "DEVICE", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Group");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NOTES", "DEVICE", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Notes");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTIPADDR", "DEVICE", "IPADDR", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Last IP");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "AUTOSOFTWAREID", "DEVICE", "MULTISOFTWAREID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Auto Discovered Software");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "STATICSOFTWAREID", "DEVICE", "MULTISOFTWAREID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "Statically Assigned Software");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FILEID", "DEVICE", "MULTIFILEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TITLE", "File Attachments");
    db_setconfigfieldvalue((int)$tempid, "DEVICE", "TOOLTIPS", "");
  }
  

  // *************************************************************************************************************
  // Configuring the MAC object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the MAC object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "MAC", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAC", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAC", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAC", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "MAC", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAC", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAC", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAC", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "MAC", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAC", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "MAC", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DEVICEID", "MAC", "DEVICEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAC", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAC", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TITLE", "Device ID");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MACADDR", "MAC", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAC", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MINVALUE", 12);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MAXVALUE", 12);
    db_setconfigfieldvalue((int)$tempid, "MAC", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "MAC", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAC", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TITLE", "MAC Address");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "STATIC", "MAC", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAC", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "MAC", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAC", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "MAC", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TITLE", "Static");
    db_setconfigfieldvalue((int)$tempid, "MAC", "TOOLTIPS", "");
  }
  
  
  // *************************************************************************************************************
  // Configuring the IP object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the IP object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "IP", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "IP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "IP", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "IP", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "IP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "IP", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "IP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "IP", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "IP", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "IP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "IP", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "IP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "IP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "IP", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "IP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MACID", "IP", "MACID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "IP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "IP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "IP", "TITLE", "MAC ID");
    db_setconfigfieldvalue((int)$tempid, "IP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "IPADDR", "IP", "IPADDR", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "IP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "IP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "IP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "IP", "TITLE", "IP Address");
    db_setconfigfieldvalue((int)$tempid, "IP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "STATIC", "IP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "IP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "IP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "IP", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "IP", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "IP", "TITLE", "Static");
    db_setconfigfieldvalue((int)$tempid, "IP", "TOOLTIPS", "");
  }
  
  
  // *************************************************************************************************************
  // Configuring the Software object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the SOFTWARE object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "SOFTWARE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "SOFTWARE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "SOFTWARE", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NAME", "SOFTWARE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 60);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Name");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NOTES", "SOFTWARE", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Notes");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FILEID", "SOFTWARE", "MULTIFILEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "File Attachments");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "VERSION", "SOFTWARE", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 15);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Version");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "REGKEY", "SOFTWARE", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 120);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "Registry Key");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SOFTWARELICENSEPOOLID", "SOFTWARE", "SOFTWARELICENSEPOOLID", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "License Pool ID");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
                                                  
  
  // *************************************************************************************************************
  // Configuring the Software License object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the Software License object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "SOFTWARELICENSE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "SOFTWARELICENSE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "SOFTWARELICENSE", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "QTY", "SOFTWARELICENSE", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Quantity");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DATEPURCHASED", "SOFTWARELICENSE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Date Purchased");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "GROUPID", "SOFTWARELICENSE", "SELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 20);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", "21");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Group");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NOTES", "SOFTWARELICENSE", "BLOCK", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "Notes");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FILEID", "SOFTWARELICENSE", "MULTIFILEID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TITLE", "File Attachment");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SOFTWARELICENSEPOOLID", "SOFTWARELICENSE", "SOFTWARELICENSEPOOLID", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TITLE", "License Pool ID");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARE", "TOOLTIPS", "");
  }
   
  
  // *************************************************************************************************************
  // Configuring the License Pool object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the LICENSEPOOL object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "SOFTWARELICENSEPOOL", "DATE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "SOFTWARELICENSEPOOL", "DATE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "SOFTWARELICENSEPOOL", "REPID", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NAME", "SOFTWARELICENSEPOOL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TITLE", "Name");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NOTES", "SOFTWARELICENSEPOOL", "BLOCK", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MAXVALUE", 4000);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TITLE", "Notes");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FILEID", "SOFTWARELICENSEPOOL", "MULTIFILEID", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TITLE", "File Attachments");
    db_setconfigfieldvalue((int)$tempid, "SOFTWARELICENSEPOOL", "TOOLTIPS", "");
  }
 
  
  // *************************************************************************************************************
  // Configuring the Rep object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the Rep object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "REP", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "REP", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "REP", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAIL", "REP", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Email Address");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FIRSTNAME", "REP", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "First Name");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTNAME", "REP", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 20);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Last Name");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PAGEREMAIL", "REP", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Pager Email");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "ADMIN", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Admin Access");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "REP", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Rep Access");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "REPORTS", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Reports Access");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PASSWORDHASH", "REP", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Password");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "EMAILWHENASSIGNED", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Email When Assigned Ticket");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "PAGEWHENASSIGNED", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Page When Assigned Ticket");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "VACATION", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "On Vacation (Disable notifications)");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "REFRESHTIMEOUT", "REP", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 60);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "15");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "15");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Dashboard Refresh (minutes)");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUPPORTLEVELSPAGE", "REP", "MULTISUPPORTLEVELID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Support Levels for Page Notification");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUPPORTLEVELSVIEW", "REP", "MULTISUPPORTLEVELID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Support Levels for Dashboard View");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUPPORTLEVELSEMAIL", "REP", "MULTISUPPORTLEVELID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Support Levels for Email Notification");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MONDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Monday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MONDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Monday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TUESDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Tuesday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TUESDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Tuesday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "WEDNESDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Wednesday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "WEDNESDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Wednesday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "THURSDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Thursday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "THURSDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Thursday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FRIDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "800");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Friday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FRIDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1700");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Friday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SATURDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Saturday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SATURDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Saturday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUNDAYSTART", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Sunday Start Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUNDAYEND", "REP", "TIME", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 2400);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Sunday End Business Hours");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DISPLAYDASHBOARDKEY", "REP", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "REP", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "REP", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "REP", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "REP", "TITLE", "Show color key on dashboard");
    db_setconfigfieldvalue((int)$tempid, "REP", "TOOLTIPS", "");
  }
    
  // *************************************************************************************************************
  // Configuring the Support Level object type
  // *************************************************************************************************************
  
  
  echo "  Configuring the Support level object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "SUPPORTLEVEL", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "SUPPORTLEVEL", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "SUPPORTLEVEL", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NAME", "SUPPORTLEVEL", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 40);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Name");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "CATEGORYIDS", "SUPPORTLEVEL", "MULTISUPPORTLEVELID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 60);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Categories");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "HRSTILLSTALE", "SUPPORTLEVEL", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "72");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "72");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Hours Till Stale");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "HIGHLIGHTUNASSIGNED", "SUPPORTLEVEL", "BOOLEAN", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "1");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Highlight unassigned tickets");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "BUSHRSPRIORITYIDS", "SUPPORTLEVEL", "MULTISELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Business Hours Email Priorities");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "NONBUSHRSPRIORITYIDS", "SUPPORTLEVEL", "MULTISELECTID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "PARRENTID", 50);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TITLE", "Non Business Hours Email Priorities");
    db_setconfigfieldvalue((int)$tempid, "SUPPORTLEVEL", "TOOLTIPS", "");
  }


  // *************************************************************************************************************
  // Configuring the File object type
  // *************************************************************************************************************
  echo "  Configuring the File object type <br />\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "FILE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "FILE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "Last update");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "FILE", "REPID", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FILENAME", "FILE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "Filename");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SIZE", "FILE", "INTEGER", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "Size (Bytes)");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MIMETYPE", "FILE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "Mimetype");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "MD5", "FILE", "LINE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "FILE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MINVALUE", 3);
    db_setconfigfieldvalue((int)$tempid, "FILE", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "FILE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "FILE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "FILE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TITLE", "MD5");
    db_setconfigfieldvalue((int)$tempid, "FILE", "TOOLTIPS", "");
  }


  // **********************************************************************************************
  // MAILQUEUE
  // ---------
  //	DATECREATED
  //	LASTUPDATE
  //	LASTUPDATEBYID
  //	TO
  //	FROM
  //	SUBJECT
  //	BODY
  //    SENT
  //    DATESENT
  // **********************************************************************************************
  echo "  MAILQUEUE Object\n";
  $tempid=db_createconfigvalue(0, "DATECREATED", "MAILQUEUE", "DATE", 1);
  if ($tempid > 0) { 
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Date Created");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATE", "MAILQUEUE", "DATE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", $now);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Last Update");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "LASTUPDATEBYID", "MAILQUEUE", "REPID", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Last update by");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "TOEMAIL", "MAILQUEUE", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "To");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "FROMEMAIL", "MAILQUEUE", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "From");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SUBJECT", "MAILQUEUE", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 80);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Subject");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "BODY", "MAILQUEUE", "BLOCK", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 8000);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", "");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Body");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "SENT", "MAILQUEUE", "BOOLEAN", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 1);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Email has been sent");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }
  $tempid=db_createconfigvalue(0, "DATESENT", "MAILQUEUE", "DATE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "REQUIRED", 0);
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "DEFAULTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "CURRENTVALUE", "0");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TITLE", "Date Email was sent");
    db_setconfigfieldvalue((int)$tempid, "MAILQUEUE", "TOOLTIPS", "");
  }

  
  
  // **********************************************************************************************
  // Set the database version
  // **********************************************************************************************
  echo "  Setting the database version <br />\n";
  $tempid=db_createconfigvalue(1000000, "DBVERSION", "GLOBAL", "LINE", 1);
  if ($tempid > 0) {
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "PARRENTID", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "ARCHIVED", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MINVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "MAXVALUE", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "POSITION", 0);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "REQUIRED", 1);
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "DEFAULTVALUE", "0.45");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "CURRENTVALUE", "0.45");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TITLE", "Database Version");
    db_setconfigfieldvalue((int)$tempid, "GLOBAL", "TOOLTIPS", "");
  }
    

  // *************************************************************************************************************
  // Test reading the configuration into the cache.
  // *************************************************************************************************************
  echo "  Testing a read of the configuration into the cache <br />\n";
  $x = db_readconfig();
  echo "  Read ". $x ." configuration items successfully... <br />\n";

  
  // *************************************************************************************************************
  // Displaying Database Version
  // *************************************************************************************************************
  echo "  Database Version: ". db_getconfigvalue("DBVERSION") ." <br />\n";    

  
  // *************************************************************************************************************
  // Creating the Admin user
  // *************************************************************************************************************
  echo "  Creating the Admin user <br />\n";
  $adminid = db_createobject("REP");
  db_clearobjectcache();
  db_setobjectvalue($adminid, "REP", "EMAIL", "hide@address.com");
  db_setobjectvalue($adminid, "REP", "FIRSTNAME", "");
  db_setobjectvalue($adminid, "REP", "LASTNAME", "Administrator");
  db_setobjectvalue($adminid, "REP", "ADMIN", 1);
  db_setobjectvalue($adminid, "REP", "REP", 1);
  db_setobjectvalue($adminid, "REP", "REPORTS", 1);
  db_setobjectvalue($adminid, "REP", "PASSWORDHASH", md5("blahpw"));
  db_setobjectvalue($adminid, "REP", "EMAILWHENASSIGNED", 0);
  db_setobjectvalue($adminid, "REP", "PAGEWHENASSIGNED", 0);

                
  // *************************************************************************************************************
  // Creating the first support level
  // *************************************************************************************************************
  echo "  Creating the first support level, 'Uncategorized' <br />\n";
  $supportlvlid = db_createobject("SUPPORTLEVEL");
  db_setobjectvalue($supportlvlid, "SUPPORTLEVEL", "NAME", "Uncategorized");
  db_setobjectvalue($supportlvlid, "SUPPORTLEVEL", "CATEGORYIDS", array(61));
  db_setobjectvalue($supportlvlid, "SUPPORTLEVEL", "HRSTILLSTALE", 72);


  // *************************************************************************************************************
  // Create the default ticket template
  // *************************************************************************************************************
  echo "  Creating the default ticket template \n";
  $tickettemplateid = db_createobject("TICKETTEMPLATE");
  if ($tickettemplateid > 0) {
    	db_setobjectvalue($tickettemplateid, "TICKETTEMPLATE", "TITLE", "Default ticket template");
    
    	$descriptionfieldid = db_createobject("TICKETTEMPLATEFIELD");
    	if ($descriptionfieldid > 0) {
    		db_setobjectvalue($descriptionfieldid, "TICKETTEMPLATEFIELD", "TICKETTEMPLATEID", $tickettemplateid);
  		db_setobjectvalue($descriptionfieldid, "TICKETTEMPLATEFIELD", "TITLE", "Description");
  		db_setobjectvalue($descriptionfieldid, "TICKETTEMPLATEFIELD", "REQUIRED", 1);
  		db_setobjectvalue($descriptionfieldid, "TICKETTEMPLATEFIELD", "DATATYPE", "BLOCK");
  		db_setobjectvalue($descriptionfieldid, "TICKETTEMPLATEFIELD", "MAX", 8000);
  	}
  	db_setconfigvalue("DEFAULTTICKETTEMPLATEID", $tickettemplateid);
  }
  

  // *************************************************************************************************************
  // Add the new support level to the admin account's view
  // *************************************************************************************************************
  db_setobjectvalue($adminid, "REP", "SUPPORTLEVELSVIEW", array($supportlvlid));


  // *************************************************************************************************************
  // Write all cache to the database
  // *************************************************************************************************************
  db_clearobjectcache();
  
  
  // *************************************************************************************************************
  // Ensure the admin user is userid #1  
  // *************************************************************************************************************
  db_query("UPDATE ". db_getconfigtable("REP") ." SET ID=1 WHERE ID=". (int)$adminid);


  
  db_close();
  echo "\n\n";
  
?>
Return current item: Cowtacular