当前位置: 首页>>代码示例>>PHP>>正文


PHP getRelatedModule函数代码示例

本文整理汇总了PHP中getRelatedModule函数的典型用法代码示例。如果您正苦于以下问题:PHP getRelatedModule函数的具体用法?PHP getRelatedModule怎么用?PHP getRelatedModule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getRelatedModule函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display_field_lines

/**
 * Advanced OpenReports, SugarCRM Reporting.
 * @package Advanced OpenReports for SugarCRM
 * @copyright SalesAgility Ltd http://www.salesagility.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
 * along with this program; if not, see http://www.gnu.org/licenses
 * or write to the Free Software Foundation,Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301  USA
 *
 * @author SalesAgility <info@salesagility.com>
 */
function display_field_lines($focus, $field, $value, $view)
{
    global $mod_strings, $app_list_strings;
    $html = '';
    if (!is_file('cache/jsLanguage/AOR_Fields/' . $GLOBALS['current_language'] . '.js')) {
        require_once 'include/language/jsLanguage.php';
        jsLanguage::createModuleStringsCache('AOR_Fields', $GLOBALS['current_language']);
    }
    $html .= '<script src="include/javascript/yui3/build/yui/yui-min.js"></script>';
    $html .= '<script src="cache/jsLanguage/AOR_Fields/' . $GLOBALS['current_language'] . '.js"></script>';
    if ($view == 'EditView') {
        $html .= '<script src="modules/AOR_Fields/fieldLines.js"></script>';
        $html .= '<script></script>';
        $html .= "<table border='0' cellspacing='4' width='100%' id='fieldLines'></table>";
        $html .= "<div style='padding-top: 10px; padding-bottom:10px;'>";
        $html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_FIELD'] . "\" id=\"btn_FieldLine\" onclick=\"insertFieldLine()\" disabled/>";
        $html .= "</div>";
        $html .= "<script>";
        $html .= "sort_by_values = \"" . trim(preg_replace('/\\s+/', ' ', get_select_options_with_id($app_list_strings['aor_sort_operator'], ''))) . "\";";
        $html .= "</script>";
        if (isset($focus->report_module) && $focus->report_module != '') {
            require_once "modules/AOW_WorkFlow/aow_utils.php";
            $html .= "<script>";
            $html .= "report_rel_modules = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($focus->report_module))) . "\";";
            $html .= "report_module = \"" . $focus->report_module . "\";";
            $html .= "document.getElementById('btn_FieldLine').disabled = '';";
            if ($focus->id != '') {
                $sql = "SELECT id FROM aor_fields WHERE aor_report_id = '" . $focus->id . "' AND deleted = 0 ORDER BY field_order ASC";
                $result = $focus->db->query($sql);
                while ($row = $focus->db->fetchByAssoc($result)) {
                    $field_name = new AOR_Field();
                    $field_name->retrieve($row['id']);
                    $field_name->module_path = unserialize(base64_decode($field_name->module_path));
                    $html .= "report_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module, $field_name->module_path[0])))) . "\";";
                    $field_item = json_encode($field_name->toArray());
                    $html .= "loadFieldLine(" . $field_item . ");";
                }
            }
            $html .= "report_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields($focus->report_module))) . "\";";
            $html .= "</script>";
        }
    } else {
        if ($view == 'DetailView') {
            /*$html .= '<script src="include/SugarCharts/Jit/js/sugarCharts.js"></script>';
            
                    $html .= '<script language="javascript" type="text/javascript" src="include/MySugar/javascript/MySugar.js"></script>';
                    $html .= '<script language="javascript" type="text/javascript" src="include/SugarCharts/Jit/js/Jit/jit.js"></script>';
                    $html .= '<script language="javascript" type="text/javascript" src="include/SugarCharts/Jit/js/sugarCharts.js"></script>';
                    $html .= '<script language="javascript" type="text/javascript" src="include/SugarCharts/Jit/js/mySugarCharts.js"></script>';*/
            $html .= $focus->build_group_report(0) . '<br />';
        }
    }
    return $html;
}
开发者ID:omusico,项目名称:windcrm,代码行数:76,代码来源:fieldLines.php

