public function getReportScheduleInfo() { $adb = PearDatabase::getInstance(); if (!empty($this->id)) { $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); if ($cachedInfo == false) { $result = $adb->pquery('SELECT * FROM its4you_reports4you_scheduled_reports WHERE reportid=?', array($this->id)); if ($adb->num_rows($result) > 0) { $reportScheduleInfo = $adb->raw_query_result_rowdata($result, 0); $scheduledInterval = !empty($reportScheduleInfo['schedule']) ? Zend_Json::decode($reportScheduleInfo['schedule']) : array(); $scheduledRecipients = !empty($reportScheduleInfo['recipients']) ? Zend_Json::decode($reportScheduleInfo['recipients']) : array(); VTCacheUtils::updateReport_ScheduledInfo($this->user->id, $this->id, true, $reportScheduleInfo['format'], $scheduledInterval, $scheduledRecipients, $reportScheduleInfo['next_trigger_time']); $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); } } if ($cachedInfo) { $this->isScheduled = $cachedInfo['isScheduled']; $this->scheduledFormat = $cachedInfo['scheduledFormat']; $this->scheduledInterval = $cachedInfo['scheduledInterval']; $this->scheduledRecipients = $cachedInfo['scheduledRecipients']; $this->scheduledTime = $cachedInfo['scheduledTime']; return true; } } else { $this->isScheduled = isset($_REQUEST['isReportScheduled']) && $_REQUEST['isReportScheduled'] != '' ? $_REQUEST['isReportScheduled'] : ''; $this->scheduledFormat = isset($_REQUEST['scheduledReportFormat']) && $_REQUEST['scheduledReportFormat'] != '' ? $_REQUEST['scheduledReportFormat'] : ''; $this->scheduledInterval = isset($_REQUEST['scheduledTypeSelectedStr']) && $_REQUEST['scheduledTypeSelectedStr'] != '' ? Zend_Json::decode($_REQUEST['scheduledIntervalJson']) : array(); $this->scheduledRecipients = isset($_REQUEST['selectedRecipientsStr']) && $_REQUEST['selectedRecipientsStr'] != '' ? Zend_Json::decode($_REQUEST['selectedRecipientsStr']) : array(); return true; } // ITS4YOU-END return false; }
function Reports($reportId = "") { $db = PearDatabase::getInstance(); $currentUser = Users_Record_Model::getCurrentUserModel(); $userId = $currentUser->getId(); $this->initListOfModules(); if ($reportId != "") { // Lookup information in cache first $cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId); $subOrdinateUsers = VTCacheUtils::lookupReport_SubordinateUsers($reportId); if ($cachedInfo === false) { $ssql = "SELECT vtiger_reportmodules.*, vtiger_report.* FROM vtiger_report\n\t\t\t\t\t\t\tINNER JOIN vtiger_reportmodules ON vtiger_report.reportid = vtiger_reportmodules.reportmodulesid\n\t\t\t\t\t\t\tWHERE vtiger_report.reportid = ?"; $params = array($reportId); require_once 'include/utils/GetUserGroups.php'; require 'user_privileges/user_privileges_' . $userId . '.php'; $userGroups = new GetUserGroups(); $userGroups->getAllUserGroups($userId); $userGroupsList = $userGroups->user_groups; if (!empty($userGroupsList) && $currentUser->isAdminUser() == false) { $userGroupsQuery = " (shareid IN (" . generateQuestionMarks($userGroupsList) . ") AND setype='groups') OR"; array_push($params, $userGroupsList); } $nonAdminQuery = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing\n\t\t\t\t\t\t\t\t\tWHERE {$userGroupsQuery} (shareid=? AND setype='users'))"; if ($currentUser->isAdminUser() == false) { $ssql .= " AND (({$nonAdminQuery})\n\t\t\t\t\t\t\t\tOR vtiger_report.sharingtype = 'Public'\n\t\t\t\t\t\t\t\tOR vtiger_report.owner = ? OR vtiger_report.owner IN\n\t\t\t\t\t\t\t\t\t(SELECT vtiger_user2role.userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%')\n\t\t\t\t\t\t\t\t)"; array_push($params, $userId, $userId); } $result = $db->pquery($ssql, $params); if ($result && $db->num_rows($result)) { $reportModulesRow = $db->fetch_array($result); // Update information in cache now VTCacheUtils::updateReport_Info($userId, $reportId, $reportModulesRow["primarymodule"], $reportModulesRow["secondarymodules"], $reportModulesRow["reporttype"], $reportModulesRow["reportname"], $reportModulesRow["description"], $reportModulesRow["folderid"], $reportModulesRow["owner"]); } $subOrdinateUsers = array(); $subResult = $db->pquery("SELECT userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%'", array()); $numOfSubRows = $db->num_rows($subResult); for ($i = 0; $i < $numOfSubRows; $i++) { $subOrdinateUsers[] = $db->query_result($subResult, $i, 'userid'); } // Update subordinate user information for re-use VTCacheUtils::updateReport_SubordinateUsers($reportId, $subOrdinateUsers); // Re-look at cache to maintain code-consistency below $cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId); } if ($cachedInfo) { $this->primodule = $cachedInfo["primarymodule"]; $this->secmodule = $cachedInfo["secondarymodules"]; $this->reporttype = $cachedInfo["reporttype"]; $this->reportname = decode_html($cachedInfo["reportname"]); $this->reportdescription = decode_html($cachedInfo["description"]); $this->folderid = $cachedInfo["folderid"]; if ($currentUser->isAdminUser() == true || in_array($cachedInfo["owner"], $subOrdinateUsers) || $cachedInfo["owner"] == $userId) { $this->is_editable = true; } else { $this->is_editable = false; } } } return $this; }
/** * Function to get the field information from module name and field label */ function getFieldByReportLabel($module, $label) { // this is required so the internal cache is populated or reused. getColumnFields($module); //lookup all the accessible fields $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if ($module == 'Calendar') { $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events'); if ($cachedModuleFields == false) { $cachedModuleFields = $cachedEventsFields; } else { $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); } } if (empty($cachedModuleFields)) { return null; } $label = decode_html($label); foreach ($cachedModuleFields as $fieldInfo) { $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']); if ($label == $fieldLabel) { return $fieldInfo; } } return null; }
public function getReportScheduleInfo() { $adb = PearDatabase::getInstance(); if (!empty($this->id)) { $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); if ($cachedInfo == false) { $result = $adb->pquery('SELECT * FROM vtiger_scheduled_reports WHERE reportid=?', array($this->id)); if ($adb->num_rows($result) > 0) { $reportScheduleInfo = $adb->raw_query_result_rowdata($result, 0); $scheduledInterval = !empty($reportScheduleInfo['schedule']) ? Zend_Json::decode($reportScheduleInfo['schedule']) : array(); $scheduledRecipients = !empty($reportScheduleInfo['recipients']) ? Zend_Json::decode($reportScheduleInfo['recipients']) : array(); VTCacheUtils::updateReport_ScheduledInfo($this->user->id, $this->id, true, $reportScheduleInfo['format'], $scheduledInterval, $scheduledRecipients, $reportScheduleInfo['next_trigger_time']); $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id); } } if ($cachedInfo) { $this->isScheduled = $cachedInfo['isScheduled']; $this->scheduledFormat = $cachedInfo['scheduledFormat']; $this->scheduledInterval = $cachedInfo['scheduledInterval']; $this->scheduledRecipients = $cachedInfo['scheduledRecipients']; $this->scheduledTime = $cachedInfo['scheduledTime']; return true; } } return false; }
/** * Function to get the field information from module name and field label */ function getFieldByReportLabel($module, $label) { // this is required so the internal cache is populated or reused. getColumnFields($module); //lookup all the accessible fields $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if (empty($cachedModuleFields)) { return null; } foreach ($cachedModuleFields as $fieldInfo) { $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']); if ($label == $fieldLabel) { return $fieldInfo; } } return null; }
/** * Function to get the field information from module name and field label */ function getFieldByReportLabel($module, $label) { $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label); if ($cacheLabel) { return $cacheLabel; } // this is required so the internal cache is populated or reused. getColumnFields($module); //lookup all the accessible fields $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); $label = decode_html($label); if ($module == 'Calendar') { $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events'); if ($cachedEventsFields) { if (empty($cachedModuleFields)) { $cachedModuleFields = $cachedEventsFields; } else { $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields); } } if ($label == 'Start_Date_and_Time') { $label = 'Start_Date_&_Time'; } } if (empty($cachedModuleFields)) { return null; } foreach ($cachedModuleFields as $fieldInfo) { $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']); $fieldLabel = decode_html($fieldLabel); //SalesPlatform.ru begin fix get field info by label if ($label == $fieldLabel || $label == getTranslatedString($fieldLabel, $module)) { //if($label == $fieldLabel) { //SalesPlatform.ru end VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo); return $fieldInfo; } } return null; }
function getModuleSequenceField($module) { global $adb, $log; $log->debug("Entering function getModuleSequenceFieldName ({$module})..."); $field = null; if (!empty($module)) { // First look at the cached information $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if ($cachedModuleFields === false) { //uitype 4 points to Module Numbering Field $seqColRes = $adb->pquery("SELECT fieldname, fieldlabel, columnname FROM vtiger_field WHERE uitype=? AND tabid=? and vtiger_field.presence in (0,2)", array('4', getTabid($module))); if ($adb->num_rows($seqColRes) > 0) { $fieldname = $adb->query_result($seqColRes, 0, 'fieldname'); $columnname = $adb->query_result($seqColRes, 0, 'columnname'); $fieldlabel = $adb->query_result($seqColRes, 0, 'fieldlabel'); $field = array(); $field['name'] = $fieldname; $field['column'] = $columnname; $field['label'] = $fieldlabel; } } else { foreach ($cachedModuleFields as $fieldinfo) { if ($fieldinfo['uitype'] == '4') { $field = array(); $field['name'] = $fieldinfo['fieldname']; $field['column'] = $fieldinfo['columnname']; $field['label'] = $fieldinfo['fieldlabel']; break; } } } } $log->debug("Exiting getModuleSequenceFieldName..."); return $field; }
function getFieldByPDFMakerLabel($module, $label) { $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label); if ($cacheLabel) { return $cacheLabel; } // this is required so the internal cache is populated or reused. getColumnFields($module); //lookup all the accessible fields $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if (empty($cachedModuleFields)) { return null; } foreach ($cachedModuleFields as $fieldInfo) { $fieldName = str_replace(' ', '_', $fieldInfo['fieldname']); if ($label == $fieldName) { VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo); return $fieldInfo; } } return null; }
static function updateMap_ListofModuleInfos($module_list, $related_modules, $rel_fields) { if (self::$_map_listofmodules_cache === false) { self::$_map_listofmodules_cache = array('module_list' => $module_list, 'related_modules' => $related_modules, 'rel_fields' => $rel_fields); } }
/** Function to set all the Mailer properties * $mail -- reference of the mail object * $subject -- subject of the email you want to send * $contents -- body of the email you want to send * $from_email -- from email id which will be displayed in the mail * $from_name -- from name which will be displayed in the mail * $to_email -- to email address -- This can be an email in a single string, a comma separated * list of emails or an array of email addresses * $attachment -- whether we want to attach the currently selected file or all vtiger_files. [values = current,all] - optional * $emailid -- id of the email object which will be used to get the vtiger_attachments - optional */ function setMailerProperties($mail, $subject, $contents, $from_email, $from_name, $to_email, $attachment = '', $emailid = '', $module = '', $logo = '') { $adb = PearDatabase::getInstance(); $adb->println("Inside the function setMailerProperties"); $CompanyDetails = getCompanyDetails(); $logourl = 'storage/Logo/' . $CompanyDetails['logoname']; if ($logo == 1) { $image = getimagesize($logourl); $mail->AddEmbeddedImage($logourl, 'logo', $CompanyDetails['logoname'], "base64", $image['mime']); } $mail->Subject = $subject; //Added back as we have changed php mailer library, older library was using html_entity_decode before sending mail $mail->Body = decode_html($contents); //$mail->Body = html_entity_decode(nl2br($contents)); //if we get html tags in mail then we will use this line $mail->AltBody = strip_tags(preg_replace(array("/<p>/i", "/<br>/i", "/<br \\/>/i"), array("\n", "\n", "\n"), $contents)); $mail->IsSMTP(); //set mailer to use SMTP //$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server setMailServerProperties($mail); //Handle the from name and email for HelpDesk $mail->From = $from_email; $userFullName = trim(VTCacheUtils::getUserFullName($from_name)); if (empty($userFullName)) { $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name)); $num_rows = $adb->num_rows($rs); if ($num_rows > 0) { $fullName = getFullNameFromQResult($rs, 0, 'Users'); VTCacheUtils::setUserFullName($from_name, $fullName); } } else { $from_name = $userFullName; } $mail->FromName = decode_html($from_name); if ($to_email != '') { if (is_array($to_email)) { for ($j = 0, $num = count($to_email); $j < $num; $j++) { $mail->addAddress($to_email[$j]); } } else { $_tmp = explode(",", $to_email); for ($j = 0, $num = count($_tmp); $j < $num; $j++) { $mail->addAddress($_tmp[$j]); } } } //commented so that it does not add from_email in reply to //$mail->AddReplyTo($from_email); $mail->WordWrap = 50; //If we want to add the currently selected file only then we will use the following function if ($attachment == 'current' && $emailid != '') { if (isset($_REQUEST['filename_hidden'])) { $file_name = $_REQUEST['filename_hidden']; } else { $file_name = $_FILES['filename']['name']; } addAttachment($mail, $file_name, $emailid); } //This will add all the vtiger_files which are related to this record or email if ($attachment == 'all' && $emailid != '') { addAllAttachments($mail, $emailid); } $mail->IsHTML(true); // set email format to HTML return; }
function getCurrencyInfo($currencyid) { $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid); if ($currencyinfo === false) { global $adb; $sql1 = "select * from vtiger_currency_info where id= ?"; $result = $adb->pquery($sql1, array($currencyid)); $resultinfo = $adb->fetch_array($result); // Update cache VTCacheUtils::updateCurrencyInfo($currencyid, $resultinfo['currency_name'], $resultinfo['currency_code'], $resultinfo['currency_symbol'], $resultinfo['conversion_rate']); // Re-look at the cache now $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid); } return $currencyinfo; }
public function buildSearchQueryWithUIType($uitype, $value, $module) { if (empty($value)) { return false; } $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if ($cachedModuleFields === false) { getColumnFields($module); // This API will initialize the cache as well // We will succeed now due to above function call $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); } $lookuptables = array(); $lookupcolumns = array(); foreach ($cachedModuleFields as $fieldinfo) { if (in_array($fieldinfo['uitype'], array($uitype))) { $lookuptables[] = $fieldinfo['tablename']; $lookupcolumns[] = $fieldinfo['columnname']; } } $entityfields = getEntityField($module); $querycolumnnames = implode(',', $lookupcolumns); $entitycolumnnames = $entityfields['fieldname']; $query = "select id as id, {$querycolumnnames}, {$entitycolumnnames} as name "; $query .= " FROM vtiger_users"; if (!empty($lookupcolumns)) { $query .= " WHERE deleted=0 AND "; $i = 0; $columnCount = count($lookupcolumns); foreach ($lookupcolumns as $columnname) { if (!empty($columnname)) { if ($i == 0 || $i == $columnCount) { $query .= sprintf("%s = '%s'", $columnname, $value); } else { $query .= sprintf(" OR %s = '%s'", $columnname, $value); } $i++; } } } return $query; }
public function delete($role) { $db = PearDatabase::getInstance(); $db->dieOnError = true; $sql = "update vtiger_user2role set roleid=? where roleid=?"; $db->pquery($sql, array($role->getId(), $this->getId())); //Deleteing from vtiger_role2profile vtiger_table $sql = "delete from vtiger_role2profile where roleid=?"; $db->pquery($sql, array($this->getId())); //delete handling for vtiger_groups $sql = "delete from vtiger_group2role where roleid=?"; $db->pquery($sql, array($this->getId())); $sql = "delete from vtiger_group2rs where roleandsubid=?"; $db->pquery($sql, array($this->getId())); //delete handling for sharing rules deleteRoleRelatedSharingRules($this->getId()); //delete from vtiger_role vtiger_table; $sql = "delete from vtiger_role where roleid=?"; $db->pquery($sql, array($this->getId())); $targetParentRoleSequence = $role->getParentRole(); $parentRoleSequence = $this->getParentRole(); $roleInfoList = getRoleAndSubordinatesInformation($roleId); foreach ($roleInfoList as $roleId => $roleInfo) { // Invalidate any cached information VTCacheUtils::clearRoleSubordinates($roleId); if ($roleId == $this->getId()) { continue; } $currentParentRoleSequence = $roleInfo[1]; $currentParentRoleSequence = str_replace($parentRoleSequence, $targetParentRoleSequence, $currentParentRoleSequence); $subDepth = count(explode('::', $currentParentRoleSequence)) - 1; $query = "update vtiger_role set parentrole=?,depth=? where roleid=?"; $db->pquery($query, array($currentParentRoleSequence, $subDepth, $roleId)); } }
/** Function to get related list entries in detailed array format * @param $module -- modulename:: Type string * @param $relatedmodule -- relatedmodule:: Type string * @param $focus -- focus:: Type object * @param $query -- query:: Type string * @param $button -- buttons:: Type string * @param $returnset -- returnset:: Type string * @param $id -- id:: Type string * @param $edit_val -- edit value:: Type string * @param $del_val -- delete value:: Type string * @returns $related_entries -- related entires:: Type string array */ function GetRelatedListBase($module, $relatedmodule, $focus, $query, $button, $returnset, $id = '', $edit_val = '', $del_val = '', $skipActions = false) { $log = LoggerManager::getLogger('account_list'); $log->debug("Entering GetRelatedList(" . $module . "," . $relatedmodule . "," . get_class($focus) . "," . $query . "," . $button . "," . $returnset . "," . $edit_val . "," . $del_val . ") method ..."); global $GetRelatedList_ReturnOnlyQuery; if (isset($GetRelatedList_ReturnOnlyQuery) and $GetRelatedList_ReturnOnlyQuery) { return array('query' => $query); } require_once 'Smarty_setup.php'; require_once "data/Tracker.php"; require_once 'include/database/PearDatabase.php'; global $adb, $app_strings, $current_language; $current_module_strings = return_module_language($current_language, $module); global $list_max_entries_per_page, $urlPrefix, $currentModule, $theme, $theme_path, $theme_path, $mod_strings; $smarty = new vtigerCRM_Smarty(); if (!isset($where)) { $where = ""; } $button = '<table cellspacing=0 cellpadding=2><tr><td>' . $button . '</td></tr></table>'; // Added to have Purchase Order as form Title $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $smarty->assign("MOD", $mod_strings); $smarty->assign("APP", $app_strings); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("MODULE", $relatedmodule); // We do not have RelatedListView in Detail View mode of Calendar module. So need to skip it. if ($module != 'Calendar') { $focus->initSortByField($relatedmodule); } // Append security parameter if ($relatedmodule != 'Users') { global $current_user; $secQuery = getNonAdminAccessControlQuery($relatedmodule, $current_user); if (strlen($secQuery) > 1) { $query = appendFromClauseToQuery($query, $secQuery); } } if ($relatedmodule == 'Leads') { $query .= " AND vtiger_leaddetails.converted = 0"; } if (isset($where) && $where != '') { $query .= ' and ' . $where; } if (!$_SESSION['rlvs'][$module][$relatedmodule]) { $modObj = new ListViewSession(); $modObj->sortby = $focus->default_order_by; $modObj->sorder = $focus->default_sort_order; $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj); } if (!empty($_REQUEST['order_by'])) { if (method_exists($focus, getSortOrder)) { $sorder = $focus->getSortOrder(); } if (method_exists($focus, getOrderBy)) { $order_by = $focus->getOrderBy(); } if (isset($order_by) && $order_by != '') { $_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder; $_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by; } } elseif ($_SESSION['rlvs'][$module][$relatedmodule]) { $sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder']; $order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby']; } else { $order_by = $focus->default_order_by; $sorder = $focus->default_sort_order; } // AssignedTo ordering issue in Related Lists $query_order_by = $order_by; if ($order_by == 'smownerid') { $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); $query_order_by = "case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end "; } elseif ($order_by != 'crmid' && !empty($order_by)) { $tabname = getTableNameForField($relatedmodule, $order_by); if ($tabname !== '' and $tabname != NULL) { $query_order_by = $tabname . "." . $query_order_by; } } if (!empty($query_order_by)) { $query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder; } if ($relatedmodule == 'Calendar') { $mod_listquery = "activity_listquery"; } else { $mod_listquery = strtolower($relatedmodule) . "_listquery"; } $_SESSION[$mod_listquery] = $query; $url_qry = "&order_by=" . $order_by . "&sorder=" . $sorder; $computeCount = isset($_REQUEST['withCount']) ? $_REQUEST['withCount'] : ''; if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) { // Retreiving the no of rows list($specialPermissionWithDuplicateRows, $cached) = VTCacheUtils::lookupCachedInformation('SpecialPermissionWithDuplicateRows'); if (FALSE and ($specialPermissionWithDuplicateRows or $relatedmodule == 'Calendar')) { // FIXME FIXME FIXME FIXME // the FALSE above MUST be eliminated, we need to execute mkCountWithFullQuery for modified queries // the problem is that related list queries are hardcoded and can (mostly do) repeat columns which is not supported as a // subquery which is what mkCountWithFullQuery does // This works on ListView because we use query generator that eliminates those repeated columns // It is currently incorrect and will produce wrong count on related lists when special permissions are active // FIXME FIXME FIXME FIXME // for calendar (with multiple contacts for single activity) and special permissions, count will change $count_result = $adb->query(mkCountWithFullQuery($query)); } else { $count_result = $adb->query(mkCountQuery($query)); } $noofrows = $adb->query_result($count_result, 0, 'count'); } else { $noofrows = null; } //Setting Listview session object while sorting/pagination if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) { $relmodule = vtlib_purify($_REQUEST['relmodule']); if ($_SESSION['rlvs'][$module][$relmodule]) { setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule); } } global $relationId; $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query); $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows); $limit_start_rec = ($start - 1) * $list_max_entries_per_page; $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array()); /* Save the related list in session for when we click in a register * from this list we will can navigate with the arrows left and right, to move only in this related list */ $relcv = new CustomView(); $relviewId = $relcv->getViewId($relatedmodule); ListViewSession::setSessionQuery($relatedmodule, $query, $relviewId); $_SESSION['lvs'][$relatedmodule][$relviewId]['start'] = $start; //Retreive the List View Table Header $id = vtlib_purify($_REQUEST['record']); $listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module, $skipActions); //"Accounts"); if ($noofrows > 15) { $smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">'); $smarty->assign('SCROLLSTOP', '</div>'); } $smarty->assign("LISTHEADER", $listview_header); if ($module == 'PriceBook' && $relatedmodule == 'Products') { $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions); } if ($module == 'Products' && $relatedmodule == 'PriceBooks') { $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel', '', '', '', '', $skipActions); } elseif ($relatedmodule == 'SalesOrder') { $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder', '', '', '', '', $skipActions); } else { $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions); } $navigationOutput = array(); $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows); if (empty($id) && !empty($_REQUEST['record'])) { $id = vtlib_purify($_REQUEST['record']); } $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $relatedmodule, $id); $related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput); $log->debug("Exiting GetRelatedList method ..."); return $related_entries; }
/** This function returns the conversion rate and vtiger_currency symbol * in array format for a given id. * param $id - vtiger_currency id. */ function getCurrencySymbolandCRate($id) { global $log; $log->debug("Entering getCurrencySymbolandCRate(" . $id . ") method ..."); // To initialize the currency information in cache getCurrencyName($id); $currencyinfo = VTCacheUtils::lookupCurrencyInfo($id); $rate_symbol['rate'] = $currencyinfo['rate']; $rate_symbol['symbol'] = $currencyinfo['symbol']; $log->debug("Exiting getCurrencySymbolandCRate method ..."); return $rate_symbol; }
$parentRoleList = $adb->query_result($result, 0, 'parentrole'); $replace_with = $parentRoleList; $orgDepth = $adb->query_result($result, 0, 'depth'); //echo 'replace with is '.$replace_with; //echo '<BR>org depth '.$orgDepth; $parentRoles = explode('::', $parentRoleList); if (in_array($fromid, $parentRoles)) { echo $mod_strings['ROLE_DRAG_ERR_MSG']; die; } $roleInfo = getRoleAndSubordinatesInformation($fromid); $fromRoleInfo = $roleInfo[$fromid]; $replaceToStringArr = explode('::' . $fromid, $fromRoleInfo[1]); $replaceToString = $replaceToStringArr[0]; //echo '<BR>to be replaced string '.$replaceToString; $stdDepth = $fromRoleInfo['2']; //echo '<BR> std depth '.$stdDepth; //Constructing the query foreach ($roleInfo as $mvRoleId => $mvRoleInfo) { $subPar = explode($replaceToString, $mvRoleInfo[1], 2); //we have to spilit as two elements only $mvParString = $replace_with . $subPar[1]; $subDepth = $mvRoleInfo[2]; $mvDepth = $orgDepth + ($subDepth - $stdDepth + 1); $query = "update vtiger_role set parentrole=?,depth=? where roleid=?"; //echo $query; $adb->pquery($query, array($mvParString, $mvDepth, $mvRoleId)); // Invalidate any cached information VTCacheUtils::clearRoleSubordinates($roleId); } header("Location: index.php?action=SettingsAjax&module=Settings&file=listroles&ajax=true");
protected function generateEntityModel($entity, $module, $prefix, $model) { // Get only active field information $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if (isset($this->focus->column_fields['currency_id'])) { $currencyInfo = getCurrencyInfo($this->focus->column_fields['currency_id']); $currency = $currencyInfo['code']; } else { $currency = 'RUB'; } if ($cachedModuleFields) { foreach ($cachedModuleFields as $fieldname => $fieldinfo) { $fieldname = $fieldinfo['fieldname']; $type = explode('~', $fieldinfo['typeofdata']); $uitype = $fieldinfo['uitype']; if ($uitype == 10 && !empty($entity->column_fields[$fieldname])) { $entityid = $entity->column_fields[$fieldname]; $entityType = getSalesEntityType($entityid); $recordName = array_values(getEntityName($entityType, $entityid)); $recordName = $recordName[0]; $model->set($prefix . $fieldname, $recordName); } else { if ($uitype == 117) { $currencyInfo = getCurrencyInfo($entity->column_fields[$fieldname]); $model->set($prefix . $fieldname, getTranslatedString($currencyInfo['name'], $module)); } else { switch ($type[0]) { case 'N': case 'NN': $model->set($prefix . $fieldname, $this->formatPrice($entity->column_fields[$fieldname])); $model->set($prefix . $fieldname . '_literal', $this->num2str($entity->column_fields[$fieldname], false, $currency)); $model->set(strtoupper($prefix) . strtoupper(str_replace(" ", "", $fieldinfo['fieldlabel'])) . '_LITERAL', $model->get($prefix . $fieldname . '_literal')); $model->set(getTranslatedString(strtoupper($prefix), $module) . str_replace(" ", "", getTranslatedString($fieldinfo['fieldlabel'], $module)) . getTranslatedString('_literal'), $model->get($prefix . $fieldname . '_literal')); break; case 'D': $model->set($prefix . $fieldname, $this->literalDate($entity->column_fields[$fieldname])); $model->set($prefix . $fieldname . '_short', $this->shortDate($entity->column_fields[$fieldname])); $model->set($prefix . $fieldname . '_mmyyyy', $this->mmyyyyDate($entity->column_fields[$fieldname])); $model->set(strtoupper($prefix) . strtoupper(str_replace(" ", "", $fieldinfo['fieldlabel'])) . '_SHORT', $model->get($prefix . $fieldname . '_short')); $model->set(getTranslatedString(strtoupper($prefix), $module) . str_replace(" ", "", getTranslatedString($fieldinfo['fieldlabel'], $module)) . getTranslatedString('_short'), $model->get($prefix . $fieldname . '_short')); break; case 'C': if ($entity->column_fields[$fieldname] == 0) { $model->set($prefix . $fieldname, 'Нет'); } else { $model->set($prefix . $fieldname, 'Да'); } break; case 'V': $model->set($prefix . $fieldname, nl2br($entity->column_fields[$fieldname])); $model->set($prefix . $fieldname . '_translated', nl2br(getTranslatedString($entity->column_fields[$fieldname], $module))); break; default: $model->set($prefix . $fieldname, $entity->column_fields[$fieldname]); break; } } } // Add human-readable variables $model->set(strtoupper($prefix) . strtoupper(str_replace(" ", "", $fieldinfo['fieldlabel'])), $model->get($prefix . $fieldname)); $model->set(getTranslatedString(strtoupper($prefix), $module) . str_replace(" ", "", getTranslatedString($fieldinfo['fieldlabel'], $module)), $model->get($prefix . $fieldname)); } } }
function getFieldRelatedInfo($tabId, $fieldName) { $fieldInfo = VTCacheUtils::lookupFieldInfo($tabId, $fieldName); if ($fieldInfo === false) { getColumnFields(getTabModuleName($tabid)); $fieldInfo = VTCacheUtils::lookupFieldInfo($tabId, $fieldName); } return $fieldInfo; }
/** * Fetch module active information at one shot, but return all the information fetched. */ function vtlib_prefetchModuleActiveInfo($force = true) { global $__cache_module_activeinfo; // Look up if cache has information $tabrows = VTCacheUtils::lookupAllTabsInfo(); // Initialize from DB if cache information is not available or force flag is set if ($tabrows === false || $force) { global $adb; $tabres = $adb->query("SELECT * FROM vtiger_tab"); $tabrows = array(); if ($tabres) { while ($tabresrow = $adb->fetch_array($tabres)) { $tabrows[] = $tabresrow; $__cache_module_activeinfo[$tabresrow['name']] = $tabresrow['presence']; } // Update cache for further re-use VTCacheUtils::updateAllTabsInfo($tabrows); } } return $tabrows; }
function initListOfModules() { global $adb, $current_user, $old_related_modules; $restricted_modules = array('Events'); $restricted_blocks = array('LBL_COMMENTS', 'LBL_COMMENT_INFORMATION'); $this->module_id = array(); $this->module_list = array(); // Prefetch module info to check active or not and also get list of tabs $modulerows = vtlib_prefetchModuleActiveInfo(false); $cachedInfo = VTCacheUtils::lookupReport_ListofModuleInfos(); if ($cachedInfo !== false) { $this->module_list = $cachedInfo['module_list']; $this->related_modules = $cachedInfo['related_modules']; } else { if ($modulerows) { foreach ($modulerows as $resultrow) { if ($resultrow['presence'] == '1') { continue; } // skip disabled modules if ($resultrow['isentitytype'] != '1') { continue; } // skip extension modules if (in_array($resultrow['name'], $restricted_modules)) { // skip restricted modules continue; } if ($resultrow['name'] != 'Calendar') { $this->module_id[$resultrow['tabid']] = $resultrow['name']; } else { $this->module_id[9] = $resultrow['name']; $this->module_id[16] = $resultrow['name']; } $this->module_list[$resultrow['name']] = array(); } $moduleids = array_keys($this->module_id); $reportblocks = $adb->pquery("SELECT blockid, blocklabel, tabid FROM vtiger_blocks WHERE tabid IN (" . generateQuestionMarks($moduleids) . ")", array($moduleids)); $prev_block_label = ''; if ($adb->num_rows($reportblocks)) { while ($resultrow = $adb->fetch_array($reportblocks)) { $blockid = $resultrow['blockid']; $blocklabel = $resultrow['blocklabel']; $module = $this->module_id[$resultrow['tabid']]; if (in_array($blocklabel, $restricted_blocks) || in_array($blockid, $this->module_list[$module]) || isset($this->module_list[$module][getTranslatedString($blocklabel, $module)])) { continue; } if (!empty($blocklabel)) { if ($module == 'Calendar' && $blocklabel == 'LBL_CUSTOM_INFORMATION') { $this->module_list[$module][$blockid] = getTranslatedString($blocklabel, $module); } else { $this->module_list[$module][$blockid] = getTranslatedString($blocklabel, $module); } $prev_block_label = $blocklabel; } else { $this->module_list[$module][$blockid] = getTranslatedString($prev_block_label, $module); } } } $relatedmodules = $adb->pquery("SELECT vtiger_tab.name, vtiger_relatedlists.tabid FROM vtiger_tab\n\t\t\t\t\tINNER JOIN vtiger_relatedlists on vtiger_tab.tabid=vtiger_relatedlists.related_tabid\n\t\t\t\t\tWHERE vtiger_tab.isentitytype=1\n\t\t\t\t\tAND vtiger_tab.name NOT IN(" . generateQuestionMarks($restricted_modules) . ")\n\t\t\t\t\tAND vtiger_tab.presence = 0 AND vtiger_relatedlists.label!='Activity History'\n\t\t\t\t\tUNION\n\t\t\t\t\tSELECT module, vtiger_tab.tabid FROM vtiger_fieldmodulerel\n\t\t\t\t\tINNER JOIN vtiger_tab on vtiger_tab.name = vtiger_fieldmodulerel.relmodule\n\t\t\t\t\tWHERE vtiger_tab.isentitytype = 1\n\t\t\t\t\tAND vtiger_tab.name NOT IN(" . generateQuestionMarks($restricted_modules) . ")\n\t\t\t\t\tAND vtiger_tab.presence = 0", array($restricted_modules, $restricted_modules)); if ($adb->num_rows($relatedmodules)) { while ($resultrow = $adb->fetch_array($relatedmodules)) { $module = $this->module_id[$resultrow['tabid']]; if (!isset($this->related_modules[$module])) { $this->related_modules[$module] = array(); } if ($module != $resultrow['name']) { $this->related_modules[$module][] = $resultrow['name']; } // To achieve Backward Compatability with Report relations if (isset($old_related_modules[$module])) { $rel_mod = array(); foreach ($old_related_modules[$module] as $key => $name) { if (vtlib_isModuleActive($name) && isPermitted($name, 'index', '')) { $rel_mod[] = $name; } } if (!empty($rel_mod)) { $this->related_modules[$module] = array_merge($this->related_modules[$module], $rel_mod); $this->related_modules[$module] = array_unique($this->related_modules[$module]); } } } } foreach ($this->related_modules as $module => $related_modules) { if ($module == 'Emails') { $this->related_modules[$module] = getEmailRelatedModules(); } } // Put the information in cache for re-use VTCacheUtils::updateReport_ListofModuleInfos($this->module_list, $this->related_modules); } } }
public static function setOutgoingMailFromEmailAddress($email) { self::$_outgoingMailFromEmailAddress = $email; }
/** * Filter in-active fields based on type * * @param String $module */ function filterInactiveFields($module) { if ($this->__inactive_fields_filtered) { return; } global $adb, $mod_strings; // Look for fields that has presence value NOT IN (0,2) $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module, array('1')); if ($cachedModuleFields === false) { // Initialize the fields calling suitable API getColumnFields($module); $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module, array('1')); } $hiddenFields = array(); if ($cachedModuleFields) { foreach ($cachedModuleFields as $fieldinfo) { $fieldLabel = $fieldinfo['fieldlabel']; // NOTE: We should not translate the label to enable field diff based on it down $fieldName = $fieldinfo['fieldname']; $tableName = str_replace("vtiger_", "", $fieldinfo['tablename']); $hiddenFields[$fieldLabel] = array($tableName => $fieldName); } } if (isset($this->list_fields)) { $this->list_fields = array_diff_assoc($this->list_fields, $hiddenFields); } if (isset($this->search_fields)) { $this->search_fields = array_diff_assoc($this->search_fields, $hiddenFields); } // To avoid re-initializing everytime. $this->__inactive_fields_filtered = true; }
/** Function to check permission to access the column for a given user * @param $userid -- User Id :: Type integer * @param $tablename -- tablename :: Type String * @param $columnname -- columnname :: Type String * @param $module -- Module Name :: Type varchar */ function getColumnVisibilityPermission($userid, $columnname, $module, $accessmode = 'readonly') { $adb = PearDatabase::getInstance(); $log = vglobal('log'); $log->debug("in function getcolumnvisibilitypermission {$columnname} -{$userid}"); $tabid = getTabid($module); // Look at cache if information is available. $cacheFieldInfo = VTCacheUtils::lookupFieldInfoByColumn($tabid, $columnname); $fieldname = false; if ($cacheFieldInfo === false) { $res = $adb->pquery("select fieldname from vtiger_field where tabid=? and columnname=? and vtiger_field.presence in (0,2)", array($tabid, $columnname)); $fieldname = $adb->query_result($res, 0, 'fieldname'); } else { $fieldname = $cacheFieldInfo['fieldname']; } return getFieldVisibilityPermission($module, $userid, $fieldname, $accessmode); }
static function updateReport_ListofModuleInfos($module_list, $related_modules) { if (self::$_report_listofmodules_cache === false) { self::$_report_listofmodules_cache = array('module_list' => $module_list, 'related_modules' => $related_modules); } }
/** END * */ function buildSearchQueryForFieldTypes($uitypes, $value = false) { global $adb; if (!is_array($uitypes)) { $uitypes = array($uitypes); } $module = get_class($this); $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); if ($cachedModuleFields === false) { getColumnFields($module); // This API will initialize the cache as well // We will succeed now due to above function call $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module); } $lookuptables = array(); $lookupcolumns = array(); foreach ($cachedModuleFields as $fieldinfo) { if (in_array($fieldinfo['uitype'], $uitypes)) { $lookuptables[] = $fieldinfo['tablename']; $lookupcolumns[] = $fieldinfo['columnname']; } } $entityfields = getEntityField($module); $querycolumnnames = implode(',', $lookupcolumns); $entitycolumnnames = $entityfields['fieldname']; $query = "select crmid as id, {$querycolumnnames}, {$entitycolumnnames} as name "; $query .= " FROM {$this->table_name} "; $query .= " INNER JOIN vtiger_crmentity ON {$this->table_name}.{$this->table_index} = vtiger_crmentity.crmid AND deleted = 0 "; //remove the base table $LookupTable = array_unique($lookuptables); $indexes = array_keys($LookupTable, $this->table_name); if (!empty($indexes)) { foreach ($indexes as $index) { unset($LookupTable[$index]); } } foreach ($LookupTable as $tablename) { $query .= " INNER JOIN {$tablename}\n\t\t\t\t\t\ton {$this->table_name}.{$this->table_index} = {$tablename}." . $this->tab_name_index[$tablename]; } if (!empty($lookupcolumns) && $value !== false) { $query .= " WHERE "; $i = 0; $columnCount = count($lookupcolumns); foreach ($lookupcolumns as $columnname) { if (!empty($columnname)) { if ($i == 0 || $i == $columnCount) { $query .= sprintf("%s = '%s'", $columnname, $value); } else { $query .= sprintf(" OR %s = '%s'", $columnname, $value); } $i++; } } } return $query; }
$focus->id = ''; $focus->mode = ''; } $focus->preEditCheck($_REQUEST, $smarty); if (!empty($_REQUEST['save_error']) and $_REQUEST['save_error'] == "true") { if (!empty($_REQUEST['encode_val'])) { global $current_user; $encode_val = vtlib_purify($_REQUEST['encode_val']); $decode_val = base64_decode($encode_val); $explode_decode_val = explode('&', trim($decode_val, '&')); $tabid = getTabid($currentModule); foreach ($explode_decode_val as $fieldvalue) { $value = explode("=", $fieldvalue); $field_name_val = $value[0]; $field_value = urldecode($value[1]); $finfo = VTCacheUtils::lookupFieldInfo($tabid, $field_name_val); if ($finfo !== false) { if ($finfo['uitype'] == '56') { $field_value = $field_value == 'on' ? '1' : '0'; } if ($finfo['uitype'] == '71' or $finfo['uitype'] == '72') { $currencyField = new CurrencyField($field_value); $field_value = CurrencyField::convertToDBFormat($field_value, $current_user); } if ($finfo['uitype'] == '33' or $finfo['uitype'] == '3313') { if (is_array($field_value)) { $field_value = implode(' |##| ', $field_value); } } } $focus->column_fields[$field_name_val] = $field_value;
/** Function to return block name * @param Integer -- $blockid * @return String - Block Name */ function getBlockName($blockid) { global $adb; $blockname = VTCacheUtils::lookupBlockLabelWithId($blockid); if (!empty($blockid) && $blockname === false) { $block_res = $adb->pquery('SELECT blocklabel FROM vtiger_blocks WHERE blockid = ?', array($blockid)); if ($adb->num_rows($block_res)) { $blockname = $adb->query_result($block_res, 0, 'blocklabel'); } else { $blockname = ''; } VTCacheUtils::updateBlockLabelWithId($blockname, $blockid); } return $blockname; }
/** * * @param String $module - module name for which query needs to be generated. * @param Users $user - user for which query needs to be generated. * @return String Access control Query for the user. */ function getNonAdminAccessControlQuery($module, $user, $scope = '') { require 'user_privileges/user_privileges_' . $user->id . '.php'; require 'user_privileges/sharing_privileges_' . $user->id . '.php'; $query = ' '; $tabId = getTabid($module); if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[$tabId] == 3) { $tableName = 'vt_tmp_u' . $user->id; $sharingRuleInfoVariable = $module . '_share_read_permission'; $sharingRuleInfo = ${$sharingRuleInfoVariable}; $sharedTabId = null; if (!empty($sharingRuleInfo) && (count($sharingRuleInfo['ROLE']) > 0 || count($sharingRuleInfo['GROUP']) > 0)) { $tableName = $tableName . '_t' . $tabId; $sharedTabId = $tabId; } elseif ($module == 'Calendar' || !empty($scope)) { $tableName .= '_t' . $tabId; } list($tsSpecialAccessQuery, $typeOfPermissionOverride, $unused1, $unused2) = cbEventHandler::do_filter('corebos.permissions.accessquery', array(' ', 'none', $module, $user)); if ($typeOfPermissionOverride == 'fullOverride') { // create the default temporary table in case it is needed $this->setupTemporaryTable($tableName, $sharedTabId, $user, $current_user_parent_role_seq, $current_user_groups); VTCacheUtils::updateCachedInformation('SpecialPermissionWithDuplicateRows', true); return $tsSpecialAccessQuery; } if ($typeOfPermissionOverride == 'none' or trim($tsSpecialAccessQuery) == '') { $this->setupTemporaryTable($tableName, $sharedTabId, $user, $current_user_parent_role_seq, $current_user_groups); $query = " INNER JOIN {$tableName} {$tableName}{$scope} ON {$tableName}{$scope}.id = vtiger_crmentity{$scope}.smownerid "; } else { global $adb; VTCacheUtils::updateCachedInformation('SpecialPermissionWithDuplicateRows', true); $tsTableName = "tsolucio_tmp_u{$user->id}"; $adb->query("drop table if exists {$tsTableName}"); if ($typeOfPermissionOverride == 'addToUserPermission') { $query = $this->getNonAdminAccessQuery($module, $user, $current_user_parent_role_seq, $current_user_groups); $tsSpecialAccessQuery = "{$query} UNION ({$tsSpecialAccessQuery}) "; } $adb->query("create temporary table {$tsTableName} (id int primary key) as {$tsSpecialAccessQuery}"); if ($typeOfPermissionOverride == 'addToUserPermission') { $query = " INNER JOIN {$tsTableName} on ({$tsTableName}.id=vtiger_crmentity.crmid or {$tsTableName}.id = vtiger_crmentity{$scope}.smownerid) "; } else { // $typeOfPermissionOverride=='showTheseRecords' $query = " INNER JOIN {$tsTableName} on {$tsTableName}.id=vtiger_crmentity.crmid "; } } } return $query; }
public static function getVariable($var, $default, $module = '', $gvuserid = '') { global $adb, $current_user, $gvvalidationinfo, $currentModule; $gvvalidationinfo[] = "search for variable '{$var}' with default value of '{$default}'"; if (empty($module)) { $module = $currentModule; } if (empty($gvuserid)) { $gvuserid = $current_user->id; } $key = md5('gvcache' . $var . $module . $gvuserid); list($value, $found) = VTCacheUtils::lookupCachedInformation($key); if ($found) { $gvvalidationinfo[] = "variable found in cache"; return $value; } $value = ''; $list_of_modules = array(); $focus = CRMEntity::getInstance('GlobalVariable'); $select = 'SELECT * FROM vtiger_globalvariable INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_globalvariable.globalvariableid '; $where = ' where vtiger_crmentity.deleted=0 and gvname=? '; $mandatory = " and mandatory='1'"; $sql = $select . $where . $mandatory; $gvvalidationinfo[] = '---'; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as mandatory in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } if (!is_numeric($gvuserid) and $gvuserid > 0) { return $default; } $user = $adb->convert2Sql(' and vtiger_crmentity.smownerid=?', array($gvuserid)); $sql = $select . $where . $user; $gvvalidationinfo[] = '---'; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as set per user {$gvuserid} in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } $gvvalidationinfo[] = '---'; require_once 'include/utils/GetUserGroups.php'; $UserGroups = new GetUserGroups(); $UserGroups->getAllUserGroups($gvuserid); if (count($UserGroups->user_groups) > 0) { $groups = implode(',', $UserGroups->user_groups); $group = ' and vtiger_crmentity.smownerid in (' . $groups . ') '; $sql = $select . $where . $group; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as set per group {$groups} in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } } else { $gvvalidationinfo[] = 'no groups to search in'; } $sql = $select . $where . " and default_check='1'"; $gvvalidationinfo[] = '---'; $value = $focus->return_global_var_value($sql, $var, $module); $gvvalidationinfo[] = "search as default variable in module {$module}: {$value}"; if ($value != '') { VTCacheUtils::updateCachedInformation($key, $value); return $value; } $gvvalidationinfo[] = '---'; $gvvalidationinfo[] = "return default value give: {$default}"; return $default; }
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(); }