Esempio n. 1
0
function print_welcome_block($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES;
    $id = "user_welcome";
    $title = $pgv_lang["welcome"] . " " . getUserFullName(PGV_USER_ID);
    $content = "<table class=\"blockcontent\" cellspacing=\"0\" cellpadding=\"0\" style=\" width: 100%; direction:ltr;\"><tr>";
    $content .= "<td class=\"tab_active_bottom\" colspan=\"3\" ></td></tr><tr>";
    if (get_user_setting(PGV_USER_ID, 'editaccount') == 'Y') {
        $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"edituser.php\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["mygedview"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["myuserdata"] . "\" title=\"" . $pgv_lang["myuserdata"] . "\" /><br />" . $pgv_lang["myuserdata"] . "</a></td>";
    }
    if (PGV_USER_GEDCOM_ID) {
        $content .= "<td class=\"center details2\" style=\" width: 34%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"" . encode_url("pedigree.php?rootid=" . PGV_USER_GEDCOM_ID) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["my_pedigree"] . "\" title=\"" . $pgv_lang["my_pedigree"] . "\" /><br />" . $pgv_lang["my_pedigree"] . "</a></td>";
        $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"" . encode_url("individual.php?pid=" . PGV_USER_GEDCOM_ID) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["indis"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["my_indi"] . "\" title=\"" . $pgv_lang["my_indi"] . "\" /><br />" . $pgv_lang["my_indi"] . "</a></td>";
    }
    $content .= "</tr><tr><td class=\"center\" colspan=\"3\">";
    $content .= print_help_link("mygedview_customize_help", "qm", "", false, true);
    $content .= "<a href=\"javascript:;\" onclick=\"window.open('" . encode_url("index_edit.php?name=" . PGV_USER_NAME . "&ctype=user") . "', '_blank', 'top=50,left=10,width=600,height=350,scrollbars=1,resizable=1');\">" . $pgv_lang["customize_page"] . "</a>";
    $content .= "<br />" . format_timestamp(client_time());
    $content .= "</td>";
    $content .= "</tr></table>";
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
Esempio n. 2
0
 function getSearchParams($stage, $assignedto, $dates)
 {
     $listSearchParams = array();
     $conditions = array();
     array_push($conditions, array("sales_stage", "e", $stage));
     if ($assignedto == '') {
         $currenUserModel = Users_Record_Model::getCurrentUserModel();
         $assignedto = $currenUserModel->getId();
     }
     if ($assignedto != 'all') {
         $ownerType = vtws_getOwnerType($assignedto);
         if ($ownerType == 'Users') {
             array_push($conditions, array("assigned_user_id", "e", getUserFullName($assignedto)));
         } else {
             $groupName = getGroupName($assignedto);
             $groupName = $groupName[0];
             array_push($conditions, array("assigned_user_id", "e", $groupName));
         }
     }
     if (!empty($dates)) {
         array_push($conditions, array("closingdate", "bw", $dates['start'] . ',' . $dates['end']));
     }
     $listSearchParams[] = $conditions;
     return '&search_params=' . json_encode($listSearchParams);
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'Potentials', 'potential_', $model);
         $entity = new Accounts();
         if ($this->focusColumnValue('related_to')) {
             $entity->retrieve_entity_info($this->focusColumnValue('related_to'), 'Accounts');
         }
         $this->generateEntityModel($entity, 'Accounts', 'account_', $model);
         $entity = new Contacts();
         if ($this->focusColumnValue('contact_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('contact_id'), 'Contacts');
         }
         $this->generateEntityModel($entity, 'Contacts', 'contact_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('potential_no', $this->focusColumnValue('potential_no'));
         $model->set('potential_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
Esempio n. 4
0
	function getModifiedByLabel() {
		global $current_user, $currentModule;
		if (isset($current_user) && $current_user->id == $this->whodid) {
			return getFullNameFromArray('Users', $current_user->column_fields);
		}
		return getUserFullName($this->whodid);
	}
Esempio n. 5
0
 function getSearchParams($value, $assignedto = '')
 {
     $listSearchParams = array();
     $conditions = array(array('ticketstatus', 'e', $value));
     if ($assignedto != '') {
         array_push($conditions, array('assigned_user_id', 'e', getUserFullName($assignedto)));
     }
     $listSearchParams[] = $conditions;
     return '&search_params=' . json_encode($listSearchParams);
 }
Esempio n. 6
0
function generateFormDataRow($moduleCompId, $userId, $columnList, $showProfileData = false)
{
    $display = array();
    $elementRow = array();
    $elementDataQuery = 'SELECT `form_elementdata`, `form_elementdesc`.`form_elementid`, `form_elementdesc`.`form_elementtype` FROM `form_elementdesc`, `form_elementdata` WHERE ' . "`form_elementdata`.`page_modulecomponentid` = '{$moduleCompId}' AND `user_id` = '{$userId}' AND " . '`form_elementdata`.`page_modulecomponentid` = `form_elementdesc`.`page_modulecomponentid` AND ' . '`form_elementdata`.`form_elementid` = `form_elementdesc`.`form_elementid` ' . 'ORDER BY `form_elementrank` ASC';
    $elementDataResult = mysql_query($elementDataQuery) or die($elementDataQuery . ' ' . mysql_error());
    while ($elementDataRow = mysql_fetch_row($elementDataResult)) {
        $elementRow['elementid_' . $elementDataRow[1]] = $elementDataRow[0];
        if ($elementDataRow[2] == 'file') {
            $elementRow['elementid_' . $elementDataRow[1]] = '<a href="./' . $elementDataRow[0] . '">' . $elementDataRow[0] . '</a>';
        }
    }
    if ($showProfileData) {
        if ($userId > 0) {
            $elementDataQuery = 'SELECT `form_elementdata`, `form_elementdesc`.`form_elementid`, `form_elementdesc`.`form_elementname`, `form_elementdesc`.`form_elementtype` FROM `form_elementdesc`, `form_elementdata` WHERE ' . "`form_elementdata`.`page_modulecomponentid` = 0 AND `user_id` = '{$userId}' AND " . "`form_elementdata`.`page_modulecomponentid` = `form_elementdesc`.`page_modulecomponentid` AND " . "`form_elementdata`.`form_elementid` = `form_elementdesc`.`form_elementid` ORDER BY `form_elementrank`";
            $elementDataResult = mysql_query($elementDataQuery) or die($elementDataQuery . '<br />' . mysql_error());
            while ($elementDataRow = mysql_fetch_assoc($elementDataResult)) {
                $elementRow['form0_' . $elementDataRow['form_elementname']] = $elementDataRow['form_elementdata'];
                if ($elementDataRow['form_elementtype'] == 'file') {
                    $elementRow['form0_' . $elementDataRow['form_elementname']] = '<a href="./' . $elementDataRow['form_elementdata'] . '">' . $elementDataRow['form_elementdata'] . '</a>';
                }
            }
        } else {
            $elementDataQuery = 'SELECT `form_elementname` FROM `form_elementdesc` WHERE `page_modulecomponentid` = 0';
            $elementDataResult = mysql_query($elementDataQuery);
            while ($elementDataRow = mysql_fetch_row($elementDataResult)) {
                $elementDataRow['form0_' . $elementDataRow['form_elementname']] = '&nbsp;';
            }
        }
    }
    if (in_array('useremail', $columnList)) {
        $elementRow['useremail'] = getUserEmail($userId);
    }
    if (in_array('username', $columnList)) {
        $elementRow['username'] = getUserName($userId);
    }
    if (in_array('userfullname', $columnList)) {
        $elementRow['userfullname'] = getUserFullName($userId);
    }
    if (in_array('lastupdated', $columnList)) {
        $elementRow['lastupdated'] = getLastUpdateDate($moduleCompId, $userId);
    }
    if (in_array('registrationdate', $columnList)) {
        $elementRow['registrationdate'] = getRegistrationDate($moduleCompId, $userId);
    }
    $columnCount = count($columnList);
    for ($i = 0; $i < count($columnList); $i++) {
        if (isset($elementRow[$columnList[$i]])) {
            $display[] = $elementRow[$columnList[$i]];
        } else {
            $display[] = ' ';
        }
    }
    return $display;
}
Esempio n. 7
0
    public function searchIncomingCalls(Vtiger_Request $request){
        $recordModel = PBXManager_Record_Model::getCleanInstance();
        $response = new Vtiger_Response();
        $user = Users_Record_Model::getCurrentUserModel();

        $recordModels = $recordModel->searchIncomingCall();
        // To check whether user have permission on caller record
        if($recordModels){
            foreach ($recordModels as $recordModel){
                // To check whether the user has permission to see contact name in popup
                $recordModel->set('callername', null);
                
                //SalesPlatform.ru begin incoming call for calling user
                if($user->id != $recordModel->get('user')) {
                    continue;
                }
                //SalesPlatform.ru end

                $callerid = $recordModel->get('customer');
                if($callerid){
                    $moduleName = $recordModel->get('customertype');

                    // SalesPlatform.ru begin
                    $callerRecordModel = Vtiger_Record_Model::getInstanceById($callerid, $moduleName);
                    $ownerId = $callerRecordModel->get('assigned_user_id');
                    $recordModel->set('ownername',getUserFullName($ownerId));
                    // SalesPlatform.ru end

                    if(!Users_Privileges_Model::isPermitted($moduleName, 'DetailView', $callerid)){
                        $name = $recordModel->get('customernumber').vtranslate('LBL_HIDDEN','PBXManager');
                        $recordModel->set('callername',$name);
                    }else{
                        $entityNames = getEntityName($moduleName, array($callerid));
                        $callerName = $entityNames[$callerid];
                        $recordModel->set('callername',$callerName);
                    }
                }
                // End
                $direction = $recordModel->get('direction');
                if($direction == 'inbound'){
                    $userid = $recordModel->get('user');
                    if($userid){
                        $entityNames = getEntityName('Users', array($userid));
                        $userName = $entityNames[$userid];
                        $recordModel->set('answeredby',$userName);
                    }
                }
                $recordModel->set('current_user_id',$user->id);
                $calls[] = $recordModel->getData();
            }
        }
        $response->setResult($calls);
        $response->emit();
    }
Esempio n. 8
0
	function getSearchParams($assignedto = '', $date)
	{
		$conditions = array();
		$listSearchParams = array();
		if ($assignedto != '')
			array_push($conditions, array('assigned_user_id', 'e', getUserFullName($assignedto)));
		if (!empty($date)) {
			array_push($conditions, array('due_date', 'bw', $date . ',' . $date . ''));
		}
		$listSearchParams[] = $conditions;
		return '&search_params=' . json_encode($listSearchParams);
	}
 function getSearchParams($value, $assignedto, $dates)
 {
     $listSearchParams = array();
     $conditions = array(array('leadstatus', 'e', $value));
     if ($assignedto != '') {
         array_push($conditions, array('assigned_user_id', 'e', getUserFullName($assignedto)));
     }
     if (!empty($dates)) {
         array_push($conditions, array('createdtime', 'bw', $dates['start'] . ' 00:00:00,' . $dates['end'] . ' 23:59:59'));
     }
     $listSearchParams[] = $conditions;
     return '&search_params=' . json_encode($listSearchParams);
 }
Esempio n. 10
0
 public function getOwnerNameCustom($id)
 {
     $db = PearDatabase::getInstance();
     if ($id != "") {
         $result = $db->pquery("SELECT user_name FROM vtiger_users WHERE id=?", array($id));
         $ownername = $db->query_result($result, 0, "user_name");
     }
     if ($ownername == "") {
         $result = $db->pquery("SELECT groupname FROM vtiger_groups WHERE groupid=?", array($id));
         $ownername = $db->query_result($result, 0, "groupname");
     } else {
         $ownername = getUserFullName($id);
     }
     return $ownername;
 }
 /**
  * Function to delete the user calendar from shared calendar
  * @param Vtiger_Request $request
  * @return Vtiger_Response $response
  */
 function deleteUserCalendar(Vtiger_Request $request)
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userId = $currentUser->getId();
     $sharedUserId = $request->get('userid');
     $db = PearDatabase::getInstance();
     $result = $db->pquery('SELECT 1 FROM vtiger_shareduserinfo WHERE userid=? AND shareduserid=?', array($userId, $sharedUserId));
     if ($db->num_rows($result) > 0) {
         $db->pquery('UPDATE vtiger_shareduserinfo SET visible=? WHERE userid=? AND shareduserid=?', array('0', $userId, $sharedUserId));
     } else {
         $db->pquery('INSERT INTO vtiger_shareduserinfo (userid, shareduserid, visible) VALUES(?, ?, ?)', array($userId, $sharedUserId, '0'));
     }
     $result = array('userid' => $userId, 'sharedid' => $sharedUserId, 'username' => getUserFullName($sharedUserId));
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
Esempio n. 12
0
function vtws_getUsersInTheSameGroup($id)
{
    require_once 'include/utils/GetGroupUsers.php';
    require_once 'include/utils/GetUserGroups.php';
    $groupUsers = new GetGroupUsers();
    $userGroups = new GetUserGroups();
    $allUsers = array();
    $userGroups->getAllUserGroups($id);
    $groups = $userGroups->user_groups;
    foreach ($groups as $group) {
        $groupUsers->getAllUsersInGroup($group);
        $usersInGroup = $groupUsers->group_users;
        foreach ($usersInGroup as $user) {
            if ($user != $id) {
                $allUsers[$user] = getUserFullName($user);
            }
        }
    }
    return $allUsers;
}
Esempio n. 13
0
 function getDetailsNoteInfo($accountid)
 {
     global $log;
     global $adb;
     $log->debug("Entering getDetailsNoteInfo method ...");
     if ($accountid != '') {
         $query = "select * from ec_notes where accountid={$accountid} and deleted=0";
         $result = $adb->query($query);
         $num_rows = $adb->num_rows($result);
         if ($num_rows > 0) {
             while ($row = $adb->fetch_array($result)) {
                 $row['smownerid'] = getUserFullName($row['smownerid']);
                 $row['title'] = "<a href='index.php?action=DetailView&module=Notes&record=" . $row['notesid'] . "&parenttab=Customer' target='_blank'>" . $row['title'] . "</a>";
                 $arr[] = $row;
             }
         }
     }
     $log->debug("Exiting getDetailsNoteInfo method ...");
     return $arr;
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'HelpDesk', 'helpdesk_', $model);
         $entity = new Products();
         if ($this->focusColumnValue('product_id')) {
             $entity->retrieve_entity_info($this->focusColumnValue('product_id'), 'Products');
         }
         $this->generateEntityModel($entity, 'Products', 'product_', $model);
         if ($this->focusColumnValue('parent_id')) {
             $setype = getSalesEntityType($this->focusColumnValue('parent_id'));
         }
         $account = new Accounts();
         $contact = new Contacts();
         if ($setype == 'Accounts') {
             $account->retrieve_entity_info($this->focusColumnValue('parent_id'), $setype);
         } elseif ($setype == 'Contacts') {
             $contact->retrieve_entity_info($this->focusColumnValue('parent_id'), $setype);
         }
         $this->generateEntityModel($account, 'Accounts', 'account_', $model);
         $this->generateEntityModel($contact, 'Contacts', 'contact_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('helpdesk_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
Esempio n. 15
0
 /**
  * Creates the root elements for the GRAMPS XML file.
  *
  * The methods adds all the root elements and appends them to a DOMDocument.
  */
 function begin_xml()
 {
     global $pgv_lang, $factarray;
     //, $eventsArray, $dom, $ePeople, $this->eFams, $eSources, $ePlaces, $eObject;
     $user = PGV_USER_NAME;
     $this->dom = new DomDocument("1.0", "UTF-8");
     $this->dom->formatOutput = true;
     $eRoot = $this->dom->createElementNS("http://gramps-project.org/xml/1.1.0/", "database");
     $eRoot = $this->dom->appendChild($eRoot);
     $eHeader = $this->dom->createElement("header");
     $eHeader = $eRoot->appendChild($eHeader);
     $eCreated = $this->dom->createElement("created");
     $eCreated = $eHeader->appendChild($eCreated);
     $eCreated->setAttribute("date", date("Y-m-d"));
     $eCreated->setAttribute("version", "1.1.2.6");
     $eResearcher = $this->dom->createElement("researcher");
     $eResname = $this->dom->createElement("resname");
     $etResname = $this->dom->createTextNode(getUserFullName($user));
     $etResname = $eResname->appendChild($etResname);
     $eResname = $eResearcher->appendChild($eResname);
     $eResemail = $this->dom->createElement("resemail");
     $etResemail = $this->dom->createTextNode(get_user_setting($user, 'email'));
     $etResemail = $eResemail->appendChild($etResemail);
     $eResemail = $eResearcher->appendChild($eResemail);
     $eResearcher = $eHeader->appendChild($eResearcher);
     $this->eEvents = $this->dom->createElement("events");
     $this->eEvents = $eRoot->appendChild($this->eEvents);
     $this->ePeople = $this->dom->createElement("people");
     $this->ePeople = $eRoot->appendChild($this->ePeople);
     $this->eFams = $this->dom->createElement("families");
     $this->eFams = $eRoot->appendChild($this->eFams);
     $this->eSources = $this->dom->createElement("sources");
     $this->eSources = $eRoot->appendChild($this->eSources);
     $this->ePlaces = $this->dom->createElement("places");
     $this->ePlaces = $eRoot->appendChild($this->ePlaces);
     $this->eObject = $this->dom->createElement("objects");
     $this->eObject = $eRoot->appendChild($this->eObject);
 }
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'SPPayments', 'payment_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('payment_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         $model->set('payment_payer', getParentName($this->focusColumnValue('payer')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
Esempio n. 17
0
 static function getAnnouncements()
 {
     $adb = PearDatabase::getInstance();
     $sql = " select * from vtiger_announcement inner join vtiger_users on vtiger_announcement.creatorid=vtiger_users.id";
     $sql .= " AND vtiger_users.is_admin='on' AND vtiger_users.status='Active' AND vtiger_users.deleted = 0";
     $result = $adb->pquery($sql, array());
     for ($i = 0; $i < $adb->num_rows($result); $i++) {
         $announce = getUserFullName($adb->query_result($result, $i, 'creatorid')) . ' :  ' . $adb->query_result($result, $i, 'announcement') . '   ';
         if ($adb->query_result($result, $i, 'announcement') != '') {
             $announcement .= $announce;
         }
     }
     return $announcement;
 }
Esempio n. 18
0
 public static function getUpdateLogCreateMessage($column_fields, $assigned_group_name, $assigntype)
 {
     global $log, $current_user;
     $updatelog = "Ticket created. Assigned to ";
     if (!empty($assigned_group_name) && $assigntype == 'T') {
         $updatelog .= " group " . (is_array($assigned_group_name) ? $assigned_group_name[0] : $assigned_group_name);
     } elseif ($column_fields['assigned_user_id'] != '') {
         $updatelog .= " user " . getUserFullName($column_fields['assigned_user_id']);
     } else {
         $updatelog .= " user " . getUserFullName($current_user->id);
     }
     $fldvalue = date("l dS F Y h:i:s A") . ' by ' . $current_user->user_name;
     $updatelog .= " -- " . $fldvalue . "--//--";
     return $updatelog;
 }
Esempio n. 19
0
 public static function showImportLockedError($lockInfo)
 {
     $errorMessage = vtranslate('ERR_MODULE_IMPORT_LOCKED', 'Import');
     $errorDetails = array(vtranslate('LBL_MODULE_NAME', 'Import') => getTabModuleName($lockInfo['tabid']), vtranslate('LBL_USER_NAME', 'Import') => getUserFullName($lockInfo['userid']), vtranslate('LBL_LOCKED_TIME', 'Import') => $lockInfo['locked_since']);
     self::showErrorPage($errorMessage, $errorDetails);
 }
 function iCalendar_event_attendee($activity)
 {
     $adb = PearDatabase::getInstance();
     $users_res = $adb->pquery("SELECT inviteeid FROM vtiger_invitees WHERE activityid=?", array($activity['id']));
     if ($adb->num_rows($users_res) > 0) {
         for ($i = 0; $i < $adb->num_rows($users_res); $i++) {
             $inviteeid = $adb->query_result($users_res, $i, 'inviteeid');
             $username = getUserFullName($inviteeid);
             $user_email = getUserEmail($inviteeid);
             $attendee = 'mailto:' . $user_email;
             $this->add_property('ATTENDEE', $attendee);
         }
     }
     return true;
 }
Esempio n. 21
0
		<td class="optionbox"><select name="NEW_WEBMASTER_EMAIL" tabindex="<?php 
    $i++;
    print $i;
    ?>
" onfocus="getHelp('WEBMASTER_EMAIL_help');">
		<?php 
    if ($WEBMASTER_EMAIL == "*****@*****.**") {
        $WEBMASTER_EMAIL = PGV_USER_NAME;
    }
    foreach (get_all_users() as $user_id => $user_name) {
        if (userIsAdmin($user_id)) {
            print "<option value=\"" . $user_name . "\"";
            if ($WEBMASTER_EMAIL == $user_name) {
                print " selected=\"selected\"";
            }
            print ">" . getUserFullName($user_id) . " - " . $user_name . "</option>\n";
        }
    }
    ?>
		</select>
		</td>
	</tr>
	<tr>
		<td class="descriptionbox wrap width20"><?php 
    print_help_link("SUPPORT_METHOD_help", "qm", "SUPPORT_METHOD");
    print $pgv_lang["SUPPORT_METHOD"];
    ?>
</td>
		<td class="optionbox"><select name="NEW_SUPPORT_METHOD" tabindex="<?php 
    $i++;
    print $i;
 public function createRecords()
 {
     $adb = PearDatabase::getInstance();
     $moduleName = $this->module;
     $focus = CRMEntity::getInstance($moduleName);
     $moduleHandler = vtws_getModuleHandlerFromName($moduleName, $this->user);
     $moduleMeta = $moduleHandler->getMeta();
     $moduleObjectId = $moduleMeta->getEntityId();
     $moduleFields = $moduleMeta->getModuleFields();
     $tableName = Import_Utils::getDbTableName($this->user);
     $sql = 'SELECT * FROM ' . $tableName . ' WHERE status = ' . Import_Data_Controller::$IMPORT_RECORD_NONE;
     if ($this->batchImport) {
         $configReader = new ConfigReader('modules/Import/config.inc', 'ImportConfig');
         $importBatchLimit = $configReader->getConfig('importBatchLimit');
         $sql .= ' LIMIT ' . $importBatchLimit;
     }
     $result = $adb->query($sql);
     $numberOfRecords = $adb->num_rows($result);
     if ($numberOfRecords <= 0) {
         return;
     }
     $fieldMapping = $this->fieldMapping;
     $fieldColumnMapping = $moduleMeta->getFieldColumnMapping();
     for ($i = 0; $i < $numberOfRecords; ++$i) {
         $row = $adb->raw_query_result_rowdata($result, $i);
         $rowId = $row['id'];
         $entityInfo = null;
         $fieldData = array();
         foreach ($fieldMapping as $fieldName => $index) {
             $fieldData[$fieldName] = $row[$fieldName];
         }
         $mergeType = $this->mergeType;
         $createRecord = false;
         if (method_exists($focus, 'importRecord')) {
             $entityInfo = $focus->importRecord($this, $fieldData);
         } else {
             if (!empty($mergeType) && $mergeType != Import_Utils::$AUTO_MERGE_NONE) {
                 $queryGenerator = new QueryGenerator($moduleName, $this->user);
                 $queryGenerator->initForDefaultCustomView();
                 $fieldsList = array('id');
                 $queryGenerator->setFields($fieldsList);
                 $mergeFields = $this->mergeFields;
                 foreach ($mergeFields as $index => $mergeField) {
                     if ($index != 0) {
                         $queryGenerator->addConditionGlue(QueryGenerator::$AND);
                     }
                     $comparisonValue = $fieldData[$mergeField];
                     $fieldInstance = $moduleFields[$mergeField];
                     if ($fieldInstance->getFieldDataType() == 'owner') {
                         $userId = getUserId_Ol($comparisonValue);
                         $comparisonValue = getUserFullName($userId);
                     }
                     if ($fieldInstance->getFieldDataType() == 'reference') {
                         if (strpos($comparisonValue, '::::') > 0) {
                             $referenceFileValueComponents = explode('::::', $comparisonValue);
                         } else {
                             $referenceFileValueComponents = explode(':::', $comparisonValue);
                         }
                         if (count($referenceFileValueComponents) > 1) {
                             $comparisonValue = trim($referenceFileValueComponents[1]);
                         }
                     }
                     $queryGenerator->addCondition($mergeField, $comparisonValue, 'e');
                 }
                 $query = $queryGenerator->getQuery();
                 $duplicatesResult = $adb->query($query);
                 $noOfDuplicates = $adb->num_rows($duplicatesResult);
                 if ($noOfDuplicates > 0) {
                     if ($mergeType == Import_Utils::$AUTO_MERGE_IGNORE) {
                         $entityInfo['status'] = self::$IMPORT_RECORD_SKIPPED;
                     } elseif ($mergeType == Import_Utils::$AUTO_MERGE_OVERWRITE || $mergeType == Import_Utils::$AUTO_MERGE_MERGEFIELDS) {
                         for ($index = 0; $index < $noOfDuplicates - 1; ++$index) {
                             $duplicateRecordId = $adb->query_result($duplicatesResult, $index, $fieldColumnMapping['id']);
                             $entityId = vtws_getId($moduleObjectId, $duplicateRecordId);
                             vtws_delete($entityId, $this->user);
                         }
                         $baseRecordId = $adb->query_result($duplicatesResult, $noOfDuplicates - 1, $fieldColumnMapping['id']);
                         $baseEntityId = vtws_getId($moduleObjectId, $baseRecordId);
                         if ($mergeType == Import_Utils::$AUTO_MERGE_OVERWRITE) {
                             $fieldData = $this->transformForImport($fieldData, $moduleMeta);
                             $fieldData['id'] = $baseEntityId;
                             $entityInfo = vtws_update($fieldData, $this->user);
                             $entityInfo['status'] = self::$IMPORT_RECORD_UPDATED;
                             //Prepare data for event handler
                             $entityData = array();
                             $entityData['rowId'] = $rowId;
                             $entityData['tableName'] = $tableName;
                             $entityData['entityInfo'] = $entityInfo;
                             $entityData['fieldData'] = $fieldData;
                             $entityData['moduleName'] = $moduleName;
                             $entityData['user'] = $this->user;
                             cbEventHandler::do_action('corebos.entity.import.overwrite', $entityData);
                         }
                         if ($mergeType == Import_Utils::$AUTO_MERGE_MERGEFIELDS) {
                             $filteredFieldData = array();
                             $defaultFieldValues = $this->getDefaultFieldValues($moduleMeta);
                             foreach ($fieldData as $fieldName => $fieldValue) {
                                 if (!empty($fieldValue)) {
                                     $filteredFieldData[$fieldName] = $fieldValue;
                                 }
                             }
                             $existingFieldValues = vtws_retrieve($baseEntityId, $this->user);
                             foreach ($existingFieldValues as $fieldName => $fieldValue) {
                                 if (empty($fieldValue) && empty($filteredFieldData[$fieldName]) && !empty($defaultFieldValues[$fieldName])) {
                                     $filteredFieldData[$fieldName] = $fieldValue;
                                 }
                             }
                             $filteredFieldData = $this->transformForImport($filteredFieldData, $moduleMeta, false, true);
                             $filteredFieldData['id'] = $baseEntityId;
                             $entityInfo = vtws_revise($filteredFieldData, $this->user);
                             $entityInfo['status'] = self::$IMPORT_RECORD_MERGED;
                             //Prepare data for event handler
                             $entityData = array();
                             $entityData['rowId'] = $rowId;
                             $entityData['tableName'] = $tableName;
                             $entityData['entityInfo'] = $entityInfo;
                             $entityData['fieldData'] = $fieldData;
                             $entityData['moduleName'] = $moduleName;
                             $entityData['user'] = $this->user;
                             cbEventHandler::do_action('corebos.entity.import.merge', $entityData);
                         }
                     } else {
                         $createRecord = true;
                     }
                 } else {
                     $createRecord = true;
                 }
             } else {
                 $createRecord = true;
             }
             if ($createRecord) {
                 $fieldData = $this->transformForImport($fieldData, $moduleMeta);
                 if ($fieldData == null) {
                     $entityInfo = null;
                 } else {
                     $entityInfo = vtws_create($moduleName, $fieldData, $this->user);
                     $entityInfo['status'] = self::$IMPORT_RECORD_CREATED;
                     //Prepare data for event handler
                     $entityData = array();
                     $entityData['rowId'] = $rowId;
                     $entityData['tableName'] = $tableName;
                     $entityData['entityInfo'] = $entityInfo;
                     $entityData['fieldData'] = $fieldData;
                     $entityData['moduleName'] = $moduleName;
                     $entityData['user'] = $this->user;
                     cbEventHandler::do_action('corebos.entity.import.create', $entityData);
                 }
             }
         }
         if ($entityInfo == null) {
             $entityInfo = array('id' => null, 'status' => self::$IMPORT_RECORD_FAILED);
         }
         $this->importedRecordInfo[$rowId] = $entityInfo;
         $this->updateImportStatus($rowId, $entityInfo);
     }
     unset($result);
     return true;
 }
Esempio n. 23
0
 public function sendEmail()
 {
     require_once 'vtlib/Vtiger/Mailer.php';
     $vtigerMailer = new Vtiger_Mailer();
     $recipientEmails = $this->getRecipientEmails();
     Vtiger_Utils::ModuleLog('ScheduleReprots', $recipientEmails);
     foreach ($recipientEmails as $name => $email) {
         $vtigerMailer->AddAddress($email, $name);
     }
     vimport('~modules/Report/models/Record.php');
     $reportRecordModel = Reports_Record_Model::getInstanceById($this->get('reportid'));
     $currentTime = date('Y-m-d.H.i.s');
     Vtiger_Utils::ModuleLog('ScheduleReprots Send Mail Start ::', $currentTime);
     $reportname = decode_html($reportRecordModel->getName());
     $subject = $reportname;
     Vtiger_Utils::ModuleLog('ScheduleReprot Name ::', $reportname);
     $vtigerMailer->Subject = $subject;
     $vtigerMailer->Body = $this->getEmailContent($reportRecordModel);
     $vtigerMailer->IsHTML();
     $baseFileName = $reportname . '__' . $currentTime;
     $oReportRun = ReportRun::getInstance($this->get('reportid'));
     $reportFormat = $this->scheduledFormat;
     $attachments = array();
     if ($reportFormat == 'CSV') {
         $fileName = $baseFileName . '.csv';
         $filePath = 'storage/' . $fileName;
         $attachments[$fileName] = $filePath;
         $oReportRun->writeReportToCSVFile($filePath);
     }
     foreach ($attachments as $attachmentName => $path) {
         $vtigerMailer->AddAttachment($path, decode_html($attachmentName));
     }
     //Added cc to account owner
     $accountOwnerId = Users::getActiveAdminId();
     $vtigerMailer->AddCC(getUserEmail($accountOwnerId), getUserFullName($accountOwnerId));
     $status = $vtigerMailer->Send(true);
     foreach ($attachments as $attachmentName => $path) {
         unlink($path);
     }
     return $status;
 }
Esempio n. 24
0
File: utils.php Progetto: yunter/crm
/**
 * this function adds a record to the callhistory module
 *
 * @param string $userExtension - the extension of the current user
 * @param string $callfrom - the caller number
 * @param string $callto - the called number
 * @param string $status - the status of the call (outgoing/incoming/missed)
 * @param object $adb - the peardatabase object
 */
function addToCallHistory($userExtension, $callfrom, $callto, $status, $adb, $useCallerInfo)
{
    $sql = "select * from vtiger_asteriskextensions where asterisk_extension=?";
    $result = $adb->pquery($sql, array($userExtension));
    $userID = $adb->query_result($result, 0, "userid");
    if (empty($userID)) {
        // we have observed call to extension not configured in Vtiger will returns NULL
        return;
    }
    if (empty($callfrom)) {
        $callfrom = "Unknown";
    }
    if (empty($callto)) {
        $callto = "Unknown";
    }
    if ($status == 'outgoing') {
        //call is from user to record
        $sql = "select * from vtiger_asteriskextensions where asterisk_extension=?";
        $result = $adb->pquery($sql, array($callfrom));
        if ($adb->num_rows($result) > 0) {
            $userid = $adb->query_result($result, 0, "userid");
            $callerName = getUserFullName($userid);
        }
        $receiver = $useCallerInfo;
        if (empty($receiver)) {
            $receiver = "Unknown";
        } else {
            $receiver = "<a href='index.php?module=" . $receiver['module'] . "&action=DetailView&record=" . $receiver['id'] . "'>" . $receiver['name'] . "</a>";
        }
    } else {
        //call is from record to user
        $sql = "select * from vtiger_asteriskextensions where asterisk_extension=?";
        $result = $adb->pquery($sql, array($callto));
        if ($adb->num_rows($result) > 0) {
            $userid = $adb->query_result($result, 0, "userid");
            $receiver = getUserFullName($userid);
        }
        $callerName = $useCallerInfo;
        if (empty($callerName)) {
            $callerName = "Unknown {$callfrom}";
        } else {
            $callerName = "<a href='index.php?module=" . $callerName['module'] . "&action=DetailView&record=" . $callerName['id'] . "'>" . decode_html($callerName['name']) . "</a>";
        }
    }
    $crmID = $adb->getUniqueID('vtiger_crmentity');
    $timeOfCall = date('Y-m-d H:i:s');
    $query = "INSERT INTO vtiger_crmentity (crmid,smcreatorid,smownerid,modifiedby,setype,description,createdtime,\n\t\t\tmodifiedtime,viewedtime,status,version,presence,deleted,label) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
    $adb->pquery($query, array($crmID, $userID, $userID, 0, "PBXManager", "", $timeOfCall, $timeOfCall, NULL, NULL, 0, 1, 0, $callerName));
    $sql = "insert into vtiger_pbxmanager (pbxmanagerid,callfrom,callto,timeofcall,status)values (?,?,?,?,?)";
    $params = array($crmID, $callerName, $receiver, $timeOfCall, $status);
    $adb->pquery($sql, $params);
    return $crmID;
}
Esempio n. 25
0
                echo "        <note Conformance=\"howdoi\">\r\n";
                echo "          <title>{'How do I' from language file}</title>\r\n";
                echo "          <para>" . encodeText($q_howdoi) . "</para>\r\n";
                echo "        </note>\r\n";
            }
            if (!empty($q_diduno)) {
                echo "        <note Conformance=\"diduno\">\r\n";
                echo "          <title>{'Did you know' from language file}</title>\r\n";
                echo "          <para>" . encodeText($q_diduno) . "</para>\r\n";
                echo "        </note>\r\n";
            }
            echo "      </question>\r\n";
            $resultA = $xoopsDB->query("select * from " . $xoopsDB->prefix("smartsection_answers") . " where answerid={$q_answerid}");
            while ($arrA = $xoopsDB->fetchArray($resultA)) {
                extract($arrA, EXTR_PREFIX_ALL, 'a');
                echo "      <answer ID=\"a{$a_answerid}\" Revision=\"{$a_datesub}\" Vendor=\"" . getUserFullName($a_uid) . "\">\r\n";
                echo "        <para>" . encodeText($a_answer) . "</para>\r\n";
                echo "      </answer>\r\n";
            }
            mysql_free_result($resultA);
            echo "    </qandaentry>\r\n";
        }
        mysql_free_result($resultQ);
        echo "  </qandadiv>\r\n";
    }
    echo "</qandaset>\r\n";
    exit;
}
function encodeText($text)
{
    return utf8_encode(htmlspecialchars($text));
Esempio n. 26
0
/**
 * this function adds a record to the callhistory module
 * 
 * @param string $userExtension - the extension of the current user
 * @param string $callfrom - the caller number
 * @param string $callto - the called number
 * @param string $status - the status of the call (outgoing/incoming/missed)
 * @param object $adb - the peardatabase object
 */
function addToCallHistory($userExtension, $callfrom, $callto, $status, $adb)
{
    $sql = "select * from vtiger_asteriskextensions where asterisk_extension=" . $userExtension;
    $result = $adb->pquery($sql, array());
    $userID = $adb->query_result($result, 0, "userid");
    $crmID = $adb->getUniqueID('vtiger_crmentity');
    $timeOfCall = date('Y-m-d H:i:s');
    $sql = "insert into vtiger_crmentity values (?,?,?,?,?,?,?,?,?,?,?,?,?)";
    $params = array($crmID, $userID, $userID, 0, "PBXManager", "", $timeOfCall, $timeOfCall, NULL, NULL, 0, 1, 0);
    $adb->pquery($sql, $params);
    if (empty($callfrom)) {
        $callfrom = "Unknown";
    }
    if (empty($callto)) {
        $callto = "Unknown";
    }
    if ($status == 'outgoing') {
        //call is from user to record
        $sql = "select * from vtiger_asteriskextensions where asterisk_extension=?";
        $result = $adb->pquery($sql, array($callfrom));
        if ($adb->num_rows($result) > 0) {
            $userid = $adb->query_result($result, 0, "userid");
            $callerName = getUserFullName($userid);
        }
        $receiver = getCallerInfo($callto);
        if ($receiver == false) {
            $receiver = getCallerInfo(getStrippedNumber($callto));
        }
        if (empty($receiver)) {
            $receiver = "Unknown";
        } else {
            $receiver = "<a href='index.php?module=" . $receiver[module] . "&action=DetailView&record=" . $receiver[id] . "'>" . $receiver[name] . "</a>";
        }
    } else {
        //call is from record to user
        $sql = "select * from vtiger_asteriskextensions where asterisk_extension=?";
        $result = $adb->pquery($sql, array($callto));
        if ($adb->num_rows($result) > 0) {
            $userid = $adb->query_result($result, 0, "userid");
            $receiver = getUserFullName($userid);
        }
        $callerName = getCallerInfo($callfrom);
        if ($callerName == false) {
            $callerName = getCallerInfo(getStrippedNumber($callfrom));
        }
        if (empty($callerName)) {
            $callerName = "Unknown";
        } else {
            $callerName = "<a href='index.php?module=" . $callerName[module] . "&action=DetailView&record=" . $callerName[id] . "'>" . decode_html($callerName[name]) . "</a>";
        }
    }
    $sql = "insert into vtiger_pbxmanager (pbxmanagerid,callfrom,callto,timeofcall,status)values (?,?,?,?,?)";
    $params = array($crmID, $callerName, $receiver, $timeOfCall, $status);
    $adb->pquery($sql, $params);
}
function vtws_addTicketFaqComment($id, $values, $user)
{
    global $log, $adb, $current_user;
    $webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
    $handlerPath = $webserviceObject->getHandlerPath();
    $handlerClass = $webserviceObject->getHandlerClass();
    require_once $handlerPath;
    $handler = new $handlerClass($webserviceObject, $user, $adb, $log);
    $meta = $handler->getMeta();
    $entityName = $meta->getObjectEntityName($id);
    if ($entityName !== 'HelpDesk' and $entityName !== 'Faq') {
        throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Invalid module specified. Must be HelpDesk or Faq");
    }
    if ($meta->hasReadAccess() !== true) {
        throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
    }
    if ($entityName !== $webserviceObject->getEntityName()) {
        throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
    }
    if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
        throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
    }
    $idComponents = vtws_getIdComponents($id);
    if (!$meta->exists($idComponents[1])) {
        throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
    }
    $comment = trim($values['comments']);
    if (empty($comment)) {
        throw new WebServiceException(WebServiceErrorCode::$MANDFIELDSMISSING, "Comment empty.");
    }
    $current_time = $adb->formatDate(date('Y-m-d H:i:s'), true);
    if ($entityName == 'HelpDesk') {
        if ($values['from_portal'] != 1) {
            $ownertype = 'user';
            if (!empty($user)) {
                $ownerId = $user->id;
            } elseif (!empty($current_user)) {
                $ownerId = $current_user->id;
            } else {
                $ownerId = 1;
            }
            //get the user email
            $result = $adb->pquery("SELECT email1 FROM vtiger_users WHERE id=?", array($ownerId));
            $fromname = getUserFullName($ownerId);
        } else {
            $ownertype = 'customer';
            $webserviceObject = VtigerWebserviceObject::fromId($adb, $values['parent_id']);
            $handlerPath = $webserviceObject->getHandlerPath();
            $handlerClass = $webserviceObject->getHandlerClass();
            require_once $handlerPath;
            $handler = new $handlerClass($webserviceObject, $user, $adb, $log);
            $meta = $handler->getMeta();
            $entityName = $meta->getObjectEntityName($values['parent_id']);
            if ($entityName !== 'Contacts') {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Invalid owner module specified. Must be Contacts");
            }
            if ($entityName !== $webserviceObject->getEntityName()) {
                throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
            }
            $pidComponents = vtws_getIdComponents($values['parent_id']);
            if (!$meta->exists($pidComponents[1])) {
                throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
            }
            $ownerId = $pidComponents[1];
            //get the contact email id who creates the ticket from portal and use this email as from email id in email
            $result = $adb->pquery("SELECT email FROM vtiger_contactdetails WHERE contactid=?", array($ownerId));
            $ename = getEntityName('Contacts', $ownerId);
            $fromname = $ename[$ownerId];
        }
        $sql = "insert into vtiger_ticketcomments values(?,?,?,?,?,?)";
        $params = array('', $idComponents[1], $comment, $ownerId, $ownertype, $current_time);
        //send mail to the assigned to user when customer add comment
        $toresult = $adb->pquery("SELECT email1,first_name\n\t\t\t\t\tFROM vtiger_users\n\t\t\t\t\tINNER JOIN vtiger_crmentity on smownerid=id\n\t\t\t\t\tINNER JOIN vtiger_troubletickets on ticketid=crmid\n\t\t\t\t\tWHERE ticketid=?", array($idComponents[1]));
        $to_email = $adb->query_result($toresult, 0, 0);
        $ownerName = $adb->query_result($toresult, 0, 1);
        $moduleName = 'HelpDesk';
        $subject = getTranslatedString('LBL_RESPONDTO_TICKETID', $moduleName) . "##" . $idComponents[1] . "##" . getTranslatedString('LBL_CUSTOMER_PORTAL', $moduleName);
        $contents = getTranslatedString('Dear', $moduleName) . " " . $ownerName . "," . "<br><br>" . getTranslatedString('LBL_CUSTOMER_COMMENTS', $moduleName) . "<br><br>\n\t\t\t\t\t<b>" . $comment . "</b><br><br>" . getTranslatedString('LBL_RESPOND', $moduleName) . "<br><br>" . getTranslatedString('LBL_REGARDS', $moduleName) . "<br>" . getTranslatedString('LBL_SUPPORT_ADMIN', $moduleName);
        $from_email = $adb->query_result($result, 0, 0);
        //send mail to assigned to user
        $mail_status = send_mail('HelpDesk', $to_email, $fromname, $from_email, $subject, $contents);
    } else {
        $sql = "insert into vtiger_faqcomments values(?, ?, ?, ?)";
        $params = array('', $idComponents[1], $comment, $current_time);
    }
    $adb->pquery($sql, $params);
    VTWS_PreserveGlobal::flush();
    return array('success' => true);
}
Esempio n. 28
0
 public static function ReportSharing(Vtiger_Request $request, $viewer)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $R_Data = $request->getAll();
     $viewer->assign("MODULE", $moduleName);
     $reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
     $primary_module = $reportModel->getPrimaryModule();
     $primary_moduleid = $reportModel->getPrimaryModuleId();
     $current_user = Users_Record_Model::getCurrentUserModel();
     //$Report_Informations = $reportModel->getReportInformations();
     $Report_Informations = $reportModel->report->reportinformations;
     $LBL_INFORMATIONS_4YOU = vtranslate("LBL_STEP8_INFO", $moduleName);
     $viewer->assign("LBL_INFORMATIONS_4YOU", $LBL_INFORMATIONS_4YOU);
     //require_once('include/utils/GetUserGroups.php');
     // ITS4YOU-UP SlOl 26. 4. 2013 9:47:59
     $template_owners = get_user_array(false);
     if (isset($Report_Informations["owner"]) && $Report_Informations["owner"] != "") {
         $selected_owner = $Report_Informations["owner"];
     } else {
         $selected_owner = $current_user->id;
     }
     $viewer->assign("TEMPLATE_OWNERS", $template_owners);
     $owner = isset($R_Data['template_owner']) && $R_Data['template_owner'] != '' ? $R_Data['template_owner'] : $selected_owner;
     $viewer->assign("TEMPLATE_OWNER", $owner);
     $sharing_types = array("public" => vtranslate("PUBLIC_FILTER", $moduleName), "private" => vtranslate("PRIVATE_FILTER", $moduleName), "share" => vtranslate("SHARE_FILTER", $moduleName));
     $viewer->assign("SHARINGTYPES", $sharing_types);
     if ($request->get('reporttype') == "custom_report") {
         $sharingtype = "private";
     } else {
         $sharingtype = "public";
     }
     if (isset($R_Data['sharing']) && $R_Data['sharing'] != '') {
         $sharingtype = $R_Data['sharing'];
     } elseif (isset($Report_Informations["sharing"]) && $Report_Informations["sharing"] != "") {
         $sharingtype = $Report_Informations["sharing"];
     }
     $viewer->assign("SHARINGTYPE", $sharingtype);
     //$cmod = return_specified_module_language($current_language, "Settings");
     //$viewer->assign("CMOD", $cmod);
     $sharingMemberArray = array();
     if (isset($R_Data['sharingSelectedColumns']) && $R_Data['sharingSelectedColumns'] != '') {
         $sharingMemberArray = explode("|", trim($R_Data['sharingSelectedColumns'], "|"));
     } elseif (isset($Report_Informations["members_array"]) && !empty($Report_Informations["members_array"])) {
         $sharingMemberArray = $Report_Informations["members_array"];
     }
     $sharingMemberArray = array_unique($sharingMemberArray);
     if (count($sharingMemberArray) > 0) {
         $outputMemberArr = array();
         foreach ($sharingMemberArray as $setype => $shareIdArr) {
             $shareIdArr = explode("::", $shareIdArr);
             $shareIdArray = array();
             $shareIdArray[$shareIdArr[0]] = $shareIdArr[1];
             foreach ($shareIdArray as $shareType => $shareId) {
                 switch ($shareType) {
                     case "groups":
                         $groupArray = getGroupName($shareId);
                         $memberName = $groupArray[0];
                         $memberDisplay = "Group::";
                         break;
                     case "roles":
                         $memberName = getRoleName($shareId);
                         $memberDisplay = "Roles::";
                         break;
                     case "rs":
                         $memberName = getRoleName($shareId);
                         $memberDisplay = "RoleAndSubordinates::";
                         break;
                     case "users":
                         $memberName = getUserFullName($shareId);
                         $memberDisplay = "User::";
                         break;
                 }
                 $outputMemberArr[] = $shareType . "::" . $shareId;
                 $outputMemberArr[] = $memberDisplay . $memberName;
             }
         }
         $viewer->assign("MEMBER", array_chunk($outputMemberArr, 2));
     }
     // ITS4YOU-END
     //Constructing the Role Array
     $roleDetails = getAllRoleDetails();
     $i = 0;
     $roleIdStr = "";
     $roleNameStr = "";
     $userIdStr = "";
     $userNameStr = "";
     $grpIdStr = "";
     $grpNameStr = "";
     foreach ($roleDetails as $roleId => $roleInfo) {
         if ($i != 0) {
             if ($i != 1) {
                 $roleIdStr .= ", ";
                 $roleNameStr .= ", ";
             }
             $roleName = $roleInfo[0];
             $roleIdStr .= "'" . $roleId . "'";
             $roleNameStr .= "'" . addslashes(decode_html($roleName)) . "'";
         }
         $i++;
     }
     //Constructing the User Array
     $l = 0;
     $userDetails = getAllUserName();
     foreach ($userDetails as $userId => $userInfo) {
         if ($l != 0) {
             $userIdStr .= ", ";
             $userNameStr .= ", ";
         }
         $userIdStr .= "'" . $userId . "'";
         $userNameStr .= "'" . $userInfo . "'";
         $l++;
     }
     //Constructing the Group Array
     $parentGroupArray = array();
     $m = 0;
     $grpDetails = getAllGroupName();
     foreach ($grpDetails as $grpId => $grpName) {
         if (!in_array($grpId, $parentGroupArray)) {
             if ($m != 0) {
                 $grpIdStr .= ", ";
                 $grpNameStr .= ", ";
             }
             $grpIdStr .= "'" . $grpId . "'";
             $grpNameStr .= "'" . addslashes(decode_html($grpName)) . "'";
             $m++;
         }
     }
     $viewer->assign("ROLEIDSTR", $roleIdStr);
     $viewer->assign("ROLENAMESTR", $roleNameStr);
     $viewer->assign("USERIDSTR", $userIdStr);
     $viewer->assign("USERNAMESTR", $userNameStr);
     $viewer->assign("GROUPIDSTR", $grpIdStr);
     $viewer->assign("GROUPNAMESTR", $grpNameStr);
     $visiblecriteria = $reportModel->getVisibleCriteria();
     $viewer->assign("VISIBLECRITERIA", $visiblecriteria);
     return $viewer->view('ReportSharing.tpl', $moduleName, true);
 }
Esempio n. 29
0
 private function x1e($x118)
 {
     global $x15d, $x15e, $x15f, $x160, $x161, $x162, $x163, $x164, $x165, $x166, $x167, $x168, $x169, $x16a, $x16b, $x16c, $x16d, $x16e, $x16f, $x170, $x171, $x172, $x173, $x174, $x175, $x176, $x177, $x178;
     if ($x118 != "") {
         $x3d = "SELECT user_name FROM vtiger_users WHERE id=?";
         $x3e = self::$x0f->pquery($x3d, array($x118));
         $x12b = self::$x0f->query_result($x3e, 0, "user_name");
     }
     if ($x12b == "") {
         $x3d = "SELECT groupname FROM vtiger_groups WHERE groupid=?";
         $x3e = self::$x0f->pquery($x3d, array($x118));
         $x12b = self::$x0f->query_result($x3e, 0, "groupname");
     } else {
         $x12b = getUserFullName($x118);
     }
     return $x12b;
 }
Esempio n. 30
0
 /** Function to get the update ticket history for the specified ticketid
  * @param $id -- $ticketid:: Type Integer
  */
 function constructUpdateLog($focus, $mode, $assigned_group_name, $assigntype)
 {
     global $adb;
     global $current_user;
     if ($mode != 'edit') {
         $updatelog = "Ticket created. Assigned to ";
         if (!empty($assigned_group_name) && $assigntype == 'T') {
             $updatelog .= " group " . (is_array($assigned_group_name) ? $assigned_group_name[0] : $assigned_group_name);
         } elseif ($focus->column_fields['assigned_user_id'] != '') {
             $updatelog .= " user " . getUserFullName($focus->column_fields['assigned_user_id']);
         } else {
             $updatelog .= " user " . getUserFullName($current_user->id);
         }
         $fldvalue = date("l dS F Y h:i:s A") . ' by ' . $current_user->user_name;
         $updatelog .= " -- " . $fldvalue . "--//--";
     } else {
         $ticketid = $focus->id;
         //First retrieve the existing information
         $tktresult = $adb->pquery("select * from vtiger_troubletickets where ticketid=?", array($ticketid));
         $crmresult = $adb->pquery("select * from vtiger_crmentity where crmid=?", array($ticketid));
         $updatelog = decode_html($adb->query_result($tktresult, 0, "update_log"));
         $old_owner_id = $adb->query_result($crmresult, 0, "smownerid");
         $old_status = $adb->query_result($tktresult, 0, "status");
         $old_priority = $adb->query_result($tktresult, 0, "priority");
         $old_severity = $adb->query_result($tktresult, 0, "severity");
         $old_category = $adb->query_result($tktresult, 0, "category");
         //Assigned to change log
         if ($focus->column_fields['assigned_user_id'] != $old_owner_id) {
             $owner_name = getOwnerName($focus->column_fields['assigned_user_id']);
             if ($assigntype == 'T') {
                 $updatelog .= ' Transferred to group ' . $owner_name . '\\.';
             } else {
                 $updatelog .= ' Transferred to user ' . decode_html($owner_name) . '\\.';
             }
             // Need to decode UTF characters which are migrated from versions < 5.0.4.
         }
         //Status change log
         if ($old_status != $focus->column_fields['ticketstatus'] && $focus->column_fields['ticketstatus'] != '') {
             $updatelog .= ' Status Changed to ' . $focus->column_fields['ticketstatus'] . '\\.';
         }
         //Priority change log
         if ($old_priority != $focus->column_fields['ticketpriorities'] && $focus->column_fields['ticketpriorities'] != '') {
             $updatelog .= ' Priority Changed to ' . $focus->column_fields['ticketpriorities'] . '\\.';
         }
         //Severity change log
         if ($old_severity != $focus->column_fields['ticketseverities'] && $focus->column_fields['ticketseverities'] != '') {
             $updatelog .= ' Severity Changed to ' . $focus->column_fields['ticketseverities'] . '\\.';
         }
         //Category change log
         if ($old_category != $focus->column_fields['ticketcategories'] && $focus->column_fields['ticketcategories'] != '') {
             $updatelog .= ' Category Changed to ' . $focus->column_fields['ticketcategories'] . '\\.';
         }
         $updatelog .= ' -- ' . date("l dS F Y h:i:s A") . ' by ' . $current_user->user_name . '--//--';
     }
     return $updatelog;
 }