Error in subpanel custom

Hi! I created a custom subpanel and I’m getting an error in the detailed view.

Can someone who has done this before take a look and see where the error might be? Here’s my code:

custom/Extension/modules//Layoutdefs/aa_asistencias_adl_ado_adolescente_completo_1_AA_asistencias_adl.php

<?php

$layout_defs["AA_asistencias_adl"]["subpanel_setup"]['aa_asistencias_adl_ado_adolescente_completo_1'] = array (
  'order' => 100,
  'module' => 'ado_adolescente_completo',
  'subpanel_name' => 'default',
  'sort_order' => 'asc',
  'sort_by' => 'id',
  'title_key' => 'LBL_AA_ASISTENCIAS_ADL_ADO_ADOLESCENTE_COMPLETO_1_FROM_ADO_ADOLESCENTE_COMPLETO_TITLE',
  'get_subpanel_data' => 'function: getRelatedAdl',
  'function_parameters' => array(
  'import_function_file' => 'custom/modules/AA_asistencias_adl/getRelatedAdl.php',
  ),
  'top_buttons' =>
  array (
    0 =>
    array (
      'widget_class' => 'SubPanelTopButtonQuickCreate',
    ),
    1 =>
    array (
      'widget_class' => 'SubPanelTopSelectButton',
      'mode' => 'MultiSelect',
    ),
  ),
);

?>

custom/modules/AA_asistencias_adl/getRelatedAdl.php

<?php

require_once 'custom/modules/AA_asistencias_adl/BuildAdlSubpanelQueryService.php';


function getRelatedAdl($param){

  $service = new BuildAdlSubpanelQueryService();
  return $service->buildQuery($param);

}

?>

custom/modules/AA_asistencias_adl/BuildAdlSubpanelService.php

<?php

class BuildAdlSubpanelQueryService
{

    public function __construct()
    {}

    public function buildQuery($param)
    {
        global $app;
        $controller = $app->controller;
        $bean = $controller->bean;
        $query = "
            SELECT *
            FROM of12_ofertadeactividades_ado_adolescente_completo_c
            WHERE of12_oferte04evidades_ida = '$bean->of12_ofertadeactividades_id_c'";
        return $query;
    }
}

of12_ofertadeactividades_ado_adolescente_completo_c It’s a table in a relationship, and I need to retrieve only the records that are related to the record I am entering to view the detail.

Your PHP log probably contains a FATAL error telling you what is wrong.

Thank Pgr. Maybe the space behind the name of the function. Now it’s working.

1 Like