Domanda

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.

È stato utile?

Soluzione

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;
  }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top