示例2: build_report_query_where

 function build_report_query_where($query = array())
 {
     global $beanList, $app_list_strings, $sugar_config;
     if ($beanList[$this->report_module]) {
         $module = new $beanList[$this->report_module]();
         $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY condition_order ASC";
         $result = $this->db->query($sql);
         while ($row = $this->db->fetchByAssoc($result)) {
             $condition = new AOR_Condition();
             $condition->retrieve($row['id']);
             $path = unserialize(base64_decode($condition->module_path));
             $condition_module = $module;
             $table_alias = $condition_module->table_name;
             if (!empty($path[0]) && $path[0] != $module->module_dir) {
                 foreach ($path as $rel) {
                     if (empty($rel)) {
                         continue;
                     }
                     $rel = strtolower($rel);
                     $new_condition_module = new $beanList[getRelatedModule($condition_module->module_dir, $rel)]();
                     $oldAlias = $table_alias;
                     $table_alias = $table_alias . ":" . $rel;
                     $query = $this->build_report_query_join($rel, $table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_condition_module);
                     $condition_module = $new_condition_module;
                 }
             }
             if (isset($app_list_strings['aor_sql_operator_list'][$condition->operator])) {
                 $where_set = false;
                 $data = $condition_module->field_defs[$condition->field];
                 if ($data['type'] == 'relate' && isset($data['id_name'])) {
                     $condition->field = $data['id_name'];
                     $data_new = $condition_module->field_defs[$condition->field];
                     if (!empty($data_new['source']) && $data_new['source'] == 'non-db' && $data_new['type'] != 'link' && isset($data['link'])) {
                         $data_new['type'] = 'link';
                         $data_new['relationship'] = $data['link'];
                     }
                     $data = $data_new;
                 }
                 if ($data['type'] == 'link' && $data['source'] == 'non-db') {
                     $relModule = getRelatedModule($condition_module->module_dir, $data['relationship']);
                     $new_field_module = new $beanList[$relModule]();
                     $query = $this->build_report_query_join($data['relationship'], $table_alias . ':' . strtolower($relModule), $oldAlias, $condition_module, 'relationship', $query, $new_field_module);
                     $field_module = $new_field_module;
                     $table_alias = $table_alias . ':' . $data['relationship'];
                     $condition->field = 'id';
                 }
                 if (isset($data['source']) && $data['source'] == 'custom_fields') {
                     $field = $this->db->quoteIdentifier($table_alias . '_cstm') . '.' . $condition->field;
                     $query = $this->build_report_query_join($table_alias . '_cstm', $table_alias . '_cstm', $oldAlias, $condition_module, 'custom', $query);
                 } else {
                     $field = $this->db->quoteIdentifier($table_alias) . '.' . $condition->field;
                 }
                 if (!empty($this->user_parameters[$condition->id]) && $condition->parameter) {
                     $condParam = $this->user_parameters[$condition->id];
                     $condition->value = $condParam['value'];
                     $condition->operator = $condParam['operator'];
                     $condition->value_type = $condParam['type'];
                 }
                 switch ($condition->value_type) {
                     case 'Field':
                         $data = $condition_module->field_defs[$condition->value];
                         if ($data['type'] == 'relate' && isset($data['id_name'])) {
                             $condition->value = $data['id_name'];
                             $data_new = $condition_module->field_defs[$condition->value];
                             if ($data_new['source'] == 'non-db' && $data_new['type'] != 'link' && isset($data['link'])) {
                                 $data_new['type'] = 'link';
                                 $data_new['relationship'] = $data['link'];
                             }
                             $data = $data_new;
                         }
                         if ($data['type'] == 'link' && $data['source'] == 'non-db') {
                             $new_field_module = new $beanList[getRelatedModule($field_module->module_dir, $data['relationship'])]();
                             $query = $this->build_report_query_join($data['relationship'], $table_alias, $oldAlias, $field_module, 'relationship', $query, $new_field_module);
                             $field_module = $new_field_module;
                             $table_alias = $data['relationship'];
                             $field->field = 'id';
                         }
                         if (isset($data['source']) && $data['source'] == 'custom_fields') {
                             $value = $condition_module->table_name . '_cstm.' . $condition->value;
                             $query = $this->build_report_query_join($condition_module->table_name . '_cstm', $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
                         } else {
                             $value = $condition_module->table_name . '.' . $condition->value;
                         }
                         break;
                     case 'Date':
                         $params = unserialize(base64_decode($condition->value));
                         if ($params[0] == 'now') {
                             if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
                                 $value = 'GetDate()';
                             } else {
                                 $value = 'NOW()';
                             }
                         } else {
                             $data = $condition_module->field_defs[$params[0]];
                             if (isset($data['source']) && $data['source'] == 'custom_fields') {
                                 $value = $condition_module->table_name . '_cstm.' . $params[0];
                                 $query = $this->build_report_query_join($condition_module->table_name . '_cstm', $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
                             } else {
                                 $value = $condition_module->table_name . '.' . $params[0];
                             }
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:101,代码来源:AOR_Report.php

示例3: getConditionsAsParameters

function getConditionsAsParameters($report, $override = array())
{
    if (empty($report)) {
        return array();
    }
    global $app_list_strings;
    $conditions = array();
    foreach ($report->get_linked_beans('aor_conditions', 'AOR_Conditions') as $key => $condition) {
        if (!$condition->parameter) {
            continue;
        }
        $path = unserialize(base64_decode($condition->module_path));
        $field_module = $report->report_module;
        if ($path[0] != $report->report_module) {
            foreach ($path as $rel) {
                if (empty($rel)) {
                    continue;
                }
                $field_module = getRelatedModule($field_module, $rel);
            }
        }
        $additionalConditions = unserialize(base64_decode($condition->value));
        $value = isset($override[$condition->id]['value']) ? $override[$condition->id]['value'] : ($value = $condition->value);
        $field = getModuleField($field_module, $condition->field, "parameter_value[{$key}]", 'EditView', $value);
        $disp = getDisplayForField($path, $condition->field, $report->report_module);
        $conditions[] = array('id' => $condition->id, 'operator' => $condition->operator, 'operator_display' => $app_list_strings['aor_operator_list'][$condition->operator], 'value_type' => $condition->value_type, 'value' => $value, 'field_display' => $disp['field'], 'module_display' => $disp['module'], 'field' => $field, 'additionalConditions' => $additionalConditions);
    }
    return $conditions;
}
开发者ID:switcode,项目名称:SuiteCRM,代码行数:29,代码来源:aor_utils.php

示例4: action_getModuleFieldType

 protected function action_getModuleFieldType()
 {
     if (isset($_REQUEST['rel_field']) && $_REQUEST['rel_field'] != '') {
         $rel_module = getRelatedModule($_REQUEST['aow_module'], $_REQUEST['rel_field']);
     } else {
         $rel_module = $_REQUEST['aow_module'];
     }
     $module = $_REQUEST['aow_module'];
     $fieldname = $_REQUEST['aow_fieldname'];
     $aow_field = $_REQUEST['aow_newfieldname'];
     if (isset($_REQUEST['view'])) {
         $view = $_REQUEST['view'];
     } else {
         $view = 'EditView';
     }
     if (isset($_REQUEST['aow_value'])) {
         $value = $_REQUEST['aow_value'];
     } else {
         $value = '';
     }
     switch ($_REQUEST['aow_type']) {
         case 'Field':
             if (isset($_REQUEST['alt_module']) && $_REQUEST['alt_module'] != '') {
                 $module = $_REQUEST['alt_module'];
             }
             if ($view == 'EditView') {
                 echo "<select type='text' style='width:178px;' name='{$aow_field}' id='{$aow_field} ' title='' tabindex='116'>" . getModuleFields($module, $view, $value, getValidFieldsTypes($module, $fieldname)) . "</select>";
             } else {
                 echo getModuleFields($module, $view, $value);
             }
             break;
         case 'Any_Change':
             echo '';
             break;
         case 'Date':
             echo getDateField($module, $aow_field, $view, $value, false);
             break;
         case 'Multi':
             echo getModuleField($rel_module, $fieldname, $aow_field, $view, $value, 'multienum');
             break;
         case 'SecurityGroup':
             $module = 'Accounts';
             $fieldname = 'SecurityGroups';
         case 'Value':
         default:
             echo getModuleField($rel_module, $fieldname, $aow_field, $view, $value);
             break;
     }
     die;
 }
开发者ID:pikkoui,项目名称:suitecrm,代码行数:50,代码来源:controller.php

示例5: run_action

 function run_action(SugarBean $bean, $params = array(), $in_save = false)
 {
     if (isset($params['rel_type']) && $params['rel_type'] != '' && $bean->module_dir != $params['rel_type']) {
         $relatedFields = $bean->get_linked_fields();
         $field = $relatedFields[$params['rel_type']];
         if (!isset($field['module']) || $field['module'] == '') {
             $field['module'] = getRelatedModule($bean->module_dir, $field['name']);
         }
         $linkedBeans = $bean->get_linked_beans($field['name'], $field['module']);
         if ($linkedBeans) {
             foreach ($linkedBeans as $linkedBean) {
                 $this->set_record($linkedBean, $bean, $params, 'false');
                 $this->set_relationships($linkedBean, $bean, $params);
             }
         }
     } else {
         $this->set_record($bean, $bean, $params, $in_save);
         $this->set_relationships($bean, $bean, $params);
     }
     return true;
 }
开发者ID:omusico,项目名称:windcrm,代码行数:21,代码来源:actionModifyRecord.php

示例6: build_report_query_where

 /**
  * @param array $query
  * @return array
  */
 function build_report_query_where($query = array())
 {
     global $beanList, $app_list_strings, $sugar_config;
     $closure = false;
     if (!empty($query['where'])) {
         $query['where'][] = '(';
         $closure = true;
     }
     if ($beanList[$this->report_module]) {
         $module = new $beanList[$this->report_module]();
         $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '" . $this->id . "' AND deleted = 0 ORDER BY condition_order ASC";
         $result = $this->db->query($sql);
         $tiltLogicOp = true;
         while ($row = $this->db->fetchByAssoc($result)) {
             $condition = new AOR_Condition();
             $condition->retrieve($row['id']);
             $path = unserialize(base64_decode($condition->module_path));
             $condition_module = $module;
             $table_alias = $condition_module->table_name;
             $oldAlias = $table_alias;
             if (!empty($path[0]) && $path[0] != $module->module_dir) {
                 foreach ($path as $rel) {
                     if (empty($rel)) {
                         continue;
                     }
                     // Bug: Prevents relationships from loading.
                     //$rel = strtolower($rel);
                     $new_condition_module = new $beanList[getRelatedModule($condition_module->module_dir, $rel)]();
                     $oldAlias = $table_alias;
                     $table_alias = $table_alias . ":" . $rel;
                     $query = $this->build_report_query_join($rel, $table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_condition_module);
                     $condition_module = $new_condition_module;
                 }
             }
             if (isset($app_list_strings['aor_sql_operator_list'][$condition->operator])) {
                 $where_set = false;
                 $data = $condition_module->field_defs[$condition->field];
                 if ($data['type'] == 'relate' && isset($data['id_name'])) {
                     $condition->field = $data['id_name'];
                     $data_new = $condition_module->field_defs[$condition->field];
                     if (!empty($data_new['source']) && $data_new['source'] == 'non-db' && $data_new['type'] != 'link' && isset($data['link'])) {
                         $data_new['type'] = 'link';
                         $data_new['relationship'] = $data['link'];
                     }
                     $data = $data_new;
                 }
                 if ($data['type'] == 'link' && $data['source'] == 'non-db') {
                     $new_field_module = new $beanList[getRelatedModule($condition_module->module_dir, $data['relationship'])]();
                     $table_alias = $data['relationship'];
                     $query = $this->build_report_query_join($data['relationship'], $table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_field_module);
                     $condition_module = $new_field_module;
                     // Debugging: security groups conditions - It's a hack to just get the query working
                     if ($condition_module->module_dir = 'SecurityGroups' && count($path) > 1) {
                         //                            $table_alias = 'opportunities:assigned_user_link:SecurityGroups' ;
                         $table_alias = $oldAlias . ':' . $rel;
                     }
                     $condition->field = 'id';
                 }
                 if (isset($data['source']) && $data['source'] == 'custom_fields') {
                     $field = $this->db->quoteIdentifier($table_alias . '_cstm') . '.' . $condition->field;
                     $query = $this->build_report_query_join($table_alias . '_cstm', $table_alias . '_cstm', $oldAlias, $condition_module, 'custom', $query);
                 } else {
                     $field = $this->db->quoteIdentifier($table_alias) . '.' . $condition->field;
                 }
                 if (!empty($this->user_parameters[$condition->id]) && $condition->parameter) {
                     $condParam = $this->user_parameters[$condition->id];
                     $condition->value = $condParam['value'];
                     $condition->operator = $condParam['operator'];
                     $condition->value_type = $condParam['type'];
                 }
                 switch ($condition->value_type) {
                     case 'Field':
                         $data = $condition_module->field_defs[$condition->value];
                         if ($data['type'] == 'relate' && isset($data['id_name'])) {
                             $condition->value = $data['id_name'];
                             $data_new = $condition_module->field_defs[$condition->value];
                             if ($data_new['source'] == 'non-db' && $data_new['type'] != 'link' && isset($data['link'])) {
                                 $data_new['type'] = 'link';
                                 $data_new['relationship'] = $data['link'];
                             }
                             $data = $data_new;
                         }
                         if ($data['type'] == 'link' && $data['source'] == 'non-db') {
                             $new_field_module = new $beanList[getRelatedModule($condition_module->module_dir, $data['relationship'])]();
                             $table_alias = $data['relationship'];
                             $query = $this->build_report_query_join($data['relationship'], $table_alias, $oldAlias, $condition_module, 'relationship', $query, $new_field_module);
                             $condition_module = $new_field_module;
                             $condition->field = 'id';
                         }
                         if (isset($data['source']) && $data['source'] == 'custom_fields') {
                             $value = $condition_module->table_name . '_cstm.' . $condition->value;
                             $query = $this->build_report_query_join($condition_module->table_name . '_cstm', $table_alias . '_cstm', $table_alias, $condition_module, 'custom', $query);
                         } else {
                             $value = ($table_alias ? "`{$table_alias}`" : $condition_module->table_name) . '.' . $condition->value;
                         }
                         break;
//.........这里部分代码省略.........
开发者ID:auf,项目名称:crm_auf_org,代码行数:101,代码来源:AOR_Report.php

示例7: parse_template

 function parse_template(SugarBean $bean, &$template, $object_override = array())
 {
     global $sugar_config;
     require_once 'modules/AOW_Actions/actions/templateParser.php';
     $object_arr[$bean->module_dir] = $bean->id;
     foreach ($bean->field_defs as $bean_arr) {
         if ($bean_arr['type'] == 'relate') {
             if (isset($bean_arr['module']) && $bean_arr['module'] != '' && isset($bean_arr['id_name']) && $bean_arr['id_name'] != '' && $bean_arr['module'] != 'EmailAddress') {
                 $idName = $bean_arr['id_name'];
                 if (isset($bean->field_defs[$idName]) && $bean->field_defs[$idName]['source'] != 'non-db') {
                     if (!isset($object_arr[$bean_arr['module']])) {
                         $object_arr[$bean_arr['module']] = $bean->{$idName};
                     }
                 }
             }
         } else {
             if ($bean_arr['type'] == 'link') {
                 if (!isset($bean_arr['module']) || $bean_arr['module'] == '') {
                     $bean_arr['module'] = getRelatedModule($bean->module_dir, $bean_arr['name']);
                 }
                 if (isset($bean_arr['module']) && $bean_arr['module'] != '' && !isset($object_arr[$bean_arr['module']]) && $bean_arr['module'] != 'EmailAddress') {
                     $linkedBeans = $bean->get_linked_beans($bean_arr['name'], $bean_arr['module'], array(), 0, 1);
                     if ($linkedBeans) {
                         $linkedBean = $linkedBeans[0];
                         if (!isset($object_arr[$linkedBean->module_dir])) {
                             $object_arr[$linkedBean->module_dir] = $linkedBean->id;
                         }
                     }
                 }
             }
         }
     }
     $object_arr['Users'] = is_a($bean, 'User') ? $bean->id : $bean->assigned_user_id;
     $object_arr = array_merge($object_arr, $object_override);
     $parsedSiteUrl = parse_url($sugar_config['site_url']);
     $host = $parsedSiteUrl['host'];
     if (!isset($parsedSiteUrl['port'])) {
         $parsedSiteUrl['port'] = 80;
     }
     $port = $parsedSiteUrl['port'] != 80 ? ":" . $parsedSiteUrl['port'] : '';
     $path = !empty($parsedSiteUrl['path']) ? $parsedSiteUrl['path'] : "";
     $cleanUrl = "{$parsedSiteUrl['scheme']}://{$host}{$port}{$path}";
     $url = $cleanUrl . "/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}";
     $template->subject = str_replace("\$contact_user", "\$user", $template->subject);
     $template->body_html = str_replace("\$contact_user", "\$user", $template->body_html);
     $template->body = str_replace("\$contact_user", "\$user", $template->body);
     $template->subject = aowTemplateParser::parse_template($template->subject, $object_arr);
     $template->body_html = aowTemplateParser::parse_template($template->body_html, $object_arr);
     $template->body_html = str_replace("\$url", $url, $template->body_html);
     $template->body = aowTemplateParser::parse_template($template->body, $object_arr);
     $template->body = str_replace("\$url", $url, $template->body);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:52,代码来源:actionSendEmail.php

示例8: build_flow_query_where

 function build_flow_query_where($query = array())
 {
     global $beanList, $app_list_strings, $sugar_config, $timedate;
     if ($beanList[$this->flow_module]) {
         $module = new $beanList[$this->flow_module]();
         $sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '" . $this->id . "' AND deleted = 0 ORDER BY condition_order ASC";
         $result = $this->db->query($sql);
         while ($row = $this->db->fetchByAssoc($result)) {
             $condition = new AOW_Condition();
             $condition->retrieve($row['id']);
             $path = unserialize(base64_decode($condition->module_path));
             $condition_module = $module;
             $table_alias = $condition_module->table_name;
             if (isset($path[0]) && $path[0] != $module->module_dir) {
                 foreach ($path as $rel) {
                     $query = $this->build_flow_query_join($rel, $condition_module, 'relationship', $query);
                     $condition_module = new $beanList[getRelatedModule($condition_module->module_dir, $rel)]();
                     $table_alias = $rel;
                 }
             }
             if (isset($app_list_strings['aow_sql_operator_list'][$condition->operator])) {
                 $where_set = false;
                 $data = $condition_module->field_defs[$condition->field];
                 if ($data['type'] == 'relate' && isset($data['id_name'])) {
                     $condition->field = $data['id_name'];
                 }
                 if (isset($data['source']) && $data['source'] == 'custom_fields') {
                     $field = $table_alias . '_cstm.' . $condition->field;
                     $query = $this->build_flow_query_join($table_alias . '_cstm', $condition_module, 'custom', $query);
                 } else {
                     $field = $table_alias . '.' . $condition->field;
                 }
                 switch ($condition->value_type) {
                     case 'Field':
                         $data = $module->field_defs[$condition->value];
                         if ($data['type'] == 'relate' && isset($data['id_name'])) {
                             $condition->value = $data['id_name'];
                         }
                         if (isset($data['source']) && $data['source'] == 'custom_fields') {
                             $value = $module->table_name . '_cstm.' . $condition->value;
                             $query = $this->build_flow_query_join($module->table_name . '_cstm', $module, 'custom', $query);
                         } else {
                             $value = $module->table_name . '.' . $condition->value;
                         }
                         break;
                     case 'Any_Change':
                         //can't detect in scheduler so return
                         return array();
                     case 'Date':
                         $params = unserialize(base64_decode($condition->value));
                         if ($params[0] == 'now') {
                             if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
                                 $value = 'GetUTCDate()';
                             } else {
                                 $value = 'UTC_TIMESTAMP()';
                             }
                         } else {
                             $data = $module->field_defs[$params[0]];
                             if (isset($data['source']) && $data['source'] == 'custom_fields') {
                                 $value = $module->table_name . '_cstm.' . $params[0];
                                 $query = $this->build_flow_query_join($module->table_name . '_cstm', $module, 'custom', $query);
                             } else {
                                 $value = $module->table_name . '.' . $params[0];
                             }
                         }
                         if ($params[1] != 'now') {
                             switch ($params[3]) {
                                 case 'business_hours':
                                     if (file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php') && $params[0] == 'now') {
                                         require_once 'modules/AOBH_BusinessHours/AOBH_BusinessHours.php';
                                         $businessHours = new AOBH_BusinessHours();
                                         $amount = $params[2];
                                         if ($params[1] != "plus") {
                                             $amount = 0 - $amount;
                                         }
                                         $value = $businessHours->addBusinessHours($amount);
                                         $value = "'" . $timedate->asDb($value) . "'";
                                         break;
                                     }
                                     //No business hours module found - fall through.
                                     $params[3] = 'hour';
                                 default:
                                     if ($sugar_config['dbconfig']['db_type'] == 'mssql') {
                                         $value = "DATEADD(" . $params[3] . ",  " . $app_list_strings['aow_date_operator'][$params[1]] . " {$params['2']}, {$value})";
                                     } else {
                                         $value = "DATE_ADD({$value}, INTERVAL " . $app_list_strings['aow_date_operator'][$params[1]] . " {$params['2']} " . $params[3] . ")";
                                     }
                                     break;
                             }
                         }
                         break;
                     case 'Multi':
                         $sep = ' AND ';
                         if ($condition->operator == 'Equal_To') {
                             $sep = ' OR ';
                         }
                         $multi_values = unencodeMultienum($condition->value);
                         if (!empty($multi_values)) {
                             $value = '(';
                             if ($data['type'] == 'multienum') {
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:101,代码来源:AOW_WorkFlow.php

示例9: display_condition_lines

/**
 * Advanced OpenWorkflow, Automating SugarCRM.
 * @package Advanced OpenWorkflow for SugarCRM
 * @copyright SalesAgility Ltd http://www.salesagility.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
 * along with this program; if not, see http://www.gnu.org/licenses
 * or write to the Free Software Foundation,Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301  USA
 *
 * @author SalesAgility <info@salesagility.com>
 */
function display_condition_lines($focus, $field, $value, $view)
{
    global $locale, $app_list_strings, $mod_strings;
    $html = '';
    if (!is_file('cache/jsLanguage/AOW_Conditions/' . $GLOBALS['current_language'] . '.js')) {
        require_once 'include/language/jsLanguage.php';
        jsLanguage::createModuleStringsCache('AOW_Conditions', $GLOBALS['current_language']);
    }
    $html .= '<script src="cache/jsLanguage/AOW_Conditions/' . $GLOBALS['current_language'] . '.js"></script>';
    if ($view == 'EditView') {
        $html .= '<script src="modules/AOW_Conditions/conditionLines.js"></script>';
        $html .= "<table border='0' cellspacing='4' width='100%' id='conditionLines'></table>";
        $html .= "<div style='padding-top: 10px; padding-bottom:10px;'>";
        $html .= "<input type=\"button\" tabindex=\"116\" class=\"button\" value=\"" . $mod_strings['LBL_ADD_CONDITION'] . "\" id=\"btn_ConditionLine\" onclick=\"insertConditionLine()\" disabled/>";
        $html .= "</div>";
        if (isset($focus->flow_module) && $focus->flow_module != '') {
            require_once "modules/AOW_WorkFlow/aow_utils.php";
            $html .= "<script>";
            $html .= "flow_rel_modules = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($focus->flow_module))) . "\";";
            $html .= "flow_module = \"" . $focus->flow_module . "\";";
            $html .= "document.getElementById('btn_ConditionLine').disabled = '';";
            if ($focus->id != '') {
                $sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '" . $focus->id . "' AND deleted = 0 ORDER BY condition_order ASC";
                $result = $focus->db->query($sql);
                while ($row = $focus->db->fetchByAssoc($result)) {
                    $condition_name = new AOW_Condition();
                    $condition_name->retrieve($row['id']);
                    $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
                    if ($condition_name->module_path == '') {
                        $condition_name->module_path = $focus->flow_module;
                    }
                    $html .= "flow_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields(getRelatedModule($focus->flow_module, $condition_name->module_path[0])))) . "\";";
                    if ($condition_name->value_type == 'Date') {
                        $condition_name->value = unserialize(base64_decode($condition_name->value));
                    }
                    $condition_item = json_encode($condition_name->toArray());
                    $html .= "loadConditionLine(" . $condition_item . ");";
                }
            }
            $html .= "flow_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields($focus->flow_module))) . "\";";
            $html .= "</script>";
        }
    } else {
        if ($view == 'DetailView') {
            $html .= '<script src="modules/AOW_Conditions/conditionLines.js"></script>';
            $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>";
            if (isset($focus->flow_module) && $focus->flow_module != '') {
                require_once "modules/AOW_WorkFlow/aow_utils.php";
                $html .= "<script>";
                $html .= "flow_rel_modules = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($focus->flow_module))) . "\";";
                $html .= "flow_module = \"" . $focus->flow_module . "\";";
                $sql = "SELECT id FROM aow_conditions WHERE aow_workflow_id = '" . $focus->id . "' AND deleted = 0 ORDER BY condition_order ASC";
                $result = $focus->db->query($sql);
                while ($row = $focus->db->fetchByAssoc($result)) {
                    $condition_name = new AOW_Condition();
                    $condition_name->retrieve($row['id']);
                    $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
                    if (empty($condition_name->module_path)) {
                        $condition_name->module_path[0] = $focus->flow_module;
                    }
                    $html .= "flow_fields = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields(getRelatedModule($focus->flow_module, $condition_name->module_path[0])))) . "\";";
                    if ($condition_name->value_type == 'Date') {
                        $condition_name->value = unserialize(base64_decode($condition_name->value));
                    }
                    $condition_item = json_encode($condition_name->toArray());
                    $html .= "loadConditionLine(" . $condition_item . ");";
                }
                $html .= "</script>";
            }
        }
    }
    return $html;
}
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:95,代码来源:conditionLines.php

示例10: build_query_where

    function build_query_where(AOW_Condition $condition, $module, $query = array()){
        global $beanList, $app_list_strings, $sugar_config, $timedate;
        $path = unserialize(base64_decode($condition->module_path));

        $condition_module = $module;
        $table_alias = $condition_module->table_name;
        if(isset($path[0]) && $path[0] != $module->module_dir){
            foreach($path as $rel){
                $query = $this->build_flow_query_join($rel, $condition_module, 'relationship', $query);
                $condition_module = new $beanList[getRelatedModule($condition_module->module_dir,$rel)];
                $table_alias = $rel;
            }
        }

        if(isset($app_list_strings['aow_sql_operator_list'][$condition->operator])){
            $where_set = false;

            $data = $condition_module->field_defs[$condition->field];

            if($data['type'] == 'relate' && isset($data['id_name'])) {
                $condition->field = $data['id_name'];
            }
            if(  (isset($data['source']) && $data['source'] == 'custom_fields')) {
                $field = $table_alias.'_cstm.'.$condition->field;
                $query = $this->build_flow_query_join($table_alias.'_cstm', $condition_module, 'custom', $query);
            } else {
                $field = $table_alias.'.'.$condition->field;
            }

            if($condition->operator == 'is_null'){
                $query['where'][] = '('.$field.' '.$app_list_strings['aow_sql_operator_list'][$condition->operator].' OR '.$field.' '.$app_list_strings['aow_sql_operator_list']['Equal_To']." '')";
                return $query;
            }

            switch($condition->value_type) {
                case 'Field':
                    $data = $module->field_defs[$condition->value];

                    if($data['type'] == 'relate' && isset($data['id_name'])) {
                        $condition->value = $data['id_name'];
                    }
                    if(  (isset($data['source']) && $data['source'] == 'custom_fields')) {
                        $value = $module->table_name.'_cstm.'.$condition->value;
                        $query = $this->build_flow_query_join($module->table_name.'_cstm', $module, 'custom', $query);
                    } else {
                        $value = $module->table_name.'.'.$condition->value;
                    }
                    break;
                case 'Any_Change':
                    //can't detect in scheduler so return
                    return array();
                case 'Date':
                    $params =  unserialize(base64_decode($condition->value));
                    if($params[0] == 'now'){
                        if($sugar_config['dbconfig']['db_type'] == 'mssql'){
                            $value  = 'GetUTCDate()';
                        } else {
                            $value = 'UTC_TIMESTAMP()';
                        }
                    } else if($params[0] == 'today'){
                        if($sugar_config['dbconfig']['db_type'] == 'mssql'){
                            //$field =
                            $value  = 'CAST(GETDATE() AS DATE)';
                        } else {
                            $field = 'DATE('.$field.')';
                            $value = 'Curdate()';
                        }
                    } else {
                        $data = $module->field_defs[$params[0]];
                        if(  (isset($data['source']) && $data['source'] == 'custom_fields')) {
                            $value = $module->table_name.'_cstm.'.$params[0];
                            $query = $this->build_flow_query_join($module->table_name.'_cstm', $module, 'custom', $query);
                        } else {
                            $value = $module->table_name.'.'.$params[0];
                        }
                    }

                    if($params[1] != 'now'){
                        switch($params[3]) {
                            case 'business_hours';
                                if(file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php') && $params[0] == 'now'){
                                    require_once('modules/AOBH_BusinessHours/AOBH_BusinessHours.php');

                                    $businessHours = new AOBH_BusinessHours();

                                    $amount = $params[2];

                                    if($params[1] != "plus"){
                                        $amount = 0-$amount;
                                    }
                                    $value = $businessHours->addBusinessHours($amount);
                                    $value = "'".$timedate->asDb( $value )."'";
                                    break;
                                }
                                //No business hours module found - fall through.
                                $params[3] = 'hour';
                            default:
                                if($sugar_config['dbconfig']['db_type'] == 'mssql'){
                                    $value = "DATEADD(".$params[3].",  ".$app_list_strings['aow_date_operator'][$params[1]]." $params[2], $value)";
                                } else {
//.........这里部分代码省略.........
开发者ID:Brother-Simon,项目名称:SuiteCRM,代码行数:101,代码来源:AOW_WorkFlow.php

示例11: getDisplayForField

 public function getDisplayForField($modulePath, $field, $reportModule)
 {
     $modulePathDisplay = array();
     $currentBean = BeanFactory::getBean($reportModule);
     $modulePathDisplay[] = $currentBean->module_name;
     if (is_array($modulePath)) {
         $split = $modulePath;
     } else {
         $split = explode(':', $modulePath);
     }
     if ($split && $split[0] == $currentBean->module_dir) {
         array_shift($split);
     }
     foreach ($split as $relName) {
         if (empty($relName)) {
             continue;
         }
         if (!empty($currentBean->field_name_map[$relName]['vname'])) {
             $moduleLabel = trim(translate($currentBean->field_name_map[$relName]['vname'], $currentBean->module_dir), ':');
         }
         $thisModule = getRelatedModule($currentBean->module_dir, $relName);
         $currentBean = BeanFactory::getBean($thisModule);
         if (!empty($moduleLabel)) {
             $modulePathDisplay[] = $moduleLabel;
         } else {
             $modulePathDisplay[] = $currentBean->module_name;
         }
     }
     $fieldDisplay = $currentBean->field_name_map[$field]['type'];
     return $fieldDisplay;
 }
开发者ID:switcode,项目名称:SuiteCRM,代码行数:31,代码来源:view.edit.php

示例12: run_action

 function run_action(SugarBean $bean, $params = array(), $in_save = false)
 {
     global $sugar_config, $beanList;
     include_once 'modules/EmailTemplates/EmailTemplate.php';
     require_once 'modules/AOW_Actions/actions/templateParser.php';
     $emailTemp = new EmailTemplate();
     $emailTemp->retrieve($params['email_template']);
     if ($emailTemp->id == '') {
         return false;
     }
     $object_arr[$bean->module_dir] = $bean->id;
     foreach ($bean->field_defs as $bean_arr) {
         if ($bean_arr['type'] == 'relate') {
             if (isset($bean_arr['module']) && $bean_arr['module'] != '' && isset($bean_arr['id_name']) && $bean_arr['id_name'] != '' && $bean_arr['module'] != 'EmailAddress') {
                 $relate_bean = new $beanList[$bean_arr['module']]();
                 if (!isset($object_arr[$relate_bean->module_dir])) {
                     $object_arr[$relate_bean->module_dir] = $bean->{$bean_arr}['id_name'];
                 }
             }
         } else {
             if ($bean_arr['type'] == 'link') {
                 if (!isset($bean_arr['module']) || $bean_arr['module'] == '') {
                     $bean_arr['module'] = getRelatedModule($bean->module_dir, $bean_arr['name']);
                 }
                 if (isset($bean_arr['module']) && $bean_arr['module'] != '' && !isset($object_arr[$bean_arr['module']]) && $bean_arr['module'] != 'EmailAddress') {
                     $linkedBeans = $bean->get_linked_beans($bean_arr['name'], $bean_arr['module']);
                     if ($linkedBeans) {
                         $linkedBean = $linkedBeans[0];
                         if (!isset($object_arr[$linkedBean->module_dir])) {
                             $object_arr[$linkedBean->module_dir] = $linkedBean->id;
                         }
                     }
                 }
             }
         }
     }
     $object_arr['Users'] = $bean->assigned_user_id;
     $parsedSiteUrl = parse_url($sugar_config['site_url']);
     $host = $parsedSiteUrl['host'];
     if (!isset($parsedSiteUrl['port'])) {
         $parsedSiteUrl['port'] = 80;
     }
     $port = $parsedSiteUrl['port'] != 80 ? ":" . $parsedSiteUrl['port'] : '';
     $path = !empty($parsedSiteUrl['path']) ? $parsedSiteUrl['path'] : "";
     $cleanUrl = "{$parsedSiteUrl['scheme']}://{$host}{$port}{$path}";
     $url = $cleanUrl . "/index.php?module={$bean->module_dir}&action=DetailView&record={$bean->id}";
     $subject = str_replace("\$contact_user", "\$user", $emailTemp->subject);
     $body_html = str_replace("\$contact_user", "\$user", $emailTemp->body_html);
     $body_plain = str_replace("\$contact_user", "\$user", $emailTemp->body);
     $subject = aowTemplateParser::parse_template($subject, $object_arr);
     $body_html = aowTemplateParser::parse_template($body_html, $object_arr);
     $body_html = str_replace("\$url", $url, $body_html);
     $body_plain = aowTemplateParser::parse_template($body_plain, $object_arr);
     $body_plain = str_replace("\$url", $url, $body_plain);
     $emails = $this->getEmailsFromParams($bean, $params);
     return $this->sendEmail($emails['to'], $subject, $body_html, $body_plain, $bean, $emails['cc'], $emails['bcc']);
 }
开发者ID:omusico,项目名称:SelkirkCRM,代码行数:57,代码来源:actionSendEmail.php


注:本文中的getRelatedModule函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。