public function process($instance)
 {
     $log = vglobal('log');
     $log->debug("Entering SumTimeProjectTask::process() method ...");
     $sum_time = Vtiger_Functions::decimalTimeFormat($instance->get('sum_time_pt'));
     $log->debug("Exiting SumTimeProjectTask::process() method ...");
     return $sum_time['short'];
 }
示例#2
0
 /**
  * Function to get the Display Value, for the current field type with given DB Insert Value
  * @param <Object> $value
  * @return <Object>
  */
 public function getDisplayValue($value)
 {
     if ($this->get('field')->getFieldName() == 'sum_time') {
         $return = Vtiger_Functions::decimalTimeFormat($value);
         return $return['short'];
     } else {
         return decimalFormat($value);
     }
 }
示例#3
0
    public function process($instance)
    {
        $adb = PearDatabase::getInstance();
        $timecontrol = 'SELECT SUM(sum_time) as sum FROM vtiger_osstimecontrol
				INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_osstimecontrol.osstimecontrolid
				WHERE vtiger_crmentity.deleted=0 AND  vtiger_osstimecontrol.accountid = ? AND osstimecontrol_status = ?';
        $result_timecontrol = $adb->pquery($timecontrol, array($instance->getId(), 'Accepted'));
        $decimalTimeFormat = Vtiger_Functions::decimalTimeFormat($adb->query_result($result_timecontrol, 0, 'sum'));
        return $decimalTimeFormat['short'];
    }
