Пример #1
0
 /**
  * Function creates default user's Role, Profiles
  */
 public static function createDefaultUsersAccess()
 {
     $adb = PearDatabase::getInstance();
     $roleId1 = $adb->getUniqueID("vtiger_role");
     $roleId2 = $adb->getUniqueID("vtiger_role");
     $roleId3 = $adb->getUniqueID("vtiger_role");
     $roleId4 = $adb->getUniqueID("vtiger_role");
     $roleId5 = $adb->getUniqueID("vtiger_role");
     $profileId1 = $adb->getUniqueID("vtiger_profile");
     $profileId2 = $adb->getUniqueID("vtiger_profile");
     $profileId3 = $adb->getUniqueID("vtiger_profile");
     $profileId4 = $adb->getUniqueID("vtiger_profile");
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId1 . "','Organisation','H" . $roleId1 . "',0)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId2 . "','CEO','H" . $roleId1 . "::H" . $roleId2 . "',1)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId3 . "','Vice President','H" . $roleId1 . "::H" . $roleId2 . "::H" . $roleId3 . "',2)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId4 . "','Sales Manager','H" . $roleId1 . "::H" . $roleId2 . "::H" . $roleId3 . "::H" . $roleId4 . "',3)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId5 . "','Sales Person','H" . $roleId1 . "::H" . $roleId2 . "::H" . $roleId3 . "::H" . $roleId4 . "::H" . $roleId5 . "',4)", array());
     //INSERT INTO vtiger_role2profile
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId2 . "'," . $profileId1 . ")", array());
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId3 . "'," . $profileId2 . ")", array());
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId4 . "'," . $profileId2 . ")", array());
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId5 . "'," . $profileId2 . ")", array());
     //New Security Start
     //Inserting into vtiger_profile vtiger_table
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId1 . "','Administrator','Admin Profile')", array());
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId2 . "','Sales Profile','Profile Related to Sales')", array());
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId3 . "','Support Profile','Profile Related to Support')", array());
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId4 . "','Guest Profile','Guest Profile for Test Users')", array());
     //Inserting into vtiger_profile2gloabal permissions
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId1 . "',1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId1 . "',2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId2 . "',1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId2 . "',2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId3 . "',1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId3 . "',2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId4 . "',1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId4 . "',2,1)", array());
     //Inserting into vtiger_profile2tab
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",27,0)", array());
     //Inserting into vtiger_profile2tab
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",27,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",27,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",27,0)", array());
     //Inserting into vtiger_profile2standardpermissions  Adminsitrator
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,4,0)", array());
     //INSERT INTO Profile 2 std permissions for Sales User
     //Help Desk Create/Delete not allowed. Read-Only
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,4,0)", array());
     //Inserting into vtiger_profile2std for Support Profile
     // Potential is read-only
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,4,0)", array());
     //Inserting into vtiger_profile2stdper for Profile Guest Profile
     //All Read-Only
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,4,0)", array());
     //Inserting into vtiger_profile 2 utility Admin
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",8,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",14,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",14,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",18,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",18,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",18,10,0)", array());
     //Inserting into vtiger_profile2utility Sales Profile
     //Import Export Not Allowed.
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",8,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",14,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",14,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",18,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",18,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",18,10,0)", array());
     //Inserting into vtiger_profile2utility Support Profile
     //Import Export Not Allowed.
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",8,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",14,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",14,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",18,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",18,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",18,10,0)", array());
     //Inserting into vtiger_profile2utility Guest Profile Read-Only
     //Import Export BusinessCar Not Allowed.
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",8,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,10,0)", array());
     // Invalidate any cached information
     VTCacheUtils::clearRoleSubordinates();
     $adminPassword = $_SESSION['config_file_info']['password'];
     $userDateFormat = $_SESSION['config_file_info']['dateformat'];
     $userTimeZone = $_SESSION['config_file_info']['timezone'];
     //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
     $userFirstName = $_SESSION['config_file_info']['firstname'];
     $userLastName = $_SESSION['config_file_info']['lastname'];
     // create default admin user
     $user = CRMEntity::getInstance('Users');
     //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
     $user->column_fields["first_name"] = $userFirstName;
     $user->column_fields["last_name"] = $userLastName;
     //Ends
     $user->column_fields["user_name"] = 'admin';
     $user->column_fields["status"] = 'Active';
     $user->column_fields["is_admin"] = 'on';
     $user->column_fields["user_password"] = $adminPassword;
     $user->column_fields["time_zone"] = $userTimeZone;
     $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
     $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
     $user->column_fields["weekstart"] = '1';
     $user->column_fields["namedays"] = '';
     $user->column_fields["currency_id"] = 1;
     $user->column_fields["reminder_interval"] = '1 Minute';
     $user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
     $user->column_fields["date_format"] = $userDateFormat;
     $user->column_fields["hour_format"] = 'am/pm';
     $user->column_fields["start_hour"] = '08:00';
     $user->column_fields["end_hour"] = '23:00';
     $user->column_fields["imagename"] = '';
     $user->column_fields["internal_mailer"] = '1';
     $user->column_fields["activity_view"] = 'This Week';
     $user->column_fields["lead_view"] = 'Today';
     $adminEmail = $_SESSION['config_file_info']['admin_email'];
     if ($adminEmail == '') {
         $adminEmail = "*****@*****.**";
     }
     $user->column_fields["email1"] = $adminEmail;
     $roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='CEO'";
     $adb->checkConnection();
     $adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
     $roleResult = $adb->pquery($roleQuery, array());
     $roleId = $adb->query_result($roleResult, 0, "roleid");
     $user->column_fields["roleid"] = $roleId;
     $user->save("Users");
     $adminUserId = $user->id;
     //Inserting into vtiger_groups table
     $groupId1 = $adb->getUniqueID("vtiger_users");
     $groupId2 = $adb->getUniqueID("vtiger_users");
     $groupId3 = $adb->getUniqueID("vtiger_users");
     $adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId1 . "','Team Selling','Group Related to Sales')", array());
     $adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId1 . "','H" . $roleId4 . "')", array());
     $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId1 . "','H" . $roleId5 . "')", array());
     $adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId2 . "','Marketing Group','Group Related to Marketing Activities')", array());
     $adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId2 . "','H" . $roleId2 . "')", array());
     $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId2 . "','H" . $roleId3 . "')", array());
     $adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId3 . "','Support Group','Group Related to providing Support to Customers')", array());
     $adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
     $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
     // Setting user group relation for admin user
     $adb->pquery("INSERT INTO vtiger_users2group VALUES (?,?)", array($groupId2, $adminUserId), array());
     //Creating the flat files for admin user
     createUserPrivilegesfile($adminUserId);
     createUserSharingPrivilegesfile($adminUserId);
     //INSERT INTO vtiger_profile2field
     insertProfile2field($profileId1);
     insertProfile2field($profileId2);
     insertProfile2field($profileId3);
     insertProfile2field($profileId4);
     insert_def_org_field();
 }
