protected function action_getModuleRelationships() { if (!empty($_REQUEST['aor_module']) && $_REQUEST['aor_module'] != '') { echo getModuleRelationships($_REQUEST['aor_module']); } die; }
function edit_display($line, SugarBean $bean = null, $params = array()) { require_once "modules/AOW_WorkFlow/aow_utils.php"; $modules = getModuleRelationships($bean->module_dir, 'EditView', $params['rel_type']); $html = "<input type='hidden' name='aow_actions_param[" . $line . "][record_type]' id='aow_actions_param_record_type" . $line . "' value='' />"; $html .= "<table border='0' cellpadding='0' cellspacing='0' width='100%'>"; $html .= "<tr>"; $html .= '<td id="name_label" scope="row" valign="top">' . translate("LBL_RECORD_TYPE", "AOW_Actions") . ':<span class="required">*</span> '; $html .= "<select name='aow_actions_param[" . $line . "][rel_type]' id='aow_actions_param_rel_type" . $line . "' onchange='show_mrModuleFields({$line});'>" . $modules . "</select></td>"; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><table id="crLine' . $line . '_table" width="100%"></table></td>'; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><input type="button" tabindex="116" class="button" value="' . translate("LBL_ADD_FIELD", "AOW_Actions") . '" id="addcrline' . $line . '" onclick="add_crLine(' . $line . ')" /></td>'; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><table id="crRelLine' . $line . '_table" width="100%"></table></td>'; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><input type="button" tabindex="116" class="button" value="' . translate("LBL_ADD_RELATIONSHIP", "AOW_Actions") . '" id="addcrrelline' . $line . '" onclick="add_crRelLine(' . $line . ')" /></td>'; $html .= "</tr>"; $html .= <<<EOS <script id ='aow_script{$line}'> function updateFlowModule(){ var mod = document.getElementById('flow_module').value; document.getElementById('aow_actions_param_record_type{$line}').value = mod; //cr_module[{$line}] = mod; //show_crModuleFields({$line}); } document.getElementById('flow_module').addEventListener("change", updateFlowModule, false); updateFlowModule({$line}); EOS; $module = getRelatedModule($bean->module_name, $params['rel_type']); $html .= "cr_module[" . $line . "] = \"" . $module . "\";"; $html .= "cr_fields[" . $line . "] = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields($module))) . "\";"; $html .= "cr_relationships[" . $line . "] = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($module))) . "\";"; if ($params && array_key_exists('field', $params)) { foreach ($params['field'] as $key => $field) { if (is_array($params['value'][$key])) { $params['value'][$key] = json_encode($params['value'][$key]); } $html .= "load_crline('" . $line . "','" . $field . "','" . str_replace(array("\r\n", "\r", "\n"), " ", $params['value'][$key]) . "','" . $params['value_type'][$key] . "');"; } } if (isset($params['rel'])) { foreach ($params['rel'] as $key => $field) { if (is_array($params['rel_value'][$key])) { $params['rel_value'][$key] = json_encode($params['rel_value'][$key]); } $html .= "load_crrelline('" . $line . "','" . $field . "','" . $params['rel_value'][$key] . "','" . $params['rel_value_type'][$key] . "');"; } } $html .= "</script>"; return $html; }
function edit_display($line, SugarBean $bean = null, $params = array()) { global $app_list_strings; $modules = $app_list_strings['aow_moduleList']; $checked = 'CHECKED'; if (isset($params['relate_to_workflow']) && !$params['relate_to_workflow']) { $checked = ''; } $html = "<table border='0' cellpadding='0' cellspacing='0' width='100%'>"; $html .= "<tr>"; $html .= '<td id="name_label" scope="row" valign="top">' . translate("LBL_RECORD_TYPE", "AOW_Actions") . ':<span class="required">*</span> '; $html .= "<select name='aow_actions_param[" . $line . "][record_type]' id='aow_actions_param_record_type" . $line . "' onchange='show_crModuleFields({$line});'>" . get_select_options_with_id($modules, $params['record_type']) . "</select></td>"; $html .= '<td id="relate_label" scope="row" valign="top">' . translate("LBL_RELATE_WORKFLOW", "AOW_Actions") . ': '; $html .= "<input type='hidden' name='aow_actions_param[" . $line . "][relate_to_workflow]' value='0' >"; $html .= "<input type='checkbox' id='aow_actions_param[" . $line . "][relate_to_workflow]' name='aow_actions_param[" . $line . "][relate_to_workflow]' value='1' {$checked}></td>"; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><table id="crLine' . $line . '_table" width="100%"></table></td>'; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><input type="button" tabindex="116" style="display:none" class="button" value="' . translate("LBL_ADD_FIELD", "AOW_Actions") . '" id="addcrline' . $line . '" onclick="add_crLine(' . $line . ')" /></td>'; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><table id="crRelLine' . $line . '_table" width="100%"></table></td>'; $html .= "</tr>"; $html .= "<tr>"; $html .= '<td colspan="4" scope="row"><input type="button" tabindex="116" style="display:none" class="button" value="' . translate("LBL_ADD_RELATIONSHIP", "AOW_Actions") . '" id="addcrrelline' . $line . '" onclick="add_crRelLine(' . $line . ')" /></td>'; $html .= "</tr>"; if (isset($params['record_type']) && $params['record_type'] != '') { require_once "modules/AOW_WorkFlow/aow_utils.php"; $html .= "<script id ='aow_script" . $line . "'>"; $html .= "cr_fields[" . $line . "] = \"" . trim(preg_replace('/\\s+/', ' ', getModuleFields($params['record_type']))) . "\";"; $html .= "cr_relationships[" . $line . "] = \"" . trim(preg_replace('/\\s+/', ' ', getModuleRelationships($params['record_type']))) . "\";"; $html .= "cr_module[" . $line . "] = \"" . $params['record_type'] . "\";"; if (isset($params['field'])) { foreach ($params['field'] as $key => $field) { if (is_array($params['value'][$key])) { $params['value'][$key] = json_encode($params['value'][$key]); } $html .= "load_crline('" . $line . "','" . $field . "','" . str_replace(array("\r\n", "\r", "\n"), " ", $params['value'][$key]) . "','" . $params['value_type'][$key] . "');"; } } if (isset($params['rel'])) { foreach ($params['rel'] as $key => $field) { if (is_array($params['rel_value'][$key])) { $params['rel_value'][$key] = json_encode($params['rel_value'][$key]); } $html .= "load_crrelline('" . $line . "','" . $field . "','" . $params['rel_value'][$key] . "','" . $params['rel_value_type'][$key] . "');"; } } $html .= "</script>"; } return $html; }
/** * 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 <*****@*****.**> */ 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; }
protected function action_getModuleRelationships() { if (!empty($_REQUEST['aow_module']) && $_REQUEST['aow_module'] != '') { if (isset($_REQUEST['rel_field']) && $_REQUEST['rel_field'] != '') { $module = getRelatedModule($_REQUEST['aow_module'], $_REQUEST['rel_field']); } else { $module = $_REQUEST['aow_module']; } echo getModuleRelationships($module); } die; }
/** * 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 <*****@*****.**> */ 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; }