コード例 #1
0
ファイル: Detail.php プロジェクト: jmangarret/vtigercrm
 public function process(Vtiger_Request $request)
 {
     PDFMaker_Debugger_Model::GetInstance()->Init();
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     if ($PDFMaker->CheckPermissions("DETAIL") == false) {
         $PDFMaker->DieDuePermission();
     }
     $viewer = $this->getViewer($request);
     if ($request->has('templateid') && !$request->isEmpty('templateid')) {
         $pdftemplateResult = $PDFMaker->GetDetailViewData($_REQUEST['templateid']);
         $viewer->assign("TEMPLATEID", $pdftemplateResult["templateid"]);
         $viewer->assign("MODULENAME", getTranslatedString($pdftemplateResult["module"]));
         $viewer->assign("BODY", decode_html($pdftemplateResult["body"]));
         $viewer->assign("HEADER", decode_html($pdftemplateResult["header"]));
         $viewer->assign("FOOTER", decode_html($pdftemplateResult["footer"]));
     }
     $version_type = $PDFMaker->GetVersionType();
     $viewer->assign("VERSION", $version_type . " " . PDFMaker_Version_Helper::$version);
     if ($PDFMaker->CheckPermissions("EDIT") && $PDFMaker->GetVersionType() != "deactivate") {
         $viewer->assign("EDIT", "permitted");
     }
     $category = getParentTab();
     $viewer->assign("CATEGORY", $category);
     $viewer->view('Detail.tpl', 'PDFMaker');
 }
コード例 #2
0
ファイル: index.php プロジェクト: casati-dolibarr/corebos
 function __construct()
 {
     parent::__construct();
     global $app_strings, $mod_strings, $currentModule, $theme;
     $this->assign('CUSTOM_MODULE', true);
     $this->assign('APP', $app_strings);
     $this->assign('MOD', $mod_strings);
     $this->assign('MODULE', $currentModule);
     // TODO: Update Single Module Instance name here.
     $this->assign('SINGLE_MOD', 'SINGLE_' . $currentModule);
     $this->assign('CATEGORY', getParentTab($currentModule));
     $this->assign('IMAGE_PATH', "themes/{$theme}/images/");
     $this->assign('THEME', $theme);
 }
コード例 #3
0
ファイル: Viewer.php プロジェクト: hbsman/vtigercrm-5.3.0-ja
 function MailManager_Viewer()
 {
     parent::vtigerCRM_Smarty();
     global $app_strings, $mod_strings, $currentModule, $theme;
     $this->assign('CUSTOM_MODULE', true);
     $this->assign('APP', $app_strings);
     $this->assign('MOD', $mod_strings);
     $this->assign('MODULE', $currentModule);
     // TODO: Update Single Module Instance name here.
     $this->assign('SINGLE_MOD', 'SINGLE_' . $currentModule);
     $this->assign('CATEGORY', getParentTab());
     $this->assign('IMAGE_PATH', "themes/{$theme}/images/");
     $this->assign('THEME', $theme);
     return parent::vtigerCRM_Smarty();
 }
コード例 #4
0
ファイル: Detail.php プロジェクト: cin-system/cinrepo
 public function process(Vtiger_Request $request)
 {
     PDFMaker_Debugger_Model::GetInstance()->Init();
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     if ($PDFMaker->CheckPermissions("DETAIL") == false) {
         $PDFMaker->DieDuePermission();
     }
     $viewer = $this->getViewer($request);
     if ($request->has('templateid') && !$request->isEmpty('templateid')) {
         $pdftemplateResult = $PDFMaker->GetDetailViewData($_REQUEST['templateid']);
         $viewer->assign("FILENAME", $pdftemplateResult["filename"]);
         $viewer->assign("DESCRIPTION", $pdftemplateResult["description"]);
         $viewer->assign("TEMPLATEID", $pdftemplateResult["templateid"]);
         $viewer->assign("MODULENAME", getTranslatedString($pdftemplateResult["module"]));
         $viewer->assign("BODY", decode_html($pdftemplateResult["body"]));
         $viewer->assign("HEADER", decode_html($pdftemplateResult["header"]));
         $viewer->assign("FOOTER", decode_html($pdftemplateResult["footer"]));
         $viewer->assign("IS_ACTIVE", $pdftemplateResult["is_active"]);
         $viewer->assign("IS_DEFAULT", $pdftemplateResult["is_default"]);
         $viewer->assign("ACTIVATE_BUTTON", $pdftemplateResult["activateButton"]);
         $viewer->assign("DEFAULT_BUTTON", $pdftemplateResult["defaultButton"]);
     }
     $version_type = $PDFMaker->GetVersionType();
     $viewer->assign("VERSION", $version_type . " " . PDFMaker_Version_Helper::$version);
     if ($pdftemplateResult["permissions"]["edit"]) {
         //if ($PDFMaker->CheckPermissions("EDIT")) {
         $viewer->assign("EXPORT", "yes");
     }
     if ($PDFMaker->GetVersionType() != "deactivate") {
         if ($pdftemplateResult["permissions"]["edit"]) {
             //if ($PDFMaker->CheckPermissions("EDIT") && $PDFMaker->GetVersionType() != "deactivate") {
             $viewer->assign("EDIT", "permitted");
             $viewer->assign("IMPORT", "yes");
         }
         if ($pdftemplateResult["permissions"]["delete"]) {
             $viewer->assign("DELETE", "permitted");
         }
     }
     //$tool_buttons = Button_Check('PDFMaker');
     //$viewer->assign('CHECK', $tool_buttons);
     $category = getParentTab();
     $viewer->assign("CATEGORY", $category);
     $viewer->view('Detail.tpl', 'PDFMaker');
 }
コード例 #5
0
require_once 'include/utils/utils.php';
require_once 'Smarty_setup.php';
global $app_strings;
global $list_max_entries_per_page;
global $currentModule, $current_user;
if ($current_user->is_admin != 'on') {
    die("<br><br><center>" . $app_strings['LBL_PERMISSION'] . " <a href='javascript:window.history.back()'>" . $app_strings['LBL_GO_BACK'] . ".</a></center>");
}
$log = LoggerManager::getLogger('user_list');
global $mod_strings, $adb;
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
global $current_language;
$mod_strings = return_module_language($current_language, 'Users');
$category = getParentTab();
$focus = new Users();
$no_of_users = UserCount();
//Display the mail send status
$smarty = new vtigerCRM_Smarty();
if ($_REQUEST['mail_error'] != '') {
    require_once "modules/Emails/mail.php";
    $error_msg = strip_tags(parseEmailErrorString($_REQUEST['mail_error']));
    $error_msg = $app_strings['LBL_MAIL_NOT_SENT_TO_USER'] . ' ' . vtlib_purify($_REQUEST['user']) . '. ' . $app_strings['LBL_PLS_CHECK_EMAIL_N_SERVER'];
    $smarty->assign("ERROR_MSG", $mod_strings['LBL_MAIL_SEND_STATUS'] . ' <b><font class="warning">' . $error_msg . '</font></b>');
}
//Retreiving the start value from request
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
    $start = vtlib_purify($_REQUEST['start']);
} elseif ($_SESSION['user_pagestart'] != '') {
    $start = $_SESSION['user_pagestart'];
コード例 #6
0
/*+**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ************************************************************************************/
require_once 'Smarty_setup.php';
require_once 'user_privileges/default_module_view.php';
global $mod_strings, $app_strings, $currentModule, $current_user, $theme, $singlepane_view;
$category = getParentTab();
$action = vtlib_purify($_REQUEST['action']);
$record = vtlib_purify($_REQUEST['record']);
$isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
$parenttab = getParentTab();
if ($singlepane_view == 'true' && $action == 'CallRelatedList') {
    header("Location:index.php?action=DetailView&module={$currentModule}&record={$record}&parenttab={$parenttab}");
} else {
    $tool_buttons = Button_Check($currentModule);
    $focus = CRMEntity::getInstance($currentModule);
    if ($record != '') {
        $focus->retrieve_entity_info($record, $currentModule);
        $focus->id = $record;
    }
    $smarty = new vtigerCRM_Smarty();
    if ($isduplicate == 'true') {
        $focus->id = '';
    }
    if (isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
        $smarty->assign("OP_MODE", vtlib_purify($_REQUEST['mode']));
コード例 #7
0
ファイル: Quotes.php プロジェクト: hardikk/HNH
 /**	function used to get the list of activities which are related to the Quotes
  *	@param int $id - quote id
  *	@return array - return an array which will be returned from the function GetRelatedList
  */
 function get_activities($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_activities(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/Activity.php";
     $other = new Activity();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     $button .= '<input type="hidden" name="activity_mode">';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\";this.form.return_module.value=\"{$this_module}\";this.form.activity_mode.value=\"Task\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "'>&nbsp;";
         }
     }
     $query = "SELECT case when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name, vtiger_contactdetails.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime,vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid where vtiger_seactivityrel.crmid=" . $id . " and vtiger_crmentity.deleted=0 and activitytype='Task' and (vtiger_activity.status is not NULL and vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL and vtiger_activity.status != 'Deferred')";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_activities method ...");
     return $return_value;
 }
コード例 #8
0
$image_path = $theme_path . "images/";
global $log, $default_charset;
$mode = 'create';
if (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] != '') {
    $mode = 'edit';
    $templateid = $_REQUEST['templateid'];
    $log->debug("the templateid is set to the value " . $templateid);
}
$sql = "select * from vtiger_emailtemplates where templateid=?";
$result = $adb->pquery($sql, array($templateid));
$emailtemplateResult = str_replace('"', '&quot;', $adb->fetch_array($result));
$smod_strings = return_module_language($current_language, 'Settings');
//To get Email Template variables -- Pavani
$allOptions = getEmailTemplateVariables();
$smarty = new vtigerCRM_smarty();
$smarty->assign("UMOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme_path);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MOD", $smod_strings);
$smarty->assign("FOLDERNAME", $emailtemplateResult["foldername"]);
$smarty->assign("TEMPLATENAME", $emailtemplateResult["templatename"]);
$smarty->assign("TEMPLATEID", $emailtemplateResult["templateid"]);
$smarty->assign("DESCRIPTION", $emailtemplateResult["description"]);
$smarty->assign("SUBJECT", $emailtemplateResult["subject"]);
$smarty->assign("BODY", $emailtemplateResult["body"]);
$smarty->assign("MODULE", 'Settings');
$smarty->assign("PARENTTAB", getParentTab());
$smarty->assign("EMODE", $mode);
$smarty->assign("ALL_VARIABLES", $allOptions);
$smarty->display("CreateEmailTemplate.tpl");
コード例 #9
0
ファイル: Services.php プロジェクト: mslokhat/corebos
 /**	function used to get the list of invoices which are related to the service
  *	@param int $id - service id
  *	@return array - array which will be returned from the function GetRelatedList
  */
 function get_invoices($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_invoices(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'>&nbsp;";
         }
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "SELECT vtiger_crmentity.*,\n\t\t\tvtiger_invoice.*,\n\t\t\tvtiger_account.accountname,\n\t\t\tcase when (vtiger_users.user_name not like '') then {$userNameSql}\n\t\t\t\telse vtiger_groups.groupname end as user_name\n\t\t\tFROM vtiger_invoice\n\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_invoice.invoiceid\n\t\t\tLEFT OUTER JOIN vtiger_account\n\t\t\t\tON vtiger_account.accountid = vtiger_invoice.accountid\n\t\t\tINNER JOIN (SELECT DISTINCT(vtiger_inventoryproductrel.id) as id FROM vtiger_inventoryproductrel WHERE vtiger_inventoryproductrel.productid = {$id}) as invrel\n\t\t\t\tON invrel.id = vtiger_invoice.invoiceid\n\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_users\n\t\t\t\tON  vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\tWHERE vtiger_crmentity.deleted = 0";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_invoices method ...");
     return $return_value;
 }
コード例 #10
0
<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ********************************************************************************/
require_once 'include/database/PearDatabase.php';
$id = vtlib_purify($_REQUEST['record']);
$sql = "delete from vtiger_seattachmentsrel where attachmentsid =?";
$adb->pquery($sql, array($id));
$sql = "delete from vtiger_attachments where attachmentsid =?";
$adb->pquery($sql, array($id));
header("Location:index.php?module=" . vtlib_purify($_REQUEST['return_module']) . "&action=" . vtlib_purify($_REQUEST['return_action']) . "&record=" . vtlib_purify($_REQUEST['return_id']) . "&parenttab=" . getParentTab());
コード例 #11
0
ファイル: Accounts.php プロジェクト: cin-system/vtigercrm-cin
 /**
  * Function to handle the related list for the module.
  * NOTE: Vtiger_Module::setRelatedList sets reference to this function in vtiger_relatedlists table
  * if function name is not explicitly specified.
  */
 function get_related_list($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $currentModule, $app_strings, $singlepane_view, $log;
     $log->debug("Entering get_related_list(" . $id . "," . $cur_tab_id . "," . $rel_tab_id . "," . $actions . ") method ...");
     $parenttab = getParentTab();
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     $other = CRMEntity::getInstance($related_module);
     // Some standard module class doesn't have required variables
     // that are used in the query, they are defined in this generic API
     vtlib_setup_modulevars($currentModule, $this);
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = 'SINGLE_' . $related_module;
     $button = '';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' " . " type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\"" . " value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module, $related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input type='hidden' name='createmode' id='createmode' value='link' />" . "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname, $related_module) . "'>&nbsp;";
         }
     }
     // To make the edit or del link actions to return back to same view.
     if ($singlepane_view == 'true') {
         $returnset = "&return_module={$currentModule}&return_action=DetailView&return_id={$id}";
     } else {
         $returnset = "&return_module={$currentModule}&return_action=CallRelatedList&return_id={$id}";
     }
     $more_relation = '';
     if (!empty($other->related_tables)) {
         foreach ($other->related_tables as $tname => $relmap) {
             $query .= ", {$tname}.*";
             // Setup the default JOIN conditions if not specified
             if (empty($relmap[1])) {
                 $relmap[1] = $other->table_name;
             }
             if (empty($relmap[2])) {
                 $relmap[2] = $relmap[0];
             }
             $more_relation .= " LEFT JOIN {$tname} ON {$tname}.{$relmap['0']} = {$relmap['1']}.{$relmap['2']}";
         }
     }
     $entityIds = $this->getRelatedContactsIds();
     array_push($entityIds, $id);
     $entityIds = implode(',', $entityIds);
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "SELECT vtiger_crmentity.*, {$other->table_name}.*,\n\t\t\t\tCASE WHEN (vtiger_users.user_name NOT LIKE '') THEN {$userNameSql} ELSE vtiger_groups.groupname END AS user_name FROM {$other->table_name}\n\t\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = {$other->table_name}.{$other->table_index}\n\t\t\t\tINNER JOIN vtiger_crmentityrel ON (vtiger_crmentityrel.relcrmid = vtiger_crmentity.crmid OR vtiger_crmentityrel.crmid = vtiger_crmentity.crmid)\n\t\t\t\t{$more_relation}\n\t\t\t\tLEFT  JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\t\tLEFT  JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tWHERE vtiger_crmentity.deleted = 0 AND (vtiger_crmentityrel.crmid IN (" . $entityIds . ") OR vtiger_crmentityrel.relcrmid IN (" . $entityIds . "))";
     $return_value = GetRelatedList($currentModule, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_related_list(" . $id . "," . $cur_tab_id . "," . $rel_tab_id . "," . $actions . ") method ...");
     return $return_value;
 }
