I also had similar problems with the subpanel not refreshing. I resolved it but I'm not sure if it's the same problem. Here is some info on the subject:
Subpanel refresh bug
Some subpanels in modules have a select button with which a user can open popup, select a record from the popup and the record is immediately added to the list of the records in the subpanel. It was noticed that certain subpanels failed to immediately refresh data after the associated record was selected.
An example definition of the subpanel for which the data wasn't refreshed, defined in custom/modules/Contacts/Ext/Layoutdefs/layoutdefs.ext.php
PHP Code:
'diff_users' => array(
'order' => 150,
'module' => 'Users',
'sort_order' => 'desc',
'sort_by' => 'user_name',
'get_subpanel_data'=>'diff_users',
'subpanel_name' => 'default',
'title_key' => 'LBL_DIFF_USERS_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopSelectButton',
'popup_module' => 'Users',
'mode' => 'MultiSelect',
),
),
),
SubPanelTopSelectButton is defined in /include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php
PHP Code:
$popup_request_data = array(
'call_back_function' => 'set_return_and_save_background',
'form_name' => 'DetailView',
'field_to_name_array' => $fton_array,
'passthru_data' => array(
'child_field' => $subpanel_name,
'return_url' => urlencode($return_url),
'link_field_name' => $link_field_name,
'module_name' => $subpanel_name, //this line is the problem
'refresh_page'=>$refresh_page,
),
);
When Select is pressed on the subpanel form, this request data is forwarded to the popup window. When the record is selected, the popup window is closed, some of the requested data is forwarded to "http_fetch_sync" function in a form of URL which is located in set_return_and_save_background() function in /include/Subpanel/SubPanelTiles.js "http_fetch_sync" function returns a piece of html code which is then dynamically put into the associated subpanel.
PHP Code:
//include/Subpanel/SubPanelTiles.js
//function set_return_and_save_background(popup_reply_data)
...
...
var returnstuff = http_fetch_sync('index.php',query_string);
request_id++;
got_data(returnstuff, true);
if(refresh_page == 1){
document.location.reload(true);
}
The problem is that 'module_name' in $popup_request_data in SugarWidgetSubPanelTopSelectButton.php is set to $subpanel_name which is just a regular module name (i.e. 'users'). Since the name of the panel in the example is 'diff_users', the returned html code is never put to the right place.
===Solution===
The solution is to set 'module_name' to 'link_field_name' which is in our case 'diff_users'.
SubPanelTopSelectButton is defined in /include/generic/SugarWidgets/SugarWidgetSubPanelTopSelectButton.php
PHP Code:
$popup_request_data = array(
'call_back_function' => 'set_return_and_save_background',
'form_name' => 'DetailView',
'field_to_name_array' => $fton_array,
'passthru_data' => array(
'child_field' => $subpanel_name,
'return_url' => urlencode($return_url),
'link_field_name' => $link_field_name,
//'module_name' => $subpanel_name, //this line is the problem
'module_name' => $link_field_name,
'refresh_page'=>$refresh_page,
),
);
I hope it helps.
Bookmarks