salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.27k stars 2.03k forks source link

Fix #10365: Custom subpanels not loading data until the page is reloaded #10366

Open pablonr11 opened 4 months ago

pablonr11 commented 4 months ago

This fixes a bug that makes custom subpanels that uses $this->_focus->id as a function parameter not load correctly

Description

By adding the record Id to the getBean call the data for the current record is retrieved which allows the layout_def custom function to acceed the bean data for building a custom query correctly.

Motivation and Context

This reduces the error margin when creating custom subpanels for modules. Also prevents the user need to reload the page everytime a custom subpanel is opened.

How To Test This

  1. Create a custom layout_def subpanel for any module that uses a custom subpanel to build a query with $this->_focus->id as a function parameter.
  2. Use this parameter in your query
  3. This will make the subpanel not load when opening it for the first time or when trying to order the subpanel by some column from the view.

Types of changes

Final checklist

SuiteBot commented 4 months ago

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/custom-subpanel-sorting-bug/91946/10

SuiteBot commented 2 months ago

This pull request has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/adding-records-to-history-subpanel/90101/10

pstevens71 commented 2 months ago

If I can add my 2 cents. I just tested this in my dev to fix the sorting of a custom subpanel. So far so good!