コード例 #12
0
function getListViewEntries2($focus, $module, $list_result, $navigation_array, $relatedlist = '', $returnset = '', $edit_action = 'EditView', $del_action = 'Delete', $oCv = '', $page = '', $selectedfields = '', $contRelatedfields = '', $skipActions = false)
{
    global $log;
    global $mod_strings;
    $log->debug("Entering getListViewEntries(" . get_class($focus) . "," . $module . "," . $list_result . "," . $navigation_array . "," . $relatedlist . "," . $returnset . "," . $edit_action . "," . $del_action . "," . (is_object($oCv) ? get_class($oCv) : $oCv) . ") method ...");
    $tabname = getParentTab();
    global $adb, $current_user;
    global $app_strings;
    $noofrows = $adb->num_rows($list_result);
    $list_block = array();
    global $theme;
    $evt_status = '';
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    //getting the vtiger_fieldtable entries from database
    $tabid = getTabid($module);
    //added for vtiger_customview 27/5
    if ($oCv) {
        if (isset($oCv->list_fields)) {
            $focus->list_fields = $oCv->list_fields;
        }
    }
    if (is_array($selectedfields) && $selectedfields != '') {
        $focus->list_fields = $selectedfields;
    }
    // Remove fields which are made inactive
    $focus->filterInactiveFields($module);
    //Added to reduce the no. of queries logging for non-admin user -- by minnie-start
    $field_list = array();
    $j = 0;
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    foreach ($focus->list_fields as $name => $tableinfo) {
        $fieldname = $focus->list_fields_name[$name];
        if ($oCv) {
            if (isset($oCv->list_fields_name)) {
                $fieldname = $oCv->list_fields_name[$name];
            }
        }
        if ($fieldname == 'accountname' && $module != 'Accounts') {
            $fieldname = 'account_id';
        }
        if ($fieldname == 'lastname' && ($module == 'SalesOrder' || $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes' || $module == 'Calendar')) {
            $fieldname = 'contact_id';
        }
        if ($fieldname == 'productname' && $module != 'Products') {
            $fieldname = 'product_id';
        }
        array_push($field_list, $fieldname);
        $j++;
    }
    $field = array();
    if ($is_admin == false) {
        if ($module == 'Emails') {
            $query = "SELECT fieldname FROM vtiger_field WHERE tabid = ? and vtiger_field.presence in (0,2)";
            $params = array($tabid);
        } else {
            $profileList = getCurrentUserProfileList();
            $params = array();
            $query = "SELECT DISTINCT vtiger_field.fieldname\r\n\t\t\t\tFROM vtiger_field\r\n\t\t\t\tINNER JOIN vtiger_profile2field\r\n\t\t\t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\r\n\t\t\t\tINNER JOIN vtiger_def_org_field\r\n\t\t\t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid";
            if ($module == "Calendar") {
                $query .= " WHERE vtiger_field.tabid in (9,16) and vtiger_field.presence in (0,2)";
            } else {
                $query .= " WHERE vtiger_field.tabid = ? and vtiger_field.presence in (0,2)";
                array_push($params, $tabid);
            }
            $query .= " AND vtiger_profile2field.visible = 0\r\n\t\t\t\t\tAND vtiger_profile2field.visible = 0\r\n\t\t\t\t\tAND vtiger_def_org_field.visible = 0\r\n\t\t\t\t\tAND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")\r\n\t\t\t\t\tAND vtiger_field.fieldname IN (" . generateQuestionMarks($field_list) . ")";
            array_push($params, $profileList, $field_list);
        }
        $result = $adb->pquery($query, $params);
        for ($k = 0; $k < $adb->num_rows($result); $k++) {
            $field[] = $adb->query_result($result, $k, "fieldname");
        }
    }
    //constructing the uitype and columnname array
    $ui_col_array = array();
    $params = array();
    $query = "SELECT uitype, columnname, fieldname FROM vtiger_field ";
    if ($module == "Calendar") {
        $query .= " WHERE vtiger_field.tabid in (9,16) and vtiger_field.presence in (0,2)";
    } else {
        $query .= " WHERE vtiger_field.tabid = ? and vtiger_field.presence in (0,2)";
        array_push($params, $tabid);
    }
    $query .= " AND fieldname IN (" . generateQuestionMarks($field_list) . ") ";
    array_push($params, $field_list);
    $result = $adb->pquery($query, $params);
    $num_rows = $adb->num_rows($result);
    for ($i = 0; $i < $num_rows; $i++) {
        $tempArr = array();
        $uitype = $adb->query_result($result, $i, 'uitype');
        $columnname = $adb->query_result($result, $i, 'columnname');
        $field_name = $adb->query_result($result, $i, 'fieldname');
        $tempArr[$uitype] = $columnname;
        $ui_col_array[$field_name] = $tempArr;
    }
    //end
    if ($navigation_array['start'] != 0) {
        for ($i = 1; $i <= $noofrows; $i++) {
            $list_header = array();
            //Getting the entityid
            if ($module != 'Users') {
                $entity_id = $adb->query_result($list_result, $i - 1, "crmid");
                $owner_id = $adb->query_result($list_result, $i - 1, "smownerid");
            } else {
                $entity_id = $adb->query_result($list_result, $i - 1, "id");
            }
            // Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
            // begin: Armando Lüscher 05.07.2005 -> §priority
            // Code contri buted by fredy Desc: Set Priority color
            $priority = $adb->query_result($list_result, $i - 1, "priority");
            $font_color_high = "color:#00DD00;";
            $font_color_medium = "color:#DD00DD;";
            $P_FONT_COLOR = "";
            switch ($priority) {
                case 'High':
                    $P_FONT_COLOR = $font_color_high;
                    break;
                case 'Medium':
                    $P_FONT_COLOR = $font_color_medium;
                    break;
                default:
                    $P_FONT_COLOR = "";
            }
            //end: Armando Lüscher 05.07.2005 -> §priority
            foreach ($focus->list_fields as $name => $tableinfo) {
                $fieldname = $focus->list_fields_name[$name];
                //added for vtiger_customview 27/5
                if ($oCv) {
                    if (isset($oCv->list_fields_name)) {
                        $fieldname = $oCv->list_fields_name[$name];
                        if ($fieldname == 'accountname' && $module != 'Accounts') {
                            $fieldname = 'account_id';
                        }
                        if ($fieldname == 'lastname' && ($module == 'SalesOrder' || $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes' || $module == 'Calendar')) {
                            $fieldname = 'contact_id';
                        }
                        if ($fieldname == 'productname' && $module != 'Products') {
                            $fieldname = 'product_id';
                        }
                    } else {
                        $fieldname = $focus->list_fields_name[$name];
                    }
                } else {
                    $fieldname = $focus->list_fields_name[$name];
                    if ($fieldname == 'accountname' && $module != 'Accounts') {
                        $fieldname = 'account_id';
                    }
                    if ($fieldname == 'lastname' && ($module == 'SalesOrder' || $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes' || $module == 'Calendar')) {
                        $fieldname = 'contact_id';
                    }
                    if ($fieldname == 'productname' && $module != 'Products') {
                        $fieldname = 'product_id';
                    }
                }
                if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0 || in_array($fieldname, $field) || $fieldname == '' || $name == 'Close' && $module == 'Calendar') {
                    if ($fieldname == '') {
                        $table_name = '';
                        $column_name = '';
                        foreach ($tableinfo as $tablename => $colname) {
                            $table_name = $tablename;
                            $column_name = $colname;
                        }
                        $value = $adb->query_result($list_result, $i - 1, $colname);
                    } else {
                        if ($module == 'Calendar') {
                            $act_id = $adb->query_result($list_result, $i - 1, "activityid");
                            $cal_sql = "select activitytype from vtiger_activity where activityid=?";
                            $cal_res = $adb->pquery($cal_sql, array($act_id));
                            if ($adb->num_rows($cal_res) >= 0) {
                                $activitytype = $adb->query_result($cal_res, 0, "activitytype");
                            }
                        }
                        if (($module == 'Calendar' || $module == 'Emails' || $module == 'HelpDesk' || $module == 'Invoice' || $module == 'Leads' || $module == 'Contacts') && ($fieldname == 'parent_id' || $name == 'Contact Name' || $name == 'Close' || $fieldname == 'firstname')) {
                            if ($module == 'Calendar') {
                                if ($fieldname == 'status') {
                                    if ($activitytype == 'Task') {
                                        $fieldname = 'taskstatus';
                                    } else {
                                        $fieldname = 'eventstatus';
                                    }
                                }
                                if ($activitytype == 'Task') {
                                    if (getFieldVisibilityPermission('Calendar', $current_user->id, $fieldname) == '0') {
                                        $has_permission = 'yes';
                                    } else {
                                        $has_permission = 'no';
                                    }
                                } else {
                                    if (getFieldVisibilityPermission('Events', $current_user->id, $fieldname) == '0') {
                                        $has_permission = 'yes';
                                    } else {
                                        $has_permission = 'no';
                                    }
                                }
                            }
                            if ($module != 'Calendar' || $module == 'Calendar' && $has_permission == 'yes') {
                                if ($fieldname == 'parent_id') {
                                    $value = getRelatedTo($module, $list_result, $i - 1);
                                }
                                if ($name == 'Contact Name') {
                                    $contact_id = $adb->query_result($list_result, $i - 1, "contactid");
                                    $contact_name = getFullNameFromQResult($list_result, $i - 1, "Contacts");
                                    $value = "";
                                    //Added to get the contactname for activities custom view - t=2190
                                    if ($contact_id != '' && !empty($contact_name)) {
                                        $contact_name = getContactName($contact_id);
                                    }
                                    if ($contact_name != "" && $contact_id != 'NULL') {
                                        // Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
                                        $value = "<a href='index.php?module=Contacts&action=DetailView&parenttab=" . $tabname . "&record=" . $contact_id . "' style='" . $P_FONT_COLOR . "'>" . $contact_name . "</a>";
                                        // Armando Lüscher 05.07.2005 -> §priority -> Desc: inserted style="$P_FONT_COLOR"
                                    }
                                }
                                if ($fieldname == "firstname") {
                                    $first_name = textlength_check($adb->query_result($list_result, $i - 1, "firstname"));
                                    $value = '<a href="index.php?action=DetailView&module=' . $module . '&parenttab=' . $tabname . '&record=' . $entity_id . '">' . $first_name . '</a>';
                                }
                                if ($name == 'Close') {
                                    $status = $adb->query_result($list_result, $i - 1, "status");
                                    $activityid = $adb->query_result($list_result, $i - 1, "activityid");
                                    if (empty($activityid)) {
                                        $activityid = $adb->query_result($list_result, $i - 1, "tmp_activity_id");
                                    }
                                    $activitytype = $adb->query_result($list_result, $i - 1, "activitytype");
                                    // TODO - Picking activitytype when it is not present in the Custom View.
                                    // Going forward, this column should be added to the select list if not already present as a performance improvement.
                                    if (empty($activitytype)) {
                                        $activitytypeRes = $adb->pquery('SELECT activitytype FROM vtiger_activity WHERE activityid=?', array($activityid));
                                        if ($adb->num_rows($activitytypeRes) > 0) {
                                            $activitytype = $adb->query_result($activitytypeRes, 0, 'activitytype');
                                        }
                                    }
                                    if ($activitytype != 'Task' && $activitytype != 'Emails') {
                                        $eventstatus = $adb->query_result($list_result, $i - 1, "eventstatus");
                                        if (isset($eventstatus)) {
                                            $status = $eventstatus;
                                        }
                                    }
                                    if ($status == 'Deferred' || $status == 'Completed' || $status == 'Held' || $status == '') {
                                        $value = "";
                                    } else {
                                        if ($activitytype == 'Task') {
                                            $evt_status = '&status=Completed';
                                        } else {
                                            $evt_status = '&eventstatus=Held';
                                        }
                                        if (isPermitted("Calendar", 'EditView', $activityid) == 'yes') {
                                            if ($returnset == '') {
                                                $returnset = '&return_module=Calendar&return_action=ListView&return_id=' . $activityid . '&return_viewname=' . $oCv->setdefaultviewid;
                                            }
                                            // Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
                                            $value = "<a href='index.php?action=Save&module=Calendar&record=" . $activityid . "&parenttab=" . $tabname . "&change_status=true" . $returnset . $evt_status . "&start=" . $navigation_array['current'] . "' style='" . $P_FONT_COLOR . "'>X</a>";
                                            // Armando Lüscher 05.07.2005 -> §priority -> Desc: inserted style="$P_FONT_COLOR"
                                        } else {
                                            $value = "";
                                        }
                                    }
                                }
                            } else {
                                $value = "";
                            }
                        } elseif ($module == "Documents" && ($fieldname == 'filelocationtype' || $fieldname == 'filename' || $fieldname == 'filesize' || $fieldname == 'filestatus' || $fieldname == 'filetype')) {
                            $value = $adb->query_result($list_result, $i - 1, $fieldname);
                            if ($fieldname == 'filelocationtype') {
                                if ($value == 'I') {
                                    $value = getTranslatedString('LBL_INTERNAL', $module);
                                } elseif ($value == 'E') {
                                    $value = getTranslatedString('LBL_EXTERNAL', $module);
                                } else {
                                    $value = ' --';
                                }
                            }
                            if ($fieldname == 'filename') {
                                $downloadtype = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                if ($downloadtype == 'I') {
                                    $fld_value = $value;
                                    $ext_pos = strrpos($fld_value, ".");
                                    $ext = substr($fld_value, $ext_pos + 1);
                                    $ext = strtolower($ext);
                                    if ($value != '') {
                                        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'>";
                                        }
                                    }
                                } elseif ($downloadtype == 'E') {
                                    if (trim($value) != '') {
                                        $fld_value = $value;
                                        $fileicon = "<img src='" . vtiger_imageurl('fbLink.gif', $theme) . "' alt='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' title='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' hspace='3' align='absmiddle' border='0'>";
                                    } else {
                                        $fld_value = '--';
                                        $fileicon = '';
                                    }
                                } else {
                                    $fld_value = ' --';
                                    $fileicon = '';
                                }
                                $file_name = $adb->query_result($list_result, $i - 1, 'filename');
                                $notes_id = $adb->query_result($list_result, $i - 1, 'crmid');
                                $folder_id = $adb->query_result($list_result, $i - 1, 'folderid');
                                $download_type = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                $file_status = $adb->query_result($list_result, $i - 1, 'filestatus');
                                $fileidQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
                                $fileidres = $adb->pquery($fileidQuery, array($notes_id));
                                $fileid = $adb->query_result($fileidres, 0, 'attachmentsid');
                                if ($file_name != '' && $file_status == 1) {
                                    if ($download_type == 'I') {
                                        $fld_value = "<a href='index.php?module=uploads&action=downloadfile&entityid={$notes_id}&fileid={$fileid}' title='" . getTranslatedString("LBL_DOWNLOAD_FILE", $module) . "' onclick='javascript:dldCntIncrease({$notes_id});'>" . $fld_value . "</a>";
                                    } elseif ($download_type == 'E') {
                                        $fld_value = "<a target='_blank' href='{$file_name}' onclick='javascript:dldCntIncrease({$notes_id});' title='" . getTranslatedString("LBL_DOWNLOAD_FILE", $module) . "'>" . $fld_value . "</a>";
                                    } else {
                                        $fld_value = ' --';
                                    }
                                }
                                $value = $fileicon . $fld_value;
                            }
                            if ($fieldname == 'filesize') {
                                $downloadtype = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                if ($downloadtype == 'I') {
                                    $filesize = $value;
                                    if ($filesize < 1024) {
                                        $value = $filesize . ' B';
                                    } elseif ($filesize > 1024 && $filesize < 1048576) {
                                        $value = round($filesize / 1024, 2) . ' KB';
                                    } else {
                                        if ($filesize > 1048576) {
                                            $value = round($filesize / (1024 * 1024), 2) . ' MB';
                                        }
                                    }
                                } else {
                                    $value = ' --';
                                }
                            }
                            if ($fieldname == 'filestatus') {
                                $filestatus = $value;
                                if ($filestatus == 1) {
                                    $value = getTranslatedString('yes', $module);
                                } elseif ($filestatus == 0) {
                                    $value = getTranslatedString('no', $module);
                                } else {
                                    $value = ' --';
                                }
                            }
                            if ($fieldname == 'filetype') {
                                $downloadtype = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                $filetype = $adb->query_result($list_result, $i - 1, 'filetype');
                                if ($downloadtype == 'E' || $downloadtype != 'I') {
                                    $value = ' --';
                                } else {
                                    $value = $filetype;
                                }
                            }
                            if ($fieldname == 'notecontent') {
                                $value = decode_html($value);
                                $value = textlength_check($value);
                            }
                        } elseif ($module == "Products" && $name == "Related to") {
                            $value = getRelatedTo($module, $list_result, $i - 1);
                        } elseif ($name == 'Contact Name' && ($module == 'SalesOrder' || $module == 'Quotes' || $module == 'PurchaseOrder')) {
                            if ($name == 'Contact Name') {
                                $contact_id = $adb->query_result($list_result, $i - 1, "contactid");
                                $contact_name = getFullNameFromQResult($list_result, $i - 1, "Contacts");
                                $value = "";
                                if ($contact_name != "" && $contact_id != 'NULL') {
                                    $value = "<a href='index.php?module=Contacts&action=DetailView&parenttab=" . $tabname . "&record=" . $contact_id . "' style='" . $P_FONT_COLOR . "'>" . $contact_name . "</a>";
                                }
                            }
                        } elseif ($name == 'Product') {
                            $product_id = textlength_check($adb->query_result($list_result, $i - 1, "productname"));
                            $value = $product_id;
                        } elseif ($name == 'Account Name') {
                            //modified for vtiger_customview 27/5
                            if ($module == 'Accounts') {
                                $account_id = $adb->query_result($list_result, $i - 1, "crmid");
                                //$account_name = getAccountName($account_id);
                                $account_name = textlength_check($adb->query_result($list_result, $i - 1, "accountname"));
                                // Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
                                $value = '<a href="index.php?module=Accounts&action=DetailView&record=' . $account_id . '&parenttab=' . $tabname . '" style="' . $P_FONT_COLOR . '">' . $account_name . '</a>';
                                // Armando Lüscher 05.07.2005 -> §priority -> Desc: inserted style="$P_FONT_COLOR"
                            } elseif ($module == 'Potentials' || $module == 'Contacts' || $module == 'Invoice' || $module == 'SalesOrder' || $module == 'Quotes') {
                                //Potential,Contacts,Invoice,SalesOrder & Quotes  records   sort by Account Name
                                $accountname = textlength_check($adb->query_result($list_result, $i - 1, "accountname"));
                                $accountid = $adb->query_result($list_result, $i - 1, "accountid");
                                $value = '<a href="index.php?module=Accounts&action=DetailView&record=' . $accountid . '&parenttab=' . $tabname . '" style="' . $P_FONT_COLOR . '">' . $accountname . '</a>';
                            } else {
                                $account_id = $adb->query_result($list_result, $i - 1, "accountid");
                                $account_name = getAccountName($account_id);
                                $acc_name = textlength_check($account_name);
                                // Fredy Klammsteiner, 4.8.2005: changes from 4.0.1 migrated to 4.2
                                $value = '<a href="index.php?module=Accounts&action=DetailView&record=' . $account_id . '&parenttab=' . $tabname . '" style="' . $P_FONT_COLOR . '">' . $acc_name . '</a>';
                                // Armando Lüscher 05.07.2005 -> §priority -> Desc: inserted style="$P_FONT_COLOR"
                            }
                        } elseif (($module == 'HelpDesk' || $module == 'PriceBook' || $module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'Faq') && $name == 'Product Name') {
                            if ($module == 'HelpDesk' || $module == 'Faq') {
                                $product_id = $adb->query_result($list_result, $i - 1, "product_id");
                            } else {
                                $product_id = $adb->query_result($list_result, $i - 1, "productid");
                            }
                            if ($product_id != '') {
                                $product_name = getProductName($product_id);
                            } else {
                                $product_name = '';
                            }
                            $value = '<a href="index.php?module=Products&action=DetailView&parenttab=' . $tabname . '&record=' . $product_id . '">' . textlength_check($product_name) . '</a>';
                        } elseif ($module == 'Quotes' && $name == 'Potential Name' || $module == 'SalesOrder' && $name == 'Potential Name') {
                            $potential_id = $adb->query_result($list_result, $i - 1, "potentialid");
                            $potential_name = getPotentialName($potential_id);
                            $value = '<a href="index.php?module=Potentials&action=DetailView&parenttab=' . $tabname . '&record=' . $potential_id . '">' . textlength_check($potential_name) . '</a>';
                        } elseif ($module == 'Emails' && $relatedlist != '' && ($name == 'Subject' || $name == 'Date Sent' || $name == 'To')) {
                            $list_result_count = $i - 1;
                            $tmp_value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
                            $value = '<a href="javascript:;" onClick="ShowEmail(\'' . $entity_id . '\');">' . textlength_check($tmp_value) . '</a>';
                            if ($name == 'Date Sent') {
                                $sql = "select email_flag from vtiger_emaildetails where emailid=?";
                                $result = $adb->pquery($sql, array($entity_id));
                                $email_flag = $adb->query_result($result, 0, "email_flag");
                                if ($email_flag != 'SAVED') {
                                    $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
                                } else {
                                    $value = '';
                                }
                            }
                        } elseif ($module == 'Calendar' && ($fieldname != 'taskstatus' && $fieldname != 'eventstatus')) {
                            if ($activitytype == 'Task') {
                                if (getFieldVisibilityPermission('Calendar', $current_user->id, $fieldname) == '0') {
                                    $list_result_count = $i - 1;
                                    $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
                                } else {
                                    $value = '';
                                }
                            } else {
                                if (getFieldVisibilityPermission('Events', $current_user->id, $fieldname) == '0') {
                                    $list_result_count = $i - 1;
                                    $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
                                } else {
                                    $value = '';
                                }
                            }
                        } elseif ($module == "Accounting" && $fieldname == "accounting_id") {
                            $list_result_count = $i - 1;
                            $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
                            $value = '<a href="index.php?action=DetailView&module=' . $module . '&parenttab=' . $tabname . '&record=' . $entity_id . '">' . $value . '</a>';
                        } else {
                            $list_result_count = $i - 1;
                            $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
                        }
                    }
                    // vtlib customization: For listview javascript triggers
                    $value = "{$value} <span type='vtlib_metainfo' vtrecordid='{$entity_id}' vtfieldname='{$fieldname}' vtmodule='{$module}' style='display:none;'></span>";
                    // END
                    if ($module == "Calendar" && $name == $app_strings['Close']) {
                        if (isPermitted("Calendar", "EditView") == 'yes') {
                            if (getFieldVisibilityPermission('Events', $current_user->id, 'eventstatus') == '0' || getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
                                array_push($list_header, $value);
                            }
                        }
                    } else {
                        $list_header[] = $value;
                    }
                }
            }
            $varreturnset = '';
            if ($returnset == '') {
                $varreturnset = '&return_module=' . $module . '&return_action=index';
            } else {
                $varreturnset = $returnset;
            }
            if ($module == 'Calendar') {
                $actvity_type = $adb->query_result($list_result, $list_result_count, 'activitytype');
                if ($actvity_type == 'Task') {
                    $varreturnset .= '&activity_mode=Task';
                } else {
                    $varreturnset .= '&activity_mode=Events';
                }
            }
            //Added for Actions ie., edit and delete links in listview
            $links_info = "";
            if (!(is_array($selectedfields) && $selectedfields != '')) {
                if (isPermitted($module, "EditView", "") == 'yes') {
                    $edit_link = getListViewEditLink($module, $entity_id, $relatedlist, $varreturnset, $list_result, $list_result_count);
                    if (isset($_REQUEST['start']) && $_REQUEST['start'] > 1 && $module != 'Emails') {
                        $links_info .= "<a href=\"{$edit_link}&start=" . vtlib_purify($_REQUEST['start']) . "\">" . $app_strings["LNK_EDIT"] . "</a> ";
                    } else {
                        $links_info .= "<a href=\"{$edit_link}\">" . $app_strings["LNK_EDIT"] . "</a> ";
                    }
                }
                if (isPermitted($module, "Delete", "") == 'yes') {
                    $del_link = getListViewDeleteLink($module, $entity_id, $relatedlist, $varreturnset);
                    if ($links_info != "" && $del_link != "") {
                        $links_info .= " | ";
                    }
                    if ($del_link != "") {
                        $links_info .= "<a href='javascript:confirmdelete(\"" . addslashes(urlencode($del_link)) . "\")'>" . $app_strings["LNK_DELETE"] . "</a>";
                    }
                }
            }
            // Record Change Notification
            if (method_exists($focus, 'isViewed') && PerformancePrefs::getBoolean('LISTVIEW_RECORD_CHANGE_INDICATOR', true)) {
                if (!$focus->isViewed($entity_id)) {
                    $links_info .= " | <img src='" . vtiger_imageurl('important1.gif', $theme) . "' border=0>";
                }
            }
            // END
            if ($links_info != "" && !$skipActions) {
                $list_header[] = $links_info;
            }
            //	$list_block[$entity_id] = $list_header;
            if (isset($_SESSION['partialpaymentview']) && $_SESSION['partialpaymentview'] == "true") {
                $list_block[$entity_id . "_" . $i] = $list_header;
            } else {
                $list_block[$entity_id] = $list_header;
            }
        }
    }
    $log->debug("Exiting getListViewEntries method ...");
    return $list_block;
}
コード例 #13
0
ファイル: Contacts.php プロジェクト: kduqi/corebos
 /**
  * Function to get Contact hierarchy of the given Contact
  * @param  integer   $id      - contactid
  * returns Contact hierarchy in array format
  */
 function getContactHierarchy($id)
 {
     global $log, $adb, $current_user;
     $log->debug("Entering getContactHierarchy({$id}) method ...");
     require 'user_privileges/user_privileges_' . $current_user->id . '.php';
     $tabname = getParentTab();
     $listview_header = array();
     $listview_entries = array();
     foreach ($this->list_fields_name as $fieldname => $colname) {
         if (getFieldVisibilityPermission('Contacts', $current_user->id, $colname) == '0') {
             $listview_header[] = getTranslatedString($fieldname);
         }
     }
     $contacts_list = array();
     // Get the contacts hierarchy from the top most contact in the hierarchy of the current contact, including the current contact
     $encountered_contacts = array($id);
     $contacts_list = $this->__getParentContacts($id, $contacts_list, $encountered_contacts);
     // Get the contacts hierarchy (list of child contacts) based on the current contact
     $contacts_list = $this->__getChildContacts($id, $contacts_list, $contacts_list[$id]['depth']);
     // Create array of all the contacts in the hierarchy
     foreach ($contacts_list as $contact_id => $contact_info) {
         $contact_info_data = array();
         $hasRecordViewAccess = is_admin($current_user) || isPermitted('Contacts', 'DetailView', $contact_id) == 'yes';
         foreach ($this->list_fields_name as $fieldname => $colname) {
             // Permission to view contact is restricted, avoid showing field values (except contact name)
             if (!$hasRecordViewAccess && $colname != 'lastname') {
                 $contact_info_data[] = '';
             } else {
                 if (getFieldVisibilityPermission('Contacts', $current_user->id, $colname) == '0') {
                     $data = $contact_info[$colname];
                     if ($colname == 'lastname') {
                         if ($contact_id != $id) {
                             if ($hasRecordViewAccess) {
                                 $data = '<a href="index.php?module=Contacts&action=DetailView&record=' . $contact_id . '&parenttab=' . $tabname . '">' . $data . '</a>';
                             } else {
                                 $data = '<i>' . $data . '</i>';
                             }
                         } else {
                             $data = '<b>' . $data . '</b>';
                         }
                         // - to show the hierarchy of the Contacts
                         $contact_depth = str_repeat(" .. ", $contact_info['depth'] * 1);
                         // * 2
                         $data = $contact_depth . $data;
                     } else {
                         if ($colname == 'website') {
                             $data = '<a href="http://' . $data . '" target="_blank">' . $data . '</a>';
                         }
                     }
                     $contact_info_data[] = $data;
                 }
             }
         }
         $listview_entries[$contact_id] = $contact_info_data;
     }
     $contact_hierarchy = array('header' => $listview_header, 'entries' => $listview_entries);
     $log->debug('Exiting getContactHierarchy method ...');
     return $contact_hierarchy;
 }
