Esempio n. 1
0
function getCalls()
{
    //Realiza el query en la base de datos
    $mysqli = makeSqlConnection();
    $sql = "SELECT * FROM calls a LEFT JOIN calls_cstm ac ON a.id = ac.id_c ";
    $sql .= "WHERE a.parent_type IN('Accounts', 'Opportunities','Tasks') AND deleted = '0' ORDER BY name ASC";
    $res = $mysqli->query($sql);
    $rows = array();
    while ($r = mysqli_fetch_assoc($res)) {
        $obj = (object) $r;
        $obj->created_by_name = getNombreUsuario($obj->created_by);
        $obj->assigned_user_name = getNombreUsuario($obj->assigned_user_id);
        $obj->parent_name = getParentName($obj->parent_id, $obj->parent_type);
        $obj->campaign_name = getCampaignName($obj->id);
        $obj->campaign_id = getCampaignId($obj->id);
        $a = (array) $obj;
        $rows[] = $a;
    }
    if (empty($rows)) {
        return '{"results" :[]}';
    } else {
        //Convierte el arreglo en json y lo retorna
        $temp = json_encode(utf8ize($rows));
        return '{"results" :' . $temp . '}';
    }
}
Esempio n. 2
0
function getInfoFromBD($sql)
{
    //Realiza el query en la base de datos
    $mysqli = makeSqlConnection();
    $res = $mysqli->query($sql);
    $rows = array();
    while ($r = mysqli_fetch_assoc($res)) {
        $obj = (object) $r;
        $obj->parent_name = getParentName($obj->parent_id);
        $a = (array) $obj;
        $rows[] = $a;
    }
    if (empty($rows)) {
        return '{"results" :[]}';
    } else {
        //Convierte el arreglo en json y lo retorna
        $temp = json_encode(utf8ize($rows));
        return '{"results" :' . $temp . '}';
    }
}
 function buildDocumentModel()
 {
     global $app_strings;
     try {
         $model = parent::buildDocumentModel();
         $this->generateEntityModel($this->focus, 'SPPayments', 'payment_', $model);
         $this->generateUi10Models($model);
         $this->generateRelatedListModels($model);
         $model->set('payment_owner', getUserFullName($this->focusColumnValue('assigned_user_id')));
         $model->set('payment_payer', getParentName($this->focusColumnValue('payer')));
         return $model;
     } catch (Exception $e) {
         echo '<meta charset="utf-8" />';
         if ($e->getMessage() == $app_strings['LBL_RECORD_DELETE']) {
             echo $app_strings['LBL_RECORD_INCORRECT'];
             echo '<br><br>';
         } else {
             echo $e->getMessage();
             echo '<br><br>';
         }
         return null;
     }
 }
Esempio n. 4
0
function getGenericCall($sql)
{
    //Realiza el query en la base de datos
    $mysqli = makeSqlConnection();
    $res = $mysqli->query($sql);
    $rows = array();
    while ($r = mysqli_fetch_assoc($res)) {
        $obj = (object) $r;
        $obj->created_by_name = getNombreUsuario($obj->created_by);
        $obj->assigned_user_name = getNombreUsuario($obj->assigned_user_id);
        $obj->parent_name = getParentName($obj->parent_id, $obj->parent_type);
        $obj->campaign_name = getCampaignName($obj->id);
        $obj->campaign_id = getCampaignId($obj->id);
        $a = (array) $obj;
        $rows[] = $a;
    }
    if (empty($rows)) {
        return '{"results" :[]}';
    } else {
        //Convierte el arreglo en json y lo retorna
        $temp = json_encode(utf8ize($rows));
        return '{"results" :' . $temp . '}';
    }
}
Esempio n. 5
0
 public static function getPortalTicketEmailContents($entityData)
 {
     require_once 'config.inc.php';
     global $PORTAL_URL;
     $moduleName = $entityData->getModuleName();
     $wsId = $entityData->getId();
     $parts = explode('x', $wsId);
     $entityId = $parts[1];
     $wsParentId = $entityData->get('parent_id');
     $parentIdParts = explode('x', $wsParentId);
     $parentId = $parentIdParts[1];
     $portalUrl = "<a href='" . $PORTAL_URL . "/index.php?module=HelpDesk&action=index&ticketid=" . $entityId . "&fun=detail'>" . getTranslatedString('LBL_TICKET_DETAILS', $moduleName) . "</a>";
     $contents = getTranslatedString('Dear', $moduleName) . " " . getParentName(parentId) . ",<br><br>";
     $contents .= getTranslatedString('reply', $moduleName) . ' <b>' . $entityData->get('ticket_title') . '</b>' . getTranslatedString('customer_portal', $moduleName);
     $contents .= getTranslatedString("link", $moduleName) . '<br>';
     $contents .= $portalUrl;
     $contents .= '<br><br>' . getTranslatedString("Thanks", $moduleName) . '<br><br>' . getTranslatedString("Support_team", $moduleName);
     return $contents;
 }
