zoukankan      html  css  js  c++  java
  • SugarCRM 一个页面控制两个模块(editview.php)

    目的:在editview中一个保存按钮,保存两个模块(两张表)
    解决方案
    :
    1.在主表模块的editview.php文件最后写
    require_once('modules/bw_Consignments/editpanels/editview.php'); //执行子表模块的editview.php文件
    2.在子表模块中新建editpanels文件夹
    将editview
    .php editview.html Forms.php 文件复制到此文件夹下
    3.修改editpanels/EditView.php文件
    (
    1) require_once('modules/bw_Consignments/language/zh_cn.lang.php');//在文件头部写此句,用于引入$mod_strings[]数组
    4.editpanels/EditView.html 可根据需求调整模板
    (
    1)去除保存 取消按钮 删除以下代码
    <input type="submit" name="button" value=" {APP.LBL_SAVE_BUTTON_LABEL} "
    class="button" tabindex="5"
    onclick
    ="this.form.action.value='Save'; return check_form('EditView');"
    title
    ="{APP.LBL_SAVE_BUTTON_TITLE}" accesskey="{APP.LBL_SAVE_BUTTON_KEY}"/>
    <input type="submit" name="button" value=" {APP.LBL_CANCEL_BUTTON_LABEL} "
    class="button" tabindex="6"
    onclick
    ="this.form.module.value='{RETURN_MODULE}'; this.form.action.value='{RETURN_ACTION}'; this.form.record.value='{RETURN_ID}';"
    title
    ="{APP.LBL_CANCEL_BUTTON_TITLE}"
    accesskey
    ="{APP.LBL_CANCEL_BUTTON_KEY}"/>
    <td align="right" nowrap><span class="required">{APP.LBL_REQUIRED_SYMBOL}</span> {APP.NTC_REQUIRED}</td>
    < td align="right">{ADMIN_EDIT}</td>
    (
    2)去除<form name="EditView" method="post" action="index.php"> </form> 因为表单这个表单不需要了
    (
    3)去除下面代码
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <input type="hidden" name="module" value="bw_Consignments" />
    <input type="hidden" name="record" value="{ID}" />
    <input type="hidden" name="action" value="" />
    <input type="hidden" name="return_module" value="{RETURN_MODULE}" />
    <input type="hidden" name="return_id" value="{RETURN_ID}" />
    <input type="hidden" name="return_action" value="{RETURN_ACTION}" />
    </tr>
    </table>
    因为这些是控制表单提交的
    ,表单已经不需要,所以这些也不用了,而且这些与主表模块冲突

    5.修改editpanels/Forms.php 文件
    function get_new_record_form 方法名修改为 get_new_record_form1
    function get_validate_record_js 方法名修改为 get_validate_record_js1
    原因
    : 因为两个模块同一页时,两个模块均调用了此方法,为了防止重名

    6.提交保存
    原理
    :将两个模块合成为一个表单一同提交,子表模块仍然由子模块执行保存.
    主表模块的save
    .php
    $return_id = $sugarbean->id; \\此句下面写
    $temp_id=$return_id;//因为$return_id已为子表模块保存的id 所以用$temp_id
    require_once('modules/bw_Consignments/Save.php');//执行子表模块Save.php
    //handleRedirect($return_id,'bw_Msg_MT3101s');//原来的,不用了

    handleRedirect($temp_id,'bw_Msg_MT3101s');//页面跳转

    注意
    : 子表保存后跳转应去掉
    SaveFormBase
    .php
    //if ($redirect) {
    // handleRedirect($return_id,"bw_Consignments" );
    //} else {
    // return $focus;
    //}
  • 相关阅读:
    Winform自定义窗体样式,实现标题栏可灵活自定义
    肿瘤转录组数分析CRN:Cancer RNA-Seq Nexus
    TCGA系列--miRNA数据分析
    TCGA系列--甲基化神器mexpress
    R:reshape2包中的melt
    TCGA系列--GDCRNATools
    R软件中排序:sort(),rank(),order()
    TCGA系列--TCGA长链非编码RNA的可视化工具TANRIC
    记一次RabbitMQ解决分布式事务问题
    RabbitMQ整合Spring Booot【死信队列】
  • 原文地址:https://www.cnblogs.com/hailexuexi/p/1953245.html
Copyright © 2011-2022 走看看