コード例 #14
0
ファイル: Accounting.php プロジェクト: jmangarret/vtigercrm
 static function get_payments($module, $id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_contacts(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('SINGLE_Accounting', 'Accounting') . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('SINGLE_Accounting', 'Accounting') . "'>&nbsp;";
         }
     }
     if ($module == "Invoice") {
         $rel_tabla = "vtiger_invoice";
         $rel_id = "invoiceid";
         $acc_rel_field = "accountingrelated2";
     } else {
         if ($module == "SalesOrder") {
             $rel_tabla = "vtiger_salesorder";
             $rel_id = "salesorderid";
             $acc_rel_field = "accountingrelated2";
         } else {
             if ($module == "PurchaseOrder") {
                 $rel_tabla = "vtiger_purchaseorder";
                 $rel_id = "purchaseorderid";
                 $acc_rel_field = "accountingrelated2";
             } else {
                 if ($module == "Accounts") {
                     $rel_tabla = "vtiger_account";
                     $rel_id = "accountid";
                     $acc_rel_field = "accountingrelated1";
                 } else {
                     if ($module == "Contacts") {
                         $rel_tabla = "vtiger_contactdetails";
                         $rel_id = "contactid";
                         $acc_rel_field = "accountingrelated1";
                     } else {
                         if ($module == "Vendors") {
                             $rel_tabla = "vtiger_vendor";
                             $rel_id = "vendorid";
                             $acc_rel_field = "accountingrelated1";
                         } else {
                             if ($module == "Project") {
                                 $rel_tabla = "vtiger_project";
                                 $rel_id = "projectid";
                                 $acc_rel_field = "accountingrelated1";
                             } else {
                                 if ($module == "Potentials") {
                                     $rel_tabla = "vtiger_potential";
                                     $rel_id = "potentialid";
                                     $acc_rel_field = "accountingrelated1";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $query = "SELECT vtiger_accounting.*,\n\t\t\t\tvtiger_crmentity.crmid,\n\t                        vtiger_crmentity.smownerid,\n\t\t\t\tvtiger_accounting.paymentref,\n\t\t\t\tcase when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name\n\t\t\t\tFROM vtiger_accounting\n\t\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\t\tON vtiger_crmentity.crmid = vtiger_accounting.accountingid\n\t\t\t\tLEFT JOIN " . $rel_tabla . "\n\t\t\t\t\tON " . $rel_tabla . "." . $rel_id . " = vtiger_accounting.accountingid\n\t\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users\n\t\t\t\t\tON vtiger_crmentity.smownerid = vtiger_users.id\n\t\t\t\tWHERE vtiger_crmentity.deleted = 0\n\t\t\t\tAND vtiger_accounting." . $acc_rel_field . " = " . $id;
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if (($module == "Invoice" || $module == "PurchaseOrder" || $module == "SalesOrder") && count($return_value['entries']) > 0) {
         $button = "";
     }
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_contacts method ...");
     return $return_value;
 }
コード例 #15
0
ファイル: List.php プロジェクト: Wasage/werpa
    public function getList(Vtiger_Request $request) {

        PDFMaker_Debugger_Model::GetInstance()->Init();

        $PDFMaker = new PDFMaker_PDFMaker_Model();
        
        if ($PDFMaker->CheckPermissions("DETAIL") == false)
            $PDFMaker->DieDuePermission();

        $viewer = $this->getViewer($request);
        $orderby = "templateid";
        $dir = "asc";

        if (isset($_REQUEST["dir"]) && $_REQUEST["dir"] == "desc")
            $dir = "desc";

        if (isset($_REQUEST["orderby"])) {
            switch ($_REQUEST["orderby"]) {
                case "name":
                    $orderby = "filename";
                    break;

                case "module":
                    $orderby = "module";
                    break;

                case "description":
                    $orderby = "description";
                    break;

                case "order":
                    $orderby = "order";
                    break;
                default:
                    $orderby = $_REQUEST["orderby"];
                    break;
            }
        }

        $version_type = $PDFMaker->GetVersionType();
        $license_key = $PDFMaker->GetLicenseKey();

        $viewer->assign("VERSION_TYPE", $version_type);
        $viewer->assign("VERSION", ucfirst($version_type) . " " . PDFMaker_Version_Helper::$version);
    
        if ($PDFMaker->CheckPermissions("EDIT")) {
            $viewer->assign("EDIT", "permitted");
        }

        $notif = $PDFMaker->GetReleasesNotif();
        $viewer->assign("RELEASE_NOTIF", $notif);

        $php_version = phpversion();
        $notif = false;
        $max_in_vars = ini_get("max_input_vars");
        if ($max_in_vars <= 1000 && $php_version >= "5.3.9")
            $notif = true;

        $test = ini_set("memory_limit", "256M");
        $memory_limit = ini_get("memory_limit");
        if (substr($memory_limit, 0, -1) <= 128)
            $notif = true;

        $max_exec_time = ini_get("max_execution_time");
        if ($max_exec_time <= 60)
            $notif = true;

        if (extension_loaded('suhosin')) {
            $request_max_vars = ini_get("suhosin.request.max_vars");
            $post_max_vars = ini_get("suhosin.post.max_vars");
            if ($request_max_vars <= 1000)
                $notif = true;
            if ($post_max_vars <= 1000)
                $notif = true;
        }

        $viewer->assign("MOD", $mod_strings);
        $viewer->assign("APP", $app_strings);
        $viewer->assign("THEME", $theme);
        $viewer->assign("PARENTTAB", getParentTab());
        $viewer->assign("IMAGE_PATH", $image_path);

        $return_data = $PDFMaker->GetListviewData($orderby, $dir);
        $viewer->assign("PDFTEMPLATES", $return_data);
        $category = getParentTab();
        $viewer->assign("CATEGORY", $category);

        if (is_admin($current_user)) {
            $viewer->assign('IS_ADMIN', '1');
        }
        
        $linkModels = $PDFMaker->getListViewLinks($linkParams);
        $viewer->assign('LISTVIEW_LINKS', $linkModels);
        
        $tpl = "ListPDFTemplates";
        if ($request->get('ajax') == "true")
            $tpl .= "Contents";

        $viewer->view($tpl.".tpl", 'PDFMaker');
    }
コード例 #16
0
 /**
  * Function to get Potential related SalesOrder
  * @param  integer   $id  - potentialid
  * returns related SalesOrder record in array format
  */
 function get_salesorder($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_salesorder(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     if ($actions && getFieldVisibilityPermission($related_module, $current_user->id, 'potential_id', 'readwrite') == '0') {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'>&nbsp;";
         }
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "select vtiger_crmentity.*, vtiger_salesorder.*, vtiger_quotes.subject as quotename\n\t\t\t, vtiger_account.accountname, vtiger_potential.potentialname,case when\n\t\t\t(vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname\n\t\t\tend as user_name from vtiger_salesorder\n\t\t\tinner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_salesorder.salesorderid\n\t\t\tleft outer join vtiger_quotes on vtiger_quotes.quoteid=vtiger_salesorder.quoteid\n\t\t\tleft outer join vtiger_account on vtiger_account.accountid=vtiger_salesorder.accountid\n\t\t\tleft outer join vtiger_potential on vtiger_potential.potentialid=vtiger_salesorder.potentialid\n\t\t\tleft join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid\n\t\t\tleft join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\t where vtiger_crmentity.deleted=0 and vtiger_potential.potentialid = " . $id;
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_salesorder method ...");
     return $return_value;
 }
コード例 #17
0
ファイル: ListViewUtils.php プロジェクト: latechdirect/vtiger
function getTableHeaderSimpleNavigation($navigation_array, $url_qry, $module = '', $action_val = 'index', $viewid = '')
{
    global $log, $app_strings;
    global $theme, $current_user;
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    if ($module == 'Documents') {
        $output = '<td class="mailSubHeader" width="100%" align="center">';
    } else {
        $output = '<td align="right" style="padding: 5px;">';
    }
    $tabname = getParentTab();
    $url_string = '';
    // vtlib Customization : For uitype 10 popup during paging
    if ($_REQUEST['form'] == 'vtlibPopupView') {
        $url_string .= '&form=vtlibPopupView&forfield=' . vtlib_purify($_REQUEST['forfield']) . '&srcmodule=' . vtlib_purify($_REQUEST['srcmodule']) . '&forrecord=' . vtlib_purify($_REQUEST['forrecord']);
    }
    // END
    if ($module == 'Calendar' && $action_val == 'index') {
        if ($_REQUEST['view'] == '') {
            if ($current_user->activity_view == "This Year") {
                $mysel = 'year';
            } else {
                if ($current_user->activity_view == "This Month") {
                    $mysel = 'month';
                } else {
                    if ($current_user->activity_view == "This Week") {
                        $mysel = 'week';
                    } else {
                        $mysel = 'day';
                    }
                }
            }
        }
        $data_value = date('Y-m-d H:i:s');
        preg_match('/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/', $data_value, $value);
        $date_data = array('day' => $value[3], 'month' => $value[2], 'year' => $value[1], 'hour' => $value[4], 'min' => $value[5]);
        $tab_type = $_REQUEST['subtab'] == '' ? 'event' : vtlib_purify($_REQUEST['subtab']);
        $url_string .= isset($_REQUEST['view']) ? "&view=" . vtlib_purify($_REQUEST['view']) : "&view=" . $mysel;
        $url_string .= isset($_REQUEST['subtab']) ? "&subtab=" . vtlib_purify($_REQUEST['subtab']) : '';
        $url_string .= isset($_REQUEST['viewOption']) ? "&viewOption=" . vtlib_purify($_REQUEST['viewOption']) : '&viewOption=listview';
        $url_string .= isset($_REQUEST['day']) ? "&day=" . vtlib_purify($_REQUEST['day']) : '&day=' . $date_data['day'];
        $url_string .= isset($_REQUEST['week']) ? "&week=" . vtlib_purify($_REQUEST['week']) : '';
        $url_string .= isset($_REQUEST['month']) ? "&month=" . vtlib_purify($_REQUEST['month']) : '&month=' . $date_data['month'];
        $url_string .= isset($_REQUEST['year']) ? "&year=" . vtlib_purify($_REQUEST['year']) : "&year=" . $date_data['year'];
        $url_string .= isset($_REQUEST['n_type']) ? "&n_type=" . vtlib_purify($_REQUEST['n_type']) : '';
        $url_string .= isset($_REQUEST['search_option']) ? "&search_option=" . vtlib_purify($_REQUEST['search_option']) : '';
    }
    if ($module == 'Calendar' && $action_val != 'index') {
        //added for the All link from the homepage -- ticket 5211
        $url_string .= isset($_REQUEST['from_homepage']) ? "&from_homepage=" . vtlib_purify($_REQUEST['from_homepage']) : '';
    }
    if ($navigation_array['prev'] != 0) {
        if ($module == 'Calendar' && $action_val == 'index') {
            $output .= '<a href="javascript:;" onClick="cal_navigation(\'' . $tab_type . '\',\'' . $url_string . '\',\'&start=1\');" alt="' . $app_strings['LBL_FIRST'] . '" title="' . $app_strings['LBL_FIRST'] . '"><img src="' . vtiger_imageurl('start.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            $output .= '<a href="javascript:;" onClick="cal_navigation(\'' . $tab_type . '\',\'' . $url_string . '\',\'&start=' . $navigation_array['prev'] . '\');" alt="' . $app_strings['LBL_FIRST'] . '" title="' . $app_strings['LBL_FIRST'] . '"><img src="' . vtiger_imageurl('start.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
        } else {
            if ($action_val == "FindDuplicate") {
                $output .= '<a href="javascript:;" onClick="getDuplicateListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=1' . $url_string . '\');" alt="' . $app_strings['LBL_FIRST'] . '" title="' . $app_strings['LBL_FIRST'] . '"><img src="' . vtiger_imageurl('start.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getDuplicateListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['prev'] . $url_string . '\');" alt="' . $app_strings['LNK_LIST_PREVIOUS'] . '"title="' . $app_strings['LNK_LIST_PREVIOUS'] . '"><img src="' . vtiger_imageurl('previous.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            } elseif ($action_val == 'UnifiedSearch') {
                $output .= '<a href="javascript:;" onClick="getUnifiedSearchEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=1' . $url_string . '\');" alt="' . $app_strings['LBL_FIRST'] . '" title="' . $app_strings['LBL_FIRST'] . '"><img src="' . vtiger_imageurl('start.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getUnifiedSearchEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['prev'] . $url_string . '\');" alt="' . $app_strings['LNK_LIST_PREVIOUS'] . '"title="' . $app_strings['LNK_LIST_PREVIOUS'] . '"><img src="' . vtiger_imageurl('previous.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            } elseif ($module == 'Documents') {
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=1' . $url_string . '\');" alt="' . $app_strings['LBL_FIRST'] . '" title="' . $app_strings['LBL_FIRST'] . '"><img src="' . vtiger_imageurl('start.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['prev'] . $url_string . '&folderid=' . $action_val . '\');" alt="' . $app_strings['LNK_LIST_PREVIOUS'] . '"title="' . $app_strings['LNK_LIST_PREVIOUS'] . '"><img src="' . vtiger_imageurl('previous.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            } else {
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=1' . $url_string . '\');" alt="' . $app_strings['LBL_FIRST'] . '" title="' . $app_strings['LBL_FIRST'] . '"><img src="' . vtiger_imageurl('start.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['prev'] . $url_string . '\');" alt="' . $app_strings['LNK_LIST_PREVIOUS'] . '"title="' . $app_strings['LNK_LIST_PREVIOUS'] . '"><img src="' . vtiger_imageurl('previous.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            }
        }
    } else {
        $output .= '<img src="' . vtiger_imageurl('start_disabled.gif', $theme) . '" border="0" align="absmiddle">&nbsp;';
        $output .= '<img src="' . vtiger_imageurl('previous_disabled.gif', $theme) . '" border="0" align="absmiddle">&nbsp;';
    }
    if ($module == 'Calendar' && $action_val == 'index') {
        $jsNavigate = "cal_navigation('{$tab_type}','{$url_string}','&start='+this.value);";
    } else {
        if ($action_val == "FindDuplicate") {
            $jsNavigate = "getDuplicateListViewEntries_js('{$module}','parenttab={$tabname}&start='+this.value+'{$url_string}');";
        } elseif ($action_val == 'UnifiedSearch') {
            $jsNavigate = "getUnifiedSearchEntries_js('{$module}','parenttab={$tabname}&start='+this.value+'{$url_string}');";
        } elseif ($module == 'Documents') {
            $jsNavigate = "getListViewEntries_js('{$module}','parenttab={$tabname}&start='+this.value+'{$url_string}&folderid={$action_val}');";
        } else {
            $jsNavigate = "getListViewEntries_js('{$module}','parenttab={$tabname}&start='+this.value+'{$url_string}');";
        }
    }
    if ($module == 'Documents' && $action_val != 'UnifiedSearch') {
        $url = '&folderid=' . $action_val;
    } else {
        $url = '';
    }
    $jsHandler = "return VT_disableFormSubmit(event);";
    $output .= "<input class='small' name='pagenum' type='text' value='{$navigation_array['current']}'\n\t\tstyle='width: 3em;margin-right: 0.7em;' onchange=\"{$jsNavigate}\"\n\t\tonkeypress=\"{$jsHandler}\">";
    $output .= "<span name='" . $module . "_listViewCountContainerName' class='small' style='white-space: nowrap;'>";
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
        $output .= $app_strings['LBL_LIST_OF'] . ' ' . $navigation_array['verylast'];
    } else {
        $output .= "<img src='" . vtiger_imageurl('windowRefresh.gif', $theme) . "' alt='" . $app_strings['LBL_HOME_COUNT'] . "'\n\t\t\tonclick='getListViewCount(\"" . $module . "\",this,this.parentNode,\"" . $url . "\")'\n\t\t\talign='absmiddle' name='" . $module . "_listViewCountRefreshIcon'/>\n\t\t\t<img name='" . $module . "_listViewCountContainerBusy' src='" . vtiger_imageurl('vtbusy.gif', $theme) . "' style='display: none;'\n\t\t\talign='absmiddle' alt='" . $app_strings['LBL_LOADING'] . "'>";
    }
    $output .= '</span>';
    if ($navigation_array['next'] != 0) {
        if ($module == 'Calendar' && $action_val == 'index') {
            $output .= '<a href="javascript:;" onClick="cal_navigation(\'' . $tab_type . '\',\'' . $url_string . '\',\'&start=' . $navigation_array['next'] . '\');" alt="' . $app_strings['LNK_LIST_NEXT'] . '" title="' . $app_strings['LNK_LIST_NEXT'] . '"><img src="' . vtiger_imageurl('next.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            $output .= '<a href="javascript:;" onClick="cal_navigation(\'' . $tab_type . '\',\'' . $url_string . '\',\'&start=' . $navigation_array['verylast'] . '\');" alt="' . $app_strings['LBL_LAST'] . '" title="' . $app_strings['LBL_LAST'] . '"><img src="' . vtiger_imageurl('end.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
        } else {
            if ($action_val == "FindDuplicate") {
                $output .= '<a href="javascript:;" onClick="getDuplicateListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['next'] . $url_string . '\');" alt="' . $app_strings['LNK_LIST_NEXT'] . '" title="' . $app_strings['LNK_LIST_NEXT'] . '"><img src="' . vtiger_imageurl('next.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getDuplicateListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['verylast'] . $url_string . '\');" alt="' . $app_strings['LBL_LAST'] . '" title="' . $app_strings['LBL_LAST'] . '"><img src="' . vtiger_imageurl('end.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            } elseif ($action_val == 'UnifiedSearch') {
                $output .= '<a href="javascript:;" onClick="getUnifiedSearchEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['next'] . $url_string . '\');" alt="' . $app_strings['LNK_LIST_NEXT'] . '" title="' . $app_strings['LNK_LIST_NEXT'] . '"><img src="' . vtiger_imageurl('next.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getUnifiedSearchEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['verylast'] . $url_string . '\');" alt="' . $app_strings['LBL_LAST'] . '" title="' . $app_strings['LBL_LAST'] . '"><img src="themes/images/end.gif" border="0" align="absmiddle"></a>&nbsp;';
            } elseif ($module == 'Documents') {
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['next'] . $url_string . '&folderid=' . $action_val . '\');" alt="' . $app_strings['LNK_LIST_NEXT'] . '" title="' . $app_strings['LNK_LIST_NEXT'] . '"><img src="' . vtiger_imageurl('next.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['verylast'] . $url_string . '&folderid=' . $action_val . '\');" alt="' . $app_strings['LBL_LAST'] . '" title="' . $app_strings['LBL_LAST'] . '"><img src="' . vtiger_imageurl('end.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            } else {
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['next'] . $url_string . '\');" alt="' . $app_strings['LNK_LIST_NEXT'] . '" title="' . $app_strings['LNK_LIST_NEXT'] . '"><img src="' . vtiger_imageurl('next.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
                $output .= '<a href="javascript:;" onClick="getListViewEntries_js(\'' . $module . '\',\'parenttab=' . $tabname . '&start=' . $navigation_array['verylast'] . $url_string . '\');" alt="' . $app_strings['LBL_LAST'] . '" title="' . $app_strings['LBL_LAST'] . '"><img src="' . vtiger_imageurl('end.gif', $theme) . '" border="0" align="absmiddle"></a>&nbsp;';
            }
        }
    } else {
        $output .= '<img src="' . vtiger_imageurl('next_disabled.gif', $theme) . '" border="0" align="absmiddle">&nbsp;';
        $output .= '<img src="' . vtiger_imageurl('end_disabled.gif', $theme) . '" border="0" align="absmiddle">&nbsp;';
    }
    $output .= '</td>';
    if ($navigation_array['first'] == '') {
        return;
    } else {
        return $output;
    }
}
コード例 #18
0
function getSearchingListViewEntries($focus, $module, $list_result, $navigation_array, $relatedlist = '', $returnset = '', $edit_action = 'EditView', $del_action = 'Delete', $oCv = '', $page = '', $selectedfields = '', $contRelatedfields = '', $skipActions = false, $linksallowed = false)
{
    global $log;
    global $mod_strings;
    $log->debug("Entering getSearchingListViewEntries(" . get_class($focus) . "," . $module . "," . $list_result . "," . $navigation_array . "," . $relatedlist . "," . $returnset . "," . $edit_action . "," . $del_action . "," . (is_object($oCv) ? get_class($oCv) : $oCv) . ") method ...");
    $tabname = getParentTab();
    global $adb, $current_user;
    global $app_strings;
    $noofrows = $adb->num_rows($list_result);
    $list_block = array();
    global $theme;
    $evt_status = '';
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    //getting the vtiger_fieldtable entries from database
    $tabid = getTabid($module);
    //added for vtiger_customview 27/5
    if ($oCv) {
        if (isset($oCv->list_fields)) {
            $focus->list_fields = $oCv->list_fields;
        }
    }
    if (is_array($selectedfields) && $selectedfields != '') {
        $focus->list_fields = $selectedfields;
    }
    // Remove fields which are made inactive
    $focus->filterInactiveFields($module);
    //Added to reduce the no. of queries logging for non-admin user -- by minnie-start
    $field_list = array();
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    foreach ($focus->list_fields as $name => $tableinfo) {
        $fieldname = $focus->list_fields_name[$name];
        if ($oCv) {
            if (isset($oCv->list_fields_name)) {
                $fieldname = $oCv->list_fields_name[$name];
            }
        }
        if ($fieldname == 'accountname' && $module != 'Accounts') {
            $fieldname = 'account_id';
        }
        if ($fieldname == 'lastname' && ($module == 'SalesOrder' || $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes' || $module == 'Calendar')) {
            $fieldname = 'contact_id';
        }
        if ($fieldname == 'productname' && $module != 'Products') {
            $fieldname = 'product_id';
        }
        array_push($field_list, $fieldname);
    }
    $field = array();
    if ($is_admin == false) {
        if ($module == 'Emails') {
            $query = "SELECT fieldname FROM vtiger_field WHERE tabid = ? and vtiger_field.presence in (0,2)";
            $params = array($tabid);
        } else {
            $profileList = getCurrentUserProfileList();
            $params = array();
            $query = "SELECT DISTINCT vtiger_field.fieldname\n\t\t\tFROM vtiger_field\n\t\t\tINNER JOIN vtiger_profile2field\n\t\t\tON vtiger_profile2field.fieldid = vtiger_field.fieldid\n\t\t\tINNER JOIN vtiger_def_org_field\n\t\t\tON vtiger_def_org_field.fieldid = vtiger_field.fieldid";
            if ($module == "Calendar") {
                $query .= " WHERE vtiger_field.tabid in (9,16) and vtiger_field.presence in (0,2)";
            } else {
                $query .= " WHERE vtiger_field.tabid = ? and vtiger_field.presence in (0,2)";
                array_push($params, $tabid);
            }
            $query .= " AND vtiger_profile2field.visible = 0\n\t\t\tAND vtiger_profile2field.visible = 0\n\t\t\tAND vtiger_def_org_field.visible = 0\n\t\t\tAND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")\n\t\t\tAND vtiger_field.fieldname IN (" . generateQuestionMarks($field_list) . ")";
            array_push($params, $profileList, $field_list);
        }
        $result = $adb->pquery($query, $params);
        for ($k = 0; $k < $adb->num_rows($result); $k++) {
            $field[] = $adb->query_result($result, $k, "fieldname");
        }
    }
    //constructing the uitype and columnname array
    $ui_col_array = array();
    $params = array();
    $query = "SELECT uitype, columnname, fieldname FROM vtiger_field ";
    if ($module == "Calendar") {
        $query .= " WHERE vtiger_field.tabid in (9,16) and vtiger_field.presence in (0,2)";
    } else {
        $query .= " WHERE vtiger_field.tabid = ? and vtiger_field.presence in (0,2)";
        array_push($params, $tabid);
    }
    $query .= " AND fieldname IN (" . generateQuestionMarks($field_list) . ") ";
    array_push($params, $field_list);
    $result = $adb->pquery($query, $params);
    $num_rows = $adb->num_rows($result);
    for ($i = 0; $i < $num_rows; $i++) {
        $tempArr = array();
        $uitype = $adb->query_result($result, $i, 'uitype');
        $columnname = $adb->query_result($result, $i, 'columnname');
        $field_name = $adb->query_result($result, $i, 'fieldname');
        $tempArr[$uitype] = $columnname;
        $ui_col_array[$field_name] = $tempArr;
    }
    //end
    if ($navigation_array['start'] != 0) {
        for ($i = 1; $i <= $noofrows; $i++) {
            $list_header = array();
            //Getting the entityid
            if ($module != 'Users') {
                $entity_id = $adb->query_result($list_result, $i - 1, "crmid");
                $owner_id = $adb->query_result($list_result, $i - 1, "smownerid");
            } else {
                $entity_id = $adb->query_result($list_result, $i - 1, "id");
            }
            foreach ($focus->list_fields as $name => $tableinfo) {
                $fieldname = $focus->list_fields_name[$name];
                //added for vtiger_customview 27/5
                if ($oCv) {
                    if (isset($oCv->list_fields_name)) {
                        $fieldname = $oCv->list_fields_name[$name];
                        if ($fieldname == 'accountname' && $module != 'Accounts') {
                            $fieldname = 'account_id';
                        }
                        if ($fieldname == 'lastname' && ($module == 'SalesOrder' || $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes' || $module == 'Calendar')) {
                            $fieldname = 'contact_id';
                        }
                        if ($fieldname == 'productname' && $module != 'Products') {
                            $fieldname = 'product_id';
                        }
                    } else {
                        $fieldname = $focus->list_fields_name[$name];
                    }
                } else {
                    $fieldname = $focus->list_fields_name[$name];
                    if ($fieldname == 'accountname' && $module != 'Accounts') {
                        $fieldname = 'account_id';
                    }
                    if ($fieldname == 'lastname' && ($module == 'SalesOrder' || $module == 'PurchaseOrder' || $module == 'Invoice' || $module == 'Quotes' || $module == 'Calendar')) {
                        $fieldname = 'contact_id';
                    }
                    if ($fieldname == 'productname' && $module != 'Products') {
                        $fieldname = 'product_id';
                    }
                }
                if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0 || in_array($fieldname, $field) || $fieldname == '' || $name == 'Close' && $module == 'Calendar') {
                    if ($fieldname == '') {
                        $table_name = '';
                        $column_name = '';
                        foreach ($tableinfo as $tablename => $colname) {
                            $table_name = $tablename;
                            $column_name = $colname;
                        }
                        $value = $adb->query_result($list_result, $i - 1, $colname);
                    } else {
                        if ($module == 'Calendar') {
                            $act_id = $adb->query_result($list_result, $i - 1, "activityid");
                            $cal_sql = "select activitytype from vtiger_activity where activityid=?";
                            $cal_res = $adb->pquery($cal_sql, array($act_id));
                            if ($adb->num_rows($cal_res) >= 0) {
                                $activitytype = $adb->query_result($cal_res, 0, "activitytype");
                            }
                        }
                        if (($module == 'Calendar' || $module == 'Emails' || $module == 'HelpDesk' || $module == 'Invoice' || $module == 'Leads' || $module == 'Contacts') && ($fieldname == 'parent_id' || $name == 'Contact Name' || $name == 'Close' || $fieldname == 'firstname')) {
                            if ($module == 'Calendar') {
                                if ($fieldname == 'status') {
                                    if ($activitytype == 'Task') {
                                        $fieldname = 'taskstatus';
                                    } else {
                                        $fieldname = 'eventstatus';
                                    }
                                }
                                if ($activitytype == 'Task') {
                                    if (getFieldVisibilityPermission('Calendar', $current_user->id, $fieldname) == '0') {
                                        $has_permission = 'yes';
                                    } else {
                                        $has_permission = 'no';
                                    }
                                } else {
                                    if (getFieldVisibilityPermission('Events', $current_user->id, $fieldname) == '0') {
                                        $has_permission = 'yes';
                                    } else {
                                        $has_permission = 'no';
                                    }
                                }
                            }
                            if ($module != 'Calendar' || $module == 'Calendar' && $has_permission == 'yes') {
                                if ($fieldname == 'parent_id') {
                                    $value = getRelatedTo($module, $list_result, $i - 1);
                                }
                                if ($name == 'Contact Name') {
                                    $contact_id = $adb->query_result($list_result, $i - 1, "contactid");
                                    $contact_name = getFullNameFromQResult($list_result, $i - 1, "Contacts");
                                    $value = "";
                                    //Added to get the contactname for activities custom view - t=2190
                                    if ($contact_id != '' && !empty($contact_name)) {
                                        $contact_name = getContactName($contact_id);
                                    }
                                    if ($contact_name != "" && $contact_id != 'NULL') {
                                        $value = $contact_name;
                                    }
                                }
                                if ($fieldname == "firstname") {
                                    $first_name = textlength_check($adb->query_result($list_result, $i - 1, "firstname"));
                                    $value = $first_name;
                                }
                                if ($name == 'Close') {
                                    $status = $adb->query_result($list_result, $i - 1, "status");
                                    $activityid = $adb->query_result($list_result, $i - 1, "activityid");
                                    if (empty($activityid)) {
                                        $activityid = $adb->query_result($list_result, $i - 1, "tmp_activity_id");
                                    }
                                    $activitytype = $adb->query_result($list_result, $i - 1, "activitytype");
                                    // TODO - Picking activitytype when it is not present in the Custom View.
                                    // Going forward, this column should be added to the select list if not already present as a performance improvement.
                                    if (empty($activitytype)) {
                                        $activitytypeRes = $adb->pquery('SELECT activitytype FROM vtiger_activity WHERE activityid=?', array($activityid));
                                        if ($adb->num_rows($activitytypeRes) > 0) {
                                            $activitytype = $adb->query_result($activitytypeRes, 0, 'activitytype');
                                        }
                                    }
                                    if ($activitytype != 'Task' && $activitytype != 'Emails') {
                                        $eventstatus = $adb->query_result($list_result, $i - 1, "eventstatus");
                                        if (isset($eventstatus)) {
                                            $status = $eventstatus;
                                        }
                                    }
                                    if ($status == 'Deferred' || $status == 'Completed' || $status == 'Held' || $status == '') {
                                        $value = "";
                                    } else {
                                        if ($activitytype == 'Task') {
                                            $evt_status = '&status=Completed';
                                        } else {
                                            $evt_status = '&eventstatus=Held';
                                        }
                                    }
                                }
                            } else {
                                $value = "";
                            }
                        } elseif ($module == "Documents" && ($fieldname == 'filelocationtype' || $fieldname == 'filename' || $fieldname == 'filesize' || $fieldname == 'filestatus' || $fieldname == 'filetype')) {
                            $value = $adb->query_result($list_result, $i - 1, $fieldname);
                            if ($fieldname == 'filelocationtype') {
                                if ($value == 'I') {
                                    $value = getTranslatedString('LBL_INTERNAL', $module);
                                } elseif ($value == 'E') {
                                    $value = getTranslatedString('LBL_EXTERNAL', $module);
                                } else {
                                    $value = ' --';
                                }
                            }
                            if ($fieldname == 'filename') {
                                $downloadtype = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                if ($downloadtype == 'I') {
                                    $fld_value = $value;
                                    $ext_pos = strrpos($fld_value, ".");
                                    $ext = substr($fld_value, $ext_pos + 1);
                                    $ext = strtolower($ext);
                                    if ($value != '') {
                                        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'>";
                                        }
                                    }
                                } elseif ($downloadtype == 'E') {
                                    if (trim($value) != '') {
                                        $fld_value = $value;
                                        $fileicon = "<img src='" . vtiger_imageurl('fbLink.gif', $theme) . "' alt='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' title='" . getTranslatedString('LBL_EXTERNAL_LNK', $module) . "' hspace='3' align='absmiddle' border='0'>";
                                    } else {
                                        $fld_value = '--';
                                        $fileicon = '';
                                    }
                                } else {
                                    $fld_value = ' --';
                                    $fileicon = '';
                                }
                                $file_name = $adb->query_result($list_result, $i - 1, 'filename');
                                $notes_id = $adb->query_result($list_result, $i - 1, 'crmid');
                                $folder_id = $adb->query_result($list_result, $i - 1, 'folderid');
                                $download_type = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                $file_status = $adb->query_result($list_result, $i - 1, 'filestatus');
                                $fileidQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
                                $fileidres = $adb->pquery($fileidQuery, array($notes_id));
                                $fileid = $adb->query_result($fileidres, 0, 'attachmentsid');
                                if ($file_name != '' && $file_status == 1) {
                                    if ($download_type == 'I') {
                                        $fld_value = "<a href='index.php?module=uploads&action=downloadfile&entityid={$notes_id}&fileid={$fileid}' title='" . getTranslatedString("LBL_DOWNLOAD_FILE", $module) . "' onclick='javascript:dldCntIncrease({$notes_id});'>" . $fld_value . "</a>";
                                    } elseif ($download_type == 'E') {
                                        $fld_value = "<a target='_blank' href='{$file_name}' onclick='javascript:dldCntIncrease({$notes_id});' title='" . getTranslatedString("LBL_DOWNLOAD_FILE", $module) . "'>" . $fld_value . "</a>";
                                    } else {
                                        $fld_value = ' --';
                                    }
                                }
                                $value = $fileicon . $fld_value;
                            }
                            if ($fieldname == 'filesize') {
                                $downloadtype = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                if ($downloadtype == 'I') {
                                    $filesize = $value;
                                    if ($filesize < 1024) {
                                        $value = $filesize . ' B';
                                    } elseif ($filesize > 1024 && $filesize < 1048576) {
                                        $value = round($filesize / 1024, 2) . ' KB';
                                    } else {
                                        if ($filesize > 1048576) {
                                            $value = round($filesize / (1024 * 1024), 2) . ' MB';
                                        }
                                    }
                                } else {
                                    $value = ' --';
                                }
                            }
                            if ($fieldname == 'filestatus') {
                                $filestatus = $value;
                                if ($filestatus == 1) {
                                    $value = getTranslatedString('yes', $module);
                                } elseif ($filestatus == 0) {
                                    $value = getTranslatedString('no', $module);
                                } else {
                                    $value = ' --';
                                }
                            }
                            if ($fieldname == 'filetype') {
                                $downloadtype = $adb->query_result($list_result, $i - 1, 'filelocationtype');
                                $filetype = $adb->query_result($list_result, $i - 1, 'filetype');
                                if ($downloadtype == 'E' || $downloadtype != 'I') {
                                    $value = ' --';
                                } else {
                                    $value = $filetype;
                                }
                            }
                            if ($fieldname == 'notecontent') {
                                $value = decode_html($value);
                                $value = textlength_check($value);
                            }
                        } elseif ($module == "Products" && $name == "Related to") {
                            $value = getRelatedTo($module, $list_result, $i - 1);
                        } elseif ($name == 'Contact Name' && ($module == 'SalesOrder' || $module == 'Quotes' || $module == 'PurchaseOrder')) {
                            if ($name == 'Contact Name') {
                                $contact_id = $adb->query_result($list_result, $i - 1, "contactid");
                                $contact_name = getFullNameFromQResult($list_result, $i - 1, "Contacts");
                                $value = "";
                                if ($contact_name != "" && $contact_id != 'NULL') {
                                    $value = $contact_name;
                                }
                            }
                        } elseif ($name == 'Product') {
                            $product_id = textlength_check($adb->query_result($list_result, $i - 1, "productname"));
                            $value = $product_id;
                        } elseif ($name == 'Account Name') {
                            //modified for vtiger_customview 27/5
                            if ($module == 'Accounts') {
                                $account_id = $adb->query_result($list_result, $i - 1, "crmid");
                                //$account_name = getAccountName($account_id);
                                $account_name = textlength_check($adb->query_result($list_result, $i - 1, "accountname"));
                                $value = $account_name;
                            } elseif ($module == 'Potentials' || $module == 'Contacts' || $module == 'Invoice' || $module == 'SalesOrder' || $module == 'Quotes') {
                                //Potential,Contacts,Invoice,SalesOrder & Quotes  records   sort by Account Name
                                //$accountname = textlength_check($adb->query_result($list_result,$i-1,"accountname"));
                                $accountid = $adb->query_result($list_result, $i - 1, "accountid");
                                $accountname = textlength_check(getAccountName($accountid));
                                $value = $accountname;
                            } else {
                                $account_id = $adb->query_result($list_result, $i - 1, "accountid");
                                $account_name = getAccountName($account_id);
                                $acc_name = textlength_check($account_name);
                                $value = $acc_name;
                            }
                        } elseif (($module == 'HelpDesk' || $module == 'PriceBook' || $module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'Faq') && $name == 'Product Name') {
                            if ($module == 'HelpDesk' || $module == 'Faq') {
                                $product_id = $adb->query_result($list_result, $i - 1, "product_id");
                            } else {
                                $product_id = $adb->query_result($list_result, $i - 1, "productid");
                            }
                            if ($product_id != '') {
                                $product_name = getProductName($product_id);
                            } else {
                                $product_name = '';
                            }
                            $value = textlength_check($product_name);
                        } elseif ($module == 'Quotes' && $name == 'Potential Name' || $module == 'SalesOrder' && $name == 'Potential Name') {
                            $potential_id = $adb->query_result($list_result, $i - 1, "potentialid");
                            $potential_name = getPotentialName($potential_id);
                            $value = textlength_check($potential_name);
                        } elseif ($module == 'Emails' && $relatedlist != '' && ($name == 'Subject' || $name == 'Date Sent' || $name == 'To')) {
                            $list_result_count = $i - 1;
                            $tmp_value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid, false);
                            $tmp_value = evvt_strip_html_links($tmp_value);
                            $value = textlength_check($tmp_value);
                            if ($name == 'Date Sent') {
                                $sql = "select email_flag from vtiger_emaildetails where emailid=?";
                                $result = $adb->pquery($sql, array($entity_id));
                                $email_flag = $adb->query_result($result, 0, "email_flag");
                                if ($email_flag != 'SAVED') {
                                    $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid, false);
                                    $value = evvt_strip_html_links($value);
                                } else {
                                    $value = '';
                                }
                            }
                        } elseif ($module == 'Calendar' && ($fieldname != 'taskstatus' && $fieldname != 'eventstatus')) {
                            if ($activitytype == 'Task') {
                                if (getFieldVisibilityPermission('Calendar', $current_user->id, $fieldname) == '0') {
                                    $list_result_count = $i - 1;
                                    $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid, false);
                                    $value = evvt_strip_html_links($value);
                                } else {
                                    $value = '';
                                }
                            } else {
                                if (getFieldVisibilityPermission('Events', $current_user->id, $fieldname) == '0') {
                                    $list_result_count = $i - 1;
                                    $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid, false);
                                    $value = evvt_strip_html_links($value);
                                } else {
                                    $value = '';
                                }
                            }
                        } else {
                            $list_result_count = $i - 1;
                            $value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid, false);
                            $value = evvt_strip_html_links($value);
                        }
                    }
                    // vtlib customization: For listview javascript triggers
                    //$value = "$value <span type='vtlib_metainfo' vtrecordid='{$entity_id}' vtfieldname='{$fieldname}' vtmodule='$module' style='display:none;'></span>";
                    // END
                    if ($module == "Calendar" && $name == $app_strings['Close']) {
                        if (isPermitted("Calendar", "EditView") == 'yes') {
                            if (getFieldVisibilityPermission('Events', $current_user->id, 'eventstatus') == '0' || getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
                                array_push($list_header, $value);
                            }
                        }
                    } else {
                        $list_header[] = $value;
                    }
                }
            }
            $varreturnset = '';
            $varreturnset = $returnset;
            $webserviceEntityId = vtyiicpng_getWSEntityId($module);
            $list_header[] = $webserviceEntityId . $entity_id;
            $list_header[] = $module;
            $list_block[$entity_id] = $list_header;
        }
    }
    $log->debug("Exiting getSearchingListViewEntries method ...");
    return $list_block;
}
コード例 #19
0
 /**
  * Default (generic) function to handle the dependents list for the module.
  * NOTE: UI type '10' is used to stored the references to other modules for a given record.
  * These dependent records can be retrieved through this function.
  * For eg: A trouble ticket can be related to an Account or a Contact.
  * From a given Contact/Account if we need to fetch all such dependent trouble tickets, get_dependents_list function can be used.
  */
 function get_dependents_list($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $currentModule, $app_strings, $singlepane_view, $current_user;
     $parenttab = getParentTab();
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     $other = CRMEntity::getInstance($related_module);
     // Some standard module class doesn't have required variables
     // that are used in the query, they are defined in this generic API
     vtlib_setup_modulevars($currentModule, $this);
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = 'SINGLE_' . $related_module;
     $button = '';
     // To make the edit or del link actions to return back to same view.
     if ($singlepane_view == 'true') {
         $returnset = "&return_module={$currentModule}&return_action=DetailView&return_id={$id}";
     } else {
         $returnset = "&return_module={$currentModule}&return_action=CallRelatedList&return_id={$id}";
     }
     $return_value = null;
     $dependentFieldSql = $this->db->pquery("SELECT tabid, fieldname, columnname FROM vtiger_field WHERE uitype='10' AND" . " fieldid IN (SELECT fieldid FROM vtiger_fieldmodulerel WHERE relmodule=? AND module=?)", array($currentModule, $related_module));
     $numOfFields = $this->db->num_rows($dependentFieldSql);
     if ($numOfFields > 0) {
         $dependentColumn = $this->db->query_result($dependentFieldSql, 0, 'columnname');
         $dependentField = $this->db->query_result($dependentFieldSql, 0, 'fieldname');
         $button .= '<input type="hidden" name="' . $dependentColumn . '" id="' . $dependentColumn . '" value="' . $id . '">';
         $button .= '<input type="hidden" name="' . $dependentColumn . '_type" id="' . $dependentColumn . '_type" value="' . $currentModule . '">';
         if ($actions) {
             if (is_string($actions)) {
                 $actions = explode(',', strtoupper($actions));
             }
             if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes' && getFieldVisibilityPermission($related_module, $current_user->id, $dependentField, 'readwrite') == '0') {
                 $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname, $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname, $related_module) . "'>&nbsp;";
             }
         }
         $query = "SELECT vtiger_crmentity.*, {$other->table_name}.*";
         $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
         $query .= ", CASE WHEN (vtiger_users.user_name NOT LIKE '') THEN {$userNameSql} ELSE vtiger_groups.groupname END AS user_name";
         $more_relation = '';
         if (!empty($other->related_tables)) {
             foreach ($other->related_tables as $tname => $relmap) {
                 $query .= ", {$tname}.*";
                 // Setup the default JOIN conditions if not specified
                 if (empty($relmap[1])) {
                     $relmap[1] = $other->table_name;
                 }
                 if (empty($relmap[2])) {
                     $relmap[2] = $relmap[0];
                 }
                 $more_relation .= " LEFT JOIN {$tname} ON {$tname}.{$relmap['0']} = {$relmap['1']}.{$relmap['2']}";
             }
         }
         $query .= " FROM {$other->table_name}";
         $query .= " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = {$other->table_name}.{$other->table_index}";
         $query .= " INNER  JOIN {$this->table_name}   ON {$this->table_name}.{$this->table_index} = {$other->table_name}.{$dependentColumn}";
         $query .= $more_relation;
         $query .= " LEFT  JOIN vtiger_users        ON vtiger_users.id = vtiger_crmentity.smownerid";
         $query .= " LEFT  JOIN vtiger_groups       ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
         $query .= " WHERE vtiger_crmentity.deleted = 0 AND {$this->table_name}.{$this->table_index} = {$id}";
         $return_value = GetRelatedList($currentModule, $related_module, $other, $query, $button, $returnset);
     }
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     return $return_value;
 }
コード例 #20
0
ファイル: Vendors.php プロジェクト: hbsman/vtigercrm-5.3.0-ja
 /** Returns a list of the associated emails
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
  * All Rights Reserved..
  * Contributor(s): ______________________________________..
  */
 function get_emails($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_emails(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     $button .= '<input type="hidden" name="email_directing_module"><input type="hidden" name="record">';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "' accessyKey='F' class='crmbutton small create' onclick='fnvshobj(this,\"sendmail_cont\");sendmail(\"{$this_module}\",{$id});' type='button' name='button' value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'></td>";
         }
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('f' => 'vtiger_users.first_name', 'l' => 'vtiger_users.last_name'));
     $query = "SELECT case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name,\n\t\t\tvtiger_activity.activityid, vtiger_activity.subject,\n\t\t\tvtiger_activity.activitytype, vtiger_crmentity.modifiedtime,\n\t\t\tvtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_activity.date_start, vtiger_seactivityrel.crmid as parent_id \n\t\t\tFROM vtiger_activity, vtiger_seactivityrel, vtiger_vendor, vtiger_users, vtiger_crmentity\n\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\tON vtiger_groups.groupid=vtiger_crmentity.smownerid\n\t\t\tWHERE vtiger_seactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\tAND vtiger_vendor.vendorid = vtiger_seactivityrel.crmid\n\t\t\t\tAND vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\t\tAND vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\t\t\tAND vtiger_vendor.vendorid = " . $id . "\n\t\t\t\tAND vtiger_activity.activitytype='Emails'\n\t\t\t\tAND vtiger_crmentity.deleted = 0";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_emails method ...");
     return $return_value;
 }
コード例 #21
0
global $app_strings;
global $current_user;
$focus = 0;
global $theme;
global $log, $default_charset;
//<<<<<>>>>>>
global $oCustomView;
//<<<<<>>>>>>
$error_msg = '';
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once 'modules/CustomView/CustomView.php';
$cv_module = vtlib_purify($_REQUEST['module']);
$recordid = vtlib_purify($_REQUEST['record']);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("CATEGORY", getParentTab());
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", $image_path);
$smarty->assign("MODULE", $cv_module);
$smarty->assign("MODULELABEL", getTranslatedString($cv_module, $cv_module));
$smarty->assign("CVMODULE", $cv_module);
$smarty->assign("CUSTOMVIEWID", $recordid);
$smarty->assign("DATEFORMAT", $current_user->date_format);
$smarty->assign("JS_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
if ($recordid == "") {
    $oCustomView = new CustomView();
    $modulecollist = $oCustomView->getModuleColumnsList($cv_module);
    $log->info('CustomView :: Successfully got ColumnsList for the module' . $cv_module);
    if (isset($modulecollist)) {
        $choosecolslist = getByModule_ColumnsList($cv_module, $modulecollist);
コード例 #22
0
ファイル: Campaigns.php プロジェクト: kikojover/corebos
 /**
  * Function to get Campaign related Activities
  * @param  integer   $id      - campaignid
  * returns related activities record in array format
  */
 function get_activities($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_activities(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/Activity.php";
     $other = new Activity();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     $button .= '<input type="hidden" name="activity_mode">';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             if (getFieldVisibilityPermission('Calendar', $current_user->id, 'parent_id', 'readwrite') == '0') {
                 $button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EventEditView\";this.form.module.value=\"Calendar4You\";this.form.return_module.value=\"{$this_module}\";this.form.activity_mode.value=\"Task\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "'>&nbsp;";
             }
             if (getFieldVisibilityPermission('Events', $current_user->id, 'parent_id', 'readwrite') == '0') {
                 $button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EventEditView\";this.form.module.value=\"Calendar4You\";this.form.return_module.value=\"{$this_module}\";this.form.activity_mode.value=\"Events\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('LBL_EVENT', $related_module) . "'>";
             }
         }
     }
     $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
     $query = "SELECT vtiger_contactdetails.lastname,\n\t\t\tvtiger_contactdetails.firstname,\n\t\t\tvtiger_contactdetails.contactid,\n\t\t\tvtiger_activity.*,\n\t\t\tvtiger_seactivityrel.*,\n\t\t\tvtiger_crmentity.crmid, vtiger_crmentity.smownerid,\n\t\t\tvtiger_crmentity.modifiedtime,\n\t\t\tCASE when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name,\n\t\t\tvtiger_recurringevents.recurringtype\n\t\t\tFROM vtiger_activity\n\t\t\tINNER JOIN vtiger_seactivityrel\n\t\t\t\tON vtiger_seactivityrel.activityid = vtiger_activity.activityid\n\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid=vtiger_activity.activityid\n\t\t\tLEFT JOIN vtiger_cntactivityrel\n\t\t\t\tON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\t\tLEFT JOIN vtiger_contactdetails\n\t\t\t\tON vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid\n\t\t\tLEFT JOIN vtiger_users\n\t\t\t\tON vtiger_users.id = vtiger_crmentity.smownerid\n\t\t\tLEFT OUTER JOIN vtiger_recurringevents\n\t\t\t\tON vtiger_recurringevents.activityid = vtiger_activity.activityid\n\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tWHERE vtiger_seactivityrel.crmid=" . $id . "\n\t\t\tAND vtiger_crmentity.deleted = 0\n\t\t\tAND (activitytype = 'Task'\n\t\t\t\tOR activitytype !='Emails')";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_activities method ...");
     return $return_value;
 }
コード例 #23
0
 * Contributor(s): ______________________________________.
 ********************************************************************************/
require_once 'Smarty_setup.php';
require_once "data/Tracker.php";
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
global $app_strings, $default_charset;
global $currentModule, $current_user;
global $theme, $adb;
$url_string = '';
$smarty = new vtigerCRM_Smarty();
if (!isset($where)) {
    $where = "";
}
$parent_tab = getParentTab();
$smarty->assign("CATEGORY", $parent_tab);
$url = '';
$popuptype = '';
$popuptype = vtlib_purify($_REQUEST["popuptype"]);
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$smarty->assign("MOD", $mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("THEME", $theme);
$smarty->assign("THEME_PATH", $theme_path);
$smarty->assign("MODULE", $currentModule);
$form = vtlib_purify($_REQUEST['form']);
//added to get relatedto field value for todo, while selecting from the popup list, after done the alphabet or basic search.
if (isset($_REQUEST['maintab']) && $_REQUEST['maintab'] != '') {
    $act_tab = vtlib_purify($_REQUEST['maintab']);
コード例 #24
0
ファイル: Products.php プロジェクト: kikojover/corebos
 /**
  * Function to get Product's related Products
  * @param  integer   $id      - productid
  * returns related Products record in array format
  */
 function get_products($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_products(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     if ($singlepane_view == 'true') {
         $returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
     } else {
         $returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
     }
     $button = '';
     if ($actions && $this->ismember_check() === 0) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
         if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
             $button .= "<input type='hidden' name='createmode' id='createmode' value='link' />" . "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'>&nbsp;";
         }
     }
     $query = "SELECT vtiger_products.productid, vtiger_products.productname,\n\t\t\tvtiger_products.productcode, vtiger_products.commissionrate,\n\t\t\tvtiger_products.qty_per_unit, vtiger_products.unit_price,\n\t\t\tvtiger_crmentity.crmid, vtiger_crmentity.smownerid\n\t\t\tFROM vtiger_products\n\t\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid\n\t\t\tLEFT JOIN vtiger_seproductsrel ON vtiger_seproductsrel.crmid = vtiger_products.productid AND vtiger_seproductsrel.setype='Products'\n\t\t\tLEFT JOIN vtiger_users\n\t\t\t\tON vtiger_users.id=vtiger_crmentity.smownerid\n\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\tWHERE vtiger_crmentity.deleted = 0 AND vtiger_seproductsrel.productid = {$id} ";
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_products method ...");
     return $return_value;
 }
コード例 #25
0
ファイル: EditView.php プロジェクト: kduqi/corebos
$focus->mode = $mode;
$disp_view = getView($focus->mode);
$smarty->assign("IMAGENAME", $focus->imagename);
$smarty->assign("BLOCKS", getBlocks($currentModule, $disp_view, $mode, $focus->column_fields));
$smarty->assign("MODULE", 'Settings');
$smarty->assign("MODE", $focus->mode);
$smarty->assign("HOUR_FORMAT", $focus->hour_format);
$smarty->assign("START_HOUR", $focus->start_hour);
if ($_REQUEST['Edit'] == ' Edit ') {
    $smarty->assign("READONLY", "readonly");
    $smarty->assign("USERNAME_READONLY", "readonly");
}
if (isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] != 'true') {
    $smarty->assign("USERNAME_READONLY", "readonly");
}
$HomeValues = $focus->getHomeStuffOrder($focus->id);
$smarty->assign("TAGCLOUDVIEW", $HomeValues['Tag Cloud']);
$smarty->assign("SHOWTAGAS", $HomeValues['showtagas']);
unset($HomeValues['Tag Cloud']);
unset($HomeValues['showtagas']);
$smarty->assign("HOMEORDER", $HomeValues);
$smarty->assign("tagshow_options", array("flat" => $mod_strings['flat'], "hring" => $mod_strings['hring'], "vring" => $mod_strings['vring'], "hcylinder" => $mod_strings['hcylinder'], "vcylinder" => $mod_strings['vcylinder']));
$smarty->assign("DUPLICATE", vtlib_purify($_REQUEST['isDuplicate']));
$smarty->assign("USER_MODE", $mode);
$smarty->assign('PARENTTAB', getParentTab());
$_SESSION['Users_FORM_TOKEN'] = rand(5, 2000) * rand(2, 7);
$smarty->assign('FORM_TOKEN', $_SESSION['Users_FORM_TOKEN']);
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
// END
$smarty->display('UserEditView.tpl');
コード例 #26
0
ファイル: Edit.php プロジェクト: jmangarret/vtigercrm
 public function process(Vtiger_Request $request)
 {
     PDFMaker_Debugger_Model::GetInstance()->Init();
     $PDFMaker = new PDFMaker_PDFMaker_Model();
     if ($PDFMaker->CheckPermissions("EDIT") == false) {
         $PDFMaker->DieDuePermission();
     }
     $viewer = $this->getViewer($request);
     if ($request->has('templateid') && !$request->isEmpty('templateid')) {
         $templateid = $request->get('templateid');
         $pdftemplateResult = $PDFMaker->GetEditViewData($templateid);
         $select_module = $pdftemplateResult["module"];
         $select_format = $pdftemplateResult["format"];
         $select_orientation = $pdftemplateResult["orientation"];
     } else {
         $templateid = "";
         if ($request->has("return_module") && !$request->isEmpty("return_module")) {
             $select_module = $request->get("return_module");
         } else {
             $select_module = "";
         }
         $select_format = "A4";
         $select_orientation = "portrait";
     }
     $PDFMaker->CheckTemplatePermissions($select_module, $templateid);
     $viewer->assign("EMODE", "edit");
     $viewer->assign("TEMPLATEID", $templateid);
     $viewer->assign("MODULENAME", vtranslate($select_module, $select_module));
     $viewer->assign("SELECTMODULE", $select_module);
     $viewer->assign("BODY", $pdftemplateResult["body"]);
     $cu_model = Users_Record_Model::getCurrentUserModel();
     $this->cu_language = $cu_model->get('language');
     $viewer->assign("THEME", $theme);
     $viewer->assign("IMAGE_PATH", $image_path);
     $app_strings_big = Vtiger_Language_Handler::getModuleStringsFromFile($this->cu_language);
     $app_strings = $app_strings_big['languageStrings'];
     $viewer->assign("APP", $app_strings);
     $viewer->assign("PARENTTAB", getParentTab());
     $modArr = $PDFMaker->GetAllModules();
     $Modulenames = $modArr[0];
     $ModuleIDS = $modArr[1];
     // ******************************************   Company and User information: **********************************
     $CUI_BLOCKS["Account"] = vtranslate("LBL_COMPANY_INFO", 'PDFMaker');
     $CUI_BLOCKS["Assigned"] = vtranslate("LBL_USER_INFO", 'PDFMaker');
     $CUI_BLOCKS["Logged"] = vtranslate("LBL_LOGGED_USER_INFO", 'PDFMaker');
     $viewer->assign("CUI_BLOCKS", $CUI_BLOCKS);
     $adb = PearDatabase::getInstance();
     $sql = "SELECT * FROM vtiger_organizationdetails";
     $result = $adb->pquery($sql, array());
     $organization_logoname = decode_html($adb->query_result($result, 0, 'logoname'));
     $organization_header = decode_html($adb->query_result($result, 0, 'headername'));
     $organization_stamp_signature = $adb->query_result($result, 0, 'stamp_signature');
     global $site_URL;
     $path = $site_URL . "/test/logo/";
     if (isset($organization_logoname)) {
         $organization_logo_img = "<img src=\"" . $path . $organization_logoname . "\">";
         $viewer->assign("COMPANYLOGO", $organization_logo_img);
     }
     if (isset($organization_stamp_signature)) {
         $organization_stamp_signature_img = "<img src=\"" . $path . $organization_stamp_signature . "\">";
         $viewer->assign("COMPANY_STAMP_SIGNATURE", $organization_stamp_signature_img);
     }
     if (isset($organization_header)) {
         $organization_header_img = "<img src=\"" . $path . $organization_header . "\">";
         $viewer->assign("COMPANY_HEADER_SIGNATURE", $organization_header_img);
     }
     $Acc_Info = array('' => vtranslate("LBL_PLS_SELECT", 'PDFMaker'), "COMPANY_NAME" => vtranslate("LBL_COMPANY_NAME", 'PDFMaker'), "COMPANY_LOGO" => vtranslate("LBL_COMPANY_LOGO", 'PDFMaker'), "COMPANY_ADDRESS" => vtranslate("LBL_COMPANY_ADDRESS", 'PDFMaker'), "COMPANY_CITY" => vtranslate("LBL_COMPANY_CITY", 'PDFMaker'), "COMPANY_STATE" => vtranslate("LBL_COMPANY_STATE", 'PDFMaker'), "COMPANY_ZIP" => vtranslate("LBL_COMPANY_ZIP", 'PDFMaker'), "COMPANY_COUNTRY" => vtranslate("LBL_COMPANY_COUNTRY", 'PDFMaker'), "COMPANY_PHONE" => vtranslate("LBL_COMPANY_PHONE", "PDFMaker"), "COMPANY_FAX" => vtranslate("LBL_COMPANY_FAX", 'PDFMaker'), "COMPANY_WEBSITE" => vtranslate("LBL_COMPANY_WEBSITE", 'PDFMaker'));
     $viewer->assign("ACCOUNTINFORMATIONS", $Acc_Info);
     $sql_user_block = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid=29 ORDER BY sequence ASC";
     $res_user_block = $adb->query($sql_user_block);
     $user_block_info_arr = array();
     while ($row_user_block = $adb->fetch_array($res_user_block)) {
         $sql_user_field = "SELECT fieldid, uitype FROM vtiger_field WHERE block=" . $row_user_block['blockid'] . " and (displaytype != 3 OR uitype = 55) ORDER BY sequence ASC";
         $res_user_field = $adb->query($sql_user_field);
         $num_user_field = $adb->num_rows($res_user_field);
         if ($num_user_field > 0) {
             $user_field_id_array = array();
             while ($row_user_field = $adb->fetch_array($res_user_field)) {
                 $user_field_id_array[] = $row_user_field['fieldid'];
                 // print_r($user_field_id_array);
             }
             $user_block_info_arr[$row_user_block['blocklabel']] = $user_field_id_array;
         }
     }
     $user_mod_strings = $this->getModuleLanguageArray("Users");
     $b = 0;
     foreach ($user_block_info_arr as $block_label => $block_fields) {
         $b++;
         if (isset($user_mod_strings[$block_label]) and $user_mod_strings[$block_label] != "") {
             $optgroup_value = $user_mod_strings[$block_label];
         } else {
             $optgroup_value = vtranslate($block_label, 'PDFMaker');
         }
         if (count($block_fields) > 0) {
             $field_ids = implode(",", $block_fields);
             $sql1 = "SELECT * FROM vtiger_field WHERE fieldid IN (" . $field_ids . ")";
             $result1 = $adb->query($sql1);
             while ($row1 = $adb->fetchByAssoc($result1)) {
                 $fieldname = $row1['fieldname'];
                 $fieldlabel = $row1['fieldlabel'];
                 $option_key = strtoupper("Users" . "_" . $fieldname);
                 if (isset($current_mod_strings[$fieldlabel]) and $current_mod_strings[$fieldlabel] != "") {
                     $option_value = $current_mod_strings[$fieldlabel];
                 } elseif (isset($app_strings[$fieldlabel]) and $app_strings[$fieldlabel] != "") {
                     $option_value = $app_strings[$fieldlabel];
                 } else {
                     $option_value = $fieldlabel;
                 }
                 $User_Info[$optgroup_value][$option_key] = $option_value;
                 $Logged_User_Info[$optgroup_value]["R_" . $option_key] = $option_value;
             }
         }
         //variable RECORD ID added
         if ($b == 1) {
             $option_value = "Record ID";
             $option_key = strtoupper("USERS_CRMID");
             $User_Info[$optgroup_value][$option_key] = $option_value;
             $Logged_User_Info[$optgroup_value]["R_" . $option_key] = $option_value;
         }
         //end
     }
     // ****************************************** END: Company and User information **********************************
     $viewer->assign("USERINFORMATIONS", $User_Info);
     $viewer->assign("LOGGEDUSERINFORMATION", $Logged_User_Info);
     $Invterandcon = array("" => vtranslate("LBL_PLS_SELECT", 'PDFMaker'), "TERMS_AND_CONDITIONS" => vtranslate("LBL_TERMS_AND_CONDITIONS", 'PDFMaker'));
     $viewer->assign("INVENTORYTERMSANDCONDITIONS", $Invterandcon);
     //labels
     $global_lang_labels = @array_flip($app_strings);
     $global_lang_labels = @array_flip($global_lang_labels);
     asort($global_lang_labels);
     $viewer->assign("GLOBAL_LANG_LABELS", $global_lang_labels);
     $module_lang_labels = array();
     if ($select_module != "") {
         $mod_lang = $this->getModuleLanguageArray($select_module);
         $module_lang_labels = @array_flip($mod_lang);
         $module_lang_labels = @array_flip($module_lang_labels);
         asort($module_lang_labels);
     } else {
         $module_lang_labels[""] = vtranslate("LBL_SELECT_MODULE_FIELD", 'PDFMaker');
     }
     $viewer->assign("MODULE_LANG_LABELS", $module_lang_labels);
     $Header_Footer_Strings = array("" => vtranslate("LBL_PLS_SELECT", 'PDFMaker'), "PAGE" => $app_strings["Page"], "PAGES" => $app_strings["Pages"]);
     $viewer->assign("HEADER_FOOTER_STRINGS", $Header_Footer_Strings);
     //PDF FORMAT SETTINGS
     $Formats = array("A3" => "A3", "A4" => "A4", "A5" => "A5", "A6" => "A6", "Letter" => "Letter", "Legal" => "Legal", "Custom" => "Custom");
     // ITS4YOU VlZa
     $viewer->assign("FORMATS", $Formats);
     if (strpos($select_format, ";") > 0) {
         $tmpArr = explode(";", $select_format);
         $select_format = "Custom";
         $custom_format["width"] = $tmpArr[0];
         $custom_format["height"] = $tmpArr[1];
         $viewer->assign("CUSTOM_FORMAT", $custom_format);
     }
     $viewer->assign("SELECT_FORMAT", $select_format);
     //PDF ORIENTATION SETTINGS
     $Orientations = array("portrait" => vtranslate("portrait", 'PDFMaker'), "landscape" => vtranslate("landscape", 'PDFMaker'));
     $viewer->assign("ORIENTATIONS", $Orientations);
     $viewer->assign("SELECT_ORIENTATION", $select_orientation);
     //PDF MARGIN SETTINGS
     if ($request->has("templateid") && !$request->isEmpty("templateid")) {
         $Margins = array("top" => $pdftemplateResult["margin_top"], "bottom" => $pdftemplateResult["margin_bottom"], "left" => $pdftemplateResult["margin_left"], "right" => $pdftemplateResult["margin_right"]);
         $Decimals = array("point" => $pdftemplateResult["decimal_point"], "decimals" => $pdftemplateResult["decimals"], "thousands" => $pdftemplateResult["thousands_separator"] != "sp" ? $pdftemplateResult["thousands_separator"] : " ");
     } else {
         $Margins = array("top" => "2", "bottom" => "2", "left" => "2", "right" => "2");
         $Decimals = array("point" => ",", "decimals" => "2", "thousands" => " ");
     }
     $viewer->assign("MARGINS", $Margins);
     $viewer->assign("DECIMALS", $Decimals);
     //PDF HEADER / FOOTER
     $header = "";
     $footer = "";
     if ($request->has("templateid") && !$request->isEmpty("templateid")) {
         $header = $pdftemplateResult["header"];
         $footer = $pdftemplateResult["footer"];
     }
     $viewer->assign("HEADER", $header);
     $viewer->assign("FOOTER", $footer);
     $hfVariables = array("##PAGE##" => vtranslate("LBL_CURRENT_PAGE", 'PDFMaker'), "##PAGES##" => vtranslate("LBL_ALL_PAGES", 'PDFMaker'), "##PAGE##/##PAGES##" => vtranslate("LBL_PAGE_PAGES", 'PDFMaker'));
     $viewer->assign("HEAD_FOOT_VARS", $hfVariables);
     $dateVariables = array("##DD.MM.YYYY##" => vtranslate("LBL_DATE_DD.MM.YYYY", 'PDFMaker'), "##DD-MM-YYYY##" => vtranslate("LBL_DATE_DD-MM-YYYY", 'PDFMaker'), "##MM-DD-YYYY##" => vtranslate("LBL_DATE_MM-DD-YYYY", 'PDFMaker'), "##YYYY-MM-DD##" => vtranslate("LBL_DATE_YYYY-MM-DD", 'PDFMaker'));
     $viewer->assign("DATE_VARS", $dateVariables);
     $cmod = $this->getModuleLanguageArray("Settings");
     //$cmod = return_specified_module_language($current_language, "Settings");
     $viewer->assign("CMOD", $cmod);
     //Ignored picklist values
     $pvsql = "SELECT value FROM vtiger_pdfmaker_ignorepicklistvalues";
     $pvresult = $adb->query($pvsql);
     $pvvalues = "";
     while ($pvrow = $adb->fetchByAssoc($pvresult)) {
         $pvvalues .= $pvrow["value"] . ", ";
     }
     $viewer->assign("IGNORE_PICKLIST_VALUES", rtrim($pvvalues, ", "));
     $More_Fields = array("CURRENCYNAME" => vtranslate("LBL_CURRENCY_NAME", 'PDFMaker'), "CURRENCYSYMBOL" => vtranslate("LBL_CURRENCY_SYMBOL", 'PDFMaker'), "CURRENCYCODE" => vtranslate("LBL_CURRENCY_CODE", 'PDFMaker'), "TOTALWITHOUTVAT" => vtranslate("LBL_VARIABLE_SUMWITHOUTVAT", 'PDFMaker'), "TOTALDISCOUNT" => vtranslate("LBL_VARIABLE_TOTALDISCOUNT", 'PDFMaker'), "TOTALDISCOUNTPERCENT" => vtranslate("LBL_VARIABLE_TOTALDISCOUNT_PERCENT", 'PDFMaker'), "TOTALAFTERDISCOUNT" => vtranslate("LBL_VARIABLE_TOTALAFTERDISCOUNT", 'PDFMaker'), "VAT" => vtranslate("LBL_VARIABLE_VAT", 'PDFMaker'), "VATPERCENT" => vtranslate("LBL_VARIABLE_VAT_PERCENT", 'PDFMaker'), "VATBLOCK" => vtranslate("LBL_VARIABLE_VAT_BLOCK", 'PDFMaker'), "TOTALWITHVAT" => vtranslate("LBL_VARIABLE_SUMWITHVAT", 'PDFMaker'), "SHTAXTOTAL" => vtranslate("LBL_SHTAXTOTAL", 'PDFMaker'), "SHTAXAMOUNT" => vtranslate("LBL_SHTAXAMOUNT", 'PDFMaker'), "ADJUSTMENT" => vtranslate("LBL_ADJUSTMENT", 'PDFMaker'), "TOTAL" => vtranslate("LBL_VARIABLE_TOTALSUM", 'PDFMaker'));
     //formatable VATBLOCK content
     $vatblock_table = '<table border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse;">
             		<tr>
                         <td>' . $app_strings["Name"] . '</td>
                         <td>' . vtranslate("LBL_VATBLOCK_VAT_PERCENT", 'PDFMaker') . '</td>
                         <td>' . vtranslate("LBL_VATBLOCK_SUM", 'PDFMaker') . '</td>
                         <td>' . vtranslate("LBL_VATBLOCK_VAT_VALUE", 'PDFMaker') . '</td>
                     </tr>
             		<tr>
                         <td colspan="4">#VATBLOCK_START#</td>
                     </tr>
             		<tr>
             			<td>$VATBLOCK_LABEL$</td>
             			<td>$VATBLOCK_VALUE$</td>
             			<td>$VATBLOCK_NETTO$</td>
             			<td>$VATBLOCK_VAT$</td>
             		</tr>
             		<tr>
                         <td colspan="4">#VATBLOCK_END#</td>
                     </tr>
                 </table>';
     $vatblock_table = str_replace(array("\r\n", "\r", "\n", "\t"), "", $vatblock_table);
     $vatblock_table = ereg_replace(" {2,}", ' ', $vatblock_table);
     $viewer->assign("VATBLOCK_TABLE", $vatblock_table);
     $ModCommentsModules = array();
     foreach ($ModuleIDS as $module => $IDS) {
         if ($module == 'Calendar') {
             $sql1 = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid IN (9,16) ORDER BY sequence ASC";
         } elseif ($module == "Quotes" || $module == "Invoice" || $module == "SalesOrder" || $module == "PurchaseOrder" || $module == "Issuecards" || $module == "Receiptcards" || $module == "Creditnote" || $module == "StornoInvoice") {
             $sql1 = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid=" . $IDS . " AND blocklabel != 'LBL_DETAILS_BLOCK' AND blocklabel != 'LBL_ITEM_DETAILS' ORDER BY sequence ASC";
         } else {
             $sql1 = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid=" . $IDS . " ORDER BY sequence ASC";
         }
         $res1 = $adb->query($sql1);
         $block_info_arr = array();
         while ($row = $adb->fetch_array($res1)) {
             if ($row['blockid'] == '41' && $row['blocklabel'] == '') {
                 $row['blocklabel'] = 'LBL_EVENT_INFORMATION';
             }
             $sql2 = "SELECT fieldid, uitype, columnname, fieldlabel\n                 FROM vtiger_field\n                 WHERE block=" . $row['blockid'] . "\n                    AND (displaytype != 3 OR uitype = 55)\n                 ORDER BY sequence ASC";
             $res2 = $adb->query($sql2);
             $num_rows2 = $adb->num_rows($res2);
             if ($num_rows2 > 0) {
                 $field_id_array = array();
                 while ($row2 = $adb->fetch_array($res2)) {
                     $field_id_array[] = $row2['fieldid'];
                     $tmpArr = array($row2["columnname"], $row2["fieldlabel"]);
                     switch ($row2['uitype']) {
                         case "51":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Accounts");
                             break;
                         case "57":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Contacts");
                             break;
                         case "58":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Campaigns");
                             break;
                         case "59":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Products");
                             break;
                         case "73":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Accounts");
                             break;
                         case "75":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Vendors");
                             break;
                         case "81":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Vendors");
                             break;
                         case "76":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Potentials");
                             break;
                         case "78":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Quotes");
                             break;
                         case "80":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "SalesOrder");
                             break;
                         case "68":
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Accounts");
                             $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Contacts");
                             break;
                         case "10":
                             $fmrs = $adb->query('SELECT relmodule FROM vtiger_fieldmodulerel WHERE fieldid=' . $row2['fieldid']);
                             while ($rm = $adb->fetch_array($fmrs)) {
                                 $All_Related_Modules[$module][] = array_merge($tmpArr, (array) $rm['relmodule']);
                             }
                             break;
                     }
                 }
                 // ITS4YOU MaJu
                 //$block_info_arr[$row['blocklabel']] = $field_id_array;
                 if (!empty($block_info_arr[$row['blocklabel']])) {
                     foreach ($field_id_array as $field_id_array_value) {
                         $block_info_arr[$row['blocklabel']][] = $field_id_array_value;
                     }
                 } else {
                     $block_info_arr[$row['blocklabel']] = $field_id_array;
                 }
                 // ITS4YOU-END
             }
         }
         if ($module == "Quotes" || $module == "Invoice" || $module == "SalesOrder" || $module == "PurchaseOrder") {
             $block_info_arr["LBL_DETAILS_BLOCK"] = array();
         }
         //ModComments support
         //if (in_array($module, $ModCommentsModules)) {
         //    $block_info_arr["TEMP_MODCOMMENTS_BLOCK"] = array();
         //}
         $ModuleFields[$module] = $block_info_arr;
     }
     //Permissions are taken into consideration when dealing with realted modules
     $AllowedRelMods = array();
     if (count($All_Related_Modules) > 0) {
         foreach ($All_Related_Modules as $Mod => $RelMods) {
             foreach ($RelMods as $RelModKey => $RelMod) {
                 $RelModName = $RelMod[2];
                 if (isPermitted($RelModName, '') == "yes") {
                     $AllowedRelMods[$Mod][$RelModKey] = $RelMod;
                 }
             }
         }
     }
     $All_Related_Modules = $AllowedRelMods;
     // Fix of emtpy selectbox in case of selected module does not have any related modules
     foreach ($Modulenames as $key => $value) {
         if (!isset($All_Related_Modules[$key])) {
             $All_Related_Modules[$key] = array();
         }
     }
     $viewer->assign("ALL_RELATED_MODULES", $All_Related_Modules);
     if ($select_module != "" && count($All_Related_Modules[$select_module]) > 0) {
         foreach ($All_Related_Modules[$select_module] as $RelModArr) {
             $Related_Modules[$RelModArr[2] . "|" . $RelModArr[0]] = vtranslate($RelModArr[2]) . " (" . $RelModArr[1] . ")";
         }
     }
     $viewer->assign("RELATED_MODULES", $Related_Modules);
     $tacModules = array();
     $tac4you = is_numeric(getTabId("Tac4you"));
     if ($tac4you == true) {
         $sql = "SELECT tac4you_module FROM vtiger_tac4you_module WHERE presence = 1";
         $result = $adb->query($sql);
         while ($row = $adb->fetchByAssoc($result)) {
             $tacModules[$row["tac4you_module"]] = $row["tac4you_module"];
         }
     }
     $desc4youModules = array();
     $desc4you = is_numeric(getTabId("Descriptions4you"));
     if ($desc4you == true) {
         $sql = "SELECT b.name FROM vtiger_links AS a\n             INNER JOIN vtiger_tab AS b USING (tabid)\n             WHERE linktype = 'DETAILVIEWWIDGET'\n                AND linkurl = 'block://ModDescriptions4you:modules/Descriptions4you/ModDescriptions4you.php'";
         $result = $adb->query($sql);
         while ($row = $adb->fetchByAssoc($result)) {
             $desc4youModules[$row["name"]] = $row["name"];
         }
     }
     $Settings_Profiles_Record_Model = new Settings_Profiles_Record_Model();
     foreach ($ModuleFields as $module => $Blocks) {
         $Optgroupts = array();
         $current_mod_strings = $this->getModuleLanguageArray($module);
         $moduleModel = Vtiger_Module_Model::getInstance($module);
         $b = 0;
         if ($module == 'Calendar') {
             $b++;
             $Optgroupts[] = '"' . vtranslate('Calendar') . '","' . $b . '"';
             $Convert_ModuleFields['Calendar|1'] .= ',"Record ID","CALENDAR_CRMID"';
             $SelectModuleFields['Calendar'][vtranslate('Calendar')]["CALENDAR_CRMID"] = "Record ID";
             $EventModel = Vtiger_Module_Model::getInstance('Events');
         }
         foreach ($Blocks as $block_label => $block_fields) {
             $b++;
             $Options = array();
             if ($block_label != "TEMP_MODCOMMENTS_BLOCK") {
                 $optgroup_value = vtranslate($block_label, $module);
                 if ($optgroup_value == $block_label) {
                     $optgroup_value = vtranslate($block_label, 'PDFMaker');
                 }
             } else {
                 $optgroup_value = vtranslate("LBL_MODCOMMENTS_INFORMATION", 'PDFMaker');
             }
             $Optgroupts[] = '"' . $optgroup_value . '","' . $b . '"';
             if (count($block_fields) > 0) {
                 $field_ids = implode(",", $block_fields);
                 $sql1 = "SELECT * FROM vtiger_field WHERE fieldid IN (" . $field_ids . ")";
                 $result1 = $adb->query($sql1);
                 while ($row1 = $adb->fetchByAssoc($result1)) {
                     $fieldname = $row1['fieldname'];
                     $fieldlabel = $row1['fieldlabel'];
                     $fieldModel = Vtiger_Field_Model::getInstance($fieldname, $moduleModel);
                     if (!$fieldModel || !$fieldModel->getPermissions('readonly')) {
                         if ($module == 'Calendar') {
                             $eventFieldModel = Vtiger_Field_Model::getInstance($fieldname, $EventModel);
                             if (!$eventFieldModel || !$eventFieldModel->getPermissions('readonly')) {
                                 continue;
                             }
                         } else {
                             continue;
                         }
                     }
                     $option_key = strtoupper($module . "_" . $fieldname);
                     if (isset($current_mod_strings[$fieldlabel]) and $current_mod_strings[$fieldlabel] != "") {
                         $option_value = $current_mod_strings[$fieldlabel];
                     } elseif (isset($app_strings[$fieldlabel]) and $app_strings[$fieldlabel] != "") {
                         $option_value = $app_strings[$fieldlabel];
                     } else {
                         $option_value = $fieldlabel;
                     }
                     if ($module == 'Calendar') {
                         if ($option_key == 'CALENDAR_ACTIVITYTYPE' || $option_key == 'CALENDAR_DUE_DATE') {
                             $Convert_ModuleFields['Calendar|1'] .= ',"' . $option_value . '","' . $option_key . '"';
                             $SelectModuleFields['Calendar'][vtranslate('Calendar')][$option_key] = $option_value;
                             continue;
                         } elseif (!isset($Existing_ModuleFields[$option_key])) {
                             $Existing_ModuleFields[$option_key] = $optgroup_value;
                         } else {
                             $Convert_ModuleFields['Calendar|1'] .= ',"' . $option_value . '","' . $option_key . '"';
                             $SelectModuleFields['Calendar'][vtranslate('Calendar')][$option_key] = $option_value;
                             $Unset_Module_Fields[] = '"' . $option_value . '","' . $option_key . '"';
                             unset($SelectModuleFields['Calendar'][$Existing_ModuleFields[$option_key]][$option_key]);
                             continue;
                         }
                     }
                     $Options[] = '"' . $option_value . '","' . $option_key . '"';
                     $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
                 }
             }
             //variable RECORD ID added
             if ($b == 1) {
                 $option_value = "Record ID";
                 $option_key = strtoupper($module . "_CRMID");
                 $Options[] = '"' . $option_value . '","' . $option_key . '"';
                 $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
                 $option_value = vtranslate('Created Time') . ' (' . vtranslate('Due Date & Time') . ')';
                 $option_key = strtoupper($module . "_CREATEDTIME_DATETIME");
                 $Options[] = '"' . $option_value . '","' . $option_key . '"';
                 $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
                 $option_value = vtranslate('Modified Time') . ' (' . vtranslate('Due Date & Time') . ')';
                 $option_key = strtoupper($module . "_MODIFIEDTIME_DATETIME");
                 $Options[] = '"' . $option_value . '","' . $option_key . '"';
                 $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
             }
             //end
             if ($block_label == "LBL_TERMS_INFORMATION" && isset($tacModules[$module])) {
                 $option_value = vtranslate("LBL_TAC4YOU", 'PDFMaker');
                 $option_key = strtoupper($module . "_TAC4YOU");
                 $Options[] = '"' . $option_value . '","' . $option_key . '"';
                 $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
             }
             if ($block_label == "LBL_DESCRIPTION_INFORMATION" && isset($desc4youModules[$module])) {
                 $option_value = vtranslate("LBL_DESC4YOU", 'PDFMaker');
                 $option_key = strtoupper($module . "_DESC4YOU");
                 $Options[] = '"' . $option_value . '","' . $option_key . '"';
                 $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
             }
             //ModComments support
             if ($block_label == "TEMP_MODCOMMENTS_BLOCK" && in_array($module, $ModCommentsModules) == true) {
                 $option_value = vtranslate("LBL_MODCOMMENTS", 'PDFMaker');
                 $option_key = strtoupper($module . "_MODCOMMENTS");
                 $Options[] = '"' . $option_value . '","' . $option_key . '"';
                 $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value;
             }
             $Convert_RelatedModuleFields[$module . "|" . $b] = implode(",", $Options);
             $OptionsRelMod = array();
             if (($block_label == "LBL_DETAILS_BLOCK" || $block_label == "LBL_ITEM_DETAILS") && ($module == "Quotes" || $module == "Invoice" || $module == "SalesOrder" || $module == "PurchaseOrder" || $module == "Issuecards" || $module == "Receiptcards" || $module == "Creditnote" || $module == "StornoInvoice")) {
                 foreach ($More_Fields as $variable => $variable_name) {
                     $variable_key = strtoupper($variable);
                     $Options[] = '"' . $variable_name . '","' . $variable_key . '"';
                     $SelectModuleFields[$module][$optgroup_value][$variable_key] = $variable_name;
                     if ($variable_key != "VATBLOCK") {
                         $OptionsRelMod[] = '"' . $variable_name . '","' . strtoupper($module) . '_' . $variable_key . '"';
                     }
                 }
             }
             //this concatenation is because of need to have extra Details block in Inventory modules which are as related modules
             $Convert_RelatedModuleFields[$module . "|" . $b] .= implode(',', $OptionsRelMod);
             $Convert_ModuleFields[$module . "|" . $b] = implode(",", $Options);
         }
         if ($module == 'Calendar') {
             $Convert_ModuleFields['Calendar|1'] = str_replace(',"Record ID","CALENDAR_CRMID",', "", $Convert_ModuleFields['Calendar|1']);
             $Convert_ModuleFields['Calendar|1'] .= ',"Record ID","CALENDAR_CRMID"';
             unset($SelectModuleFields['Calendar'][vtranslate('Calendar')]["CALENDAR_CRMID"]);
             $SelectModuleFields['Calendar'][vtranslate('Calendar')]["CALENDAR_CRMID"] = "Record ID";
         }
         $Convert_ModuleBlocks[$module] = implode(",", $Optgroupts);
     }
     foreach ($Convert_ModuleFields as $cmf_key => $cmf_value) {
         if (substr($cmf_key, 0, 9) == 'Calendar|' && $cmf_key != 'Calendar|1') {
             foreach ($Unset_Module_Fields as $to_unset) {
                 $cmf_value = str_replace($to_unset, '', $cmf_value);
                 $cmf_value = str_replace(",,", ',', $cmf_value);
                 $Convert_ModuleFields[$cmf_key] = trim($cmf_value, ',');
             }
         }
     }
     $viewer->assign("MODULE_BLOCKS", $Convert_ModuleBlocks);
     $viewer->assign("RELATED_MODULE_FIELDS", $Convert_RelatedModuleFields);
     $viewer->assign("MODULE_FIELDS", $Convert_ModuleFields);
     //Product block fields start
     // Product bloc templates
     $sql = "SELECT * FROM vtiger_pdfmaker_productbloc_tpl";
     $result = $adb->query($sql);
     $Productbloc_tpl[""] = vtranslate("LBL_PLS_SELECT", 'PDFMaker');
     while ($row = $adb->fetchByAssoc($result)) {
         $Productbloc_tpl[$row["body"]] = $row["name"];
     }
     $viewer->assign("PRODUCT_BLOC_TPL", $Productbloc_tpl);
     $ProductBlockFields = $PDFMaker->GetProductBlockFields();
     foreach ($ProductBlockFields as $viewer_key => $pbFields) {
         $viewer->assign($viewer_key, $pbFields);
     }
     //Product block fields end
     $viewer->assign("SELECT_MODULE_FIELD", $SelectModuleFields[$select_module]);
     $smf_filename = $SelectModuleFields[$select_module];
     unset($smf_filename["Details"]);
     $viewer->assign("SELECT_MODULE_FIELD_FILENAME", $smf_filename);
     $version_type = ucfirst($PDFMaker->GetVersionType());
     $viewer->assign("VERSION", $version_type . " " . PDFMaker_Version_Helper::$version);
     $category = getParentTab();
     $viewer->assign("CATEGORY", $category);
     $viewer->view('Edit.tpl', 'PDFMaker');
 }
コード例 #27
0
ファイル: EditView.php プロジェクト: casati-dolibarr/corebos
/*+**********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 ************************************************************************************/
global $app_strings, $mod_strings, $current_language, $currentModule, $theme, $adb, $log, $current_user;
require_once 'Smarty_setup.php';
require_once 'data/Tracker.php';
require_once 'include/CustomFieldUtil.php';
require_once 'include/utils/utils.php';
$focus = CRMEntity::getInstance($currentModule);
$smarty = new vtigerCRM_Smarty();
$category = getParentTab($currentModule);
$record = vtlib_purify($_REQUEST['record']);
$isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
//added to fix the issue4600
$searchurl = getBasic_Advance_SearchURL();
$smarty->assign("SEARCH", $searchurl);
//4600 ends
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
    $focus->id = $record;
    $focus->mode = 'edit';
    $focus->retrieve_entity_info($record, 'PurchaseOrder');
    $focus->name = $focus->column_fields['subject'];
}
コード例 #28
0
ファイル: ListViewUtils.php プロジェクト: honj51/taobaocrm
function getValue($uitype, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, $mode, $popuptype, $returnset = '', $viewid = '')
{
    global $log;
    global $app_strings;
    //changed by dingjianting on 2007-11-05 for php5.2.x
    $log->debug("Entering getValue() method ...");
    global $adb, $current_user;
    if ($uitype == 10) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val != "") {
            $value = "";
            $module_entityname = "";
            $modulename_lower = substr($fieldname, 0, -2);
            $modulename = ucfirst($modulename_lower);
            $modulesid = $modulename_lower . "id";
            $tablename = "ec_" . $modulename_lower;
            $entityname = substr($fieldname, 0, -3) . "name";
            $query = "SELECT {$entityname} FROM {$tablename} WHERE {$modulesid}='" . $temp_val . "' and deleted=0";
            $fldmod_result = $adb->query($query);
            $rownum = $adb->num_rows($fldmod_result);
            if ($rownum > 0) {
                $value = $adb->query_result($fldmod_result, 0, $entityname);
            }
        } else {
            $value = '';
        }
    } elseif ($uitype == 52 || $uitype == 53 || $uitype == 77) {
        $value = $adb->query_result($list_result, $list_result_count, 'user_name');
    } elseif ($uitype == 5 || $uitype == 6 || $uitype == 23 || $uitype == 70) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if (isValidDate($temp_val)) {
            $value = getDisplayDate($temp_val);
        } else {
            $value = '';
        }
    } elseif ($uitype == 33) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        $value = str_ireplace(' |##| ', ', ', $temp_val);
    } elseif ($uitype == 17) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        $value = '<a href="http://' . $temp_val . '" target="_blank">' . $temp_val . '</a>';
    } elseif ($uitype == 13 || $uitype == 104) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        $value = '<a href="' . getComposeMailUrl($temp_val) . '" target="_blank">' . $temp_val . '</a>';
    } elseif ($uitype == 56) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val == 1) {
            $value = 'yes';
        } else {
            $value = 'no';
        }
        //changed by dingjianting on 2006-10-15 for simplized chinese
        if (isset($app_strings[$value])) {
            $value = $app_strings[$value];
        }
    } elseif ($uitype == 51 || $uitype == 73 || $uitype == 50) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val != '') {
            $value = getAccountName($temp_val);
        } else {
            $value = '';
        }
    } elseif ($uitype == 59) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val != '') {
            $value = getProductName($temp_val);
        } else {
            $value = '';
        }
    } elseif ($uitype == 76) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val != '') {
            $value = getPotentialName($temp_val);
        } else {
            $value = '';
        }
    } elseif ($uitype == 80) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val != '') {
            $value = getSoName($temp_val);
        } else {
            $value = '';
        }
    } elseif ($uitype == 1004) {
        $value = $adb->query_result($list_result, $list_result_count, 'smcreatorid');
        $value = getUserName($value);
    } elseif ($uitype == 1007) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        $value = getApproveStatusById($temp_val);
    } elseif ($uitype == 1008) {
        $value = $adb->query_result($list_result, $list_result_count, 'approvedby');
        $value = getUserName($value);
    } elseif ($uitype == 1004) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        $value = getUserName($temp_val);
    } elseif ($uitype == 1007) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($temp_val == '1') {
            $value = $app_strings["already_approved"];
        } elseif ($temp_val == '-1') {
            $value = $app_strings["unapproved"];
        } elseif ($temp_val == '-2') {
            $value = $app_strings["Rejected"];
        } else {
            $value = $app_strings["approving"];
        }
    } elseif ($uitype == 1008) {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        $value = getUserName($temp_val);
    } else {
        $temp_val = $adb->query_result($list_result, $list_result_count, $fieldname);
        if ($fieldname != $focus->list_link_field) {
            $value = $temp_val;
        } else {
            if ($mode == "list") {
                $tabname = getParentTab();
                $value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
            } elseif ($mode == "search") {
                if ($popuptype == "specific") {
                    $temp_val = str_replace("'", '\\"', $temp_val);
                    $temp_val = popup_from_html($temp_val);
                    //Added to avoid the error when select SO from Invoice through AjaxEdit
                    if ($module == 'Salesorders') {
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . br2nl($temp_val) . '","' . $_REQUEST['form'] . '");\'>' . $temp_val . '</a>';
                    } else {
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . br2nl($temp_val) . '");\'>' . $temp_val . '</a>';
                    }
                } elseif ($popuptype == "detailview") {
                    $temp_val = popup_from_html($temp_val);
                    $focus->record_id = $_REQUEST['recordid'];
                    if ($_REQUEST['return_module'] == "Calendar") {
                        $value = '<a href="javascript:window.close();" id="calendarCont' . $entity_id . '" LANGUAGE=javascript onclick=\'add_data_to_relatedlist_incal("' . $entity_id . '","' . $temp_val . '");\'>' . $temp_val . '</a>';
                    } else {
                        $value = '<a href="javascript:window.close();" onclick=\'add_data_to_relatedlist("' . $entity_id . '","' . $focus->record_id . '","' . $module . '");\'>' . $temp_val . '</a>';
                    }
                } elseif ($popuptype == "formname_specific") {
                    $temp_val = popup_from_html($temp_val);
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_formname_specific("' . $_REQUEST['form'] . '", "' . $entity_id . '", "' . br2nl($temp_val) . '");\'>' . $temp_val . '</a>';
                } elseif ($popuptype == "inventory_prod") {
                    $row_id = $_REQUEST['curr_row'];
                    //To get all the tax types and values and pass it to product details
                    $tax_str = '';
                    $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                    $qty_stock = $adb->query_result($list_result, $list_result_count, 'qtyinstock');
                    $productcode = $adb->query_result($list_result, $list_result_count, 'productcode');
                    $temp_val = popup_from_html($temp_val);
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $unitprice . '", "' . $qty_stock . '","' . $tax_str . '","' . $row_id . '","' . $productcode . '");\'>' . $temp_val . '</a>';
                } elseif ($popuptype == "inventory_prods") {
                    $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                    $qty_stock = $adb->query_result($list_result, $list_result_count, 'qtyinstock');
                    $productcode = $adb->query_result($list_result, $list_result_count, 'productcode');
                    $serialno = $adb->query_result($list_result, $list_result_count, 'serialno');
                    $temp_val = popup_from_html($temp_val);
                    $value = $temp_val . '<input type="hidden" name="productname_' . $entity_id . '" id="productname_' . $entity_id . '" value="' . $temp_val . '"><input type="hidden" name="listprice_' . $entity_id . '" id="listprice_' . $entity_id . '" value="' . $unitprice . '"><input type="hidden" name="qtyinstock_' . $entity_id . '" id="qtyinstock_' . $entity_id . '" value="' . $qty_stock . '"><input type="hidden" id="productcode_' . $entity_id . '" name="productcode_' . $entity_id . '" value="' . $productcode . '"><input type="hidden" id="serialno_' . $entity_id . '" name="serialno_' . $entity_id . '" value="' . $serialno . '">';
                } elseif ($popuptype == "salesorder_prod") {
                    $row_id = $_REQUEST['curr_row'];
                    $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                    $temp_val = popup_from_html($temp_val);
                    $producttype = $_REQUEST['producttype'];
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_so("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $unitprice . '", "' . $row_id . '","' . $producttype . '");\'>' . $temp_val . '</a>';
                } elseif ($popuptype == "inventory_prod_po") {
                    $row_id = $_REQUEST['curr_row'];
                    $unitprice = $adb->query_result($list_result, $list_result_count, 'unit_price');
                    $productcode = $adb->query_result($list_result, $list_result_count, 'productcode');
                    $temp_val = popup_from_html($temp_val);
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_po("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $unitprice . '", "' . $productcode . '","' . $row_id . '"); \'>' . $temp_val . '</a>';
                } elseif ($popuptype == "inventory_prod_noprice") {
                    $row_id = $_REQUEST['curr_row'];
                    $temp_val = popup_from_html($temp_val);
                    $qtyinstock = $adb->query_result($list_result, $list_result_count, 'qtyinstock');
                    $productcode = $adb->query_result($list_result, $list_result_count, 'productcode');
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_noprice("' . $entity_id . '", "' . br2nl($temp_val) . '","' . $row_id . '","' . $qtyinstock . '","' . $productcode . '");\'>' . $temp_val . '</a>';
                } elseif ($popuptype == "inventory_prod_check") {
                    $row_id = $_REQUEST['curr_row'];
                    $temp_val = popup_from_html($temp_val);
                    $productcode = $adb->query_result($list_result, $list_result_count, 'productcode');
                    $usageunit = $adb->query_result($list_result, $list_result_count, 'usageunit');
                    $qtyinstock = $adb->query_result($list_result, $list_result_count, 'qtyinstock');
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_inventory_check("' . $entity_id . '", "' . br2nl($temp_val) . '","' . $row_id . '","' . $productcode . '","' . $usageunit . '","' . $qtyinstock . '"); \'>' . $temp_val . '</a>';
                } elseif ($popuptype == "specific_account_address") {
                    require_once 'modules/Accounts/Accounts.php';
                    $acct_focus = new Accounts();
                    $acct_focus->retrieve_entity_info($entity_id, "Accounts");
                    $temp_val = popup_from_html($temp_val);
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . br2nl($acct_focus->column_fields['bill_street']) . '", "' . br2nl($acct_focus->column_fields['ship_street']) . '", "' . br2nl($acct_focus->column_fields['bill_city']) . '", "' . br2nl($acct_focus->column_fields['ship_city']) . '", "' . br2nl($acct_focus->column_fields['bill_state']) . '", "' . br2nl($acct_focus->column_fields['ship_state']) . '", "' . br2nl($acct_focus->column_fields['bill_code']) . '", "' . br2nl($acct_focus->column_fields['ship_code']) . '", "' . br2nl($acct_focus->column_fields['bill_country']) . '", "' . br2nl($acct_focus->column_fields['ship_country']) . '","' . br2nl($acct_focus->column_fields['bill_pobox']) . '", "' . br2nl($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>';
                } elseif ($popuptype == "specific_contact_account_address") {
                    require_once 'modules/Accounts/Accounts.php';
                    $acct_focus = new Accounts();
                    $acct_focus->retrieve_entity_info($entity_id, "Accounts");
                    $temp_val = popup_from_html($temp_val);
                    $value = '<a href="javascript:window.close();" onclick=\'set_return_contact_address("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . br2nl($acct_focus->column_fields['bill_street']) . '", "' . br2nl($acct_focus->column_fields['ship_street']) . '", "' . br2nl($acct_focus->column_fields['bill_city']) . '", "' . br2nl($acct_focus->column_fields['ship_city']) . '", "' . br2nl($acct_focus->column_fields['bill_state']) . '", "' . br2nl($acct_focus->column_fields['ship_state']) . '", "' . br2nl($acct_focus->column_fields['bill_code']) . '", "' . br2nl($acct_focus->column_fields['ship_code']) . '", "' . br2nl($acct_focus->column_fields['bill_country']) . '", "' . br2nl($acct_focus->column_fields['ship_country']) . '","' . br2nl($acct_focus->column_fields['bill_pobox']) . '", "' . br2nl($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>';
                } elseif ($popuptype == "specific_potential_account_address") {
                    $acntid = $adb->query_result($list_result, $list_result_count, "accountid");
                    if ($acntid != "") {
                        //require_once('modules/Accounts/Accounts.php');
                        //$acct_focus = new Accounts();
                        //$acct_focus->retrieve_entity_info($acntid,"Accounts");
                        $account_name = getAccountName($acntid);
                        $temp_val = popup_from_html($temp_val);
                        $value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . br2nl($temp_val) . '", "' . $acntid . '", "' . br2nl($account_name) . '");\'>' . $temp_val . '</a>';
                    } else {
                        $temp_val = popup_from_html($temp_val);
                        $value = '<a href="javascript:window.close();" >' . $temp_val . '</a>';
                    }
                } elseif ($popuptype == "set_return_emails") {
                    $name = $adb->query_result($list_result, $list_result_count, "lastname");
                    $emailaddress = $adb->query_result($list_result, $list_result_count, "email");
                    if ($emailaddress == '') {
                        $emailaddress = $adb->query_result($list_result, $list_result_count, "msn");
                    }
                    $where = isset($_REQUEST['where']) ? $_REQUEST['where'] : "";
                    $value = '<a href="javascript:;" onclick=\'return set_return_emails("' . $where . '","' . $name . '","' . $emailaddress . '"); \'>' . $name . '</a>';
                } elseif ($popuptype == "set_return_mobiles") {
                    //$firstname=$adb->query_result($list_result,$list_result_count,"first_name");
                    $contactname = $adb->query_result($list_result, $list_result_count, "lastname");
                    $mobile = $adb->query_result($list_result, $list_result_count, "mobile");
                    //changed by dingjianting on 2006-11-9 for simplized chinese
                    $value = '<a href="#" onclick=\'return set_return_mobiles(' . $entity_id . ',"' . $contactname . '","' . $mobile . '"); \'>' . $contactname . '</a>';
                } elseif ($popuptype == "set_return_usermobiles") {
                    //$firstname=$adb->query_result($list_result,$list_result_count,"first_name");
                    $lastname = $adb->query_result($list_result, $list_result_count, "last_name");
                    $mobile = $adb->query_result($list_result, $list_result_count, "phone_mobile");
                    //changed by dingjianting on 2006-11-9 for simplized chinese
                    $value = '<a href="#" onclick=\'return set_return_mobiles(' . $entity_id . ',"' . $lastname . '","' . $mobile . '"); \'>' . $lastname . '</a>';
                } else {
                    $temp_val = str_replace("'", '\\"', $temp_val);
                    $temp_val = popup_from_html($temp_val);
                    $value = '<a href="javascript:window.close();" onclick=\'set_return("' . $entity_id . '", "' . br2nl($temp_val) . '");\'>' . $temp_val . '</a>';
                }
            }
        }
    }
    $log->debug("Exiting getValue method ...");
    return $value;
}
コード例 #29
0
ファイル: Activity.php プロジェクト: kikojover/corebos
 /**
  * Function to get Activity related Contacts
  * @param  integer   $id      - activityid
  * returns related Contacts record in array format
  */
 function get_contacts($id, $cur_tab_id, $rel_tab_id, $actions = false)
 {
     global $log, $singlepane_view, $currentModule, $current_user;
     $log->debug("Entering get_contacts(" . $id . ") method ...");
     $this_module = $currentModule;
     $related_module = vtlib_getModuleNameById($rel_tab_id);
     require_once "modules/{$related_module}/{$related_module}.php";
     $other = new $related_module();
     vtlib_setup_modulevars($related_module, $other);
     $singular_modname = vtlib_toSingular($related_module);
     $parenttab = getParentTab();
     $returnset = '&return_module=' . $this_module . '&return_action=DetailView&activity_mode=Events&return_id=' . $id;
     $search_string = '';
     $button = '';
     if ($actions) {
         if (is_string($actions)) {
             $actions = explode(',', strtoupper($actions));
         }
         if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
             $button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}{$search_string}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'>&nbsp;";
         }
     }
     $query = 'select vtiger_users.user_name,vtiger_contactdetails.accountid,vtiger_contactdetails.contactid, vtiger_contactdetails.firstname,vtiger_contactdetails.lastname, vtiger_contactdetails.department, vtiger_contactdetails.title, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_contactdetails inner join vtiger_cntactivityrel on vtiger_cntactivityrel.contactid=vtiger_contactdetails.contactid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid where vtiger_cntactivityrel.activityid=' . $id . ' and vtiger_crmentity.deleted=0';
     $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
     if ($return_value == null) {
         $return_value = array();
     }
     $return_value['CUSTOM_BUTTON'] = $button;
     $log->debug("Exiting get_contacts method ...");
     return $return_value;
 }