Esempio n. 6
0
/** Function to return the duplicate records data as a formatted array */
function getDuplicateRecordsArr($module)
{
    global $adb, $app_strings, $list_max_entries_per_page, $theme;
    $field_values_array = getFieldValues($module);
    $field_values = $field_values_array['fieldnames_list'];
    $fld_arr = $field_values_array['fieldnames_array'];
    $col_arr = $field_values_array['columnnames_array'];
    $fld_labl_arr = $field_values_array['fieldlabels_array'];
    $ui_type = $field_values_array['fieldname_uitype'];
    $dup_query = getDuplicateQuery($module, $field_values, $ui_type);
    // added for page navigation
    $dup_count_query = substr($dup_query, stripos($dup_query, 'FROM'), strlen($dup_query));
    $dup_count_query = "SELECT count(*) as count " . $dup_count_query;
    $count_res = $adb->query($dup_count_query);
    $no_of_rows = $adb->query_result($count_res, 0, "count");
    if ($no_of_rows <= $list_max_entries_per_page) {
        $_SESSION['dup_nav_start' . $module] = 1;
    } else {
        if (isset($_REQUEST["start"]) && $_REQUEST["start"] != "" && $_SESSION['dup_nav_start' . $module] != $_REQUEST["start"]) {
            $_SESSION['dup_nav_start' . $module] = ListViewSession::getRequestStartPage();
        }
    }
    $start = $_SESSION['dup_nav_start' . $module] != "" ? $_SESSION['dup_nav_start' . $module] : 1;
    $navigation_array = getNavigationValues($start, $no_of_rows, $list_max_entries_per_page);
    $start_rec = $navigation_array['start'];
    $end_rec = $navigation_array['end_val'];
    $navigationOutput = getTableHeaderNavigation($navigation_array, "", $module, "FindDuplicate", "");
    if ($start_rec == 0) {
        $limit_start_rec = 0;
    } else {
        $limit_start_rec = $start_rec - 1;
    }
    $dup_query .= " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}";
    //ends
    $nresult = $adb->query($dup_query);
    $no_rows = $adb->num_rows($nresult);
    require_once 'modules/Vtiger/layout_utils.php';
    if ($no_rows == 0) {
        if ($_REQUEST['action'] == 'FindDuplicateRecords') {
            //echo "<br><br><center>".$app_strings['LBL_NO_DUPLICATE']." <a href='javascript:window.history.back()'>".$app_strings['LBL_GO_BACK'].".</a></center>";
            //die;
            echo "<link rel='stylesheet' type='text/css' href='themes/{$theme}/style.css'>";
            echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
            echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>\n\n\t\t\t\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t\t<tbody><tr>\n\t\t\t\t<td rowspan='2' width='11%'><img src='" . vtiger_imageurl('empty.jpg', $theme) . "' ></td>\n\t\t\t\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'><span class='genHeaderSmall'>{$app_strings['LBL_NO_DUPLICATE']}</span></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td class='small' align='right' nowrap='nowrap'>\n\t\t\t\t<a href='javascript:window.history.back();'>{$app_strings['LBL_GO_BACK']}</a><br>     </td>\n\t\t\t\t</tr>\n\t\t\t\t</tbody></table>\n\t\t\t\t</div>";
            echo "</td></tr></table>";
            exit;
        } else {
            echo "<br><br><table align='center' class='reportCreateBottom big' width='95%'><tr><td align='center'>" . $app_strings['LBL_NO_DUPLICATE'] . "</td></tr></table>";
            die;
        }
    }
    $rec_cnt = 0;
    $temp = array();
    $sl_arr = array();
    $grp = "group0";
    $gcnt = 0;
    $ii = 0;
    //ii'th record in group
    while ($rec_cnt < $no_rows) {
        $result = $adb->fetchByAssoc($nresult);
        //echo '<pre>';print_r($result);echo '</pre>';
        if ($rec_cnt != 0) {
            $sl_arr = array_slice($result, 2);
            array_walk($temp, 'lower_array');
            array_walk($sl_arr, 'lower_array');
            $arr_diff = array_diff($temp, $sl_arr);
            if (count($arr_diff) > 0) {
                $gcnt++;
                $temp = $sl_arr;
                $ii = 0;
            }
            $grp = "group" . $gcnt;
        }
        $fld_values[$grp][$ii]['recordid'] = $result['recordid'];
        for ($k = 0; $k < count($col_arr); $k++) {
            if ($rec_cnt == 0) {
                $temp[$fld_labl_arr[$k]] = $result[$col_arr[$k]];
            }
            if ($ui_type[$fld_arr[$k]] == 56) {
                if ($result[$col_arr[$k]] == 0) {
                    $result[$col_arr[$k]] = $app_strings['no'];
                } else {
                    $result[$col_arr[$k]] = $app_strings['yes'];
                }
            }
            if ($ui_type[$fld_arr[$k]] == 75 || $ui_type[$fld_arr[$k]] == 81) {
                $vendor_id = $result[$col_arr[$k]];
                if ($vendor_id != '') {
                    $vendor_name = getVendorName($vendor_id);
                }
                $result[$col_arr[$k]] = $vendor_name;
            }
            if ($ui_type[$fld_arr[$k]] == 57) {
                $contact_id = $result[$col_arr[$k]];
                if ($contact_id != '') {
                    $parent_module = 'Contacts';
                    $displayValueArray = getEntityName($parent_module, $contact_id);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $contactname = $field_value;
                        }
                    }
                }
                $result[$col_arr[$k]] = $contactname;
            }
            if ($ui_type[$fld_arr[$k]] == 15 || $ui_type[$fld_arr[$k]] == 16) {
                $result[$col_arr[$k]] = getTranslatedString($result[$col_arr[$k]], $module);
            }
            if ($ui_type[$fld_arr[$k]] == 33) {
                $fieldvalue = explode(' |##| ', $result[$col_arr[$k]]);
                $result[$col_arr[$k]] = array();
                foreach ($fieldvalue as $picklistValue) {
                    $result[$col_arr[$k]][] = getTranslatedString($picklistValue, $module);
                }
                $result[$col_arr[$k]] = implode(', ', $result[$col_arr[$k]]);
            }
            if ($ui_type[$fld_arr[$k]] == 68) {
                $parent_id = $result[$col_arr[$k]];
                if ($parent_id != '') {
                    $parentname = getParentName($parent_id);
                }
                $result[$col_arr[$k]] = $parentname;
            }
            if ($ui_type[$fld_arr[$k]] == 53 || $ui_type[$fld_arr[$k]] == 52) {
                if ($result[$col_arr[$k]] != '') {
                    $owner = getOwnerName($result[$col_arr[$k]]);
                }
                $result[$col_arr[$k]] = $owner;
            }
            if ($ui_type[$fld_arr[$k]] == 50 or $ui_type[$fld_arr[$k]] == 51) {
                if ($module != 'Products') {
                    $entity_name = getAccountName($result[$col_arr[$k]]);
                } else {
                    $entity_name = getProductName($result[$col_arr[$k]]);
                }
                if ($entity_name != '') {
                    $result[$col_arr[$k]] = $entity_name;
                } else {
                    $result[$col_arr[$k]] = '';
                }
            }
            if ($ui_type[$fld_arr[$k]] == 58) {
                $campaign_name = getCampaignName($result[$col_arr[$k]]);
                if ($campaign_name != '') {
                    $result[$col_arr[$k]] = $campaign_name;
                } else {
                    $result[$col_arr[$k]] = '';
                }
            }
            if ($ui_type[$fld_arr[$k]] == 59) {
                $product_name = getProductName($result[$col_arr[$k]]);
                if ($product_name != '') {
                    $result[$col_arr[$k]] = $product_name;
                } else {
                    $result[$col_arr[$k]] = '';
                }
            }
            /*uitype 10 handling*/
            if ($ui_type[$fld_arr[$k]] == 10) {
                $result[$col_arr[$k]] = getRecordInfoFromID($result[$col_arr[$k]]);
            }
            if ($ui_type[$fld_arr[$k]] == 5 || $ui_type[$fld_arr[$k]] == 6 || $ui_type[$fld_arr[$k]] == 23) {
                if (${$result}[$col_arr[$k]] != '' && ${$result}[$col_arr[$k]] != '0000-00-00') {
                    $date = new DateTimeField(${$result}[$col_arr[$k]]);
                    $value = $date->getDisplayDate();
                    if (strpos(${$result}[$col_arr[$k]], ' ') > -1) {
                        $value .= ' ' . $date->getDisplayTime();
                    }
                } elseif (${$result}[$col_arr[$k]] == '0000-00-00') {
                    $value = '';
                } else {
                    $value = ${$result}[$col_arr[$k]];
                }
                $result[$col_arr[$k]] = $value;
            }
            if ($ui_type[$fld_arr[$k]] == 71) {
                $result[$col_arr[$k]] = CurrencyField::convertToUserFormat($result[$col_arr[$k]]);
            }
            if ($ui_type[$fld_arr[$k]] == 72) {
                $result[$col_arr[$k]] = CurrencyField::convertToUserFormat($result[$col_arr[$k]], null, true);
            }
            $fld_values[$grp][$ii][$fld_labl_arr[$k]] = $result[$col_arr[$k]];
        }
        $fld_values[$grp][$ii]['Entity Type'] = $result['deleted'];
        $ii++;
        $rec_cnt++;
    }
    $gro = "group";
    for ($i = 0; $i < $no_rows; $i++) {
        $ii = 0;
        $dis_group[] = $fld_values[$gro . $i][$ii];
        $count_group[$i] = count($fld_values[$gro . $i]);
        $ii++;
        $new_group[] = $dis_group[$i];
    }
    $fld_nam = $new_group[0];
    $ret_arr[0] = $fld_values;
    $ret_arr[1] = $fld_nam;
    $ret_arr[2] = $ui_type;
    $ret_arr["navigation"] = $navigationOutput;
    return $ret_arr;
}
Esempio n. 7
0
 public static function getPortalTicketEmailContents($entityData)
 {
     require_once 'config/config.php';
     global $PORTAL_URL, $HELPDESK_SUPPORT_NAME;
     $moduleName = $entityData->getModuleName();
     $wsId = $entityData->getId();
     if (strpos($wsId, 'x')) {
         $parts = explode('x', $wsId);
         $entityId = $parts[1];
     } else {
         $entityId = $wsId;
     }
     $wsParentId = $entityData->get('contact_id');
     $parentIdParts = explode('x', $wsParentId);
     // If this function is being triggered as part of Eventing API
     // Then the reference field ID will not matching the webservice format.
     // Regardless of the entry we need just the ID
     $parentId = array_pop($parentIdParts);
     $portalUrl = "<a href='" . $PORTAL_URL . "/index.php?module=HelpDesk&action=index&ticketid=" . $entityId . "&fun=detail'>" . getTranslatedString('LBL_TICKET_DETAILS', $moduleName) . "</a>";
     $contents = getTranslatedString('Dear', $moduleName) . ' ';
     $contents .= $parentId ? getParentName($parentId) : '';
     $contents .= ",<br>";
     $contents .= getTranslatedString('reply', $moduleName) . ' <b>' . $entityData->get('ticket_title') . '</b> ' . getTranslatedString('customer_portal', $moduleName);
     $contents .= getTranslatedString("link", $moduleName) . '<br>';
     $contents .= $portalUrl;
     $contents .= '<br><br>' . getTranslatedString("Thanks", $moduleName) . '<br>' . $HELPDESK_SUPPORT_NAME;
     return $contents;
 }
