コード例 #1
0
ファイル: InitSchema.php プロジェクト: kikojover/corebos
 /**
  * Function creates default user's Role, Profiles
  */
 public function setDefaultUsersAccess()
 {
     $adminPassword = $_SESSION['installation_info']['admin_password'];
     $this->db->pquery('update vtiger_users set email1=? where id=1', array($_SESSION['installation_info']['admin_email']));
     $newUser = new Users();
     $newUser->retrieve_entity_info(1, 'Users');
     $newUser->change_password('admin', $adminPassword, false);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile(1);
 }
コード例 #2
0
ファイル: Record.php プロジェクト: nikdejan/YetiForceCRM
 public function recalculate()
 {
     $php_max_execution_time = vglobal('php_max_execution_time');
     set_time_limit($php_max_execution_time);
     vimport('~~modules/Users/CreateUserPrivilegeFile.php');
     $userIdsList = Settings_Profiles_Record_Model::getUsersList(true);
     if ($userIdsList) {
         foreach ($userIdsList as $userId) {
             createUserPrivilegesfile($userId);
         }
     }
 }
コード例 #3
0
 public function process(Vtiger_Request $request)
 {
     $adb = \PearDatabase::getInstance();
     switch ($request->get('option')) {
         case 'recreateUserPrivilegs':
             $sql = 'SELECT id FROM vtiger_users WHERE status = "Active"';
             $result = $adb->query($sql);
             require_once 'modules/Users/CreateUserPrivilegeFile.php';
             while ($row = $adb->fetchByAssoc($result)) {
                 createUserPrivilegesfile($row['id']);
                 createUserSharingPrivilegesfile($row['id']);
                 ini_set('display_errors', 1);
                 global $root_directory;
                 require_once $root_directory . 'user_privileges/user_privileges_' . $row['id'] . '.php';
                 require_once $root_directory . 'user_privileges/sharing_privileges_' . $row['id'] . '.php';
             }
             break;
         case 'enableModComments':
             $commentsModuleModel = Vtiger_Module_Model::getInstance('ModComments');
             if ($commentsModuleModel && $commentsModuleModel->isActive()) {
                 $relatedToFieldResult = $adb->pquery('SELECT fieldid FROM vtiger_field WHERE fieldname = ? AND tabid = ?', array('related_to', $commentsModuleModel->getId()));
                 $fieldId = $adb->query_result($relatedToFieldResult, 0, 'fieldid');
                 $sql = 'SELECT * FROM vtiger_tab WHERE (isentitytype = 1  AND presence = 0) OR name = "Events"';
                 $result = $adb->query($sql);
                 while ($row = $adb->fetchByAssoc($result)) {
                     $sql = 'SELECT fieldid FROM vtiger_fieldmodulerel WHERE fieldid = ? AND module = "ModComments" AND relmodule = ?';
                     $check = $adb->pquery($sql, array($fieldId, $row['name']));
                     if ($adb->num_rows($check) == 0) {
                         $sql = 'INSERT INTO vtiger_fieldmodulerel SET fieldid = ?, module = "ModComments", relmodule = ?';
                         $adb->pquery($sql, array($fieldId, $row['name']));
                     }
                 }
             }
             break;
         case 'initFilterSortOrder':
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_col', 'VARCHAR(255)');
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_dir', 'VARCHAR(4)');
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric_check', 'TINYINT');
             \SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric', 'VARCHAR(10)');
             $adb = PearDatabase::getInstance();
             $em = new VTEventsManager($adb);
             // Registering event for Recurring Invoices
             $em->registerHandler('vtiger.filter.process.customview.editajax.view.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             $em->registerHandler('vtiger.process.customview.editajax.view.finish', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             $em->registerHandler('vtiger.filter.process.customview.save.action.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             $em->registerHandler('vtiger.filter.listview.orderby', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
             break;
     }
 }
コード例 #4
0
ファイル: 600_to_610.php プロジェクト: lsmonki/vtigercrm
    $field->uitype = 1;
    $field->typeofdata = 'V~O';
    $field->readonly = '0';
    $field->displaytype = '5';
    $field->masseditable = '0';
    $field->quickcreate = '0';
    $field->columntype = 'VARCHAR(5)';
    $field->defaultvalue = 0;
    $usersBlockInstance->addField($field);
    echo '<br> Added isOwner field in Users';
}
//Setting up is_owner for every admin user of CRM
$adb = PearDatabase::getInstance();
$idResult = $adb->pquery('SELECT id FROM vtiger_users WHERE is_admin = ? AND status=?', array('on', 'Active'));
if ($adb->num_rows($idResult) > 0) {
    for ($i = 0; $i <= $adb->num_rows($idResult); $i++) {
        $userid = $adb->query_result($idResult, $i, 'id');
        $adb->pquery('UPDATE vtiger_users SET is_owner=? WHERE id=?', array(1, $userid));
        echo '<br>Account Owner Informnation saved in vtiger';
        //Recreate user prvileges
        createUserPrivilegesfile($userId);
        echo '<br>User previleges file recreated aftter adding is_owner field';
    }
} else {
    echo '<br>Account Owner was not existed in this database';
}
//Reports Chart Supported
Migration_Index_View::ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_reporttype(\n                        reportid INT(10),\n                        data text,\n\t\t\t\t\t\tPRIMARY KEY (`reportid`),\n\t\t\t\t\t\tCONSTRAINT `fk_1_vtiger_reporttype` FOREIGN KEY (`reportid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE)\n                        ENGINE=InnoDB DEFAULT CHARSET=utf8;", array());
//Configuration Editor fix
$sql = "UPDATE vtiger_settings_field SET name = ? WHERE name = ?";
Migration_Index_View::ExecuteQuery($sql, array('LBL_CONFIG_EDITOR', 'Configuration Editor'));
コード例 #5
0
ファイル: VtlibUtils.php プロジェクト: ssstorm/YetiForceCRM
/**
 * Recreate user privileges files.
 */
function vtlib_RecreateUserPrivilegeFiles()
{
    $adb = PearDatabase::getInstance();
    $userres = $adb->query('SELECT id FROM vtiger_users WHERE deleted = 0');
    if ($userres && $adb->num_rows($userres)) {
        while ($userrow = $adb->fetch_array($userres)) {
            createUserPrivilegesfile($userrow['id']);
        }
    }
}
コード例 #6
0
ファイル: Users.php プロジェクト: rcrrich/UpdatePackages
 /** Function to save the user information into the database
  * @param $module -- module name:: Type varchar
  *
  */
 function save($module_name)
 {
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     if ($this->mode != 'edit') {
         $sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
         $result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
         if ($adb->num_rows($result) > 0) {
             Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
             throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
             return false;
         }
     }
     //Save entity being called with the modulename as parameter
     $this->saveentity($module_name);
     // Added for Reminder Popup support
     $query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
     $prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
     //$focus->imagename = $image_upload_array['imagename'];
     $this->saveHomeStuffOrder($this->id);
     SaveTagCloudView($this->id);
     // Added for Reminder Popup support
     $this->resetReminderInterval($prev_reminder_interval);
     //Creating the Privileges Flat File
     if (isset($this->column_fields['roleid'])) {
         updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
     }
     //After adding new user, set the default activity types for new user
     Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->id);
     createUserSharingPrivilegesfile($this->id);
 }
コード例 #7
0
ファイル: CreateTables.inc.php プロジェクト: nvh3010/quancrm
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();
}
コード例 #8
0
ファイル: Users.php プロジェクト: Bergdahls/YetiForceCRM
 /** Function to save the user information into the database
  * @param $module -- module name:: Type varchar
  *
  */
 function save($module_name)
 {
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     //Event triggering code
     require_once "include/events/include.inc";
     //In Bulk mode stop triggering events
     if (!self::isBulkSaveMode()) {
         $em = new VTEventsManager($adb);
         // Initialize Event trigger cache
         $em->initTriggerCache();
         $entityData = VTEntityData::fromCRMEntity($this);
         $em->triggerEvent("vtiger.entity.beforesave.modifiable", $entityData);
         $em->triggerEvent("vtiger.entity.beforesave", $entityData);
         $em->triggerEvent("vtiger.entity.beforesave.final", $entityData);
     }
     if ($this->mode != 'edit') {
         $sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
         $result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
         if ($adb->num_rows($result) > 0) {
             Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
             throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
             return false;
         }
     } else {
         $query = 'SELECT `roleid` FROM `vtiger_user2role` WHERE `userid` = ? LIMIT 1;';
         $oldRoleResult = $adb->pquery($query, [$this->id]);
         $oldRole = $adb->query_result($oldRoleResult, 0, 'roleid');
         if ($oldRole != $this->column_fields['roleid']) {
             $query = 'DELETE FROM `vtiger_module_dashboard_widgets` WHERE `userid` = ?;';
             $adb->pquery($query, [$this->id]);
         }
     }
     //Save entity being called with the modulename as parameter
     $this->saveentity($module_name);
     if ($em) {
         //Event triggering code
         $em->triggerEvent("vtiger.entity.aftersave", $entityData);
         $em->triggerEvent("vtiger.entity.aftersave.final", $entityData);
         //Event triggering code ends
     }
     // Added for Reminder Popup support
     $query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
     $prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
     //$focus->imagename = $image_upload_array['imagename'];
     $this->saveHomeStuffOrder($this->id);
     SaveTagCloudView($this->id);
     // Added for Reminder Popup support
     $this->resetReminderInterval($prev_reminder_interval);
     //Creating the Privileges Flat File
     if (isset($this->column_fields['roleid'])) {
         updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
     }
     //After adding new user, set the default activity types for new user
     Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->id);
     createUserSharingPrivilegesfile($this->id);
 }
コード例 #9
0
ファイル: Record.php プロジェクト: nouphet/vtigercrm-6.0.0-ja
 public function saveUserPreferences($userPreferenceData)
 {
     $db = PearDatabase::getInstance();
     $updateQuery = 'UPDATE vtiger_users SET ' . (implode('=?,', array_keys($userPreferenceData)) . '=?') . ' WHERE id = ?';
     $updateQueryParams = array_values($userPreferenceData);
     $updateQueryParams[] = $this->getId();
     $db->pquery($updateQuery, $updateQueryParams);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->getId());
 }
コード例 #10
0
ファイル: Record.php プロジェクト: rcrrich/UpdatePackages
 /**
  * Function recalculate the sharing rules
  */
 public function recalculate()
 {
     $php_max_execution_time = vglobal('php_max_execution_time');
     set_time_limit($php_max_execution_time);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     $userIdsList = $this->getUsersList();
     if ($userIdsList) {
         foreach ($userIdsList as $userId) {
             createUserPrivilegesfile($userId);
         }
     }
 }
コード例 #11
0
         $auditrecord = $record;
     }
     $date_var = $adb->formatDate(date('Y-m-d H:i:s'), true);
     $query = "insert into vtiger_audit_trial values(?,?,?,?,?,?)";
     $params = array($adb->getUniqueID('vtiger_audit_trial'), $focus->id, 'Users', 'Authenticate', '', $date_var);
     $adb->pquery($query, $params);
 }
 // Recording the login info
 $usip = $_SERVER['REMOTE_ADDR'];
 $intime = date("Y/m/d H:i:s");
 require_once 'modules/Users/LoginHistory.php';
 $loghistory = new LoginHistory();
 $Signin = $loghistory->user_login($focus->column_fields["user_name"], $usip, $intime);
 //Security related entries start
 require_once 'include/utils/UserInfoUtil.php';
 createUserPrivilegesfile($focus->id);
 //Security related entries end
 session_unregister('login_password');
 session_unregister('login_error');
 session_unregister('login_user_name');
 $_SESSION['authenticated_user_id'] = $focus->id;
 $_SESSION['app_unique_key'] = $application_unique_key;
 // store the user's theme in the session
 if (isset($_REQUEST['login_theme'])) {
     $authenticated_user_theme = $_REQUEST['login_theme'];
 } elseif (isset($_REQUEST['ck_login_theme'])) {
     $authenticated_user_theme = $_REQUEST['ck_login_theme'];
 } else {
     $authenticated_user_theme = $default_theme;
 }
 // store the user's language in the session
コード例 #12
0
ファイル: Record.php プロジェクト: JeRRimix/YetiForceCRM
 /**
  * Function to recalculate user priviliges files
  * @param <Array> $oldUsersList
  */
 public function recalculate($oldUsersList)
 {
     $php_max_execution_time = vglobal('php_max_execution_time');
     set_time_limit($php_max_execution_time);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     $userIdsList = array();
     foreach ($oldUsersList as $userId => $userRecordModel) {
         $userIdsList[$userId] = $userId;
     }
     $this->members = null;
     foreach ($this->getUsersList(true) as $userId => $userRecordModel) {
         $userIdsList[$userId] = $userId;
     }
     foreach ($userIdsList as $userId) {
         createUserPrivilegesfile($userId);
     }
 }
コード例 #13
0
ファイル: Users.php プロジェクト: Wasage/werpa
    /** Function to save the user information into the database
     * @param $module -- module name:: Type varchar
     *
     */
    function save($module_name) {
        global $log, $adb;
        //Save entity being called with the modulename as parameter
        $this->saveentity($module_name);

        // Added for Reminder Popup support
        $query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?",
                array($this->id));
        $prev_reminder_interval = $adb->query_result($query_prev_interval,0,'reminder_interval');

        //$focus->imagename = $image_upload_array['imagename'];
        $this->saveHomeStuffOrder($this->id);
        SaveTagCloudView($this->id);

        // Added for Reminder Popup support
        $this->resetReminderInterval($prev_reminder_interval);
        //Creating the Privileges Flat File
        if(isset($this->column_fields['roleid'])) {
            updateUser2RoleMapping($this->column_fields['roleid'],$this->id);
        }

		//After adding new user, set the default activity types for new user
		Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);

        require_once('modules/Users/CreateUserPrivilegeFile.php');
        createUserPrivilegesfile($this->id);
        createUserSharingPrivilegesfile($this->id);

    }
コード例 #14
0
<?php

/*************************************************************************************************
 * Copyright 2016 JPL TSolucio, S.L. -- This file is a part of TSOLUCIO coreBOS Customizations.
 * Licensed under the vtiger CRM Public License Version 1.1 (the "License"); you may not use this
 * file except in compliance with the License. You can redistribute it and/or modify it
 * under the terms of the License. JPL TSolucio, S.L. reserves all rights not expressly
 * granted by the License. coreBOS distributed by JPL TSolucio S.L. is distributed in
 * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Unless required by
 * applicable law or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT ANY WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing
 * permissions and limitations under the License. You may obtain a copy of the License
 * at <http://corebos.org/documentation/doku.php?id=en:devel:vpl11>
 *************************************************************************************************
 *  Author       : JPL TSolucio, S. L.
 *************************************************************************************************/
include 'modules/Users/CreateUserPrivilegeFile.php';
$record = vtlib_purify($_REQUEST['record']);
if (!empty($record)) {
    createUserPrivilegesfile($record);
    createUserSharingPrivilegesfile($record);
}
header("Location: index.php?action=DetailView&module=Users&record=" . $record);
コード例 #15
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();
 }
コード例 #16
0
ファイル: Users.php プロジェクト: jaimeaga84/corebos
 /** Function to save the user information into the database
  * @param $module -- module name:: Type varchar
  *
  */
 function save($module_name)
 {
     global $log, $adb, $current_user;
     if (!is_admin($current_user) and $current_user->id != $this->id) {
         // only admin users can change other users profile
         return false;
     }
     //Save entity being called with the modulename as parameter
     $this->saveentity($module_name);
     // Added for Reminder Popup support
     $query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
     $prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
     //$focus->imagename = $image_upload_array['imagename'];
     $this->saveHomeStuffOrder($this->id);
     SaveTagCloudView($this->id);
     // Added for Reminder Popup support
     $this->resetReminderInterval($prev_reminder_interval);
     //Creating the Privileges Flat File
     if (isset($this->column_fields['roleid'])) {
         updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
     }
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->id);
     createUserSharingPrivilegesfile($this->id);
 }
コード例 #17
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");
     // 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();
 }
コード例 #18
0
ファイル: InitSchema.php プロジェクト: rcrrich/YetiForceCRM
 /**
  * Function creates default user's Role, Profiles
  */
 public function setDefaultUsersAccess()
 {
     $adminPassword = $_SESSION['config_file_info']['password'];
     $userDateFormat = $_SESSION['config_file_info']['dateformat'];
     $userTimeZone = $_SESSION['config_file_info']['timezone'];
     $userFirstName = $_SESSION['config_file_info']['firstname'];
     $userLastName = $_SESSION['config_file_info']['lastname'];
     $adminEmail = $_SESSION['config_file_info']['admin_email'];
     $adb = PearDatabase::getInstance();
     $adb->pquery("UPDATE vtiger_users SET date_format = ?, time_zone = ?, first_name = ?, last_name = ?, email1 = ?, accesskey = ?, language = ?", array($userDateFormat, $userTimeZone, $userFirstName, $userLastName, $adminEmail, vtws_generateRandomAccessKey(16), $_SESSION['default_language']));
     $newUser = new Users();
     $newUser->retrieve_entity_info(1, 'Users');
     $newUser->change_password('admin', $adminPassword, false);
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile(1);
 }
コード例 #19
0
ファイル: Users.php プロジェクト: kduqi/corebos
 /** Function to save the user information into the database
  * @param $module -- module name:: Type varchar
  */
 function saveentity($module, $fileid = '')
 {
     global $current_user;
     //$adb added by raju for mass mailing
     $insertion_mode = $this->mode;
     if (empty($this->column_fields['time_zone'])) {
         $dbDefaultTimeZone = DateTimeField::getDBTimeZone();
         $this->column_fields['time_zone'] = $dbDefaultTimeZone;
         $this->time_zone = $dbDefaultTimeZone;
     }
     if (empty($this->column_fields['currency_id'])) {
         $this->column_fields['currency_id'] = CurrencyField::getDBCurrencyId();
     }
     if (empty($this->column_fields['date_format'])) {
         $this->column_fields['date_format'] = 'yyyy-mm-dd';
     }
     $this->db->println("TRANS saveentity starts {$module}");
     $this->db->startTransaction();
     foreach ($this->tab_name as $table_name) {
         if ($table_name == 'vtiger_attachments') {
             $this->insertIntoAttachment($this->id, $module, $fileid);
         } else {
             $this->insertIntoEntityTable($table_name, $module, $fileid);
         }
     }
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->id);
     unset($_SESSION['next_reminder_interval']);
     unset($_SESSION['next_reminder_time']);
     if ($insertion_mode != 'edit') {
         $this->createAccessKey();
     }
     $this->db->completeTransaction();
     $this->db->println("TRANS saveentity ends");
 }
コード例 #20
0
 /** Function to save the user information into the database
  * @param $module -- module name:: Type varchar
  *
  */
 function saveentity($module)
 {
     global $current_user;
     //$adb added by raju for mass mailing
     $insertion_mode = $this->mode;
     $this->db->println("TRANS saveentity starts {$module}");
     $this->db->startTransaction();
     foreach ($this->tab_name as $table_name) {
         if ($table_name == 'vtiger_attachments') {
             $this->insertIntoAttachment($this->id, $module);
         } else {
             $this->insertIntoEntityTable($table_name, $module);
         }
     }
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     createUserPrivilegesfile($this->id);
     if ($insertion_mode != 'edit') {
         $this->createAccessKey();
     }
     $this->db->completeTransaction();
     $this->db->println("TRANS saveentity ends");
 }
コード例 #21
0
/**
 * Recreate user privileges files.
 */
function vtlib_RecreateUserPrivilegeFiles()
{
    global $adb;
    $userres = $adb->query('SELECT id FROM vtiger_users WHERE deleted = 0');
    if ($userres && $adb->num_rows($userres)) {
        while ($userrow = $adb->fetch_array($userres)) {
            createUserPrivilegesfile($userrow['id']);
        }
    }
}
コード例 #22
0
ファイル: VtlibUtils.php プロジェクト: Wasage/werpa
/**
 * Recreate user privileges files.
 */
function vtlib_RecreateUserPrivilegeFiles()
{
    global $adb;
    // SalesPlatform.ru begin Bugfix
    require_once 'modules/Users/CreateUserPrivilegeFile.php';
    // SalesPlatform.ru end
    $userres = $adb->query('SELECT id FROM vtiger_users WHERE deleted = 0');
    if ($userres && $adb->num_rows($userres)) {
        while ($userrow = $adb->fetch_array($userres)) {
            createUserPrivilegesfile($userrow['id']);
        }
    }
}
コード例 #23
0
ファイル: Record.php プロジェクト: vinzdrance/YetiForceCRM
 /**
  * Function to delete the role
  * @param <Settings_Roles_Record_Model> $transferToRole
  */
 public function delete($transferToRole)
 {
     $db = PearDatabase::getInstance();
     $roleId = $this->getId();
     $transferRoleId = $transferToRole->getId();
     $db->pquery('UPDATE vtiger_user2role SET roleid=? WHERE roleid=?', array($transferRoleId, $roleId));
     $db->pquery('DELETE FROM vtiger_role2profile WHERE roleid=?', array($roleId));
     $db->pquery('DELETE FROM vtiger_group2role WHERE roleid=?', array($roleId));
     $db->pquery('DELETE FROM vtiger_group2rs WHERE roleandsubid=?', array($roleId));
     /*
      $noOfUsers = $db->num_rows($user_result);
      $array_users = array();
      if($noOfUsers > 0) {
      for($i=0; $i<$noOfUsers; ++$i) {
      $array_users[] = $db->query_result($user_result, $i, 'userid');
      }
      }
     */
     //delete handling for sharing rules
     deleteRoleRelatedSharingRules($roleId);
     $db->pquery('DELETE FROM vtiger_role WHERE roleid=?', array($roleId));
     $allChildren = $this->getAllChildren();
     $transferParentRoleSequence = $transferToRole->getParentRoleString();
     $currentParentRoleSequence = $this->getParentRoleString();
     foreach ($allChildren as $roleId => $roleModel) {
         $oldChildParentRoleString = $roleModel->getParentRoleString();
         $newChildParentRoleString = str_replace($currentParentRoleSequence, $transferParentRoleSequence, $oldChildParentRoleString);
         $newChildDepth = count(explode('::', $newChildParentRoleString)) - 1;
         $roleModel->set('depth', $newChildDepth);
         $roleModel->set('parentrole', $newChildParentRoleString);
         $roleModel->save();
     }
     if (is_array($array_users)) {
         require_once 'modules/Users/CreateUserPrivilegeFile.php';
         foreach ($array_users as $userid) {
             createUserPrivilegesfile($userid);
             createUserSharingPrivilegesfile($userid);
         }
     }
 }
コード例 #24
0
$sql = 'SELECT fieldid FROM vtiger_def_org_field WHERE tabid = ?';
$result1 = $adb->pquery($sql, array($tabId));
$def_org_fields = array();
$defRows = $adb->num_rows($result1);
for ($j = 0; $j < $defRows; $j++) {
    array_push($def_org_fields, $adb->query_result($result1, $j, 'fieldid'));
}
foreach ($userAccessbleFields as $fieldId => $fieldName) {
    if (!in_array($fieldId, $def_org_fields)) {
        $insertQuery = 'INSERT INTO vtiger_def_org_field(tabid,fieldid,visible,readonly) VALUES(?,?,?,?)';
        Migration_Index_View::ExecuteQuery($insertQuery, array($tabId, $fieldId, 0, 0));
    }
}
//need to recreate user_privileges files as lot of user fields are added in this script and user_priviliges files are not updated
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile('1');
//Remove '--None--'/'None' from all the picklist values.
$sql = 'SELECT fieldname FROM vtiger_field WHERE uitype IN(?,?,?,?)';
$result = $adb->pquery($sql, array(15, 16, 33, 55));
$num_rows = $adb->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
    $fieldName = $adb->query_result($result, $i, 'fieldname');
    $checkTable = $adb->pquery('SHOW TABLES LIKE "vtiger_' . $fieldName . '"', array());
    if ($adb->num_rows($checkTable) > 0) {
        $query = "DELETE FROM vtiger_{$fieldName} WHERE {$fieldName} = ? OR {$fieldName} = ?";
        Migration_Index_View::ExecuteQuery($query, array('--None--', 'None'));
    }
}
$potentials = Vtiger_Module::getInstance('Potentials');
$potentials->addLink('DASHBOARDWIDGET', 'Funnel Amount', 'index.php?module=Potentials&view=ShowWidget&name=FunnelAmount', '', '10');
$home = Vtiger_Module::getInstance('Home');
コード例 #25
0
/** Function to recalculate the Sharing Rules for all the vtiger_users
 * This function will recalculate all the sharing rules for all the vtiger_users in the Organization and will write them in flat vtiger_files
 *
 */
function RecalculateSharingRules()
{
    $log = vglobal('log');
    $log->debug("Entering RecalculateSharingRules() method ...");
    $adb = PearDatabase::getInstance();
    require_once 'modules/Users/CreateUserPrivilegeFile.php';
    $query = "select id from vtiger_users where deleted=0";
    $result = $adb->pquery($query, array());
    $num_rows = $adb->num_rows($result);
    for ($i = 0; $i < $num_rows; $i++) {
        $id = $adb->query_result($result, $i, 'id');
        createUserPrivilegesfile($id);
        createUserSharingPrivilegesfile($id);
    }
    $log->debug("Exiting RecalculateSharingRules method ...");
}
コード例 #26
0
ファイル: Record.php プロジェクト: DeliveryPLANET/vTiger
 /**
  * Function to recalculate user priviliges files
  * @param <Array> $oldUsersList
  */
 public function recalculate($oldUsersList)
 {
     set_time_limit(vglobal('php_max_execution_time'));
     require_once 'modules/Users/CreateUserPrivilegeFile.php';
     //SalesPlatform.ru begin
     /* Simple way - recalculate all users privileges files */
     foreach (Users_Record_Model::getAll() as $userModel) {
         createUserPrivilegesfile($userModel->getId());
     }
     //$userIdsList = array();
     //foreach ($oldUsersList as $userId => $userRecordModel) {
     //	$userIdsList[$userId] = $userId;
     //}
     //
     //$this->members = null;
     //foreach ($this->getUsersList(true) as $userId => $userRecordModel) {
     //	$userIdsList[$userId] = $userId;
     //}
     //
     //foreach ($userIdsList as $userId) {
     //	createUserPrivilegesfile($userId);
     //}
     //SalesPlatform.ru end
 }