示例#4
0
    public function process($instance)
    {
        $log = vglobal('log');
        $log->debug("Entering TotalTimeWorked::process() method ...");
        $adb = PearDatabase::getInstance();
        $timecontrol = 'SELECT SUM(sum_time) as sum FROM vtiger_osstimecontrol
			INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_osstimecontrol.osstimecontrolid
			WHERE vtiger_crmentity.deleted=0 AND  vtiger_osstimecontrol.link = ?';
        $result_timecontrol = $adb->pquery($timecontrol, array($instance->getId()));
        $decimalTimeFormat = Vtiger_Functions::decimalTimeFormat($adb->query_result($result_timecontrol, 0, 'sum'));
        $log->debug("Exiting TotalTimeWorked::process() method ...");
        return $decimalTimeFormat['short'];
    }
 public function process($moduleName, $id, Vtiger_PDF_Model $pdf)
 {
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $fields = $moduleModel->getFields();
     $ids = $pdf->getRecordIds();
     if (!is_array($ids)) {
         $ids = [$ids];
     }
     $html = '<br><style>' . '.table {width: 100%; border-collapse: collapse;}' . '.table thead th {border-bottom: 1px solid grey;}' . '.table tbody tr {border-bottom: 1px solid grey}' . '.table tbody tr:nth-child(even) {background-color: #F7F7F7;}' . '.center {text-align: center;}' . '.summary {border-top: 1px solid grey;}' . '</style>';
     $html .= '<table class="table"><thead><tr>';
     foreach ($this->columnNames as $column) {
         $fieldModel = $fields[$column];
         $html .= '<th><span>' . vtranslate($fieldModel->get('label'), $moduleName) . '</span>&nbsp;</th>';
     }
     $html .= '</tr></thead><tbody>';
     $summary = [];
     foreach ($ids as $recordId) {
         $html .= '<tr>';
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
         foreach ($this->columnNames as $key => $column) {
             $fieldModel = $fields[$column];
             $class = '';
             if (in_array($column, ['time_start', 'time_end', 'due_date', 'date_start', 'sum_time'])) {
                 $class = 'class="center"';
             }
             $html .= '<td ' . $class . '>' . $recordModel->getDisplayValue($fieldModel->getName(), $recordId, true) . '</td>';
             if ($column == 'sum_time') {
                 $summary['sum_time'] += $recordModel->get($fieldModel->getName());
             }
         }
         $html .= '</tr>';
     }
     $html .= '</tbody><tfoot><tr>';
     foreach ($this->columnNames as $key => $column) {
         $class = $content = '';
         if ($column == 'sum_time') {
             $time = Vtiger_Functions::decimalTimeFormat($summary['sum_time']);
             $content = '<strong>' . $time['short'] . '</strong>';
             $class = 'center';
         } elseif ($column == 'name') {
             $content = '<strong>' . vtranslate('LBL_SUMMARY', $moduleName) . ':' . '</strong>';
         }
         $html .= '<td class="summary ' . $class . '">' . $content . '</td>';
     }
     $html .= '</tr></tfoot></table>';
     return $html;
 }
 public function process($moduleName, $id, Vtiger_PDF_Model $pdf)
 {
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $fields = $moduleModel->getFields();
     $html = '<br><style>' . '.table {width: 100%; border-collapse: collapse;}' . '.table thead th {border-bottom: 1px solid grey;}' . '.table tbody tr {border-bottom: 1px solid grey}' . '.table tbody tr:nth-child(even) {background-color: #F7F7F7;}' . '.center {text-align: center;}' . '.summary {border-top: 1px solid grey;}' . '</style>';
     $html .= '<table class="table"><thead><tr>';
     $html .= '<th>Nazwa użytkownika</th>';
     $html .= '<th class="center">Dział</th>';
     $html .= '<th class="center">Czas pracy</th>';
     $html .= '</tr></thead><tbody>';
     $summary = [];
     foreach ($this->getUserList($pdf, $moduleName) as $user => $data) {
         $html .= '<tr>';
         $html .= '<td>' . $user . '</td>';
         $html .= '<td class="center">' . $data['role'] . '</td>';
         $time = Vtiger_Functions::decimalTimeFormat($data['time']);
         $html .= '<td class="center">' . $time['short'] . '</td>';
         $html .= '</tr>';
     }
     $html .= '</tbody></table>';
     return $html;
 }
 function getListViewRecords($focus, $module, $result)
 {
     global $listview_max_textlength, $theme, $default_charset;
     require 'user_privileges/user_privileges_' . $this->user->id . '.php';
     $fields = $this->queryGenerator->getFields();
     $meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
     $moduleFields = $this->queryGenerator->getModuleFields();
     $accessibleFieldList = array_keys($moduleFields);
     $listViewFields = array_intersect($fields, $accessibleFieldList);
     $referenceFieldList = $this->queryGenerator->getReferenceFieldList();
     foreach ($referenceFieldList as $fieldName) {
         if (in_array($fieldName, $listViewFields)) {
             $field = $moduleFields[$fieldName];
             $this->fetchNameList($field, $result);
         }
     }
     $db = PearDatabase::getInstance();
     $rowCount = $db->num_rows($result);
     $ownerFieldList = $this->queryGenerator->getOwnerFieldList();
     foreach ($ownerFieldList as $fieldName) {
         if (in_array($fieldName, $listViewFields)) {
             $field = $moduleFields[$fieldName];
             $idList = array();
             for ($i = 0; $i < $rowCount; $i++) {
                 $id = $this->db->query_result($result, $i, $field->getColumnName());
                 if (!isset($this->ownerNameList[$fieldName][$id])) {
                     $idList[] = $id;
                 }
             }
             if (count($idList) > 0) {
                 if (!is_array($this->ownerNameList[$fieldName])) {
                     $this->ownerNameList[$fieldName] = getOwnerNameList($idList);
                 } else {
                     //array_merge API loses key information so need to merge the arrays
                     // manually.
                     $newOwnerList = getOwnerNameList($idList);
                     foreach ($newOwnerList as $id => $name) {
                         $this->ownerNameList[$fieldName][$id] = $name;
                     }
                 }
             }
         }
     }
     foreach ($listViewFields as $fieldName) {
         $field = $moduleFields[$fieldName];
         if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
             $this->setupAccessiblePicklistValueList($fieldName);
         }
     }
     $useAsterisk = get_use_asterisk($this->user->id);
     $data = array();
     for ($i = 0; $i < $rowCount; ++$i) {
         //Getting the recordId
         if ($module != 'Users') {
             $baseTable = $meta->getEntityBaseTable();
             $moduleTableIndexList = $meta->getEntityTableIndexList();
             $baseTableIndex = $moduleTableIndexList[$baseTable];
             $recordId = $db->query_result($result, $i, $baseTableIndex);
         } else {
             $recordId = $db->query_result($result, $i, "id");
         }
         $row = array();
         foreach ($listViewFields as $fieldName) {
             $field = $moduleFields[$fieldName];
             $uitype = $field->getUIType();
             $rawValue = $this->db->query_result($result, $i, $field->getColumnName());
             if (in_array($uitype, array(15, 33, 16))) {
                 $value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
             } else {
                 $value = $rawValue;
             }
             if ($module == 'Documents' && $fieldName == 'filename') {
                 $downloadtype = $db->query_result($result, $i, 'filelocationtype');
                 $fileName = $db->query_result($result, $i, 'filename');
                 $downloadType = $db->query_result($result, $i, 'filelocationtype');
                 $status = $db->query_result($result, $i, 'filestatus');
                 $fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
                 $fileIdRes = $db->pquery($fileIdQuery, array($recordId));
                 $fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
                 if ($fileName != '' && $status == 1) {
                     if ($downloadType == 'I') {
                         $value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="index.php?module=Documents&action=DownloadFile&record=' . $recordId . '&fileid=' . $fileId . '"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
                     } elseif ($downloadType == 'E') {
                         $value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="' . $fileName . '" target="_blank"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
                     } else {
                         $value = ' --';
                     }
                 }
                 $value = $fileicon . $value;
             } elseif ($module == 'Documents' && $fieldName == 'filesize') {
                 $downloadType = $db->query_result($result, $i, 'filelocationtype');
                 if ($downloadType == 'I') {
                     $filesize = $value;
                     if ($filesize < 1024) {
                         $value = $filesize . ' B';
                     } elseif ($filesize > 1024 && $filesize < 1048576) {
                         $value = round($filesize / 1024, 2) . ' KB';
                     } else {
                         if ($filesize > 1048576) {
                             $value = round($filesize / (1024 * 1024), 2) . ' MB';
                         }
                     }
                 } else {
                     $value = ' --';
                 }
             } elseif ($module == 'Documents' && $fieldName == 'filestatus') {
                 if ($value == 1) {
                     $value = getTranslatedString('yes', $module);
                 } elseif ($value == 0) {
                     $value = getTranslatedString('no', $module);
                 } else {
                     $value = '--';
                 }
             } elseif ($module == 'Documents' && $fieldName == 'filetype') {
                 $downloadType = $db->query_result($result, $i, 'filelocationtype');
                 if ($downloadType == 'E' || $downloadType != 'I') {
                     $value = '--';
                 }
             } elseif ($module == 'OSSTimeControl' && $fieldName == 'sum_time') {
                 $value = Vtiger_Functions::decimalTimeFormat($value);
                 $value = $value['short'];
             } elseif ($field->getUIType() == '27') {
                 if ($value == 'I') {
                     $value = getTranslatedString('LBL_INTERNAL', $module);
                 } elseif ($value == 'E') {
                     $value = getTranslatedString('LBL_EXTERNAL', $module);
                 } else {
                     $value = ' --';
                 }
                 $value = Vtiger_Functions::textLength($value);
             } elseif ($field->getFieldDataType() == 'picklist') {
                 $value = Vtiger_Language_Handler::getTranslatedString($value, $module);
                 $value = textlength_check($value);
             } elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
                 if ($value != '' && $value != '0000-00-00') {
                     $fieldDataType = $field->getFieldDataType();
                     if ($module == 'Calendar' && ($fieldName == 'date_start' || $fieldName == 'due_date')) {
                         if ($fieldName == 'date_start') {
                             $timeField = 'time_start';
                         } else {
                             if ($fieldName == 'due_date') {
                                 $timeField = 'time_end';
                             }
                         }
                         $timeFieldValue = $this->db->query_result($result, $i, $timeField);
                         if (!empty($timeFieldValue)) {
                             $value .= ' ' . $timeFieldValue;
                             //TO make sure it takes time value as well
                             $fieldDataType = 'datetime';
                         }
                     }
                     if ($fieldDataType == 'datetime') {
                         $value = Vtiger_Datetime_UIType::getDateTimeValue($value);
                     } else {
                         if ($fieldDataType == 'date') {
                             $date = new DateTimeField($value);
                             $value = $date->getDisplayDate();
                         }
                     }
                 } elseif ($value == '0000-00-00') {
                     $value = '';
                 }
             } elseif ($field->getFieldDataType() == 'time') {
                 if (!empty($value)) {
                     $userModel = Users_Privileges_Model::getCurrentUserModel();
                     if ($userModel->get('hour_format') == '12') {
                         $value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
                     }
                 }
             } elseif ($field->getFieldDataType() == 'currency') {
                 if ($value != '') {
                     if ($field->getUIType() == 72) {
                         if ($fieldName == 'unit_price') {
                             $currencyId = getProductBaseCurrency($recordId, $module);
                             $cursym_convrate = getCurrencySymbolandCRate($currencyId);
                             $currencySymbol = $cursym_convrate['symbol'];
                         } else {
                             $currencyInfo = getInventoryCurrencyInfo($module, $recordId);
                             $currencySymbol = $currencyInfo['currency_symbol'];
                         }
                         $value = CurrencyField::convertToUserFormat($value, null, true);
                         $row['currencySymbol'] = $currencySymbol;
                         $value = CurrencyField::appendCurrencySymbol($value, $currencySymbol);
                     } else {
                         if (!empty($value)) {
                             $value = CurrencyField::convertToUserFormat($value);
                             $currencyModal = new CurrencyField($value);
                             $currencyModal->initialize();
                             $value = $currencyModal->appendCurrencySymbol($value, $currencyModal->currencySymbol);
                         }
                     }
                 }
             } elseif ($field->getFieldDataType() == 'url') {
                 $matchPattern = "^[\\w]+:\\/\\/^";
                 preg_match($matchPattern, $rawValue, $matches);
                 if (!empty($matches[0])) {
                     $value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
                 } else {
                     $value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
                 }
             } elseif ($field->getFieldDataType() == 'email') {
                 $current_user = vglobal('current_user');
                 if ($current_user->internal_mailer == 1) {
                     //check added for email link in user detailview
                     $value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}','{$module}');\">" . textlength_check($value) . "</a>";
                 } else {
                     $value = '<a class="emailField" href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
                 }
             } elseif ($field->getFieldDataType() == 'boolean') {
                 if ($value === 'on') {
                     $value = 1;
                 } else {
                     if ($value == 'off') {
                         $value = 0;
                     }
                 }
                 if ($value == 1) {
                     $value = getTranslatedString('yes', $module);
                 } elseif ($value == 0) {
                     $value = getTranslatedString('no', $module);
                 } else {
                     $value = '--';
                 }
             } elseif ($field->getUIType() == 98) {
                 $value = '<a href="index.php?module=Roles&parent=Settings&view=Edit&record=' . $value . '">' . textlength_check(getRoleName($value)) . '</a>';
             } elseif ($field->getFieldDataType() == 'multipicklist') {
                 $value = $value != "" ? str_replace(' |##| ', ', ', $value) : "";
                 if (!$is_admin && $value != '') {
                     $valueArray = $rawValue != "" ? explode(' |##| ', $rawValue) : array();
                     $tmp = '';
                     $tmpArray = array();
                     foreach ($valueArray as $index => $val) {
                         if (!$listview_max_textlength || !(strlen(preg_replace("/(<\\/?)(\\w+)([^>]*>)/i", "", $tmp)) > $listview_max_textlength)) {
                             $tmpArray[] = $val;
                             $tmp .= ', ' . $val;
                         } else {
                             $tmpArray[] = '...';
                             $tmp .= '...';
                         }
                     }
                     $value = implode(', ', $tmpArray);
                     $value = textlength_check($value);
                 }
             } elseif ($field->getFieldDataType() == 'skype') {
                 $value = $value != "" ? "<a href='skype:{$value}?call'>" . textlength_check($value) . "</a>" : "";
             } elseif ($field->getUIType() == 11) {
                 $outgoingCallPermission = Vtiger_Mobile_Model::checkPermissionForOutgoingCall();
                 if ($outgoingCallPermission && !empty($value)) {
                     $phoneNumber = preg_replace('/[-()\\s]/', '', $value);
                     $value = '<a class="phoneField" data-phoneNumber="' . $phoneNumber . '" record="' . $recordId . '" onclick="Vtiger_Mobile_Js.registerOutboundCall(\'' . $phoneNumber . '\', ' . $recordId . ')">' . textlength_check($value) . '</a>';
                     $callUsers = Vtiger_Mobile_Model::getPrivilegesUsers();
                     if ($callUsers) {
                         $value .= '  <a class="btn btn-xs noLinkBtn" onclick="Vtiger_Mobile_Js.registerOutboundCallToUser(this,\'' . $phoneNumber . '\',' . $recordId . ')" data-placement="right" data-original-title="' . vtranslate('LBL_SELECT_USER_TO_CALL', $module) . '" data-content=\'<select class="select sesectedUser" name="sesectedUser">';
                         foreach ($callUsers as $key => $item) {
                             $value .= '<option value="' . $key . '">' . $item . '</option>';
                         }
                         $value .= '</select><br /><a class="btn btn-success popoverCallOK">' . vtranslate('LBL_BTN_CALL', $module) . '</a>   <a class="btn btn-inverse popoverCallCancel">' . vtranslate('LBL_CANCEL', $module) . '</a>\' data-trigger="manual"><i class="icon-user"></i></a>';
                     }
                 } else {
                     $value = textlength_check($value);
                 }
             } elseif ($field->getFieldDataType() == 'reference') {
                 $referenceFieldInfoList = $this->queryGenerator->getReferenceFieldInfoList();
                 $moduleList = $referenceFieldInfoList[$fieldName];
                 if (count($moduleList) == 1) {
                     $parentModule = reset($moduleList);
                 } else {
                     $parentModule = $this->typeList[$value];
                 }
                 if (!empty($value) && !empty($this->nameList[$fieldName]) && !empty($parentModule)) {
                     $parentMeta = $this->queryGenerator->getMeta($parentModule);
                     $value = textlength_check($this->nameList[$fieldName][$value]);
                     if ($parentMeta->isModuleEntity() && $parentModule != "Users") {
                         $value = "<a class='moduleColor_{$parentModule}' href='?module={$parentModule}&view=Detail&" . "record={$rawValue}' title='" . getTranslatedString($parentModule, $parentModule) . "'>{$value}</a>";
                     }
                 } else {
                     $value = '--';
                 }
             } elseif ($field->getFieldDataType() == 'owner') {
                 $value = textlength_check($this->ownerNameList[$fieldName][$value]);
             } elseif ($field->getUIType() == 25) {
                 //TODO clean request object reference.
                 $contactId = $_REQUEST['record'];
                 $emailId = $this->db->query_result($result, $i, "activityid");
                 $result1 = $this->db->pquery("SELECT access_count FROM vtiger_email_track WHERE " . "crmid=? AND mailid=?", array($contactId, $emailId));
                 $value = $this->db->query_result($result1, 0, "access_count");
                 if (!$value) {
                     $value = 0;
                 }
             } elseif ($field->getUIType() == 8) {
                 if (!empty($value)) {
                     $temp_val = html_entity_decode($value, ENT_QUOTES, $default_charset);
                     $json = new Zend_Json();
                     $value = vt_suppressHTMLTags(implode(',', $json->decode($temp_val)));
                 }
             } elseif ($field->getFieldDataType() == 'taxes') {
                 if (!empty($value)) {
                     $valueArray = $value != "" ? explode(',', $value) : [];
                     $tmp = '';
                     $tmpArray = [];
                     $taxs = Vtiger_Taxes_UIType::getTaxes();
                     foreach ($valueArray as $index => $tax) {
                         if (isset($taxs[$tax])) {
                             $tmpArray[] = $taxs[$tax]['value'] . '% - ' . $taxs[$tax]['name'];
                         }
                     }
                     $value = implode(', ', $tmpArray);
                     $value = Vtiger_Functions::textLength($value);
                 }
             } elseif ($field->getFieldDataType() == 'inventoryLimit') {
                 if (!empty($value)) {
                     $valueArray = $value != "" ? explode(',', $value) : [];
                     $tmp = '';
                     $tmpArray = [];
                     $limits = Vtiger_InventoryLimit_UIType::getLimits();
                     foreach ($valueArray as $index => $limit) {
                         if (isset($limits[$limit])) {
                             $tmpArray[] = $limits[$limit]['value'] . ' - ' . $limits[$limit]['name'];
                         }
                     }
                     $value = implode(', ', $tmpArray);
                     $value = Vtiger_Functions::textLength($value);
                 }
             } elseif ($field->getFieldDataType() == 'multiReferenceValue') {
                 $params = $field->getFieldParams();
                 $fieldModel = Vtiger_Field_Model::getInstanceFromFieldId($params['field']);
                 $valueTmp = trim($value, '|#|');
                 $valueTmp = $valueTmp != "" ? explode('|#|', $valueTmp) : [];
                 foreach ($valueTmp as $index => $tmp) {
                     $valueTmp[$index] = $fieldModel->getUITypeModel()->getDisplayValue($tmp);
                 }
                 $value = implode(', ', $valueTmp);
                 $value = Vtiger_Functions::textLength($value);
             } elseif (in_array($uitype, array(7, 9, 90))) {
                 $value = "<span align='right'>" . textlength_check($value) . "</div>";
             } else {
                 $value = Vtiger_Functions::textLength($value);
             }
             //				// vtlib customization: For listview javascript triggers
             //				$value = "$value <span type='vtlib_metainfo' vtrecordid='{$recordId}' vtfieldname=".
             //					"'{$fieldName}' vtmodule='$module' style='display:none;'></span>";
             //				// END
             $row[$fieldName] = $value;
         }
         $data[$recordId] = $row;
     }
     return $data;
 }