Esempio n. 8
0
 function getParentName($id)
 {
     $cat = ProductCategory::getInstance($id);
     return $cat->vals['parent_id'] ? getParentName($cat->vals['parent_id']) . '/' . $cat->vals['name'] : $cat->vals['name'];
 }
Esempio n. 9
0
/**
 * 栏目页SEO信息
 * @param int    $cat
 * @param int    $page
 * @param string $kw
 * @return array
 */
function listSeo($cat, $page = 1, $kw = NULL)
{
    $config = App::get_config();
    $meta_title = $meta_keywords = $meta_description = '';
    if ($kw) {
        $meta_title = (empty($cat) ? lang('fun-2', array('1' => $kw)) : lang('fun-2', array('1' => $kw))) . '-' . $config['SITE_NAME'];
        $meta_title = $page > 1 ? lang('fun-1', array('1' => $page)) . '-' . $meta_title : $meta_title;
    } else {
        $meta_title = empty($cat['meta_title']) ? getParentName($cat['catid'], '-', 0) : $cat['meta_title'];
        $meta_title = $meta_title ? $meta_title . '-' . $config['SITE_NAME'] : $config['SITE_NAME'];
        $meta_title = isset($cat['stitle']) && $cat['stitle'] ? $cat['stitle'] . '-' . $meta_title : ($page > 1 ? lang('fun-1', array('1' => $page)) . '-' . $meta_title : $meta_title);
        $meta_keywords = empty($cat['meta_keywords']) ? getParentName($cat['catid'], ',', 0) . ',' . $config['SITE_KEYWORDS'] : $cat['meta_keywords'];
        $meta_description = empty($cat['meta_description']) ? $config['SITE_DESCRIPTION'] : $cat['meta_description'];
    }
    return array('meta_title' => $meta_title, 'meta_keywords' => $meta_keywords, 'meta_description' => $meta_description);
}
<?php

