public function displayOptions() { if (!isset($this->v_ids) || count($this->v_ids) == 0) { $this->_searchFields['v_ids']['input_name0'] = array_keys(get_user_array(false)); } return parent::displayOptions(); }
public function view($id) { $uploads = array('report' => array(), 'account_list' => ''); if ($this->input->post('update_project')) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png|pdf|doc|docx|txt'; $this->load->library('upload', $config); foreach ($this->dates as $key => $value) { $tmp = array(); if ($_FILES['report_' . $value]['size'] > 0) { $this->upload->do_upload('report_' . $value); $tmp = $this->upload->data(); $uploads['report'][][$key] = @$tmp['file_name']; } } if ($_FILES['account_list']['size'] > 0) { $this->upload->do_upload('account_list'); $tmp = array(); $tmp = $this->upload->data(); $uploads['account_list'] = $tmp['file_name']; } $this->projects_model->update_project($id, $this->input->post(), $uploads); $this->session->set_flashdata('projects', 'The project has been updated'); redirect('projects/view/' . $id); } $data = array(); $data['staff'] = get_user_array(); $data['data'] = $this->projects_model->get_project_data($id); $this->load->view('projects/view', $data); }
function template_reports_request_vars_js(&$smarty, &$reporter, &$args) { $field_defs = $reporter->focus->field_defs; $table_columns = array(); $hidden_columns = array(); if (!isset($reporter->report_def['report_type'])) { $report_type = 'tabular'; } else { $report_type = $reporter->report_def['report_type']; } // else $allowed_modules_arr = array(); global $report_modules; foreach ($report_modules as $module => $name) { array_push($allowed_modules_arr, "\"{$module}\":1"); } // foreach $allowed_modules_js = implode(",", $allowed_modules_arr); $smarty->assign('allowed_modules_js', "{" . $allowed_modules_js . "}"); $smarty->assign('reporter_report_def_str1', $reporter->report_def_str); if (isset($reporter->report_def['goto_anchor'])) { $goto_anchor = $reporter->report_def['goto_anchor']; } else { $goto_anchor = "\"\""; } // else $smarty->assign('goto_anchor', $goto_anchor); $user_array = get_user_array(FALSE); $smarty->assign('user_array', $user_array); }
public function testGetUserArray() { $users1 = get_user_array(false, ''); $users2 = get_user_array(false, '', '', true, "{$this->user->user_name}"); $users3 = get_user_array(false, '', '', true, "{$this->user2->user_name}"); $this->assertNotEquals(count($users1), count($users2), 'get_user_array does not filter correctly on cache'); $this->assertEquals(1, count($users2), 'get_user_array does not filter correctly on cache'); $this->assertEquals(1, count($users3), 'get_user_array does not filter correctly on cache'); }
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $vardef['options'] = get_user_array(false); if (!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); return $this->fetch('include/SugarFields/Fields/Multienum/EditViewFunction.tpl'); } else { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); return $this->fetch('include/SugarFields/Fields/Assigned_user_name/SearchView.tpl'); } }
function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) { $vardef['options'] = get_user_array(false); if (!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); return $this->fetch($this->findTemplate('EditViewFunction')); } else { $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex); return $this->fetch($this->findTemplate('SearchView')); } }
/** Function returns the user array * @param $assigned_user_id -- assigned_user_id:: Type string * @returns $user_list -- user list:: Type array * */ function get_assigned_user_name(&$assigned_user_id) { global $log; $log->debug("Entering get_assigned_user_name() method ..."); $user_list =& get_user_array(false, ""); if (isset($user_list[$assigned_user_id])) { $log->debug("Exiting get_assigned_user_name method ..."); return $user_list[$assigned_user_id]; } $log->debug("Exiting get_assigned_user_name method ..."); return ""; }
function vtJsonOwnersList($adb) { $ownersList = array(); $activeUsersList = get_user_array(false); $allGroupsList = get_group_array(false); foreach ($activeUsersList as $userId => $userName) { $ownersList[] = array('label' => $userName, 'value' => getUserName($userId), 'id' => $userId); } foreach ($allGroupsList as $groupId => $groupName) { $ownersList[] = array('label' => $groupName, 'value' => $groupName, 'id' => $groupId); } echo Zend_Json::encode($ownersList); }
public function profile($id) { if ($this->input->post('update_caller')) { $this->helpline_model->update_caller($this->input->post()); $this->session->set_flashdata('helpline', 'The profile has been updated.'); redirect('helpline/profile/' . $id); } $data['reference_agencies'] = get_option_for_dropdown('reference_agencies'); $data['staff'] = get_user_array(); $data['caller'] = $this->helpline_model->get_caller($id); $data['ethnicity'] = $this->config->item('ethnicity'); $data['relationship'] = $this->config->item('relationship'); $data['gender'] = $this->config->item('gender'); $data['education'] = $this->config->item('education'); $this->load->view('helpline/profile', $data); }
/** * @see DashletGenericChart::displayOptions() */ public function displayOptions() { global $app_list_strings; $selected_datax = array(); if (!empty($this->lsbo_lead_sources) && sizeof($this->lsbo_lead_sources) > 0) { foreach ($this->lsbo_lead_sources as $key) { $selected_datax[] = $key; } } else { $selected_datax = array_keys($app_list_strings['lead_source_dom']); } $this->_searchFields['lsbo_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']); $this->_searchFields['lsbo_lead_sources']['input_name0'] = $selected_datax; if (!isset($this->lsbo_ids) || count($this->lsbo_ids) == 0) { $this->_searchFields['lsbo_ids']['input_name0'] = array_keys(get_user_array(false)); } return parent::displayOptions(); }
/** * This function loads portal config vars from db and sets them for the view * @see SugarView::display() for more info */ function display() { $portalFields = array('appStatus' => 'offline', 'logoURL' => '', 'maxQueryResult' => '20', 'maxSearchQueryResult' => '5', 'defaultUser' => ''); $userList = get_user_array(); $userList[''] = ''; require_once "modules/MySettings/TabController.php"; $controller = new TabController(); $disabledModulesFlag = false; $disabledModules = array_diff($controller->getAllPortalTabs(), $controller->getPortalTabs()); if (!empty($disabledModules)) { $disabledModulesFlag = true; array_walk($disabledModules, function (&$item) { $item = translate($item); }); } $admin = Administration::getSettings(); $portalConfig = $admin->getConfigForModule('portal', 'support', true); $portalConfig['appStatus'] = !empty($portalConfig['on']) ? 'online' : 'offline'; $smarty = new Sugar_Smarty(); $smarty->assign('disabledDisplayModulesList', $disabledModules); $smarty->assign('disabledDisplayModules', $disabledModulesFlag); foreach ($portalFields as $fieldName => $fieldDefault) { if (isset($portalConfig[$fieldName])) { $smarty->assign($fieldName, html_entity_decode($portalConfig[$fieldName])); } else { $smarty->assign($fieldName, $fieldDefault); } } $smarty->assign('userList', $userList); $smarty->assign('welcome', $GLOBALS['mod_strings']['LBL_SYNCP_WELCOME']); $smarty->assign('mod', $GLOBALS['mod_strings']); $smarty->assign('siteURL', $GLOBALS['sugar_config']['site_url']); if (isset($_REQUEST['label'])) { $smarty->assign('label', $_REQUEST['label']); } $options = !empty($GLOBALS['system_config']->settings['system_portal_url']) ? $GLOBALS['system_config']->settings['system_portal_url'] : 'https://'; $smarty->assign('options', $options); $ajax = new AjaxCompose(); $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")'); $ajax->addCrumb(ucwords(translate('LBL_PORTAL_CONFIGURE')), ''); $ajax->addSection('center', translate('LBL_SUGARPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl')); $GLOBALS['log']->debug($smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl')); echo $ajax->getJavascript(); }
/** * Run the Upgrade Task * * Set the user preference for email link type to 'mailto' if the system configuration is not properly set */ public function run() { if (!version_compare($this->from_version, '7.2.0', "<")) { return; } $user = BeanFactory::getBean('Users'); $users = get_user_array(false); foreach ($users as $userId => $userName) { $user->retrieve($userId); $emailClientPreference = $user->getPreference('email_link_type'); if ($emailClientPreference == 'sugar') { $mailerPreferenceStatus = OutboundEmailConfigurationPeer::getMailConfigurationStatusForUser($user, 'sugar'); if ($mailerPreferenceStatus != OutboundEmailConfigurationPeer::STATUS_VALID_CONFIG) { $user->setPreference('email_link_type', 'mailto'); } $user->savePreferencesToDB(); } } }
function get_new_record_form() { if (!ACLController::checkAccess('ProjectTask', 'edit', true)) { return ''; } global $app_strings; global $mod_strings; global $currentModule; global $current_user; global $sugar_version, $sugar_config; $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']); $form = new XTemplate('modules/ProjectTask/Forms.html'); $module_select = empty($_REQUEST['module_select']) ? '' : $_REQUEST['module_select']; $form->assign('mod', $mod_strings); $form->assign('app', $app_strings); $form->assign('module', $currentModule); $options = get_select_options_with_id(get_user_array(), $current_user->id); $form->assign('ASSIGNED_USER_OPTIONS', $options); /////////////////////////////////////// /// /// SETUP ACCOUNT POPUP $popup_request_data = array('call_back_function' => 'set_return', 'form_name' => "quick_save", 'field_to_name_array' => array('id' => 'parent_id', 'name' => 'project_name')); $json = getJSONobj(); $encoded_popup_request_data = $json->encode($popup_request_data); // /////////////////////////////////////// $form->assign('encoded_popup_request_data', $encoded_popup_request_data); $form->parse('main'); $the_form .= $form->text('main'); require_once 'modules/ProjectTask/ProjectTask.php'; $focus = new ProjectTask(); require_once 'include/javascript/javascript.php'; $javascript = new javascript(); $javascript->setFormName('quick_save'); $javascript->setSugarBean($focus); $javascript->addRequiredFields(''); $jscript = $javascript->getScript(); $the_form .= $jscript . get_left_form_footer(); return $the_form; }
public function _edit($model, $view, $id) { $this->load->model($model); if ($this->input->post('do_action')) { $this->{$model}->update($this->input->post(), $id); redirect('lasrmetrics/' . $view . '/edit/' . $id); } $data = array(); $data = (array) $this->{$model}->fetch($id); $data['staff'] = get_user_array(); $data['locations'] = get_option_for_dropdown('office_locations'); $data['presenter_types'] = get_option_for_dropdown('presenter_types'); $data['program_types'] = get_option_for_dropdown('program_types'); $data['group_types'] = get_option_for_dropdown('group_types'); $data['event_types'] = get_option_for_dropdown('event_types'); $data['education_programs'] = get_option_for_dropdown('education_programs'); $data['target_audiences'] = get_option_for_dropdown('target_audiences'); $data['SPA'] = get_option_for_dropdown('SPA'); $data['grant_programs'] = get_option_for_dropdown('grant_programs'); $data['engagement_types'] = get_option_for_dropdown('engagement_types'); $data['counties'] = get_option_for_dropdown('counties'); $this->load->view('lasrmetrics/' . $view . '/edit', $data); }
function draw($extra_tools) { require_once 'include/utils.php'; global $app_list_strings, $current_language, $ids, $sugar_config, $theme; $current_module_strings = return_module_language($current_language, 'Charts'); if (isset($_REQUEST['pbls_refresh'])) { $refresh = $_REQUEST['pbls_refresh']; } else { $refresh = false; } $tempx = array(); $datax = array(); $selected_datax = array(); //get list of sales stage keys to display global $current_user; $user_tempx = $current_user->getPreference('pbls_lead_sources'); if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbls_lead_sources'])) { $tempx = $user_tempx; $GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:"); $GLOBALS['log']->debug($user_tempx); } elseif (isset($_REQUEST['pbls_lead_sources']) && count($_REQUEST['pbls_lead_sources']) > 0) { $tempx = $_REQUEST['pbls_lead_sources']; $current_user->setPreference('pbls_lead_sources', $_REQUEST['pbls_lead_sources']); $GLOBALS['log']->debug("_REQUEST['pbls_lead_sources'] is:"); $GLOBALS['log']->debug($_REQUEST['pbls_lead_sources']); $GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:"); $GLOBALS['log']->debug($current_user->getPreference('pbls_lead_sources')); } //set $datax using selected sales stage keys if (count($tempx) > 0) { foreach ($tempx as $key) { $datax[$key] = $app_list_strings['lead_source_dom'][$key]; array_push($selected_datax, $key); } } else { $datax = $app_list_strings['lead_source_dom']; $selected_datax = array_keys($app_list_strings['lead_source_dom']); } $GLOBALS['log']->debug("datax is:"); $GLOBALS['log']->debug($datax); $ids = array(); $user_ids = $current_user->getPreference('pbls_ids'); //get list of user ids for which to display data if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbls_ids'])) { if (isset($_SESSION['pbls_ids'])) { $ids = $_SESSION['pbls_ids']; } $GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:"); $GLOBALS['log']->debug($user_ids); } elseif (isset($_REQUEST['pbls_ids']) && count($_REQUEST['pbls_ids']) > 0) { $ids = $_REQUEST['pbls_ids']; $current_user->setPreference('pbls_ids', $ids); $GLOBALS['log']->debug("_REQUEST['pbls_ids'] is:"); $GLOBALS['log']->debug($_REQUEST['pbls_ids']); $GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:"); $GLOBALS['log']->debug($current_user->getPreference('pbls_ids')); } else { $ids = get_user_array(false); $ids = array_keys($ids); } //create unique prefix based on selected users for image files $id_hash = '1'; if (isset($ids) && is_array($ids)) { sort($ids); $id_hash = crc32(implode('', $ids)); if ($id_hash < 0) { $id_hash = $id_hash * -1; } } $GLOBALS['log']->debug("ids is:"); $GLOBALS['log']->debug($ids); $id_md5 = substr(md5($current_user->id), 0, 9); $seps = array("-", "/"); $dates = array(date('Y-m-d'), date('Y-m-d')); $dateFileNameSafe = str_replace($seps, "_", $dates); $cache_file_name = $current_user->getUserPrivGuid() . "_pipeline_by_lead_source_" . $dateFileNameSafe[0] . "_" . $dateFileNameSafe[1] . ".xml"; $GLOBALS['log']->debug("cache file name is: {$cache_file_name}"); global $currentModule, $action, $image_path; $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&pbls_refresh=true" class="chartToolsLink">' . get_image($image_path . 'refresh', 'alt="Refresh" border="0" align="absmiddle"') . ' ' . $current_module_strings['LBL_REFRESH'] . '</a> <a href="javascript: toggleDisplay(\'pbls_edit\');" class="chartToolsLink">' . get_image($image_path . 'edit', 'alt="Edit" border="0" align="absmiddle"') . ' ' . $current_module_strings['LBL_EDIT'] . '</a> ' . $extra_tools . '</div>'; ?> <?php echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_LEAD_SOURCE_FORM_TITLE'], $tools, false) . '</span>'; if (empty($_SESSION['pbls_lead_sources'])) { $_SESSION['pbls_lead_sources'] = ""; } if (empty($_SESSION['pbls_ids'])) { $_SESSION['pbls_ids'] = ""; } ?> <p> <div id='pbls_edit' style='display: none;'> <form action="index.php" method="post" > <input type="hidden" name="module" value="<?php echo $currentModule; ?> "> <input type="hidden" name="action" value="<?php echo $action; ?> "> <input type="hidden" name="pbls_refresh" value="true"> <table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center"> <tr> <td valign='top' nowrap><b><?php echo $current_module_strings['LBL_LEAD_SOURCES']; ?> </b></td> <td valign='top'><select name="pbls_lead_sources[]" multiple size='3'><?php echo get_select_options_with_id($app_list_strings['lead_source_dom'], $selected_datax); ?> </select></td> <td valign='top' nowrap><b><?php echo $current_module_strings['LBL_USERS']; ?> </b></td> <td valign='top'><select name="pbls_ids[]" multiple size='3'><?php $allUsers = get_user_array(false); echo get_select_options_with_id($allUsers, $ids); ?> </select></td> <?php global $app_strings; ?> <td align="right" valign="top"><input class="button" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?> " accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?> " value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']; ?> " /><input class="button" onClick="javascript: toggleDisplay('pbls_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?> " accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY']; ?> " value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']; ?> "/></td> </tr> </table> </form> </div> </p> <?php // draw table echo "<p align='center'>" . $this->gen_xml($datax, $ids, $sugar_config['tmp_dir'] . $cache_file_name, $refresh, $current_module_strings) . "</p>"; echo "<P align='center'><span class='chartFootnote'>" . $current_module_strings['LBL_LEAD_SOURCE_FORM_DESC'] . "</span></P>"; if (file_exists($sugar_config['tmp_dir'] . $cache_file_name)) { global $timedate; $file_date = date($timedate->get_date_format() . " " . $timedate->get_time_format(), filemtime($sugar_config['tmp_dir'] . $cache_file_name)); } else { $file_date = ''; } ?> <span class='chartFootnote'> <p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'] . ' ' . $file_date; ?> </i></p> </span> <?php }
function displayInput(&$layout_def) { $selected_users = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']; $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; return $str; }
function display() { global $current_user, $app_list_strings; //lets set the return values if (isset($_REQUEST['return_module'])) { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); } $this->ss->assign('IS_ADMIN', $current_user->is_admin ? true : false); //make sure we can populate user type dropdown. This usually gets populated in predisplay unless this is a quickeditform if (!isset($this->fieldHelper)) { $this->fieldHelper = UserViewHelper::create($this->ss, $this->bean, 'EditView'); $this->fieldHelper->setupAdditionalFields(); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); $this->ss->assign('RETURN_ACTION', $_REQUEST['return_action']); $this->ss->assign('RETURN_ID', $_REQUEST['record']); $this->bean->id = ""; $this->bean->user_name = ""; $this->ss->assign('ID', ''); } else { if (isset($_REQUEST['return_module'])) { $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']); } else { $this->ss->assign('RETURN_MODULE', $this->bean->module_dir); } $return_id = isset($_REQUEST['return_id']) ? $_REQUEST['return_id'] : $this->bean->id; if (isset($return_id)) { $return_action = isset($_REQUEST['return_action']) ? $_REQUEST['return_action'] : 'DetailView'; $this->ss->assign('RETURN_ID', $return_id); $this->ss->assign('RETURN_ACTION', $return_action); } } /////////////////////////////////////////////////////////////////////////////// //// REDIRECTS FROM COMPOSE EMAIL SCREEN if (isset($_REQUEST['type']) && (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails')) { $this->ss->assign('REDIRECT_EMAILS_TYPE', $_REQUEST['type']); } //// END REDIRECTS FROM COMPOSE EMAIL SCREEN /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //// NEW USER CREATION ONLY if (empty($this->bean->id)) { $this->ss->assign('SHOW_ADMIN_CHECKBOX', 'height="30"'); $this->ss->assign('NEW_USER', '1'); } else { $this->ss->assign('NEW_USER', '0'); $this->ss->assign('NEW_USER_TYPE', 'DISABLED'); $this->ss->assign('REASSIGN_JS', "return confirmReassignRecords();"); } //// END NEW USER CREATION ONLY /////////////////////////////////////////////////////////////////////////////// global $sugar_flavor; $admin = Administration::getSettings(); if (isset($sugar_flavor) && $sugar_flavor != null && ($sugar_flavor == 'CE' || isset($admin->settings['license_enforce_user_limit']) && $admin->settings['license_enforce_user_limit'] == 1)) { if (empty($this->bean->id)) { $license_users = $admin->settings['license_users']; if ($license_users != '') { $license_seats_needed = count(get_user_array(false, "", "", false, null, " AND " . User::getLicensedUsersWhere(), false)) - $license_users; } else { $license_seats_needed = -1; } if ($license_seats_needed >= 0) { displayAdminError(translate('WARN_LICENSE_SEATS_USER_CREATE', 'Administration') . translate('WARN_LICENSE_SEATS2', 'Administration')); if (isset($_SESSION['license_seats_needed'])) { unset($_SESSION['license_seats_needed']); } //die(); } } } // FIXME: Translate error prefix if (isset($_REQUEST['error_string'])) { $this->ss->assign('ERROR_STRING', '<span class="error">Error: ' . $_REQUEST['error_string'] . '</span>'); } if (isset($_REQUEST['error_password'])) { $this->ss->assign('ERROR_PASSWORD', '<span id="error_pwd" class="error">Error: ' . $_REQUEST['error_password'] . '</span>'); } // Build viewable versions of a few fields for non-admins if (!empty($this->bean->id)) { if (!empty($this->bean->status)) { $this->ss->assign('STATUS_READONLY', $app_list_strings['user_status_dom'][$this->bean->status]); } if (!empty($this->bean->employee_status)) { $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]); } if (!empty($this->bean->reports_to_id)) { $reportsToUserField = "<input type='text' name='reports_to_name' id='reports_to_name' value='{$this->bean->reports_to_name}' disabled>\n"; $reportsToUserField .= "<input type='hidden' name='reports_to_id' id='reports_to_id' value='{$this->bean->reports_to_id}'>"; $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField); } if (!empty($this->bean->title)) { $this->ss->assign('TITLE_READONLY', $this->bean->title); } if (!empty($this->bean->department)) { $this->ss->assign('DEPT_READONLY', $this->bean->department); } } $processSpecial = false; $processFormName = ''; if (isset($this->fieldHelper->usertype) && ($this->fieldHelper->usertype == 'GROUP' || $this->fieldHelper->usertype == 'PORTAL_ONLY')) { $this->ev->formName = 'EditViewGroup'; $processSpecial = true; $processFormName = 'EditViewGroup'; } //Bug#51609 Replace {php} code block in EditViewHeader.tpl $action_button = array(); $APP = $this->ss->get_template_vars('APP'); $PWDSETTINGS = $this->ss->get_template_vars('PWDSETTINGS'); $REGEX = $this->ss->get_template_vars('REGEX'); $CHOOSER_SCRIPT = $this->ss->get_template_vars('CHOOSER_SCRIPT'); $REASSIGN_JS = $this->ss->get_template_vars('REASSIGN_JS'); $RETURN_ACTION = $this->ss->get_template_vars('RETURN_ACTION'); $RETURN_MODULE = $this->ss->get_template_vars('RETURN_MODULE'); $RETURN_ID = $this->ss->get_template_vars('RETURN_ID'); $minpwdlength = !empty($PWDSETTINGS['minpwdlength']) ? $PWDSETTINGS['minpwdlength'] : ''; $maxpwdlength = !empty($PWDSETTINGS['maxpwdlength']) ? $PWDSETTINGS['maxpwdlength'] : ''; $action_button_header[] = <<<EOD <input type="button" id="SAVE_HEADER" title="{$APP['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$APP['LBL_SAVE_BUTTON_KEY']}" class="button primary" onclick="var _form = \$('#EditView')[0]; if (!set_password(_form,newrules('{$minpwdlength}','{$maxpwdlength}','{$REGEX}'))) return false; if (!Admin_check()) return false; _form.action.value='Save'; {$CHOOSER_SCRIPT} {$REASSIGN_JS} if(verify_data(EditView)) _form.submit();" name="button" value="{$APP['LBL_SAVE_BUTTON_LABEL']}"> EOD; $action_button_header[] = <<<EOD <input\ttitle="{$APP['LBL_CANCEL_BUTTON_TITLE']}" id="CANCEL_HEADER" accessKey="{$APP['LBL_CANCEL_BUTTON_KEY']}" class="button" onclick="var _form = \$('#EditView')[0]; _form.action.value='{$RETURN_ACTION}'; _form.module.value='{$RETURN_MODULE}'; _form.record.value='{$RETURN_ID}'; _form.submit()" type="button" name="button" value="{$APP['LBL_CANCEL_BUTTON_LABEL']}"> EOD; $action_button_header = array_merge($action_button_header, $this->ss->get_template_vars('BUTTONS_HEADER')); $this->ss->assign('ACTION_BUTTON_HEADER', $action_button_header); $action_button_footer[] = <<<EOD <input type="button" id="SAVE_FOOTER" title="{$APP['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$APP['LBL_SAVE_BUTTON_KEY']}" class="button primary" onclick="var _form = \$('#EditView')[0]; if (!set_password(_form,newrules('{$minpwdlength}','{$maxpwdlength}','{$REGEX}'))) return false; if (!Admin_check()) return false; _form.action.value='Save'; {$CHOOSER_SCRIPT} {$REASSIGN_JS} if(verify_data(EditView)) _form.submit();" name="button" value="{$APP['LBL_SAVE_BUTTON_LABEL']}"> EOD; $action_button_footer[] = <<<EOD <input\ttitle="{$APP['LBL_CANCEL_BUTTON_TITLE']}" id="CANCEL_FOOTER" accessKey="{$APP['LBL_CANCEL_BUTTON_KEY']}" class="button" onclick="var _form = \$('#EditView')[0]; _form.action.value='{$RETURN_ACTION}'; _form.module.value='{$RETURN_MODULE}'; _form.record.value='{$RETURN_ID}'; _form.submit()" type="button" name="button" value="{$APP['LBL_CANCEL_BUTTON_LABEL']}"> EOD; $action_button_footer = array_merge($action_button_footer, $this->ss->get_template_vars('BUTTONS_FOOTER')); $this->ss->assign('ACTION_BUTTON_FOOTER', $action_button_footer); //if the request object has 'scrolltocal' set, then we are coming here from the tour window box and need to set flag to true // so that footer.tpl fires off script to scroll to calendar section if (!empty($_REQUEST['scrollToCal'])) { $this->ss->assign('scroll_to_cal', true); } $this->ev->process($processSpecial, $processFormName); echo $this->ev->display($this->showTitle); }
/** * getActiveUsers * * Returns all active users * @return Array of active users in the system */ public static function getActiveUsers() { $active_users = get_user_array(FALSE); asort($active_users); return $active_users; }
/** * Method removes module from global search configurations * * return bool */ public function uninstall_global_search() { if (empty($this->installdefs['beans'])) { return true; } if (is_file('custom/modules/unified_search_modules_display.php') == false) { return true; } $user = new User(); $users = get_user_array(); $unified_search_modules_display = array(); require 'custom/modules/unified_search_modules_display.php'; foreach ($this->installdefs['beans'] as $beanDefs) { if (array_key_exists($beanDefs['module'], $unified_search_modules_display) == false) { continue; } unset($unified_search_modules_display[$beanDefs['module']]); foreach ($users as $userId => $userName) { if (empty($userId)) { continue; } $user->retrieve($userId); $prefs = $user->getPreference('globalSearch', 'search'); if (array_key_exists($beanDefs['module'], $prefs) == false) { continue; } unset($prefs[$beanDefs['module']]); $user->setPreference('globalSearch', $prefs, 0, 'search'); $user->savePreferencesToDB(); } } if (write_array_to_file("unified_search_modules_display", $unified_search_modules_display, 'custom/modules/unified_search_modules_display.php') == false) { global $app_strings; $msg = string_format($app_strings['ERR_FILE_WRITE'], array('custom/modules/unified_search_modules_display.php')); $GLOBALS['log']->error($msg); throw new Exception($msg); return false; } return true; }
/** * Returns user array * * @param string $condition * @return array */ protected function getUserArray($condition) { return showFullName() ? getUserArrayFromFullName($condition, true) : get_user_array(false, 'Active', '', false, $condition, ' AND portal_only=0 ', false); }
/** * getAllUsers * * Returns all active and inactive users * @return Array of all users in the system */ public static function getAllUsers() { $active_users = get_user_array(FALSE); $inactive_users = get_user_array(FALSE, "Inactive"); $result = $active_users + $inactive_users; asort($result); return $result; }
function template_calendar($args) { global $timedate; if (isset($args['size']) && $args['size'] == 'small') { $args['calendar']->show_activities = false; $args['calendar']->show_week_on_month_view = false; } $newargs = array(); $newargs['view'] = $args['view']; $newargs['calendar'] = $args['calendar']; if (!isset($args['size']) || $args['size'] != 'small') { template_cal_tabs($newargs); } if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'shared') { global $ids; global $current_user; global $mod_strings; global $app_list_strings, $current_language, $currentModule, $action, $app_strings; $current_module_strings = return_module_language($current_language, 'Calendar'); $ids = array(); $user_ids = $current_user->getPreference('shared_ids'); //get list of user ids for which to display data if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['shared_ids'])) { $ids = $user_ids; } elseif (isset($_REQUEST['shared_ids']) && count($_REQUEST['shared_ids']) > 0) { $ids = $_REQUEST['shared_ids']; $current_user->setPreference('shared_ids', $_REQUEST['shared_ids']); } else { //$ids = get_user_array(false); //$ids = array_keys($ids); $ids = array($current_user->id); } //get team id for which to display user list $tools = '<div align="right"><a href="index.php?module=' . $currentModule . '&action=' . $action . '&view=shared" class="tabFormAdvLink"> <a href="javascript: toggleDisplay(\'shared_cal_edit\');" class="tabFormAdvLink">' . SugarThemeRegistry::current()->getImage('edit', 'alt="' . $current_module_strings['LBL_EDIT'] . '" border="0" align="absmiddle"') . ' ' . $current_module_strings['LBL_EDIT'] . '</a></div>'; echo get_form_header($mod_strings['LBL_SHARED_CAL_TITLE'], $tools, false); if (empty($_SESSION['shared_ids'])) { $_SESSION['shared_ids'] = ""; } echo "\n\t\t\t<script language=\"javascript\">\n\t\t\tfunction up(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tobj =(typeof obj == \"string\") ? document.getElementById(obj) : obj;\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\n\t\t\t\tfor(i=0; i<obj.length; i++) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != 0 && !obj[sel[i]-1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);\n\t\t\t\t\t\tobj[sel[i]-1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]-1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]-1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction down(name) {\n\t\t\t\tvar td = document.getElementById(name+'_td');\n\t\t\t\tvar obj = td.getElementsByTagName('select')[0];\n\t\t\t\tif(obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\t\t\t\treturn false;\n\t\t\t\tvar sel = new Array();\n\t\t\t\tfor(i=obj.length-1; i>-1; i--) {\n\t\t\t\t\tif(obj[i].selected == true) {\n\t\t\t\t\t\tsel[sel.length] = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i in sel) {\n\t\t\t\t\tif(sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {\n\t\t\t\t\t\tvar tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);\n\t\t\t\t\t\tobj[sel[i]+1].text = obj[sel[i]].text;\n\t\t\t\t\t\tobj[sel[i]+1].value = obj[sel[i]].value;\n\t\t\t\t\t\tobj[sel[i]].text = tmp[0];\n\t\t\t\t\t\tobj[sel[i]].value = tmp[1];\n\t\t\t\t\t\tobj[sel[i]+1].selected = true;\n\t\t\t\t\t\tobj[sel[i]].selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t</script>\n\n\t\t\t<div id='shared_cal_edit' style='display: none;'>\n\t\t\t<form name='shared_cal' action=\"index.php\" method=\"post\" >\n\t\t\t<input type=\"hidden\" name=\"module\" value=\"" . $currentModule . "\">\n\t\t\t<input type=\"hidden\" name=\"action\" value=\"" . $action . "\">\n\t\t\t<input type=\"hidden\" name=\"view\" value=\"shared\">\n\t\t\t<input type=\"hidden\" name=\"edit\" value=\"0\">\n\t\t\t<table cellpadding=\"0\" cellspacing=\"3\" border=\"0\" align=\"center\">\n\t\t\t<tr><th valign=\"top\" align=\"center\" colspan=\"2\">\n\t\t\t"; echo $current_module_strings['LBL_SELECT_USERS']; echo "\n\t\t\t</th>\n\t\t\t</tr>\n\t\t\t<tr><td valign=\"top\">"; echo "\n </td><td valign=\"top\">\n\n\t\t\t<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\" class=\"edit view\" align=\"center\">\n\t\t\t<tr>\n\t\t\t\t<td valign='top' nowrap><b>" . $current_module_strings['LBL_USERS'] . "</b></td>\n\t\t\t\t<td valign='top' id=\"shared_ids_td\"><select id=\"shared_ids\" name=\"shared_ids[]\" multiple size='3'>"; echo get_select_options_with_id(get_user_array(false), $ids); echo "\t</select></td>\n\t\t\t\t<td><a onclick=\"up('shared_ids');\">" . SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;" alt="' . $app_strings['LBL_SORT'] . '"') . "</a><br>\n\t\t\t\t<a onclick=\"down('shared_ids');\">" . SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;" alt="' . $app_strings['LBL_SORT'] . '"') . "</a></td>\n\t\t\t</tr>\n\t\t\t<tr>"; echo "<td align=\"right\" colspan=\"2\"><input class=\"button\" type=\"submit\" title=\"" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "\" /><input class=\"button\" onClick=\"javascript: toggleDisplay('shared_cal_edit');\" type=\"button\" title=\"" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "\" accessKey=\"" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "\" value=\"" . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "\"/></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td></tr>\n\t\t\t</table>\n\t\t\t</form>"; } // end "shared" view echo "</div></p>"; if (isset($_REQUEST['edit']) && $_REQUEST['edit']) { echo " <script language=\"javascript\"> toggleDisplay('shared_cal_edit'); </script>"; } echo "\n\t\t<table id=\"daily_cal_table_outside\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthBox\">\n\t\t<tr>\n\t\t<td>\n\t\t <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"monthHeader\">\n\t\t <tr>\n\t\t <td width=\"1%\" nowrap>"; if (!isset($args['size']) || $args['size'] != 'small') { template_get_previous_calendar($args); } echo "\n\t\t </td>\n\t\t <td width=\" 98 % \" align=center scope='row'>"; if (isset($args['size']) && ($args['size'] = 'small')) { ?> <a style="text-decoration: none;" href="index.php?module=Calendar&action=index&view=month<?php echo $args['calendar']->date_time->get_date_str(); ?> "> <?php } ?> <h3> <?php template_echo_date_info($args['view'], $args['calendar']->date_time); ?> </h3> <?php if (isset($args['size']) && ($args['size'] = 'small')) { echo "</a>"; } ?> </td> <td align="right" width="1%" nowrap><?php if (!isset($args['size']) || $args['size'] != 'small') { template_get_next_calendar($args); } ?> </td> </tr> </table> </td> </tr> <tr> <td class="monthCalBody"> <?php if ($args['calendar']->view == 'month') { template_calendar_month($args); } else { if ($args['calendar']->view == 'year') { template_calendar_year($args); } else { if ($args['calendar']->view == 'shared') { global $current_user, $shared_user; $shared_args = array(); foreach ($args as $key => $val) { $shared_args[$key] = $val; } $shared_args['calendar'] = $args['calendar']; $shared_user = new User(); foreach ($ids as $member) { $shared_user->retrieve($member); $shared_args['calendar']->show_tasks = true; $shared_args['calendar']->add_activities($shared_user); $shared_args['show_link'] = 'off'; if ($shared_user->id == $current_user->id) { $shared_args['show_link'] = 'on'; } echo '<h5 class="calSharedUser">' . $shared_user->full_name . '</h5>'; template_calendar_horizontal($shared_args); } } else { template_calendar_vertical($args); } } } ?> </td> </tr> <tr> <td> <table width="100%" cellspacing="0" cellpadding="0" class="monthFooter"> <tr> <td width="50%"><?php template_get_previous_calendar($args); ?> </td> <td align="right" width="50%"><?php template_get_next_calendar($args); ?> </td> </tr> </table> </td> </tr> </table> <?php }
function constructQuery() { global $current_user; global $app_list_strings; $tempx = array(); $datax = array(); $selected_datax = array(); //get list of sales stage keys to display $tempx = $current_user->getPreference('lsbo_lead_sources'); if (!empty($lsbo_lead_sources) && count($lsbo_lead_sources) > 0 && !isset($_REQUEST['lsbo_lead_sources'])) { $GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:"); $GLOBALS['log']->fatal($tempx); } elseif (isset($_REQUEST['lsbo_lead_sources']) && count($_REQUEST['lsbo_lead_sources']) > 0) { $tempx = $_REQUEST['lsbo_lead_sources']; $current_user->setPreference('lsbo_lead_sources', $_REQUEST['lsbo_lead_sources']); $GLOBALS['log']->fatal("_REQUEST['lsbo_lead_sources'] is:"); $GLOBALS['log']->fatal($_REQUEST['lsbo_lead_sources']); $GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:"); $GLOBALS['log']->fatal($current_user->getPreference('lsbo_lead_sources')); } //set $datax using selected sales stage keys if (!empty($tempx) && sizeof($tempx) > 0) { foreach ($tempx as $key) { $datax[$key] = $app_list_strings['lead_source_dom'][$key]; array_push($selected_datax, $key); } } else { $datax = $app_list_strings['lead_source_dom']; $selected_datax = array_keys($app_list_strings['lead_source_dom']); } $datay = $datax; $ids = $current_user->getPreference('lsbo_ids'); //get list of user ids for which to display data if (!empty($ids) && count($ids) != 0 && !isset($_REQUEST['lsbo_ids'])) { $GLOBALS['log']->debug("_SESSION['lsbo_ids'] is:"); $GLOBALS['log']->debug($ids); } elseif (isset($_REQUEST['lsbo_ids']) && count($_REQUEST['lsbo_ids']) > 0) { $ids = $_REQUEST['lsbo_ids']; $current_user->setPreference('lsbo_ids', $_REQUEST['lsbo_ids']); $GLOBALS['log']->debug("_REQUEST['lsbo_ids'] is:"); $GLOBALS['log']->debug($_REQUEST['lsbo_ids']); $GLOBALS['log']->debug("user->getPreference('lsbo_ids') is:"); $GLOBALS['log']->debug($current_user->getPreference('lsbo_ids')); } else { $ids = get_user_array(false); $ids = array_keys($ids); } $user_id = $ids; $opp = new Opportunity(); $where = ""; //build the where clause for the query that matches $user $count = count($user_id); $id = array(); if ($count > 0) { foreach ($user_id as $the_id) { $id[] = "'" . $the_id . "'"; } $ids = join(",", $id); $where .= "opportunities.assigned_user_id IN ({$ids}) "; } //build the where clause for the query that matches $datay $count = count($datay); $datayArr = array(); if ($count > 0) { foreach ($datay as $key => $value) { $datayArr[] = "'" . $key . "'"; } $datayArr = join(",", $datayArr); $where .= "AND opportunities.lead_source IN\t({$datayArr}) "; } $query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities "; $query .= "WHERE " . $where . " AND opportunities.deleted=0 "; $query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage"; return $query; }
$xtpl->assign("THEME", $theme); $xtpl->assign("IMAGE_PATH", $image_path); $xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']); require_once 'include/QuickSearchDefaults.php'; $qsd = new QuickSearchDefaults(); $sqs_objects = array('assigned_user_name' => $qsd->getQSUser()); $quicksearch_js = $qsd->getQSScripts(); $quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>'; $xtpl->assign("JAVASCRIPT", get_set_focus_js() . get_validate_record_js() . $quicksearch_js); if (empty($focus->assigned_user_id) && empty($focus->id)) { $focus->assigned_user_id = $current_user->id; } if (empty($focus->assigned_name) && empty($focus->id)) { $focus->assigned_user_name = $current_user->user_name; } $xtpl->assign("ASSIGNED_USER_OPTIONS", get_select_options_with_id(get_user_array(TRUE, "Active", $focus->assigned_user_id), $focus->assigned_user_id)); $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name); $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); $xtpl->assign("DATE_ENTERED", $focus->date_entered); $xtpl->assign("DATE_MODIFIED", $focus->date_modified); $xtpl->assign("CREATED_BY", $focus->created_by_name); $xtpl->assign("MODIFIED_BY", $focus->modified_by_name); $xtpl->assign("ID", $focus->id); $xtpl->assign("NAME", $focus->name); $xtpl->assign("DESCRIPTION", $focus->description); $xtpl->assign("DOMAIN_NAME", $focus->domain_name); if (empty($focus->list_type) or $focus->list_type != 'exempt_domain') { $xtpl->assign("DOMAIN_HIDDEN", "display:none"); } if (empty($focus->assigned_user_id) && empty($focus->id)) { $focus->assigned_user_id = $current_user->id;
function get_assigned_user_name($assigned_user_id, $is_group = '') { static $saved_user_list = null; if (empty($saved_user_list)) { $saved_user_list = get_user_array(false, '', '', false, null, $is_group); } if (isset($saved_user_list[$assigned_user_id])) { return $saved_user_list[$assigned_user_id]; } return ''; }
/** * Function to get all the accessible users * @return <Array> */ public function getAccessibleUsers($private = "", $module = false) { $currentUserRoleModel = Settings_Roles_Record_Model::getInstanceById($this->getRole()); $accessibleUser = Vtiger_Cache::get('vtiger-' . $this->getRole() . '-' . $currentUserRoleModel->get('allowassignedrecordsto'), 'accessibleusers'); if (empty($accessibleUser)) { if ($currentUserRoleModel->get('allowassignedrecordsto') == '1' || $private == 'Public') { $accessibleUser = get_user_array(false, "ACTIVE", "", $private, $module); } else { if ($currentUserRoleModel->get('allowassignedrecordsto') == '2') { $accessibleUser = $this->getSameLevelUsersWithSubordinates(); } else { if ($currentUserRoleModel->get('allowassignedrecordsto') == '3') { $accessibleUser = $this->getRoleBasedSubordinateUsers(); } else { if ($currentUserRoleModel->get('allowassignedrecordsto') == '4') { $accessibleUser[$this->getId()] = $this->getName(); } } } } Vtiger_Cache::set('vtiger-' . $this->getRole() . '-' . $currentUserRoleModel->get('allowassignedrecordsto'), 'accessibleusers', $accessibleUser); } return $accessibleUser; }
"'> </td> </tr> </table> <table border='0' cellspacing='0' cellpadding='0' class='edit view'> <tr> <td> <BR> <?php echo $mod_strings_users['LBL_REASS_USER_FROM']; ?> <BR> <select name="fromuser" id='fromuser'> <?php $active_users = get_user_array(FALSE); $inactive_users = get_user_array(FALSE, "Inactive"); $all_users = array_merge($active_users, $inactive_users); // sb - issue with php array_merge causing array index '1' to change to '0' if (isset($all_users[0])) { $all_users[1] = 'admin'; unset($all_users[0]); } asort($all_users); echo get_select_options_with_id($all_users, isset($_SESSION['reassignRecords']['fromuser']) ? $_SESSION['reassignRecords']['fromuser'] : ''); ?> </select> <BR> <BR> <?php echo $mod_strings_users['LBL_REASS_USER_TO']; ?>
function constructQuery() { global $current_user; global $timedate; $user_date_start = $current_user->getPreference('obm_date_start'); if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) { $date_start = $user_date_start; Log::debug("USER PREFERENCES['obm_date_start'] is:"); Log::debug($user_date_start); } elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') { $date_start = $_REQUEST['obm_year'] . '-01-01'; $current_user->setPreference('obm_date_start', $date_start); Log::debug("_REQUEST['obm_date_start'] is:"); Log::debug($_REQUEST['obm_date_start']); Log::debug("_SESSION['obm_date_start'] is:"); Log::debug($current_user->getPreference('obm_date_start')); } else { $date_start = date('Y') . '-01-01'; } $user_date_end = $current_user->getPreference('obm_date_end'); if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) { $date_end = $user_date_end; Log::debug("USER PREFERENCES['obm_date_end'] is:"); Log::debug($date_end); } elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') { $date_end = $_REQUEST['obm_year'] . '-12-31'; $current_user->setPreference('obm_date_end', $date_end); Log::debug("_REQUEST['obm_date_end'] is:"); Log::debug($_REQUEST['obm_date_end']); Log::debug("USER PREFERENCES['obm_date_end'] is:"); Log::debug($current_user->getPreference('obm_date_end')); } else { $date_end = date('Y') . '-12-31'; } $ids = array(); //get list of user ids for which to display data $user_ids = $current_user->getPreference('obm_ids'); if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) { $ids = $user_ids; Log::debug("USER PREFERENCES['obm_ids'] is:"); Log::debug($user_ids); } elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) { $ids = $_REQUEST['obm_ids']; $current_user->setPreference('obm_ids', $_REQUEST['obm_ids']); Log::debug("_REQUEST['obm_ids'] is:"); Log::debug($_REQUEST['obm_ids']); Log::debug("USER PREFRENCES['obm_ids'] is:"); Log::debug($current_user->getPreference('obm_ids')); } else { $ids = get_user_array(false); $ids = array_keys($ids); } $user_id = $ids; $where = ""; //build the where clause for the query that matches $user $count = count($user_id); $id = array(); if ($count > 0) { foreach ($user_id as $the_id) { $id[] = "'" . $the_id . "'"; } $ids = join(",", $id); $where .= "opportunities.assigned_user_id IN ({$ids}) "; } // cn: adding user-pref date handling $dateStartDisplay = $timedate->asUserDate($timedate->fromString($date_start)); $dateEndDisplay = $timedate->asUserDate($timedate->fromString($date_end)); $opp = new Opportunity(); //build the where clause for the query that matches $date_start and $date_end $where .= "AND opportunities.date_closed >= " . db_convert("'" . $date_start . "'", 'date') . " AND opportunities.date_closed <= " . db_convert("'" . $date_end . "'", 'date') . " AND opportunities.deleted=0"; $query = "SELECT sales_stage," . db_convert('opportunities.date_closed', 'date_format', array("'%Y-%m'"), array("'YYYY-MM'")) . " as m, sum(amount_usdollar/1000) as total, count(*) as opp_count FROM opportunities "; $query .= "WHERE " . $where; $query .= " GROUP BY sales_stage," . db_convert('opportunities.date_closed', 'date_format', array("'%Y-%m'"), array("'YYYY-MM'")) . "ORDER BY m"; return $query; }
//Convert to MB $smarty->assign("UPLOAD_MAXSIZE", $upload_maxsize); if ($_REQUEST['upload_error'] == true) { echo '<br><b><font color="red"> ' . $mod_strings['FILE_HAS_NO_DATA'] . '.</font></b><br>'; } if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') { $focus->id = $_REQUEST['record']; $focus->mode = 'edit'; $focus->retrieve_entity_info($_REQUEST['record'], "Documents"); $focus->name = $focus->column_fields['notes_title']; } if ($focus->mode != 'edit') { if (isset($_REQUEST['parent_id']) && isset($_REQUEST['return_module'])) { $owner = getRecordOwnerId($_REQUEST['parent_id']); if (isset($owner['Users']) && $owner['Users'] != '') { $permitted_users = get_user_array('true', 'Active', $current_user->id); if (!in_array($owner['Users'], $permitted_users)) { $owner['Users'] = $current_user->id; } $focus->column_fields['assigntype'] = 'U'; $focus->column_fields['assigned_user_id'] = $owner['Users']; } elseif (isset($owner['Groups']) && $owner['Groups'] != '') { $focus->column_fields['assigntype'] = 'T'; $focus->column_fields['assigned_user_id'] = $owner['Groups']; } } } if (empty($_REQUEST['record']) && $focus->mode != 'edit') { setObjectValuesFromRequest($focus); } if (isset($_REQUEST['parent_id']) && $focus->mode != 'edit') {
/** This function returns the detail view form vtiger_field and and its properties in array format. * Param $uitype - UI type of the vtiger_field * Param $fieldname - Form vtiger_field name * Param $fieldlabel - Form vtiger_field label name * Param $col_fields - array contains the vtiger_fieldname and values * Param $generatedtype - Field generated type (default is 1) * Param $tabid - vtiger_tab id to which the Field belongs to (default is "") * Return type is an array */ function getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields, $generatedtype, $tabid = '', $module = '') { global $log; $log->debug("Entering getDetailViewOutputHtml(" . $uitype . "," . $fieldname . "," . $fieldlabel . "," . $col_fields . "," . $generatedtype . "," . $tabid . ") method ..."); global $adb; global $mod_strings; global $app_strings; global $current_user; global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $fieldlabel = from_html($fieldlabel); $custfld = ''; $value = ''; $arr_data = array(); $label_fld = array(); $data_fld = array(); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; require 'user_privileges/sharing_privileges_' . $current_user->id . '.php'; // vtlib customization: New uitype to handle relation between modules if ($uitype == '10') { $fieldlabel = getTranslatedString($fieldlabel, $module); $parent_id = $col_fields[$fieldname]; if (!empty($parent_id)) { $parent_module = getSalesEntityType($parent_id); $valueTitle = getTranslatedString($parent_module, $parent_module); $displayValueArray = getEntityName($parent_module, $parent_id); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $value) { $displayValue = $value; } } // vtlib customization: For listview javascript triggers $modMetaInfo = getEntityFieldNames($parent_module); $modEName = is_array($modMetaInfo['fieldname']) ? $modMetaInfo['fieldname'][0] : $modMetaInfo['fieldname']; $vtlib_metainfo = "<span type='vtlib_metainfo' vtrecordid='{$parent_id}' vtfieldname=" . "'{$modEName}' vtmodule='{$parent_module}' style='display:none;'></span>"; // END $label_fld = array($fieldlabel, "<a href='index.php?module={$parent_module}&action=DetailView&record={$parent_id}' title='{$valueTitle}'>{$displayValue}</a>{$vtlib_metainfo}"); } else { $moduleSpecificMessage = 'MODULE_NOT_SELECTED'; if ($mod_strings[$moduleSpecificMessage] != "") { $moduleSpecificMessage = $mod_strings[$moduleSpecificMessage]; } $label_fld = array($fieldlabel, ''); } } else { if ($uitype == 99) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; if ($fieldname == 'confirm_password') { return null; } } elseif ($uitype == 116 || $uitype == 117) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = getCurrencyName($col_fields[$fieldname]); $pick_query = "select * from vtiger_currency_info where currency_status = 'Active' and deleted=0"; $pickListResult = $adb->pquery($pick_query, array()); $noofpickrows = $adb->num_rows($pickListResult); //Mikecrowe fix to correctly default for custom pick lists $options = array(); $found = false; for ($j = 0; $j < $noofpickrows; $j++) { $pickListValue = $adb->query_result($pickListResult, $j, 'currency_name'); $currency_id = $adb->query_result($pickListResult, $j, 'id'); if ($col_fields[$fieldname] == $currency_id) { $chk_val = "selected"; $found = true; } else { $chk_val = ''; } $options[$currency_id] = array($pickListValue => $chk_val); } $label_fld["options"] = $options; } elseif ($uitype == 13 || $uitype == 104) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 16) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = getTranslatedString($col_fields[$fieldname], $module); $fieldname = $adb->sql_escape_string($fieldname); $pick_query = "select {$fieldname} from vtiger_{$fieldname} order by sortorderid"; $params = array(); $pickListResult = $adb->pquery($pick_query, $params); $noofpickrows = $adb->num_rows($pickListResult); $options = array(); $count = 0; $found = false; for ($j = 0; $j < $noofpickrows; $j++) { $pickListValue = decode_html($adb->query_result($pickListResult, $j, strtolower($fieldname))); $col_fields[$fieldname] = decode_html($col_fields[$fieldname]); if ($col_fields[$fieldname] == $pickListValue) { $chk_val = "selected"; $count++; $found = true; } else { $chk_val = ''; } $pickListValue = to_html($pickListValue); $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val); } $label_fld["options"] = $options; } elseif ($uitype == 15) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; $roleid = $current_user->roleid; $valueArr = explode("|##|", $col_fields[$fieldname]); $picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb); //Mikecrowe fix to correctly default for custom pick lists $options = array(); $count = 0; $found = false; if (!empty($picklistValues)) { foreach ($picklistValues as $order => $pickListValue) { if (in_array(trim($pickListValue), array_map("trim", $valueArr))) { $chk_val = "selected"; $pickcount++; } else { $chk_val = ''; } if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') { $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val); } else { $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val); } } if ($pickcount == 0 && !empty($value)) { $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected'); } } $label_fld["options"] = $options; } elseif ($uitype == 115) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = getTranslatedString($col_fields[$fieldname]); $pick_query = "select * from vtiger_" . $adb->sql_escape_string($fieldname); $pickListResult = $adb->pquery($pick_query, array()); $noofpickrows = $adb->num_rows($pickListResult); $options = array(); $found = false; for ($j = 0; $j < $noofpickrows; $j++) { $pickListValue = $adb->query_result($pickListResult, $j, strtolower($fieldname)); if ($col_fields[$fieldname] == $pickListValue) { $chk_val = "selected"; $found = true; } else { $chk_val = ''; } $options[] = array($pickListValue => $chk_val); } $label_fld["options"] = $options; } elseif ($uitype == 33) { //uitype 33 added for multiselector picklist - Jeri $roleid = $current_user->roleid; $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = str_ireplace(' |##| ', ', ', $col_fields[$fieldname]); $picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb); $options = array(); $selected_entries = array(); $selected_entries = explode(' |##| ', $col_fields[$fieldname]); if (!empty($picklistValues)) { foreach ($picklistValues as $order => $pickListValue) { foreach ($selected_entries as $selected_entries_value) { if (trim($selected_entries_value) == trim(htmlentities($pickListValue, ENT_QUOTES, $default_charset))) { $chk_val = 'selected'; $pickcount++; break; } else { $chk_val = ''; } } if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') { $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val); } else { $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val); } } if ($pickcount == 0 && !empty($value)) { $not_access_lbl = "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>"; $options[] = array($not_access_lbl, trim($selected_entries_value), 'selected'); } } $label_fld["options"] = $options; } elseif ($uitype == 17) { $label_fld[] = getTranslatedString($fieldlabel, $module); $matchPattern = "^[\\w]+:\\/\\/^"; $value = $col_fields[$fieldname]; preg_match($matchPattern, $value, $matches); if (!empty($matches[0])) { $fieldValue = str_replace($matches, "", $value); $label_fld[] = $value; } else { if ($value != null) { $label_fld[] = 'http://' . $value; } else { $label_fld[] = ''; } } } elseif ($uitype == 19) { if ($fieldname == 'notecontent' or $module == 'Timecontrol') { $col_fields[$fieldname] = decode_html($col_fields[$fieldname]); } else { $col_fields[$fieldname] = str_replace("<br />", "<br>", $col_fields[$fieldname]); } $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 20 || $uitype == 21 || $uitype == 22 || $uitype == 24) { // Armando LC<scher 11.08.2005 -> B'descriptionSpan -> Desc: removed $uitype == 19 and made an aditional elseif above if ($uitype == 20) { //Fix the issue #4680 $col_fields[$fieldname] = $col_fields[$fieldname]; } else { $col_fields[$fieldname] = nl2br($col_fields[$fieldname]); } $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) { $account_id = $col_fields[$fieldname]; if ($account_id != '') { $account_name = getAccountName($account_id); } $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $account_name; $label_fld["secid"] = $account_id; $label_fld["link"] = "index.php?module=Accounts&action=DetailView&record=" . $account_id; //Account Name View } elseif ($uitype == 52 || $uitype == 77 || $uitype == 101) { $label_fld[] = getTranslatedString($fieldlabel, $module); $user_id = $col_fields[$fieldname]; $user_name = getOwnerName($user_id); if ($user_id != '') { $assigned_user_id = $user_id; } else { $assigned_user_id = $current_user->id; } if (is_admin($current_user)) { $label_fld[] = '<a href="index.php?module=Users&action=DetailView&record=' . $user_id . '">' . $user_name . '</a>'; } else { $label_fld[] = $user_name; } if ($is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module)] == 3 or $defaultOrgSharingPermission[getTabid($module)] == 0)) { $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id); } else { $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $user_id), $assigned_user_id); } $label_fld["options"] = $users_combo; } elseif ($uitype == 11) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 53) { global $noof_group_rows, $adb; $owner_id = $col_fields[$fieldname]; $user = '******'; $result = $adb->pquery("SELECT count(*) as count from vtiger_users where id = ?", array($owner_id)); if ($adb->query_result($result, 0, 'count') > 0) { $user = '******'; } $owner_name = getOwnerName($owner_id); $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $owner_name; if (is_admin($current_user)) { $label_fld["secid"][] = $owner_id; if ($user == 'no') { $label_fld["link"][] = "index.php?module=Settings&action=GroupDetailView&groupId=" . $owner_id; } else { $label_fld["link"][] = "index.php?module=Users&action=DetailView&record=" . $owner_id; } //$label_fld["secid"][] = $groupid; //$label_fld["link"][] = "index.php?module=Settings&action=GroupDetailView&groupId=".$groupid; } //Security Checks if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) { $result = get_current_user_access_groups($module_name); } else { $result = get_group_options(); } if ($result) { $nameArray = $adb->fetch_array($result); } global $current_user; //$value = $user_id; if ($owner_id != '') { if ($user == 'yes') { $label_fld["options"][] = 'User'; $assigned_user_id = $owner_id; $user_checked = "checked"; $team_checked = ''; $user_style = 'display:block'; $team_style = 'display:none'; } else { //$record = $col_fields["record_id"]; //$module = $col_fields["record_module"]; $label_fld["options"][] = 'Group'; $assigned_group_id = $owner_id; $user_checked = ''; $team_checked = 'checked'; $user_style = 'display:none'; $team_style = 'display:block'; } } else { $label_fld["options"][] = 'User'; $assigned_user_id = $current_user->id; $user_checked = "checked"; $team_checked = ''; $user_style = 'display:block'; $team_style = 'display:none'; } if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module)] == 3 or $defaultOrgSharingPermission[getTabid($module)] == 0)) { $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $current_user->id, 'private'), $assigned_user_id); } else { $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $current_user->id), $assigned_user_id); } if ($noof_group_rows != 0) { if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module)] == 3 or $defaultOrgSharingPermission[getTabid($module)] == 0)) { $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $current_user->id, 'private'), $current_user->id); } else { $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $current_user->id), $current_user->id); } } $label_fld["options"][] = $users_combo; $label_fld["options"][] = $groups_combo; } elseif ($uitype == 55 || $uitype == 255) { if ($tabid == 4) { $query = "select vtiger_contactdetails.imagename from vtiger_contactdetails where contactid=?"; $result = $adb->pquery($query, array($col_fields['record_id'])); $imagename = $adb->query_result($result, 0, 'imagename'); if ($imagename != '') { $imgpath = "test/contact/" . $imagename; $label_fld[] = getTranslatedString($fieldlabel, $module); } else { $label_fld[] = getTranslatedString($fieldlabel, $module); } } else { $label_fld[] = getTranslatedString($fieldlabel, $module); } $value = $col_fields[$fieldname]; if ($uitype == 255) { global $currentModule; $fieldpermission = getFieldVisibilityPermission($currentModule, $current_user->id, 'firstname'); } if ($uitype == 255 && $fieldpermission == 0 && $fieldpermission != '') { $fieldvalue[] = ''; } else { $roleid = $current_user->roleid; $subrole = getRoleSubordinates($roleid); if (count($subrole) > 0) { $roleids = implode("','", $subrole); $roleids = $roleids . "','" . $roleid; } else { $roleids = $roleid; } if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) { $pick_query = "select salutationtype from vtiger_salutationtype order by salutationtype"; $params = array(); } else { $pick_query = "select * from vtiger_salutationtype left join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid=vtiger_salutationtype.picklist_valueid where picklistid in (select picklistid from vtiger_picklist where name='salutationtype') and roleid=? order by salutationtype"; $params = array($current_user->roleid); } $pickListResult = $adb->pquery($pick_query, $params); $noofpickrows = $adb->num_rows($pickListResult); $sal_value = $col_fields["salutationtype"]; $salcount = 0; for ($j = 0; $j < $noofpickrows; $j++) { $pickListValue = $adb->query_result($pickListResult, $j, "salutationtype"); if ($sal_value == $pickListValue) { $chk_val = "selected"; $salcount++; } else { $chk_val = ''; } } if ($salcount == 0 && $sal_value != '') { $notacc = $app_strings['LBL_NOT_ACCESSIBLE']; } $sal_value = $col_fields["salutationtype"]; if ($sal_value == '--None--') { $sal_value = ''; } $label_fld["salut"] = getTranslatedString($sal_value); $label_fld["notaccess"] = $notacc; } $label_fld[] = $value; } elseif ($uitype == 56) { $label_fld[] = getTranslatedString($fieldlabel, $module); $value = $col_fields[$fieldname]; if ($value == 1) { //Since "yes" is not been translated it is given as app strings here.. $displayValue = $app_strings['yes']; } else { $displayValue = $app_strings['no']; } $label_fld[] = $displayValue; } elseif ($uitype == 156) { $label_fld[] = getTranslatedString($fieldlabel, $module); $value = $col_fields[$fieldname]; if ($value == 'on') { //Since "yes" is not been translated it is given as app strings here.. $displayValue = $app_strings['yes']; } else { $displayValue = $app_strings['no']; } $label_fld[] = $displayValue; } elseif ($uitype == 57) { $label_fld[] = getTranslatedString($fieldlabel, $module); $contact_id = $col_fields[$fieldname]; if ($contact_id != '') { $displayValueArray = getEntityName('Contacts', $contact_id); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $contact_name = $field_value; } } else { $contact_name = ''; } } $label_fld[] = $contact_name; $label_fld["secid"] = $contact_id; $label_fld["link"] = "index.php?module=Contacts&action=DetailView&record=" . $contact_id; } elseif ($uitype == 58) { $label_fld[] = getTranslatedString($fieldlabel, $module); $campaign_id = $col_fields[$fieldname]; if ($campaign_id != '') { $campaign_name = getCampaignName($campaign_id); } $label_fld[] = $campaign_name; $label_fld["secid"] = $campaign_id; $label_fld["link"] = "index.php?module=Campaigns&action=DetailView&record=" . $campaign_id; } elseif ($uitype == 59) { $label_fld[] = getTranslatedString($fieldlabel, $module); $product_id = $col_fields[$fieldname]; if ($product_id != '') { $product_name = getProductName($product_id); } //Account Name View $label_fld[] = $product_name; $label_fld["secid"] = $product_id; $label_fld["link"] = "index.php?module=Products&action=DetailView&record=" . $product_id; } elseif ($uitype == 61) { global $adb; $label_fld[] = getTranslatedString($fieldlabel, $module); if ($tabid == 10) { $attach_result = $adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])); for ($ii = 0; $ii < $adb->num_rows($attach_result); $ii++) { $attachmentid = $adb->query_result($attach_result, $ii, 'attachmentsid'); if ($attachmentid != '') { $attachquery = "select * from vtiger_attachments where attachmentsid=?"; $attachmentsname = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name'); if ($attachmentsname != '') { $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '">' . $attachmentsname . '</a>'; } else { $custfldval = ''; } } $label_fld['options'][] = $custfldval; } } else { $attachmentid = $adb->query_result($adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])), 0, 'attachmentsid'); if ($col_fields[$fieldname] == '' && $attachmentid != '') { $attachquery = "select * from vtiger_attachments where attachmentsid=?"; $col_fields[$fieldname] = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name'); } //This is added to strip the crmid and _ from the file name and show the original filename //$org_filename = ltrim($col_fields[$fieldname],$col_fields['record_id'].'_'); /* Above line is not required as the filename in the database is stored as it is and doesn't have crmid attached to it. This was the cause for the issue reported in ticket #4645 */ $org_filename = $col_fields[$fieldname]; // For Backward Compatibility version < 5.0.4 $filename_pos = strpos($org_filename, $col_fields['record_id'] . '_'); if ($filename_pos === 0) { $start_idx = $filename_pos + strlen($col_fields['record_id'] . '_'); $org_filename = substr($org_filename, $start_idx); } if ($org_filename != '') { if ($col_fields['filelocationtype'] == 'E') { if ($col_fields['filestatus'] == 1) { //&& strlen($col_fields['filename']) > 7 ){ $custfldval = '<a target="_blank" href =' . $col_fields['filename'] . ' onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>'; } else { $custfldval = $col_fields[$fieldname]; } } elseif ($col_fields['filelocationtype'] == 'I') { if ($col_fields['filestatus'] == 1) { $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '" onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>'; } else { $custfldval = $col_fields[$fieldname]; } } else { $custfldval = ''; } } $label_fld[] = $custfldval; } } elseif ($uitype == 28) { $label_fld[] = getTranslatedString($fieldlabel, $module); $attachmentid = $adb->query_result($adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])), 0, 'attachmentsid'); if ($col_fields[$fieldname] == '' && $attachmentid != '') { $attachquery = "select * from vtiger_attachments where attachmentsid=?"; $col_fields[$fieldname] = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name'); } $org_filename = $col_fields[$fieldname]; // For Backward Compatibility version < 5.0.4 $filename_pos = strpos($org_filename, $col_fields['record_id'] . '_'); if ($filename_pos === 0) { $start_idx = $filename_pos + strlen($col_fields['record_id'] . '_'); $org_filename = substr($org_filename, $start_idx); } if ($org_filename != '') { if ($col_fields['filelocationtype'] == 'E') { if ($col_fields['filestatus'] == 1) { //&& strlen($col_fields['filename']) > 7 ){ $custfldval = '<a target="_blank" href =' . $col_fields['filename'] . ' onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>'; } else { $custfldval = $col_fields[$fieldname]; } } elseif ($col_fields['filelocationtype'] == 'I') { if ($col_fields['filestatus'] == 1) { $custfldval = '<a href = "index.php?module=uploads&action=downloadfile&return_module=' . $col_fields['record_module'] . '&fileid=' . $attachmentid . '&entityid=' . $col_fields['record_id'] . '" onclick=\'javascript:dldCntIncrease(' . $col_fields['record_id'] . ');\'>' . $col_fields[$fieldname] . '</a>'; } else { $custfldval = $col_fields[$fieldname]; } } else { $custfldval = ''; } } $label_fld[] = $custfldval; } elseif ($uitype == 69) { $label_fld[] = getTranslatedString($fieldlabel, $module); if ($tabid == 14) { $images = array(); $query = 'select productname, vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name,vtiger_crmentity.setype from vtiger_products left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_products.productid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid where vtiger_crmentity.setype="Products Image" and productid=?'; $result_image = $adb->pquery($query, array($col_fields['record_id'])); for ($image_iter = 0; $image_iter < $adb->num_rows($result_image); $image_iter++) { $image_id_array[] = $adb->query_result($result_image, $image_iter, 'attachmentsid'); //decode_html - added to handle UTF-8 characters in file names //urlencode - added to handle special characters like #, %, etc., $image_array[] = urlencode(decode_html($adb->query_result($result_image, $image_iter, 'name'))); $image_orgname_array[] = decode_html($adb->query_result($result_image, $image_iter, 'name')); $imagepath_array[] = $adb->query_result($result_image, $image_iter, 'path'); } if (count($image_array) > 1) { if (count($image_array) < 4) { $sides = count($image_array) * 2; } else { $sides = 8; } $image_lists = '<div id="Carousel" style="position:relative;vertical-align: middle;"> <img src="modules/Products/placeholder.gif" width="571" height="117" style="position:relative;"> </div><script>var Car_NoOfSides=' . $sides . '; Car_Image_Sources=new Array('; for ($image_iter = 0; $image_iter < count($image_array); $image_iter++) { $images[] = '"' . $imagepath_array[$image_iter] . $image_id_array[$image_iter] . "_" . $image_array[$image_iter] . '","' . $imagepath_array[$image_iter] . $image_id_array[$image_iter] . "_" . $image_array[$image_iter] . '"'; } $image_lists .= implode(',', $images) . ');</script><script language="JavaScript" type="text/javascript" src="modules/Products/Productsslide.js"></script><script language="JavaScript" type="text/javascript">Carousel();</script>'; $label_fld[] = $image_lists; } elseif (count($image_array) == 1) { list($pro_image_width, $pro_image_height) = getimagesize($imagepath_array[0] . $image_id_array[0] . "_" . $image_orgname_array[0]); if ($pro_image_width > 450 || $pro_image_height > 300) { $label_fld[] = '<img src="' . $imagepath_array[0] . $image_id_array[0] . "_" . $image_array[0] . '" border="0" width="450" height="300">'; } else { $label_fld[] = '<img src="' . $imagepath_array[0] . $image_id_array[0] . "_" . $image_array[0] . '" border="0" width="' . $pro_image_width . '" height="' . $pro_image_height . '">'; } } else { $label_fld[] = ''; } } else { if ($module == 'Contacts') { $imageattachment = 'Image'; } else { $imageattachment = 'Attachment'; } //$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname]; $sql = "select vtiger_attachments.*,vtiger_crmentity.setype\n\t\t\t from vtiger_attachments\n\t\t\t inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid\n\t\t\t inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid\n\t\t\t where vtiger_crmentity.setype='{$module} {$imageattachment}'\n\t\t\t and vtiger_attachments.name = ?\n\t\t\t and vtiger_seattachmentsrel.crmid=?"; $image_res = $adb->pquery($sql, array($col_fields[$fieldname], $col_fields['record_id'])); $image_id = $adb->query_result($image_res, 0, 'attachmentsid'); $image_path = $adb->query_result($image_res, 0, 'path'); //decode_html - added to handle UTF-8 characters in file names //urlencode - added to handle special characters like #, %, etc., $image_name = urlencode(decode_html($adb->query_result($image_res, 0, 'name'))); $imgpath = $image_path . $image_id . "_" . $image_name; if ($image_name != '') { $ftype = $adb->query_result($image_res, 0, 'type'); $isimage = stripos($ftype, 'image') !== false; if ($isimage) { $imgtxt = getTranslatedString('SINGLE_' . $module, $module) . ' ' . getTranslatedString('Image'); $label_fld[] = '<img src="' . $imgpath . '" alt="' . $imgtxt . '" title= "' . $imgtxt . '" style="max-width: 500px;">'; } else { $imgtxt = getTranslatedString('SINGLE_' . $module, $module) . ' ' . getTranslatedString('SINGLE_Documents'); $label_fld[] = '<a href="' . $imgpath . '" alt="' . $imgtxt . '" title= "' . $imgtxt . '">' . $image_name . '</a>'; } } else { $label_fld[] = ''; } } } elseif ($uitype == 62) { $value = $col_fields[$fieldname]; if ($value != '') { $parent_module = getSalesEntityType($value); if ($parent_module == "Leads") { $label_fld[] = $app_strings['LBL_LEAD_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $lead_name = $field_value; } } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>'; } elseif ($parent_module == "Accounts") { $label_fld[] = $app_strings['LBL_ACCOUNT_NAME']; $sql = "select * from vtiger_account where accountid=?"; $result = $adb->pquery($sql, array($value)); $account_name = $adb->query_result($result, 0, "accountname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $account_name . '</a>'; } elseif ($parent_module == "Potentials") { $label_fld[] = $app_strings['LBL_POTENTIAL_NAME']; $sql = "select * from vtiger_potential where potentialid=?"; $result = $adb->pquery($sql, array($value)); $potentialname = $adb->query_result($result, 0, "potentialname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $potentialname . '</a>'; } elseif ($parent_module == "Products") { $label_fld[] = $app_strings['LBL_PRODUCT_NAME']; $sql = "select * from vtiger_products where productid=?"; $result = $adb->pquery($sql, array($value)); $productname = $adb->query_result($result, 0, "productname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $productname . '</a>'; } elseif ($parent_module == "PurchaseOrder") { $label_fld[] = $app_strings['LBL_PORDER_NAME']; $sql = "select * from vtiger_purchaseorder where purchaseorderid=?"; $result = $adb->pquery($sql, array($value)); $pordername = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $pordername . '</a>'; } elseif ($parent_module == "SalesOrder") { $label_fld[] = $app_strings['LBL_SORDER_NAME']; $sql = "select * from vtiger_salesorder where salesorderid=?"; $result = $adb->pquery($sql, array($value)); $sordername = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $sordername . '</a>'; } elseif ($parent_module == "Invoice") { $label_fld[] = $app_strings['LBL_INVOICE_NAME']; $sql = "select * from vtiger_invoice where invoiceid=?"; $result = $adb->pquery($sql, array($value)); $invoicename = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $invoicename . '</a>'; } elseif ($parent_module == "Quotes") { $label_fld[] = $app_strings['LBL_QUOTES_NAME']; $sql = "select * from vtiger_quotes where quoteid=?"; $result = $adb->pquery($sql, array($value)); $quotename = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $quotename . '</a>'; } elseif ($parent_module == "HelpDesk") { $label_fld[] = $app_strings['LBL_HELPDESK_NAME']; $sql = "select * from vtiger_troubletickets where ticketid=?"; $result = $adb->pquery($sql, array($value)); $title = $adb->query_result($result, 0, "title"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $title . '</a>'; } } else { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $value; } } elseif ($uitype == 105) { //Added for user image $label_fld[] = getTranslatedString($fieldlabel, $module); //$imgpath = getModuleFileStoragePath('Contacts').$col_fields[$fieldname]; $sql = "select vtiger_attachments.* from vtiger_attachments left join vtiger_salesmanattachmentsrel on vtiger_salesmanattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid where vtiger_salesmanattachmentsrel.smid=?"; $image_res = $adb->pquery($sql, array($col_fields['record_id'])); $image_id = $adb->query_result($image_res, 0, 'attachmentsid'); $image_path = $adb->query_result($image_res, 0, 'path'); $image_name = $adb->query_result($image_res, 0, 'name'); $imgpath = $image_path . $image_id . "_" . $image_name; if ($image_name != '') { //Added the following check for the image to retain its in original size. list($pro_image_width, $pro_image_height) = getimagesize(decode_html($imgpath)); $label_fld[] = '<a href="' . $imgpath . '" target="_blank"><img src="' . $imgpath . '" width="' . $pro_image_width . '" height="' . $pro_image_height . '" alt="' . $col_fields['user_name'] . '" title="' . $col_fields['user_name'] . '" border="0"></a>'; } else { $label_fld[] = ''; } } elseif ($uitype == 66) { $value = $col_fields[$fieldname]; if ($value != '') { $parent_module = getSalesEntityType($value); if ($parent_module == "Leads") { $label_fld[] = $app_strings['LBL_LEAD_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $lead_name = $field_value; } } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>'; } elseif ($parent_module == "Accounts") { $label_fld[] = $app_strings['LBL_ACCOUNT_NAME']; $sql = "select * from vtiger_account where accountid=?"; $result = $adb->pquery($sql, array($value)); $account_name = $adb->query_result($result, 0, "accountname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $account_name . '</a>'; } elseif ($parent_module == "Potentials") { $label_fld[] = $app_strings['LBL_POTENTIAL_NAME']; $sql = "select * from vtiger_potential where potentialid=?"; $result = $adb->pquery($sql, array($value)); $potentialname = $adb->query_result($result, 0, "potentialname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $potentialname . '</a>'; } elseif ($parent_module == "Quotes") { $label_fld[] = $app_strings['LBL_QUOTE_NAME']; $sql = "select * from vtiger_quotes where quoteid=?"; $result = $adb->pquery($sql, array($value)); $quotename = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $quotename . '</a>'; } elseif ($parent_module == "PurchaseOrder") { $label_fld[] = $app_strings['LBL_PORDER_NAME']; $sql = "select * from vtiger_purchaseorder where purchaseorderid=?"; $result = $adb->pquery($sql, array($value)); $pordername = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $pordername . '</a>'; } elseif ($parent_module == "SalesOrder") { $label_fld[] = $app_strings['LBL_SORDER_NAME']; $sql = "select * from vtiger_salesorder where salesorderid=?"; $result = $adb->pquery($sql, array($value)); $sordername = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $sordername . '</a>'; } elseif ($parent_module == "Invoice") { $label_fld[] = $app_strings['LBL_INVOICE_NAME']; $sql = "select * from vtiger_invoice where invoiceid=?"; $result = $adb->pquery($sql, array($value)); $invoicename = $adb->query_result($result, 0, "subject"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $invoicename . '</a>'; } elseif ($parent_module == "Campaigns") { $label_fld[] = $app_strings['LBL_CAMPAIGN_NAME']; $sql = "select * from vtiger_campaign where campaignid=?"; $result = $adb->pquery($sql, array($value)); $campaignname = $adb->query_result($result, 0, "campaignname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $campaignname . '</a>'; } elseif ($parent_module == "HelpDesk") { $label_fld[] = $app_strings['LBL_HELPDESK_NAME']; $sql = "select * from vtiger_troubletickets where ticketid=?"; $result = $adb->pquery($sql, array($value)); $tickettitle = $adb->query_result($result, 0, "title"); if (strlen($tickettitle) > 25) { $tickettitle = substr($tickettitle, 0, 25) . '...'; } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $tickettitle . '</a>'; } elseif ($parent_module == "Vendors") { //MSL $label_fld[] = $app_strings['LBL_VENDOR_NAME']; $sql = "select vendorname from vtiger_vendor where vendorid=?"; $result = $adb->pquery($sql, array($value)); $vendor_name = $adb->query_result($result, 0, "vendorname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $vendor_name . '</a>'; } //MSL ------------------------------------------- } else { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $value; } } elseif ($uitype == 67) { $value = $col_fields[$fieldname]; if ($value != '') { $parent_module = getSalesEntityType($value); if ($parent_module == "Leads") { $label_fld[] = $app_strings['LBL_LEAD_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $lead_name = $field_value; } } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>'; } elseif ($parent_module == "Contacts") { $label_fld[] = $app_strings['LBL_CONTACT_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $contact_name = $field_value; } } else { $contact_name = ''; } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $contact_name . '</a>'; } } else { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $value; } } elseif ($uitype == 357) { $value = $col_fields[$fieldname]; if ($value != '') { $parent_name = ''; $parent_id = ''; $myemailid = $_REQUEST['record']; $mysql = "select crmid from vtiger_seactivityrel where activityid=?"; $myresult = $adb->pquery($mysql, array($myemailid)); $mycount = $adb->num_rows($myresult); if ($mycount > 1) { $label_fld[] = $app_strings['LBL_RELATED_TO']; $label_fld[] = $app_strings['LBL_MULTIPLE']; } else { $parent_module = getSalesEntityType($value); if ($parent_module == "Leads") { $label_fld[] = $app_strings['LBL_LEAD_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $lead_name = $field_value; } } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $lead_name . '</a>'; } elseif ($parent_module == "Contacts") { $label_fld[] = $app_strings['LBL_CONTACT_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $contact_name = $field_value; } } else { $contact_name = ''; } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $contact_name . '</a>'; } elseif ($parent_module == "Accounts") { $label_fld[] = $app_strings['LBL_ACCOUNT_NAME']; $sql = "select * from vtiger_account where accountid=?"; $result = $adb->pquery($sql, array($value)); $accountname = $adb->query_result($result, 0, "accountname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $accountname . '</a>'; } } } else { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $value; } } elseif ($uitype == 68) { $value = $col_fields[$fieldname]; if ($value != '') { $parent_module = getSalesEntityType($value); if ($parent_module == "Contacts") { $label_fld[] = $app_strings['LBL_CONTACT_NAME']; $displayValueArray = getEntityName($parent_module, $value); if (!empty($displayValueArray)) { foreach ($displayValueArray as $key => $field_value) { $contact_name = $field_value; } } else { $contact_name = ''; } $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $contact_name . '</a>'; } elseif ($parent_module == "Accounts") { $label_fld[] = $app_strings['LBL_ACCOUNT_NAME']; $sql = "select * from vtiger_account where accountid=?"; $result = $adb->pquery($sql, array($value)); $account_name = $adb->query_result($result, 0, "accountname"); $label_fld[] = '<a href="index.php?module=' . $parent_module . '&action=DetailView&record=' . $value . '">' . $account_name . '</a>'; } else { $value = ''; $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $value; } } else { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $value; } } elseif ($uitype == 63) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname] . 'h ' . $col_fields['duration_minutes'] . 'm'; } elseif ($uitype == 6) { $label_fld[] = getTranslatedString($fieldlabel, $module); if ($col_fields[$fieldname] == '0') { $col_fields[$fieldname] = ''; } if ($col_fields['time_start'] != '') { $start_time = $col_fields['time_start']; } $dateValue = $col_fields[$fieldname]; if ($col_fields[$fieldname] == '0000-00-00' || empty($dateValue)) { $displayValue = ''; } else { if (empty($start_time) && strpos($col_fields[$fieldname], ' ') == false) { $displayValue = DateTimeField::convertToUserFormat($col_fields[$fieldname]); } else { if (!empty($start_time)) { $date = new DateTimeField($col_fields[$fieldname] . ' ' . $start_time); } else { $date = new DateTimeField($col_fields[$fieldname]); } $displayValue = $date->getDisplayDateTimeValue(); } } $label_fld[] = $displayValue; } elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) { $label_fld[] = getTranslatedString($fieldlabel, $module); $dateValue = $col_fields[$fieldname]; if ($col_fields['time_end'] != '' && ($tabid == 9 || $tabid == 16) && $uitype == 23) { $end_time = $col_fields['time_end']; } if ($dateValue == '0000-00-00' || empty($dateValue)) { $displayValue = ''; } else { if (empty($end_time) && strpos($dateValue, ' ') == false) { $displayValue = DateTimeField::convertToUserFormat($col_fields[$fieldname]); } else { if (!empty($end_time)) { $date = new DateTimeField($col_fields[$fieldname] . ' ' . $end_time); } else { $date = new DateTimeField($col_fields[$fieldname]); } $displayValue = $date->getDisplayDateTimeValue(); } } $label_fld[] = $displayValue; } elseif ($uitype == 71 || $uitype == 72) { $label_fld[] = getTranslatedString($fieldlabel, $module); $currencyField = new CurrencyField($col_fields[$fieldname]); if ($uitype == 72) { // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion if ($fieldname == 'unit_price') { $rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module)); $label_fld[] = $currencyField->getDisplayValue(null, true); $label_fld["cursymb"] = $rate_symbol['symbol']; } else { $currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']); $label_fld[] = $currencyField->getDisplayValue(null, true); $label_fld["cursymb"] = $currency_info['currency_symbol']; } } else { $label_fld[] = $currencyField->getDisplayValue(); $label_fld["cursymb"] = $currencyField->getCurrencySymbol(); } } elseif ($uitype == 75 || $uitype == 81) { $label_fld[] = getTranslatedString($fieldlabel, $module); $vendor_id = $col_fields[$fieldname]; if ($vendor_id != '') { $vendor_name = getVendorName($vendor_id); } $label_fld[] = $vendor_name; $label_fld["secid"] = $vendor_id; $label_fld["link"] = "index.php?module=Vendors&action=DetailView&record=" . $vendor_id; } elseif ($uitype == 76) { $label_fld[] = getTranslatedString($fieldlabel, $module); $potential_id = $col_fields[$fieldname]; if ($potential_id != '') { $potential_name = getPotentialName($potential_id); } $label_fld[] = $potential_name; $label_fld["secid"] = $potential_id; $label_fld["link"] = "index.php?module=Potentials&action=DetailView&record=" . $potential_id; } elseif ($uitype == 78) { $label_fld[] = getTranslatedString($fieldlabel, $module); $quote_id = $col_fields[$fieldname]; if ($quote_id != '') { $quote_name = getQuoteName($quote_id); } $label_fld[] = $quote_name; $label_fld["secid"] = $quote_id; $label_fld["link"] = "index.php?module=Quotes&action=DetailView&record=" . $quote_id; } elseif ($uitype == 79) { $label_fld[] = getTranslatedString($fieldlabel, $module); $purchaseorder_id = $col_fields[$fieldname]; if ($purchaseorder_id != '') { $purchaseorder_name = getPoName($purchaseorder_id); } $label_fld[] = $purchaseorder_name; $label_fld["secid"] = $purchaseorder_id; $label_fld["link"] = "index.php?module=PurchaseOrder&action=DetailView&record=" . $purchaseorder_id; } elseif ($uitype == 80) { $label_fld[] = getTranslatedString($fieldlabel, $module); $salesorder_id = $col_fields[$fieldname]; if ($salesorder_id != '') { $salesorder_name = getSoName($salesorder_id); } $label_fld[] = $salesorder_name; $label_fld["secid"] = $salesorder_id; $label_fld["link"] = "index.php?module=SalesOrder&action=DetailView&record=" . $salesorder_id; } elseif ($uitype == 30) { $rem_days = 0; $rem_hrs = 0; $rem_min = 0; $reminder_str = ""; $rem_days = floor($col_fields[$fieldname] / (24 * 60)); $rem_hrs = floor(($col_fields[$fieldname] - $rem_days * 24 * 60) / 60); $rem_min = ($col_fields[$fieldname] - $rem_days * 24 * 60) % 60; $label_fld[] = getTranslatedString($fieldlabel, $module); if ($col_fields[$fieldname]) { $reminder_str = $rem_days . ' ' . $mod_strings['LBL_DAYS'] . ' ' . $rem_hrs . ' ' . $mod_strings['LBL_HOURS'] . ' ' . $rem_min . ' ' . $mod_strings['LBL_MINUTES'] . ' ' . $mod_strings['LBL_BEFORE_EVENT']; } $label_fld[] = ' ' . $reminder_str; } elseif ($uitype == 98) { $label_fld[] = getTranslatedString($fieldlabel, $module); if (is_admin($current_user)) { $label_fld[] = '<a href="index.php?module=Settings&action=RoleDetailView&roleid=' . $col_fields[$fieldname] . '">' . getRoleName($col_fields[$fieldname]) . '</a>'; } else { $label_fld[] = getRoleName($col_fields[$fieldname]); } } elseif ($uitype == 85) { //Added for Skype by Minnie $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; } elseif ($uitype == 26) { $label_fld[] = getTranslatedString($fieldlabel, $module); $query = "select foldername from vtiger_attachmentsfolder where folderid = ?"; $result = $adb->pquery($query, array($col_fields[$fieldname])); $folder_name = $adb->query_result($result, 0, "foldername"); $label_fld[] = $folder_name; } elseif ($uitype == 27) { if ($col_fields[$fieldname] == 'I') { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $mod_strings['LBL_INTERNAL']; } else { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $mod_strings['LBL_EXTERNAL']; } } elseif ($uitype == 31) { $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = $col_fields[$fieldname]; $options = array(); $themeList = get_themes(); foreach ($themeList as $theme) { if ($current_user->theme == $theme) { $selected = 'selected'; } else { $selected = ''; } $options[] = array(getTranslatedString($theme), $theme, $selected); } $label_fld["options"] = $options; } elseif ($uitype == 32) { $options = array(); $languageList = Vtiger_Language::getAll(); $label_fld[] = getTranslatedString($fieldlabel, $module); $label_fld[] = isset($languageList[$col_fields[$fieldname]]) ? $languageList[$col_fields[$fieldname]] : $col_fields[$fieldname]; foreach ($languageList as $prefix => $label) { if ($current_user->language == $prefix) { $selected = 'selected'; } else { $selected = ''; } $options[] = array(getTranslatedString($label), $prefix, $selected); } $label_fld["options"] = $options; } else { $label_fld[] = getTranslatedString($fieldlabel, $module); if ($col_fields[$fieldname] == '0' && $fieldname != 'filedownloadcount' && $fieldname != 'filestatus' && $fieldname != 'filesize') { $col_fields[$fieldname] = ''; } //code for Documents module :start if ($tabid == 8) { $downloadtype = $col_fields['filelocationtype']; if ($fieldname == 'filename') { if ($downloadtype == 'I') { //$file_value = $mod_strings['LBL_INTERNAL']; $fld_value = $col_fields['filename']; $ext_pos = strrpos($fld_value, "."); $ext = substr($fld_value, $ext_pos + 1); $ext = strtolower($ext); if ($ext == 'bin' || $ext == 'exe' || $ext == 'rpm') { $fileicon = "<img src='" . vtiger_imageurl('fExeBin.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>"; } elseif ($ext == 'jpg' || $ext == 'gif' || $ext == 'bmp') { $fileicon = "<img src='" . vtiger_imageurl('fbImageFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>"; } elseif ($ext == 'txt' || $ext == 'doc' || $ext == 'xls') { $fileicon = "<img src='" . vtiger_imageurl('fbTextFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>"; } elseif ($ext == 'zip' || $ext == 'gz' || $ext == 'rar') { $fileicon = "<img src='" . vtiger_imageurl('fbZipFile.gif', $theme) . "' hspace='3' align='absmiddle'\tborder='0'>"; } else { $fileicon = "<img src='" . vtiger_imageurl('fbUnknownFile.gif', $theme) . "' hspace='3' align='absmiddle' border='0'>"; } } else { $fld_value = $col_fields['filename']; $fileicon = "<img src='" . vtiger_imageurl('fbLink.gif', $theme) . "' alt='" . $mod_strings['LBL_EXTERNAL_LNK'] . "' title='" . $mod_strings['LBL_EXTERNAL_LNK'] . "' hspace='3' align='absmiddle' border='0'>"; } $label_fld[] = $fileicon . $fld_value; } if ($fieldname == 'filesize') { if ($col_fields['filelocationtype'] == 'I') { $filesize = $col_fields[$fieldname]; if ($filesize < 1024) { $label_fld[] = $filesize . ' B'; } elseif ($filesize > 1024 && $filesize < 1048576) { $label_fld[] = round($filesize / 1024, 2) . ' KB'; } else { if ($filesize > 1048576) { $label_fld[] = round($filesize / (1024 * 1024), 2) . ' MB'; } } } else { $label_fld[] = ' --'; } } if ($fieldname == 'filetype' && $col_fields['filelocationtype'] == 'E') { $label_fld[] = ' --'; } /* if($fieldname == 'filestatus') { $filestatus = $col_fields[$fieldname]; if($filestatus == 0) $label_fld[]=$mod_strings['LBL_ACTIVE']; else $label_fld[]=$mod_strings['LBL_INACTIVE']; } */ } //code for Documents module :end $label_fld[] = $col_fields[$fieldname]; } } $label_fld[] = $uitype; //sets whether the currenct user is admin or not if (is_admin($current_user)) { $label_fld["isadmin"] = 1; } else { $label_fld["isadmin"] = 0; } $log->debug("Exiting getDetailViewOutputHtml method ..."); return $label_fld; }