本文整理汇总了PHP中createUserSharingPrivilegesfile函数的典型用法代码示例。如果您正苦于以下问题:PHP createUserSharingPrivilegesfile函数的具体用法?PHP createUserSharingPrivilegesfile怎么用?PHP createUserSharingPrivilegesfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createUserSharingPrivilegesfile函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$adb = \PearDatabase::getInstance();
switch ($request->get('option')) {
case 'recreateUserPrivilegs':
$sql = 'SELECT id FROM vtiger_users WHERE status = "Active"';
$result = $adb->query($sql);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
while ($row = $adb->fetchByAssoc($result)) {
createUserPrivilegesfile($row['id']);
createUserSharingPrivilegesfile($row['id']);
ini_set('display_errors', 1);
global $root_directory;
require_once $root_directory . 'user_privileges/user_privileges_' . $row['id'] . '.php';
require_once $root_directory . 'user_privileges/sharing_privileges_' . $row['id'] . '.php';
}
break;
case 'enableModComments':
$commentsModuleModel = Vtiger_Module_Model::getInstance('ModComments');
if ($commentsModuleModel && $commentsModuleModel->isActive()) {
$relatedToFieldResult = $adb->pquery('SELECT fieldid FROM vtiger_field WHERE fieldname = ? AND tabid = ?', array('related_to', $commentsModuleModel->getId()));
$fieldId = $adb->query_result($relatedToFieldResult, 0, 'fieldid');
$sql = 'SELECT * FROM vtiger_tab WHERE (isentitytype = 1 AND presence = 0) OR name = "Events"';
$result = $adb->query($sql);
while ($row = $adb->fetchByAssoc($result)) {
$sql = 'SELECT fieldid FROM vtiger_fieldmodulerel WHERE fieldid = ? AND module = "ModComments" AND relmodule = ?';
$check = $adb->pquery($sql, array($fieldId, $row['name']));
if ($adb->num_rows($check) == 0) {
$sql = 'INSERT INTO vtiger_fieldmodulerel SET fieldid = ?, module = "ModComments", relmodule = ?';
$adb->pquery($sql, array($fieldId, $row['name']));
}
}
}
break;
case 'initFilterSortOrder':
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_col', 'VARCHAR(255)');
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_dir', 'VARCHAR(4)');
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric_check', 'TINYINT');
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric', 'VARCHAR(10)');
$adb = PearDatabase::getInstance();
$em = new VTEventsManager($adb);
// Registering event for Recurring Invoices
$em->registerHandler('vtiger.filter.process.customview.editajax.view.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
$em->registerHandler('vtiger.process.customview.editajax.view.finish', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
$em->registerHandler('vtiger.filter.process.customview.save.action.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
$em->registerHandler('vtiger.filter.listview.orderby', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
break;
}
}
示例2: RecalculateSharingRules
/** Function to recalculate the Sharing Rules for all the vtiger_users
* This function will recalculate all the sharing rules for all the vtiger_users in the Organization and will write them in flat vtiger_files
*
*/
function RecalculateSharingRules()
{
$log = vglobal('log');
$log->debug("Entering RecalculateSharingRules() method ...");
$adb = PearDatabase::getInstance();
require_once 'modules/Users/CreateUserPrivilegeFile.php';
$query = "select id from vtiger_users where deleted=0";
$result = $adb->pquery($query, array());
$num_rows = $adb->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
$id = $adb->query_result($result, $i, 'id');
createUserPrivilegesfile($id);
createUserSharingPrivilegesfile($id);
}
$log->debug("Exiting RecalculateSharingRules method ...");
}
示例3: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
//Event triggering code
require_once "include/events/include.inc";
//In Bulk mode stop triggering events
if (!self::isBulkSaveMode()) {
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromCRMEntity($this);
$em->triggerEvent("vtiger.entity.beforesave.modifiable", $entityData);
$em->triggerEvent("vtiger.entity.beforesave", $entityData);
$em->triggerEvent("vtiger.entity.beforesave.final", $entityData);
}
if ($this->mode != 'edit') {
$sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
$result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
if ($adb->num_rows($result) > 0) {
Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
return false;
}
} else {
$query = 'SELECT `roleid` FROM `vtiger_user2role` WHERE `userid` = ? LIMIT 1;';
$oldRoleResult = $adb->pquery($query, [$this->id]);
$oldRole = $adb->query_result($oldRoleResult, 0, 'roleid');
if ($oldRole != $this->column_fields['roleid']) {
$query = 'DELETE FROM `vtiger_module_dashboard_widgets` WHERE `userid` = ?;';
$adb->pquery($query, [$this->id]);
}
}
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
if ($em) {
//Event triggering code
$em->triggerEvent("vtiger.entity.aftersave", $entityData);
$em->triggerEvent("vtiger.entity.aftersave.final", $entityData);
//Event triggering code ends
}
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if (isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例4: recalculateSharingRules
/**
* Function recalculate the sharing rules
*/
public static function recalculateSharingRules()
{
set_time_limit(vglobal('php_max_execution_time'));
$db = PearDatabase::getInstance();
require_once 'modules/Users/CreateUserPrivilegeFile.php';
$result = $db->pquery('SELECT id FROM vtiger_users WHERE deleted = ?', array(0));
$numOfRows = $db->num_rows($result);
for ($i = 0; $i < $numOfRows; $i++) {
createUserSharingPrivilegesfile($db->query_result($result, $i, 'id'));
}
}
示例5: delete
/**
* Function to delete the role
* @param <Settings_Roles_Record_Model> $transferToRole
*/
public function delete($transferToRole)
{
$db = PearDatabase::getInstance();
$roleId = $this->getId();
$transferRoleId = $transferToRole->getId();
$db->pquery('UPDATE vtiger_user2role SET roleid=? WHERE roleid=?', array($transferRoleId, $roleId));
$db->pquery('DELETE FROM vtiger_role2profile WHERE roleid=?', array($roleId));
$db->pquery('DELETE FROM vtiger_group2role WHERE roleid=?', array($roleId));
$db->pquery('DELETE FROM vtiger_group2rs WHERE roleandsubid=?', array($roleId));
/*
$noOfUsers = $db->num_rows($user_result);
$array_users = array();
if($noOfUsers > 0) {
for($i=0; $i<$noOfUsers; ++$i) {
$array_users[] = $db->query_result($user_result, $i, 'userid');
}
}
*/
//delete handling for sharing rules
deleteRoleRelatedSharingRules($roleId);
$db->pquery('DELETE FROM vtiger_role WHERE roleid=?', array($roleId));
$allChildren = $this->getAllChildren();
$transferParentRoleSequence = $transferToRole->getParentRoleString();
$currentParentRoleSequence = $this->getParentRoleString();
foreach ($allChildren as $roleId => $roleModel) {
$oldChildParentRoleString = $roleModel->getParentRoleString();
$newChildParentRoleString = str_replace($currentParentRoleSequence, $transferParentRoleSequence, $oldChildParentRoleString);
$newChildDepth = count(explode('::', $newChildParentRoleString)) - 1;
$roleModel->set('depth', $newChildDepth);
$roleModel->set('parentrole', $newChildParentRoleString);
$roleModel->save();
}
if (is_array($array_users)) {
require_once 'modules/Users/CreateUserPrivilegeFile.php';
foreach ($array_users as $userid) {
createUserPrivilegesfile($userid);
createUserSharingPrivilegesfile($userid);
}
}
}
示例6: updateUsers2GroupMapping
}
if (isset($_POST['group_name']) && $_POST['group_name'] != '') {
updateUsers2GroupMapping($_POST['group_name'], $focus->id);
}
} else {
if (isset($_POST['user_role'])) {
insertUser2RoleMapping($_POST['user_role'], $focus->id);
}
if (isset($_POST['group_name'])) {
insertUsers2GroupMapping($_POST['group_name'], $focus->id);
}
}
//Creating the Privileges Flat File
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($focus->id);
createUserSharingPrivilegesfile($focus->id);
}
if (isset($_POST['return_module']) && $_POST['return_module'] != "") {
$return_module = vtlib_purify($_REQUEST['return_module']);
} else {
$return_module = "Users";
}
if (isset($_POST['return_action']) && $_POST['return_action'] != "") {
$return_action = vtlib_purify($_REQUEST['return_action']);
} else {
$return_action = "DetailView";
}
if (isset($_POST['return_id']) && $_POST['return_id'] != "") {
$return_id = vtlib_purify($_REQUEST['return_id']);
}
if (isset($_REQUEST['activity_mode'])) {
示例7: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*/
function save($module_name, $fileid = '')
{
global $log, $adb, $current_user;
if (!is_admin($current_user) and $current_user->id != $this->id) {
// only admin users can change other users profile
return false;
}
$userrs = $adb->pquery('select roleid from vtiger_user2role where userid = ?', array($this->id));
$oldrole = $adb->query_result($userrs, 0, 0);
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if (isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
}
require_once 'modules/Users/CreateUserPrivilegeFile.php';
//createUserPrivilegesfile($this->id); // done in saveentity above
if ($this->mode != 'edit' or $oldrole != $this->column_fields['roleid']) {
createUserSharingPrivilegesfile($this->id);
}
}
示例8: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name) {
global $log, $adb;
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?",
array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval,0,'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if(isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'],$this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once('modules/Users/CreateUserPrivilegeFile.php');
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例9: create_default_users_access
//.........这里部分代码省略.........
$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 = "admin@vtigeruser.com";
}
$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();
}
示例10: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
if ($this->mode != 'edit') {
$sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
$result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
if ($adb->num_rows($result) > 0) {
Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
return false;
}
}
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if (isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例11: vtlib_purify
<?php
/*************************************************************************************************
* Copyright 2016 JPL TSolucio, S.L. -- This file is a part of TSOLUCIO coreBOS Customizations.
* Licensed under the vtiger CRM Public License Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You can redistribute it and/or modify it
* under the terms of the License. JPL TSolucio, S.L. reserves all rights not expressly
* granted by the License. coreBOS distributed by JPL TSolucio S.L. is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Unless required by
* applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT ANY WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing
* permissions and limitations under the License. You may obtain a copy of the License
* at <http://corebos.org/documentation/doku.php?id=en:devel:vpl11>
*************************************************************************************************
* Author : JPL TSolucio, S. L.
*************************************************************************************************/
include 'modules/Users/CreateUserPrivilegeFile.php';
$record = vtlib_purify($_REQUEST['record']);
if (!empty($record)) {
createUserPrivilegesfile($record);
createUserSharingPrivilegesfile($record);
}
header("Location: index.php?action=DetailView&module=Users&record=" . $record);
示例12: createDefaultUsersAccess
//.........这里部分代码省略.........
//Import Export BusinessCar Not Allowed.
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",8,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,9,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,10,0)", array());
// Invalidate any cached information
VTCacheUtils::clearRoleSubordinates();
$adminPassword = $_SESSION['config_file_info']['password'];
$userDateFormat = $_SESSION['config_file_info']['dateformat'];
$userTimeZone = $_SESSION['config_file_info']['timezone'];
//Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
$userFirstName = $_SESSION['config_file_info']['firstname'];
$userLastName = $_SESSION['config_file_info']['lastname'];
// create default admin user
$user = CRMEntity::getInstance('Users');
//Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
$user->column_fields["first_name"] = $userFirstName;
$user->column_fields["last_name"] = $userLastName;
//Ends
$user->column_fields["user_name"] = 'admin';
$user->column_fields["status"] = 'Active';
$user->column_fields["is_admin"] = 'on';
$user->column_fields["user_password"] = $adminPassword;
$user->column_fields["time_zone"] = $userTimeZone;
$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
$user->column_fields["weekstart"] = '1';
$user->column_fields["namedays"] = '';
$user->column_fields["currency_id"] = 1;
$user->column_fields["reminder_interval"] = '1 Minute';
$user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
$user->column_fields["date_format"] = $userDateFormat;
$user->column_fields["hour_format"] = 'am/pm';
$user->column_fields["start_hour"] = '08:00';
$user->column_fields["end_hour"] = '23:00';
$user->column_fields["imagename"] = '';
$user->column_fields["internal_mailer"] = '1';
$user->column_fields["activity_view"] = 'This Week';
$user->column_fields["lead_view"] = 'Today';
$adminEmail = $_SESSION['config_file_info']['admin_email'];
if ($adminEmail == '') {
$adminEmail = "admin@vtigeruser.com";
}
$user->column_fields["email1"] = $adminEmail;
$roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='CEO'";
$adb->checkConnection();
$adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
$roleResult = $adb->pquery($roleQuery, array());
$roleId = $adb->query_result($roleResult, 0, "roleid");
$user->column_fields["roleid"] = $roleId;
$user->save("Users");
$adminUserId = $user->id;
//Inserting into vtiger_groups table
$groupId1 = $adb->getUniqueID("vtiger_users");
$groupId2 = $adb->getUniqueID("vtiger_users");
$groupId3 = $adb->getUniqueID("vtiger_users");
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId1 . "','Team Selling','Group Related to Sales')", array());
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId1 . "','H" . $roleId4 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId1 . "','H" . $roleId5 . "')", array());
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId2 . "','Marketing Group','Group Related to Marketing Activities')", array());
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId2 . "','H" . $roleId2 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId2 . "','H" . $roleId3 . "')", array());
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId3 . "','Support Group','Group Related to providing Support to Customers')", array());
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
// Setting user group relation for admin user
$adb->pquery("INSERT INTO vtiger_users2group VALUES (?,?)", array($groupId2, $adminUserId), array());
//Creating the flat files for admin user
createUserPrivilegesfile($adminUserId);
createUserSharingPrivilegesfile($adminUserId);
//INSERT INTO vtiger_profile2field
insertProfile2field($profileId1);
insertProfile2field($profileId2);
insertProfile2field($profileId3);
insertProfile2field($profileId4);
insert_def_org_field();
}
示例13: recalculateSharingRules
/**
* Function recalculate the sharing rules
*/
public static function recalculateSharingRules()
{
$phpMaxExecutionTime = vglobal('php_max_execution_time');
set_time_limit($phpMaxExecutionTime);
$db = PearDatabase::getInstance();
require_once 'modules/Users/CreateUserPrivilegeFile.php';
$result = $db->pquery('SELECT id FROM vtiger_users WHERE deleted = ?', [0]);
while (($id = $db->getSingleValue($result)) !== false) {
createUserSharingPrivilegesfile($id);
}
}
示例14: createDefaultUsersAccess
//.........这里部分代码省略.........
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,10,0)", array());
// Invalidate any cached information
VTCacheUtils::clearRoleSubordinates();
$adminPassword = $_SESSION['config_file_info']['password'];
$userDateFormat = $_SESSION['config_file_info']['dateformat'];
$userTimeZone = $_SESSION['config_file_info']['timezone'];
//Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
$userFirstName = $_SESSION['config_file_info']['firstname'];
$userLastName = $_SESSION['config_file_info']['lastname'];
// create default admin user
$user = CRMEntity::getInstance('Users');
// SalesPlatform.ru begin
$user->column_fields["last_name"] = 'Администратор';
//$user->column_fields["last_name"] = 'Administrator';
// SalesPlatform.ru end
$user->column_fields["user_name"] = 'admin';
$user->column_fields["status"] = 'Active';
$user->column_fields["is_admin"] = 'on';
$user->column_fields["user_password"] = $adminPassword;
$user->column_fields["time_zone"] = $userTimeZone;
// SalesPlatform.ru begin
$user->column_fields["holidays"] = 'ru,';
$user->column_fields["workdays"] = '1,2,3,4,5,6,0,';
//$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
//$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
// SalesPlatform.ru end
$user->column_fields["weekstart"] = '1';
$user->column_fields["namedays"] = '';
$user->column_fields["currency_id"] = 1;
$user->column_fields["reminder_interval"] = '1 Minute';
$user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
$user->column_fields["date_format"] = $userDateFormat;
// SalesPlatform.ru begin
$user->column_fields["hour_format"] = '24';
//$user->column_fields["hour_format"] = 'am/pm';
// SalesPlatform.ru end
$user->column_fields["start_hour"] = '08:00';
$user->column_fields["end_hour"] = '23:00';
$user->column_fields["imagename"] = '';
$user->column_fields["internal_mailer"] = '1';
$user->column_fields["activity_view"] = 'This Week';
$user->column_fields["lead_view"] = 'Today';
$adminEmail = $_SESSION['config_file_info']['admin_email'];
if ($adminEmail == '') {
$adminEmail = "admin@vtigeruser.com";
}
$user->column_fields["email1"] = $adminEmail;
// SalesPlatform.ru begin
$roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='Директор'";
//$roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='CEO'";
// SalesPlatform.ru end
$adb->checkConnection();
$adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
$roleResult = $adb->pquery($roleQuery, array());
$roleId = $adb->query_result($roleResult, 0, "roleid");
$user->column_fields["roleid"] = $roleId;
// SalesPlatform.ru begin: Add default currency formatting
$user->column_fields["currency_grouping_pattern"] = '123456789';
$user->column_fields["currency_decimal_separator"] = ",";
$user->column_fields["currency_grouping_separator"] = '\'';
$user->column_fields["currency_symbol_placement"] = '1.0$';
$user->column_fields["dayoftheweek"] = 'Monday';
// SalesPlatform.ru end
$user->save("Users");
$adminUserId = $user->id;
//Inserting into vtiger_groups table
$groupId1 = $adb->getUniqueID("vtiger_users");
$groupId2 = $adb->getUniqueID("vtiger_users");
$groupId3 = $adb->getUniqueID("vtiger_users");
// SalesPlatform.ru begin
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId1 . "','Отдел Продаж','Группа менеджеров по Продажам')", array());
//$adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId1."','Team Selling','Group Related to Sales')", array());
// SalesPlatform.ru end
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId1 . "','H" . $roleId4 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId1 . "','H" . $roleId5 . "')", array());
// SalesPlatform.ru begin
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId2 . "','Отдел Маркетинга','Группа менеджеров по Маркетингу')", array());
//$adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId2."','Marketing Group','Group Related to Marketing Activities')", array());
// SalesPlatform.ru end
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId2 . "','H" . $roleId2 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId2 . "','H" . $roleId3 . "')", array());
// SalesPlatform.ru begin
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId3 . "','Отдел Поддержки','Группа сервисной поддержки Клиентов')", array());
//$adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId3."','Support Group','Group Related to providing Support to Customers')", array());
// SalesPlatform.ru end
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
// Setting user group relation for admin user
$adb->pquery("INSERT INTO vtiger_users2group VALUES (?,?)", array($groupId2, $adminUserId), array());
//Creating the flat files for admin user
createUserPrivilegesfile($adminUserId);
createUserSharingPrivilegesfile($adminUserId);
//INSERT INTO vtiger_profile2field
insertProfile2field($profileId1);
insertProfile2field($profileId2);
insertProfile2field($profileId3);
insertProfile2field($profileId4);
insert_def_org_field();
}