//INCLUDE ALL OF OUR MODULE CLASSES
include '../class/class_config.php';
include '../class/class_db.php';
//CREATE OUR CONFIG
$cfg = new class_config();
//CREATE OUR DATABASE
$db = new class_db($cfg->db_host, $cfg->db_name, $cfg->db_user, $cfg->db_pass);
//CONNECT TO OUR DATABASE
$database_connection = $db->DB_CONNECT();
//CONSTRUCT THE FILEPATH
$parent_page = $_REQUEST['parent_page'];
$tmp_array = explode("/", getParentName($db, $parent_page, $cfg));
for ($i = count($tmp_array) - 2; $i >= 0; $i--) {
    $tmp_path .= $tmp_array[$i] . "/";
}
$file_path = "../../{$tmp_path}" . $_REQUEST['file'];
//CLOSE OUT CONNECTION TO THE DATABASE
$db->DB_CLOSE($database_connection);
if (file_exists($file_path)) {
    echo "true";
} else {
    echo "false";
}
//
function getParentName($db, $parent_page, $cfg)
{
    if ($parent_page != 0) {
        $sql = "SELECT * FROM " . $cfg->db_prefix . "_block_page WHERE id = {$parent_page}";
        $results = $db->DB_Q_C($sql);
Esempio n. 11
0
 function save_module($module)
 {
     global $adb;
     //Handling module specific save
     //Insert into seactivity rel
     if (isset($this->column_fields['parent_id']) && $this->column_fields['parent_id'] != '') {
         $this->insertIntoEntityTable("vtiger_seactivityrel", $module);
     } elseif ($this->column_fields['parent_id'] == '' && $insertion_mode == "edit") {
         $this->deleteRelation("vtiger_seactivityrel");
     }
     //Insert into cntactivity rel
     if (isset($this->column_fields['contact_id']) && $this->column_fields['contact_id'] != '') {
         $this->insertIntoEntityTable('vtiger_cntactivityrel', $module);
     } elseif ($this->column_fields['contact_id'] == '' && $insertion_mode == "edit") {
         $this->deleteRelation('vtiger_cntactivityrel');
     }
     if (!empty($this->column_fields['sendnotification'])) {
         $mail_data = array();
         $mail_data['user_id'] = $this->column_fields['assigned_user_id'];
         $mail_data['subject'] = $this->column_fields['subject'];
         $mail_data['status'] = $this->column_fields['activitytype'] == 'Task' ? $this->column_fields['taskstatus'] : $this->column_fields['eventstatus'];
         $mail_data['taskpriority'] = $this->column_fields['taskpriority'];
         $relatedContacts = getActivityRelatedContacts($this->id);
         $mail_data['contact_name'] = implode(',', $relatedContacts);
         $mail_data['description'] = $this->column_fields['description'];
         $mail_data['st_date_time'] = $this->column_fields['date_start'] . ' ' . $this->column_fields['time_start'];
         $mail_data['end_date_time'] = $this->column_fields['due_date'] . ' ' . $this->column_fields['time_end'];
         $mail_data['relatedto'] = getParentName($this->column_fields['parent_id']);
         $mail_data['location'] = $this->column_fields['location'];
         getEventNotification($this->column_fields['activitytype'], $this->column_fields['subject'], $mail_data);
     }
     $recur_type = '';
     if (($recur_type == "--None--" || $recur_type == '') && $this->mode == "edit") {
         $sql = 'delete  from vtiger_recurringevents where activityid=?';
         $adb->pquery($sql, array($this->id));
     }
     //Handling for recurring type
     //Insert into vtiger_recurring event table
     if (isset($this->column_fields['recurringtype']) && $this->column_fields['recurringtype'] != '' && $this->column_fields['recurringtype'] != '--None--') {
         $recur_type = trim($this->column_fields['recurringtype']);
         $recur_data = getrecurringObjValue();
         if (is_object($recur_data)) {
             $this->insertIntoRecurringTable($recur_data);
         }
     }
     //Insert into vtiger_activity_remainder table
     $this->insertIntoReminderTable('vtiger_activity_reminder', $module, "");
     //Handling for invitees
     $selected_users_string = $_REQUEST['inviteesid'];
     $invitees_array = explode(';', $selected_users_string);
     $this->insertIntoInviteeTable($module, $invitees_array);
     //Inserting into sales man activity rel
     $this->insertIntoSmActivityRel($module);
     $this->insertIntoActivityReminderPopup($module);
 }