示例#8
0
 public function getEntity()
 {
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $db = PearDatabase::getInstance();
     $data = $this->getQuery();
     $result = $db->pquery($data['query'], $data['params']);
     $return = [];
     while ($record = $db->fetch_array($result)) {
         $item = [];
         $crmid = $record['activityid'];
         $activitytype = $record['activitytype'];
         $item['id'] = $crmid;
         $item['module'] = $this->getModuleName();
         $item['title'] = $record['subject'];
         $item['url'] = 'index.php?module=' . $this->getModuleName() . '&view=Detail&record=' . $crmid;
         $item['set'] = $record['activitytype'] == 'Task' ? 'Task' : 'Event';
         $item['lok'] = $record['location'];
         $item['pri'] = $record['priority'];
         $item['sta'] = $record['status'];
         $item['vis'] = $record['visibility'];
         $item['state'] = $record['state'];
         $item['smownerid'] = Vtiger_Functions::getOwnerRecordLabel($record['smownerid']);
         //translate
         $item['labels']['sta'] = vtranslate($record['status'], $this->getModuleName());
         $item['labels']['pri'] = vtranslate($record['priority'], $this->getModuleName());
         $item['labels']['state'] = vtranslate($record['state'], $this->getModuleName());
         //Relation
         $item['link'] = $record['link'];
         $item['linkl'] = $record['linklabel'];
         $item['linkm'] = $record['linkmod'];
         //Process
         $item['process'] = $record['process'];
         $item['procl'] = $record['processlabel'];
         $item['procm'] = $record['processmod'];
         //Subprocess
         $item['subprocess'] = $record['subprocess'];
         $item['subprocl'] = $record['subprocesslabel'];
         $item['subprocm'] = $record['subprocessmod'];
         if ($record['linkmod'] != 'Accounts' && (!empty($record['link']) || !empty($record['process']))) {
             $findId = 0;
             $findMod = '';
             if (!empty($record['link'])) {
                 $findId = $record['link'];
                 $findMod = $record['linkmod'];
             }
             if (!empty($record['process'])) {
                 $findId = $record['process'];
                 $findMod = $record['processmod'];
             }
             $tabInfo = $this->relationAcounts[$findMod];
             if ($tabInfo) {
                 $findResult = $db->pquery('SELECT accountid, accountname FROM vtiger_account ' . 'INNER JOIN ' . $tabInfo[0] . ' ON vtiger_account.accountid = ' . $tabInfo[0] . '.' . $tabInfo[2] . ' WHERE ' . $tabInfo[1] . ' = ?;', [$findId]);
                 if ($db->num_rows($findResult) > 0) {
                     $item['accid'] = $db->query_result_raw($findResult, 0, 'accountid');
                     $item['accname'] = $db->query_result_raw($findResult, 0, 'accountname');
                 }
             }
         }
         $dateTimeFieldInstance = new DateTimeField($record['date_start'] . ' ' . $record['time_start']);
         $userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
         $startDateTimeDisplay = $dateTimeFieldInstance->getDisplayDateTimeValue();
         $startTimeDisplay = $dateTimeFieldInstance->getDisplayTime();
         $dateTimeComponents = explode(' ', $userDateTimeString);
         $dateComponent = $dateTimeComponents[0];
         $startTimeFormated = $dateTimeComponents[1];
         //Conveting the date format in to Y-m-d . since full calendar expects in the same format
         $startDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
         $dateTimeFieldInstance = new DateTimeField($record['due_date'] . ' ' . $record['time_end']);
         $userDateTimeString = $dateTimeFieldInstance->getFullcalenderDateTimevalue($currentUser);
         $endDateTimeDisplay = $dateTimeFieldInstance->getDisplayDateTimeValue();
         $dateTimeComponents = explode(' ', $userDateTimeString);
         $dateComponent = $dateTimeComponents[0];
         $endTimeFormated = $dateTimeComponents[1];
         //Conveting the date format in to Y-m-d . since full calendar expects in the same format
         $endDateFormated = DateTimeField::__convertToDBFormat($dateComponent, $currentUser->get('date_format'));
         $item['start'] = $startDateFormated . ' ' . $startTimeFormated;
         $item['end'] = $endDateFormated . ' ' . $endTimeFormated;
         // display date time values
         $item['start_display'] = $startDateTimeDisplay;
         $item['end_display'] = $endDateTimeDisplay;
         $item['hour_start'] = $startTimeDisplay;
         $hours = Vtiger_Functions::getDateTimeHoursDiff($item['start'], $item['end']);
         $item['hours'] = Vtiger_Functions::decimalTimeFormat($hours)['short'];
         $item['allDay'] = $record['allday'] == 1 ? true : false;
         $item['className'] = ' userCol_' . $record['smownerid'] . ' calCol_' . $activitytype;
         $return[] = $item;
     }
     return $return;
 }