Where do I override the create_export_query for a custom module?

橙三吉。 提交于 2019-12-25 07:50:07

问题


I am working with SugarCRM.

I have a custom module, I am trying to override the export method to not include all of the columns. I actually need to make the columns dependent on the visible columns in the list view (that I can figure out).

I have been going through all the files in SugarCRM, I notice that the built in modules have a Module.php file, where there is a 'SELECT Module.*' for the export method. I cannot find a file like that for my custom module. I am asking for help on where do I create (if needed) or where can I find the file to customize the create_export_query.


回答1:


create_export_query is a method in SugarBean (/data/SugarBean.php is the base class for nearly all SugarCRM objects) and can be overriden in the bean's core class file. So if you have custom module MyModule you can find the core class in /modules/MyModule/MyModule.php

There is likely not a create_export_query() method there currently, so you can write one in. It'll look something like this:

<?php
require_once("include/SugarObjects/templates/basic/Basic.php");
class MyModule extends Basic{

  public function MyModule(){
    parent::Basic();
  }

  public function create_export_query(&$order_by, &$where, $relate_link_join=''){
    $query = " select * from {$this->table_name} "; // build your query string however you like
    return $query;
  }
}


来源:https://stackoverflow.com/questions/21919229/where-do-i-override-the-create-export-query-for-a-custom-module

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!