When you try to open a subpanel introduced using a custom layour def the subpanel first loads empty. Once you reload the page mantaining the subpanel opened the data loads correctly. The same occurs when you try to order the subpanel by some column.
Expected Behavior
When opening/ordering the subpanel the data should load the same way as the other subpanels in the CRM
Actual Behavior
Since the record is not retrieved on the bean you can't acceed the id in the _focus on the layout defs you can't run the custom query properly.
This makes the subpanel load empty.
Possible Fix
In include/SubPanel/SubPanelViewer.php around line 86 changing
$bean = BeanFactory::getBean($module);
for
$bean = BeanFactory::getBean($module, $record);
This will retrieve the current record in the bean which will allow the custom subpanel layout_def to acceed the id in $this->_focus.
Steps to Reproduce
Create a custom layout_def subpanel that loads data using a function and makes use of $this->_focus->id as a function parameter. For example
I was implementing a custom subpanel that shows some employee holidays and I needed to show only the future holidays so i needed to filter the ones that already happened.
In most cases the default relationships that you can build with studio/module builder are enough. I think the times a custom subpanel is needed are low. I'll mark this as a medium issue.
Your Environment
SuiteCRM Version used: 7.14.2
Browser name and version: Chrome Version 122.0.6261.57
Environment name and version: PHP 8.1. MySQL 8.0.30
Issue
When you try to open a subpanel introduced using a custom layour def the subpanel first loads empty. Once you reload the page mantaining the subpanel opened the data loads correctly. The same occurs when you try to order the subpanel by some column.
Expected Behavior
When opening/ordering the subpanel the data should load the same way as the other subpanels in the CRM
Actual Behavior
Since the record is not retrieved on the bean you can't acceed the id in the _focus on the layout defs you can't run the custom query properly. This makes the subpanel load empty.
Possible Fix
In include/SubPanel/SubPanelViewer.php around line 86 changing
for
This will retrieve the current record in the bean which will allow the custom subpanel layout_def to acceed the id in $this->_focus.
Steps to Reproduce
Context
I was implementing a custom subpanel that shows some employee holidays and I needed to show only the future holidays so i needed to filter the ones that already happened.
In most cases the default relationships that you can build with studio/module builder are enough. I think the times a custom subpanel is needed are low. I'll mark this as a medium issue.
Your Environment