Beispiel #1
0
    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>&nbsp;&nbsp;';
        $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;
    }
Beispiel #2
0
 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>&nbsp;&nbsp;';
     $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") . ':&nbsp;&nbsp;';
     $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;
 }
Beispiel #3
0
/**
 * 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;
}
Beispiel #4
0
function getRelModuleFields($module, $rel_field, $view = 'EditView', $value = '')
{
    global $beanList;
    if ($module == $rel_field) {
        return getModuleFields($module, $view, $value);
    }
    $mod = new $beanList[$module]();
    $data = $mod->field_defs[$rel_field];
    if (isset($data['module']) && $data['module'] != '') {
        return getModuleFields($data['module'], $view, $value);
    }
}
Beispiel #5
0
 protected function action_getRelFieldTypeSet()
 {
     $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) . "</select>";
             } else {
                 echo getModuleFields($module, $view, $value);
             }
             break;
         case 'Value':
         default:
             echo getModuleField($module, $fieldname, $aow_field, $view, $value);
             break;
     }
     die;
 }
Beispiel #6
0
 public function &render($hookFunction=false)
 {
     //$data_item_type_id=100;
     $arrModule=getModules();
     $arrRender=array();
     foreach($arrModule as $data_item_type_id=>$moduleData)
     {
         $arrFieldRecord=getModuleFields($data_item_type_id,true);
         
         $arrRenderSerialize=array();
         /**
          * build sequence array
          */
         $arrFieldSeq=array();
         foreach($arrFieldRecord as $ind=>$fieldData)
         {
             $sequence=isset($fieldData["sequence"])?$fieldData["sequence"]:0;
             $arrFieldSeq[$sequence][]=$fieldData;
         }
         ksort($arrFieldSeq, SORT_NUMERIC);//trace($arrFieldSeq,2);
                 //trace($arrFieldSeq);
         foreach($arrFieldSeq as $sequence=>$arrField)
         {
             foreach($arrField as $ind=>$fieldData)
             {
                 //if($fieldData["displaytype"]<=0) continue;
                 $fieldName=$fieldData["fieldname"];
                 /**
                  * process hook
                  */
                 $caption=getLangVar($fieldName);
                 $arrRenderSerialize[]=empty($caption)?$fieldName:$caption;
                 /**
                  * check whether calculated field or database field
                  */
                 ///if it is database field
                 if(isset($fieldData["id"]))
                 {
                     if($fieldData["displaytype"]<=0)
                     {
                         $arrRenderSerialize[]="<input type='checkbox' name='field_hide[{$fieldData["id"]}]' onclick='javascript:updateField(\"{$moduleData["module"]}\",\"{$fieldName}\",this);' />";
                     }
                     else
                     {
                         $arrRenderSerialize[]="<input type='checkbox' checked name='field_hide[{$fieldData["id"]}]' onclick='javascript:updateField(\"{$moduleData["module"]}\",\"{$fieldName}\",this);' />";
                     }
                     if($fieldData["readonly"]<=0)
                     {
                         $arrRenderSerialize[]="<input type='checkbox' name='field_readonly[{$fieldData["id"]}]' onclick='javascript:updateFieldReadonly(\"{$moduleData["module"]}\",\"{$fieldName}\",this);' />";
                     }
                     else
                     {
                         $arrRenderSerialize[]="<input type='checkbox' checked name='field_readonly[{$fieldData["id"]}]' onclick='javascript:updateFieldReadonly(\"{$moduleData["module"]}\",\"{$fieldName}\",this);' />";
                     }
                     $arrRenderSerialize[]="<a href='index.php?m=settings&modulename={$moduleData["module"]}&a=moveUp&field_id={$fieldData["id"]}'>Up</a>";
                     $arrRenderSerialize[]="<a href='index.php?m=settings&modulename={$moduleData["module"]}&a=moveDown&field_id={$fieldData["id"]}'>Down</a>";
                     if($fieldData["is_extra"]>0)
                     {
                         $arrRenderSerialize[]="<a href='index.php?m=settings&modulename={$moduleData["module"]}&a=delete&field_id={$fieldData["id"]}'>Delete</a>";
                     }
                     else
                     {
                         $arrRenderSerialize[]="-";
                     }
                 }
                 else
                 {
                     if(!isset($fieldData["displaytype"]) || $fieldData["displaytype"]<=0)
                     {
                         $arrRenderSerialize[]="<input type='checkbox' disabled />";
                     }
                     else
                     {
                         $arrRenderSerialize[]="<input type='checkbox' checked disabled />";
                     }
                     if(!isset($fieldData["readyonly"]) || $fieldData["readyonly"]<=0)
                     {
                         $arrRenderSerialize[]="<input type='checkbox' disabled />";
                     }
                     else
                     {
                         $arrRenderSerialize[]="<input type='checkbox' checked disabled />";
                     }
                     $arrRenderSerialize[]="<input type='button' value='up' disabled />";
                     $arrRenderSerialize[]="<input type='button' value='down' disabled />";
                     $arrRenderSerialize[]="<input type='button' value='delete' disabled />";
                 }
             }
         }
         $columnPrefix="col";
         $arrRenderView =  multi_dimension_array($arrRenderSerialize, 6, $columnPrefix);
         $arrRender[$data_item_type_id]=$arrRenderView;
     }
     return $arrRender;
 }
Beispiel #7
0
/**
 * 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;
}