by Izertis

Create documents in docx, xlsx (MS Office Word and Excel), odt, ods (LibreOffice and OpenOffice) and pdf format without MS Office or others plugins installed from any module and subpanel using templates.

Includes a 30 day guarantee
Try it Now

By clicking you consent to share your profile with the developer

#917 - Sort subpanel records in Generated document - can't make it work

Closed Bug? created by kir 7 years ago

Hi MMR is updated to 2.4 but no success on sorting subpanel records in generated Document Used code from example from opportunities, changed query_table and field_name in SQL statement ORDER BY also changed opportunities into my child module_name kir_deal_items File is placed in custom/main_module_folder wich is kir_kp No success it never goes inside condition if (isset($main_data['kir_deal_items']) && is_array($main_data['kir_deal_items']) && count($main_data['kir_deal_items']) > 1 ) Any suggestions?

  1. dharma member avatar

    Izertis Provider

    7 years ago

    Note: this question continues from case This question also was answered in this case

    We assume that the question is coming from this example . $main_data variable don't exists in the MMR code. To use something like that you need to get that value first. Check it in the example the previous code to use (... foreach ($this->Generate_Document_Instance->datos as $main_key => $main_data) ...)

    Check the class name used for the Calculated Fields file, and remember to add require_once('modules/DHA_PlantillasDocumentos/DHA_DocumentTemplatesCalculatedFields_base.php') before declare class name. If needed, debug this problem in function GetCalculatedFieldsClass (in \modules\DHA_PlantillasDocumentos\Generate_Document.php) to get where is the problem. This function is responsible to get the instance of the calculated fields class.

  2. kir member avatar


    7 years ago

    Sure code was used from example in opportunity In previous conversation i wrote names of my modules and pasted code. You confirmed that code is right. But it was not working. I solved the problem by my own and it was: $main_data['kir_deal_items'] - here we should place name of relationship not module name in the array's index so code must be $main_data['kir_deal_items_kir_kp'] (in my case). In core sugarcrm files names of relationship is generally the same as module name, so hard to figure out without documented example's code where to use module_name and where relationship_name. It would be nice to have descriptions in code in english (variables naming also would be greate). Now it works :)


  3. rdouglas member avatar


    6 years ago

    Hey KIR, is there any chance you could post your full solution code/placement etc? Thanks for any assistance you can give

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
  • "The single biggest downfall of the community edition of SugarCRM or SuiteCRM is the lack of creating a report form a custom module for a single event...." - ian

    Read More Reviews