Пример #2
0
function create_default_users_access()
{
    global $log, $adb;
    global $admin_email;
    global $admin_password;
    $role1_id = $adb->getUniqueID("vtiger_role");
    $role2_id = $adb->getUniqueID("vtiger_role");
    $role3_id = $adb->getUniqueID("vtiger_role");
    $role4_id = $adb->getUniqueID("vtiger_role");
    $role5_id = $adb->getUniqueID("vtiger_role");
    $profile1_id = $adb->getUniqueID("vtiger_profile");
    $profile2_id = $adb->getUniqueID("vtiger_profile");
    $profile3_id = $adb->getUniqueID("vtiger_profile");
    $profile4_id = $adb->getUniqueID("vtiger_profile");
    $adb->query("insert into vtiger_role values('H" . $role1_id . "','Organisation','H" . $role1_id . "',0)");
    $adb->query("insert into vtiger_role values('H" . $role2_id . "','CEO','H" . $role1_id . "::H" . $role2_id . "',1)");
    $adb->query("insert into vtiger_role values('H" . $role3_id . "','Vice President','H" . $role1_id . "::H" . $role2_id . "::H" . $role3_id . "',2)");
    $adb->query("insert into vtiger_role values('H" . $role4_id . "','Sales Manager','H" . $role1_id . "::H" . $role2_id . "::H" . $role3_id . "::H" . $role4_id . "',3)");
    $adb->query("insert into vtiger_role values('H" . $role5_id . "','Sales Man','H" . $role1_id . "::H" . $role2_id . "::H" . $role3_id . "::H" . $role4_id . "::H" . $role5_id . "',4)");
    //Insert into vtiger_role2profile
    $adb->query("insert into vtiger_role2profile values ('H" . $role2_id . "'," . $profile1_id . ")");
    $adb->query("insert into vtiger_role2profile values ('H" . $role3_id . "'," . $profile2_id . ")");
    $adb->query("insert into vtiger_role2profile values ('H" . $role4_id . "'," . $profile2_id . ")");
    $adb->query("insert into vtiger_role2profile values ('H" . $role5_id . "'," . $profile2_id . ")");
    //New Security Start
    //Inserting into vtiger_profile vtiger_table
    $adb->query("insert into vtiger_profile values ('" . $profile1_id . "','Administrator','Admin Profile')");
    $adb->query("insert into vtiger_profile values ('" . $profile2_id . "','Sales Profile','Profile Related to Sales')");
    $adb->query("insert into vtiger_profile values ('" . $profile3_id . "','Support Profile','Profile Related to Support')");
    $adb->query("insert into vtiger_profile values ('" . $profile4_id . "','Guest Profile','Guest Profile for Test Users')");
    //Inserting into vtiger_profile2gloabal permissions
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile1_id . "',1,0)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile1_id . "',2,0)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile2_id . "',1,1)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile2_id . "',2,1)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile3_id . "',1,1)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile3_id . "',2,1)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile4_id . "',1,1)");
    $adb->query("insert into vtiger_profile2globalpermissions values ('" . $profile4_id . "',2,1)");
    //Inserting into vtiger_profile2tab
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",1,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",2,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",3,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",4,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",6,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",7,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",8,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",9,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",10,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",13,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",14,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",15,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",16,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",18,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",19,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",20,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",21,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",22,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",23,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",24,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",25,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",26,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile1_id . ",27,0)");
    //Inserting into vtiger_profile2tab
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",1,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",2,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",3,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",4,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",6,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",7,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",8,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",9,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",10,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",13,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",14,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",15,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",16,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",18,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",19,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",20,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",21,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",22,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",23,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",24,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",25,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",26,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile2_id . ",27,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",1,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",2,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",3,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",4,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",6,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",7,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",8,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",9,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",10,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",13,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",14,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",15,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",16,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",18,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",19,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",20,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",21,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",22,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",23,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",24,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",25,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",26,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile3_id . ",27,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",1,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",2,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",3,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",4,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",6,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",7,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",8,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",9,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",10,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",13,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",14,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",15,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",16,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",18,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",19,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",20,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",21,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",22,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",23,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",24,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",25,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",26,0)");
    $adb->query("insert into vtiger_profile2tab values (" . $profile4_id . ",27,0)");
    //Inserting into vtiger_profile2standardpermissions  Adminsitrator
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",2,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",2,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",2,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",2,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",2,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",4,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",4,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",4,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",4,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",4,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",6,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",6,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",6,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",6,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",6,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",7,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",7,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",7,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",7,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",7,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",8,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",8,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",8,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",8,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",8,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",9,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",9,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",9,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",9,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",9,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",13,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",13,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",13,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",13,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",13,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",14,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",14,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",14,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",14,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",14,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",15,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",15,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",15,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",15,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",15,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",16,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",16,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",16,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",16,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",16,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",18,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",18,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",18,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",18,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",18,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",19,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",19,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",19,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",19,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",19,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",20,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",20,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",20,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",20,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",20,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",21,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",21,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",21,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",21,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",21,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",22,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",22,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",22,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",22,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",22,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",23,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",23,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",23,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",23,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",23,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",26,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",26,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",26,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",26,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile1_id . ",26,4,0)");
    //Insert into Profile 2 std permissions for Sales User
    //Help Desk Create/Delete not allowed. Read-Only
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",2,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",2,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",2,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",2,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",2,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",4,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",4,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",4,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",4,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",4,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",6,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",6,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",6,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",6,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",6,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",7,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",7,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",7,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",7,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",7,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",8,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",8,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",8,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",8,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",8,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",9,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",9,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",9,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",9,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",9,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",13,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",13,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",13,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",13,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",13,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",14,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",14,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",14,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",14,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",14,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",15,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",15,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",15,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",15,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",15,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",16,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",16,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",16,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",16,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",16,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",18,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",18,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",18,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",18,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",18,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",19,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",19,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",19,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",19,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",19,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",20,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",20,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",20,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",20,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",20,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",21,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",21,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",21,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",21,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",21,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",22,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",22,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",22,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",22,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",22,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",23,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",23,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",23,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",23,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",23,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",26,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",26,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",26,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",26,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile2_id . ",26,4,0)");
    //Inserting into vtiger_profile2std for Support Profile
    // Potential is read-only
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",2,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",2,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",2,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",2,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",2,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",4,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",4,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",4,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",4,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",4,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",6,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",6,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",6,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",6,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",6,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",7,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",7,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",7,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",7,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",7,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",8,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",8,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",8,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",8,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",8,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",9,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",9,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",9,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",9,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",9,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",13,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",13,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",13,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",13,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",13,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",14,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",14,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",14,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",14,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",14,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",15,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",15,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",15,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",15,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",15,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",16,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",16,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",16,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",16,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",16,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",18,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",18,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",18,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",18,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",18,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",19,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",19,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",19,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",19,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",19,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",20,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",20,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",20,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",20,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",20,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",21,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",21,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",21,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",21,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",21,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",22,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",22,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",22,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",22,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",22,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",23,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",23,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",23,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",23,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",23,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",26,0,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",26,1,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",26,2,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",26,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile3_id . ",26,4,0)");
    //Inserting into vtiger_profile2stdper for Profile Guest Profile
    //All Read-Only
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",2,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",2,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",2,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",2,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",2,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",4,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",4,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",4,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",4,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",4,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",6,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",6,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",6,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",6,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",6,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",7,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",7,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",7,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",7,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",7,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",8,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",8,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",8,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",8,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",8,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",9,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",9,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",9,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",9,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",9,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",13,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",13,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",13,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",13,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",13,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",14,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",14,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",14,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",14,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",14,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",15,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",15,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",15,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",15,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",15,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",16,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",16,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",16,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",16,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",16,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",18,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",18,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",18,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",18,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",18,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",19,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",19,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",19,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",19,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",19,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",20,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",20,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",20,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",20,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",20,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",21,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",21,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",21,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",21,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",21,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",22,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",22,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",22,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",22,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",22,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",23,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",23,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",23,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",23,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",23,4,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",26,0,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",26,1,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",26,2,1)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",26,3,0)");
    $adb->query("insert into vtiger_profile2standardpermissions values (" . $profile4_id . ",26,4,0)");
    //Inserting into vtiger_profile 2 utility Admin
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",2,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",2,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",4,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",4,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",6,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",6,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",7,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",7,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",8,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",7,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",6,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",4,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",13,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",13,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",13,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",14,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",14,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",7,9,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",18,5,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",18,6,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",7,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",6,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",4,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",2,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",13,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",14,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile1_id . ",18,10,0)");
    //Inserting into vtiger_profile2utility Sales Profile
    //Import Export Not Allowed.
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",2,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",2,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",4,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",4,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",6,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",6,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",7,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",7,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",8,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",7,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",6,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",4,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",13,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",13,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",13,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",14,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",14,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",7,9,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",18,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",18,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",7,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",6,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",4,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",2,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",13,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",14,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile2_id . ",18,10,0)");
    //Inserting into vtiger_profile2utility Support Profile
    //Import Export Not Allowed.
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",2,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",2,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",4,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",4,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",6,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",6,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",7,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",7,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",8,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",7,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",6,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",4,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",13,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",13,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",13,8,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",14,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",14,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",7,9,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",18,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",18,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",7,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",6,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",4,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",2,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",13,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",14,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",18,10,0)");
    //Inserting into vtiger_profile2utility Guest Profile Read-Only
    //Import Export BusinessCar Not Allowed.
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",2,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",2,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",8,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,8,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,8,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,8,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,8,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",14,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",14,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,9,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",18,5,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",18,6,1)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",2,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",14,10,0)");
    $adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",18,10,0)");
    // Invalidate any cached information
    VTCacheUtils::clearRoleSubordinates();
    // create default admin user
    $user = new Users();
    $user->column_fields["last_name"] = 'Administrator';
    $user->column_fields["user_name"] = 'admin';
    $user->column_fields["status"] = 'Active';
    $user->column_fields["is_admin"] = 'on';
    $user->column_fields["user_password"] = $admin_password;
    $user->column_fields["tz"] = 'Europe/Berlin';
    $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
    $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
    $user->column_fields["weekstart"] = '1';
    $user->column_fields["namedays"] = '';
    $user->column_fields["currency_id"] = 1;
    $user->column_fields["reminder_interval"] = '1 Minute';
    $user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
    $user->column_fields["date_format"] = 'yyyy-mm-dd';
    $user->column_fields["hour_format"] = 'am/pm';
    $user->column_fields["start_hour"] = '08:00';
    $user->column_fields["end_hour"] = '23:00';
    $user->column_fields["imagename"] = '';
    $user->column_fields["internal_mailer"] = '1';
    $user->column_fields["activity_view"] = 'This Week';
    $user->column_fields["lead_view"] = 'Today';
    //added by philip for default admin emailid
    if ($admin_email == '') {
        $admin_email = "*****@*****.**";
    }
    $user->column_fields["email1"] = $admin_email;
    $role_query = "select roleid from vtiger_role where rolename='CEO'";
    $adb->checkConnection();
    $adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
    $role_result = $adb->query($role_query);
    $role_id = $adb->query_result($role_result, 0, "roleid");
    $user->column_fields["roleid"] = $role_id;
    $user->save("Users");
    $admin_user_id = $user->id;
    //Inserting into vtiger_groups table
    $group1_id = $adb->getUniqueID("vtiger_users");
    $group2_id = $adb->getUniqueID("vtiger_users");
    $group3_id = $adb->getUniqueID("vtiger_users");
    $adb->query("insert into vtiger_groups values ('" . $group1_id . "','Team Selling','Group Related to Sales')");
    $adb->query("insert into vtiger_group2role values ('" . $group1_id . "','H" . $role4_id . "')");
    $adb->query("insert into vtiger_group2rs values ('" . $group1_id . "','H" . $role5_id . "')");
    $adb->query("insert into vtiger_groups values ('" . $group2_id . "','Marketing Group','Group Related to Marketing Activities')");
    $adb->query("insert into vtiger_group2role values ('" . $group2_id . "','H" . $role2_id . "')");
    $adb->query("insert into vtiger_group2rs values ('" . $group2_id . "','H" . $role3_id . "')");
    $adb->query("insert into vtiger_groups values ('" . $group3_id . "','Support Group','Group Related to providing Support to Customers')");
    $adb->query("insert into vtiger_group2role values ('" . $group3_id . "','H" . $role3_id . "')");
    $adb->query("insert into vtiger_group2rs values ('" . $group3_id . "','H" . $role3_id . "')");
    // Setting user group relation for admin user
    $adb->pquery("insert into vtiger_users2group values (?,?)", array($group2_id, $admin_user_id));
    //Creating the flat files for admin user
    createUserPrivilegesfile($admin_user_id);
    createUserSharingPrivilegesfile($admin_user_id);
    //Insert into vtiger_profile2field
    insertProfile2field($profile1_id);
    insertProfile2field($profile2_id);
    insertProfile2field($profile3_id);
    insertProfile2field($profile4_id);
    insert_def_org_field();
}
 /**
  * Function creates default user's Role, Profiles
  */
 public static function createDefaultUsersAccess()
 {
     $adb = PearDatabase::getInstance();
     $roleId1 = $adb->getUniqueID("vtiger_role");
     $roleId2 = $adb->getUniqueID("vtiger_role");
     $roleId3 = $adb->getUniqueID("vtiger_role");
     $roleId4 = $adb->getUniqueID("vtiger_role");
     $roleId5 = $adb->getUniqueID("vtiger_role");
     $profileId1 = $adb->getUniqueID("vtiger_profile");
     $profileId2 = $adb->getUniqueID("vtiger_profile");
     $profileId3 = $adb->getUniqueID("vtiger_profile");
     $profileId4 = $adb->getUniqueID("vtiger_profile");
     // SalesPlatform.ru begin
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId1 . "','Организация','H" . $roleId1 . "',0)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId2 . "','Директор','H" . $roleId1 . "::H" . $roleId2 . "',1)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId3 . "','Заместитель Директора','H" . $roleId1 . "::H" . $roleId2 . "::H" . $roleId3 . "',2)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId4 . "','Менеджер по Продажам','H" . $roleId1 . "::H" . $roleId2 . "::H" . $roleId3 . "::H" . $roleId4 . "',3)", array());
     $adb->pquery("INSERT INTO vtiger_role VALUES('H" . $roleId5 . "','Продавец','H" . $roleId1 . "::H" . $roleId2 . "::H" . $roleId3 . "::H" . $roleId4 . "::H" . $roleId5 . "',4)", array());
     //		$adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId1."','Organisation','H".$roleId1."',0)", array());
     //        $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId2."','CEO','H".$roleId1."::H".$roleId2."',1)", array());
     //        $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId3."','Vice President','H".$roleId1."::H".$roleId2."::H".$roleId3."',2)", array());
     //        $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId4."','Sales Manager','H".$roleId1."::H".$roleId2."::H".$roleId3."::H".$roleId4."',3)", array());
     //        $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId5."','Sales Person','H".$roleId1."::H".$roleId2."::H".$roleId3."::H".$roleId4."::H".$roleId5."',4)", array());
     // SalesPlatform.ru end
     //INSERT INTO vtiger_role2profile
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId2 . "'," . $profileId1 . ")", array());
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId3 . "'," . $profileId2 . ")", array());
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId4 . "'," . $profileId2 . ")", array());
     $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H" . $roleId5 . "'," . $profileId2 . ")", array());
     //New Security Start
     //Inserting into vtiger_profile vtiger_table
     // SalesPlatform.ru begin
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId1 . "','Администратор','Профиль Администратора Системы')", array());
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId2 . "','Продажи','Профиль относящийся к Продажам')", array());
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId3 . "','Поддержка','Профиль относящийся к Поддержке')", array());
     $adb->pquery("INSERT INTO vtiger_profile VALUES ('" . $profileId4 . "','Гости','Гостевой профиль для Тестирования')", array());
     //		$adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId1."','Administrator','Admin Profile')", array());
     //		$adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId2."','Sales Profile','Profile Related to Sales')", array());
     //		$adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId3."','Support Profile','Profile Related to Support')", array());
     //		$adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId4."','Guest Profile','Guest Profile for Test Users')", array());
     // SalesPlatform.ru end
     //Inserting into vtiger_profile2gloabal permissions
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId1 . "',1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId1 . "',2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId2 . "',1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId2 . "',2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId3 . "',1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId3 . "',2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId4 . "',1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('" . $profileId4 . "',2,1)", array());
     //Inserting into vtiger_profile2tab
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",27,0)", array());
     // SalesPlatform.ru end Added perms to PDF templates in installer
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId1 . ",30,1)", array());
     // SalesPlatform.ru end
     //Inserting into vtiger_profile2tab
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",27,0)", array());
     // SalesPlatform.ru end Added perms to PDF templates in installer
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId2 . ",30,1)", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",27,0)", array());
     // SalesPlatform.ru end Added perms to PDF templates in installer
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId3 . ",30,1)", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",7,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",13,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",14,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",15,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",16,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",18,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",19,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",20,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",21,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",22,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",23,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",24,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",25,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",26,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",27,0)", array());
     // SalesPlatform.ru end Added perms to PDF templates in installer
     $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (" . $profileId4 . ",30,1)", array());
     // SalesPlatform.ru end
     //Inserting into vtiger_profile2standardpermissions  Adminsitrator
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId1 . ",26,4,0)", array());
     //INSERT INTO Profile 2 std permissions for Sales User
     //Help Desk Create/Delete not allowed. Read-Only
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId2 . ",26,4,0)", array());
     //Inserting into vtiger_profile2std for Support Profile
     // Potential is read-only
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,0,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,1,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,2,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId3 . ",26,4,0)", array());
     //Inserting into vtiger_profile2stdper for Profile Guest Profile
     //All Read-Only
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",2,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",4,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",6,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",7,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",8,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",9,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",13,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",14,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",15,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",16,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",18,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",19,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",20,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",21,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",22,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",23,4,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,0,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,1,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,2,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,3,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (" . $profileId4 . ",26,4,0)", array());
     //Inserting into vtiger_profile 2 utility Admin
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,6,0)", array());
     // SalesPlatform.ru begin Added Potentials merge perms
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,8,0)", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",8,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",14,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",14,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",18,5,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",18,6,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",18,10,0)", array());
     //Inserting into vtiger_profile2utility Sales Profile
     //Import Export Not Allowed.
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,6,1)", array());
     // SalesPlatform.ru begin Added Potentials merge perms
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,8,0)", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",8,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",14,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",14,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",18,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",18,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId2 . ",18,10,0)", array());
     //Inserting into vtiger_profile2utility Support Profile
     //Import Export Not Allowed.
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,6,1)", array());
     // SalesPlatform.ru begin Added Potentials merge perms
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,8,0)", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",8,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,8,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",14,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",14,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",18,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",18,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId3 . ",18,10,0)", array());
     //Inserting into vtiger_profile2utility Guest Profile Read-Only
     //Import Export BusinessCar Not Allowed.
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,6,1)", array());
     // SalesPlatform.ru begin Added Potentials merge perms
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId1 . ",2,8,0)", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",8,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,8,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,9,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,5,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,6,1)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,10,0)", array());
     $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,10,0)", array());
     // Invalidate any cached information
     VTCacheUtils::clearRoleSubordinates();
     $adminPassword = $_SESSION['config_file_info']['password'];
     $userDateFormat = $_SESSION['config_file_info']['dateformat'];
     $userTimeZone = $_SESSION['config_file_info']['timezone'];
     //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
     $userFirstName = $_SESSION['config_file_info']['firstname'];
     $userLastName = $_SESSION['config_file_info']['lastname'];
     // create default admin user
     $user = CRMEntity::getInstance('Users');
     // SalesPlatform.ru begin
     $user->column_fields["last_name"] = 'Администратор';
     //$user->column_fields["last_name"] = 'Administrator';
     // SalesPlatform.ru end
     $user->column_fields["user_name"] = 'admin';
     $user->column_fields["status"] = 'Active';
     $user->column_fields["is_admin"] = 'on';
     $user->column_fields["user_password"] = $adminPassword;
     $user->column_fields["time_zone"] = $userTimeZone;
     // SalesPlatform.ru begin
     $user->column_fields["holidays"] = 'ru,';
     $user->column_fields["workdays"] = '1,2,3,4,5,6,0,';
     //$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
     //$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
     // SalesPlatform.ru end
     $user->column_fields["weekstart"] = '1';
     $user->column_fields["namedays"] = '';
     $user->column_fields["currency_id"] = 1;
     $user->column_fields["reminder_interval"] = '1 Minute';
     $user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
     $user->column_fields["date_format"] = $userDateFormat;
     // SalesPlatform.ru begin
     $user->column_fields["hour_format"] = '24';
     //$user->column_fields["hour_format"] = 'am/pm';
     // SalesPlatform.ru end
     $user->column_fields["start_hour"] = '08:00';
     $user->column_fields["end_hour"] = '23:00';
     $user->column_fields["imagename"] = '';
     $user->column_fields["internal_mailer"] = '1';
     $user->column_fields["activity_view"] = 'This Week';
     $user->column_fields["lead_view"] = 'Today';
     $adminEmail = $_SESSION['config_file_info']['admin_email'];
     if ($adminEmail == '') {
         $adminEmail = "*****@*****.**";
     }
     $user->column_fields["email1"] = $adminEmail;
     // SalesPlatform.ru begin
     $roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='Директор'";
     //$roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='CEO'";
     // SalesPlatform.ru end
     $adb->checkConnection();
     $adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
     $roleResult = $adb->pquery($roleQuery, array());
     $roleId = $adb->query_result($roleResult, 0, "roleid");
     $user->column_fields["roleid"] = $roleId;
     // SalesPlatform.ru begin: Add default currency formatting
     $user->column_fields["currency_grouping_pattern"] = '123456789';
     $user->column_fields["currency_decimal_separator"] = ",";
     $user->column_fields["currency_grouping_separator"] = '\'';
     $user->column_fields["currency_symbol_placement"] = '1.0$';
     $user->column_fields["dayoftheweek"] = 'Monday';
     // SalesPlatform.ru end
     $user->save("Users");
     $adminUserId = $user->id;
     //Inserting into vtiger_groups table
     $groupId1 = $adb->getUniqueID("vtiger_users");
     $groupId2 = $adb->getUniqueID("vtiger_users");
     $groupId3 = $adb->getUniqueID("vtiger_users");
     // SalesPlatform.ru begin
     $adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId1 . "','Отдел Продаж','Группа менеджеров по Продажам')", array());
     //$adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId1."','Team Selling','Group Related to Sales')", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId1 . "','H" . $roleId4 . "')", array());
     $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId1 . "','H" . $roleId5 . "')", array());
     // SalesPlatform.ru begin
     $adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId2 . "','Отдел Маркетинга','Группа менеджеров по Маркетингу')", array());
     //$adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId2."','Marketing Group','Group Related to Marketing Activities')", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId2 . "','H" . $roleId2 . "')", array());
     $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId2 . "','H" . $roleId3 . "')", array());
     // SalesPlatform.ru begin
     $adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId3 . "','Отдел Поддержки','Группа сервисной поддержки Клиентов')", array());
     //$adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId3."','Support Group','Group Related to providing Support to Customers')", array());
     // SalesPlatform.ru end
     $adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
     $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
     // Setting user group relation for admin user
     $adb->pquery("INSERT INTO vtiger_users2group VALUES (?,?)", array($groupId2, $adminUserId), array());
     //Creating the flat files for admin user
     createUserPrivilegesfile($adminUserId);
     createUserSharingPrivilegesfile($adminUserId);
     //INSERT INTO vtiger_profile2field
     insertProfile2field($profileId1);
     insertProfile2field($profileId2);
     insertProfile2field($profileId3);
     insertProfile2field($profileId4);
     insert_def_org_field();
 }