コード例 #30
0
ファイル: calendarLayout.php プロジェクト: p6/VF
/**
 * Function to get todos list scheduled between specified dates
 * @param array   $calendar              -  collection of objects and strings
 * @param string  $start_date            -  date string
 * @param string  $end_date              -  date string
 * @param string  $info                  -  string 'listcnt' or empty string. if 'listcnt' means it returns no. of todos and no. of pending todos in array format else it returns todos list in array format
 * return array   $Entries               -  todolists in array format
 */
function getTodoList(&$calendar, $start_date, $end_date, $info = '')
{
    global $log, $app_strings, $theme;
    $Entries = array();
    $category = getParentTab();
    global $adb, $current_user, $mod_strings, $cal_log, $list_max_entries_per_page;
    $cal_log->debug("Entering getTodoList() method...");
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    $count_qry = "SELECT count(*) as count FROM vtiger_activity\n\t\tINNER JOIN vtiger_crmentity\n\t\tON vtiger_crmentity.crmid = vtiger_activity.activityid\n\t\tLEFT JOIN vtiger_cntactivityrel\n\t\tON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\tLEFT JOIN vtiger_groups\n\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\tLEFT JOIN vtiger_users\n\t\tON vtiger_users.id = vtiger_crmentity.smownerid\n\t\tWHERE vtiger_crmentity.deleted = 0\n\t\tAND vtiger_activity.activitytype = 'Task'\n\t\tAND (vtiger_activity.date_start BETWEEN ? AND ?) AND vtiger_crmentity.smownerid = " . $current_user->id;
    $query = "SELECT vtiger_groups.groupname, vtiger_users.user_name, vtiger_crmentity.crmid, vtiger_cntactivityrel.contactid, \n\t\t\t\tvtiger_activity.* FROM vtiger_activity\n                INNER JOIN vtiger_crmentity\n\t\t\t\t\tON vtiger_crmentity.crmid = vtiger_activity.activityid\n                LEFT JOIN vtiger_cntactivityrel\n\t\t\t\t\tON vtiger_cntactivityrel.activityid = vtiger_activity.activityid\n\t\t\t\tLEFT JOIN vtiger_groups\n\t\t\t\t\tON vtiger_groups.groupid = vtiger_crmentity.smownerid\n\t\t\t\tLEFT JOIN vtiger_users\n\t\t\t\t\tON vtiger_users.id = vtiger_crmentity.smownerid\n                WHERE vtiger_crmentity.deleted = 0\n\t\t\t\t\tAND vtiger_activity.activitytype = 'Task'\n\t\t\t\t\tAND (vtiger_activity.date_start BETWEEN ? AND ?) AND vtiger_crmentity.smownerid = " . $current_user->id;
    $list_query = $query;
    // User Select Customization
    /*$only_for_user = calendarview_getSelectedUserId();
    	if($only_for_user != 'ALL') {
    		$query .= " AND vtiger_crmentity.smownerid = "  . $only_for_user;
    		$count_qry .= " AND vtiger_crmentity.smownerid = "  . $only_for_user;
    	}*/
    // END
    $params = $info_params = array($start_date, $end_date);
    if ($info != '') {
        //added to fix #4816
        $groupids = explode(",", fetchUserGroupids($current_user->id));
        if (count($groupids) > 0) {
            $com_q = " AND (vtiger_crmentity.smownerid = ?\n\t\t\t\t\tOR vtiger_groups.groupid in (" . generateQuestionMarks($groupids) . "))";
        } else {
            $com_q = " AND vtiger_crmentity.smownerid = ?";
        }
        //end
        $pending_query = $query . " AND (vtiger_activity.status != 'Completed')" . $com_q;
        $total_q = $query . "" . $com_q;
        array_push($info_params, $current_user->id);
        if (count($groupids) > 0) {
            array_push($info_params, $groupids);
        }
        if ($adb->dbType == "pgsql") {
            $pending_query = fixPostgresQuery($pending_query, $log, 0);
            $total_q = fixPostgresQuery($total_q, $log, 0);
        }
        $total_res = $adb->pquery($total_q, $info_params);
        $total = $adb->num_rows($total_res);
        $res = $adb->pquery($pending_query, $info_params);
        $pending_rows = $adb->num_rows($res);
        $cal_log->debug("Exiting getTodoList() method...");
        return array('totaltodo' => $total, 'pendingtodo' => $pending_rows);
    }
    if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[9] == 3) {
        $sec_parameter = getListViewSecurityParameter('Calendar');
        $query .= $sec_parameter;
        $list_query .= $sec_parameter;
        $count_qry .= $sec_parameter;
    }
    $group_cond = '';
    $count_res = $adb->pquery($count_qry, $params);
    $total_rec_count = $adb->query_result($count_res, 0, 'count');
    $group_cond .= " ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
    if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
        $start = vtlib_purify($_REQUEST['start']);
    } else {
        $start = 1;
    }
    $navigation_array = getNavigationValues($start, $total_rec_count, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    if ($start_rec <= 1) {
        $start_rec = 0;
    } else {
        $start_rec = $start_rec - 1;
    }
    $query .= $group_cond . " limit {$start_rec},{$list_max_entries_per_page}";
    $list_query .= $group_cond;
    if ($adb->dbType == "pgsql") {
        $query = fixPostgresQuery($query, $log, 0);
        $list_query = fixPostgresQuery($list_query, $log, 0);
    }
    $list_query = $adb->convert2Sql($list_query, $params);
    $_SESSION['Calendar_listquery'] = $list_query;
    $result = $adb->pquery($query, $params);
    $rows = $adb->num_rows($result);
    $c = 0;
    if ($start > 1) {
        $c = ($start - 1) * $list_max_entries_per_page;
    }
    for ($i = 0; $i < $rows; $i++) {
        $element = array();
        $contact_name = '';
        $element['no'] = $c + 1;
        $more_link = "";
        $start_time = $adb->query_result($result, $i, "time_start");
        $format = $calendar['calendar']->hour_format;
        $value = getaddEventPopupTime($start_time, $start_time, $format);
        $element['starttime'] = $value['starthour'] . ':' . $value['startmin'] . '' . $value['startfmt'];
        $date_start = $adb->query_result($result, $i, "date_start");
        $due_date = $adb->query_result($result, $i, "due_date");
        if ($calendar['view'] != 'day') {
            $element['startdate'] = getDisplayDate($date_start);
        }
        $element['duedate'] = getDisplayDate($due_date);
        $id = $adb->query_result($result, $i, "activityid");
        $subject = $adb->query_result($result, $i, "subject");
        //CHANGE : TO IMPROVE PERFORMANCE
        /*$contact_id = $adb->query_result($result,$i,"contactid");
        		if($contact_id!='')
        		{
        			$contact_name = getContactName($contact_id);
        		}*/
        $more_link = "<a href='index.php?action=DetailView&module=Calendar&record=" . $id . "&activity_mode=Task&viewtype=calendar&parenttab=" . $category . "' class='webMnu'>" . $subject . "</a>";
        $element['tododetail'] = $more_link;
        /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
        		{
        			$element['task_relatedto'] = getRelatedTo('Calendar',$result,$i);
        		}
        		if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
        		{
        			$element['task_contact'] = "<a href=\"index.php?module=Contacts&action=DetailView&record=".$contact_id."\">".$contact_name."</a>";
        		}*/
        if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
            $taskstatus = $adb->query_result($result, $i, "status");
            if (!$is_admin && $taskstatus != '') {
                $roleid = $current_user->roleid;
                $roleids = array();
                $subrole = getRoleSubordinates($roleid);
                if (count($subrole) > 0) {
                    $roleids = $subrole;
                }
                array_push($roleids, $roleid);
                //here we are checking wheather the table contains the sortorder column .If  sortorder is present in the main picklist table, then the role2picklist will be applicable for this table...
                $sql = "select * from vtiger_taskstatus where taskstatus=?";
                $res = $adb->pquery($sql, array(decode_html($taskstatus)));
                $picklistvalueid = $adb->query_result($res, 0, 'picklist_valueid');
                if ($picklistvalueid != null) {
                    $pick_query = "select * from vtiger_role2picklist where picklistvalueid={$picklistvalueid} and roleid in (" . generateQuestionMarks($roleids) . ")";
                    $res_val = $adb->pquery($pick_query, array($roleids));
                    $num_val = $adb->num_rows($res_val);
                }
                if ($num_val > 0) {
                    $element['status'] = getTranslatedString(decode_html($taskstatus));
                } else {
                    $element['status'] = "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>";
                }
            } else {
                $element['status'] = getTranslatedString(decode_html($taskstatus));
            }
        }
        if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
            $element['action'] = "<img onClick='getcalAction(this,\"taskcalAction\"," . $id . ",\"" . $calendar['view'] . "\",\"" . $calendar['calendar']->date_time->hour . "\",\"" . $calendar['calendar']->date_time->get_formatted_date() . "\",\"todo\");' src='" . vtiger_imageurl('cal_event.jpg', $theme) . "' border='0'>";
        }
        $assignedto = $adb->query_result($result, $i, "user_name");
        if (!empty($assignedto)) {
            $element['assignedto'] = $assignedto;
        } else {
            $element['assignedto'] = $adb->query_result($result, $i, "groupname");
        }
        $c++;
        $Entries[] = $element;
    }
    $ret_arr[0] = $Entries;
    $ret_arr[1] = $navigation_array;
    $cal_log->debug("Exiting getTodoList() method...");
    return $ret_arr;
}