Quick Create button:
I replaced the line:
array('widget_class' => 'SubPanelTopCreateAccountNameButton'),
with:
array('widget_class' => 'SubPanelTopButtonQuickCreate'),
and now it creates an account instead of a contact.
Custom folder:
I placed the original file modules/Contacts/metadata/subpaneldefs.php (without modifications) into custom/modules/Contacts/metadata/subpaneldefs.php and then added the modifications we made.
Unfortunately this doesn’t work.
So I digged into the SuiteCRM and I found a bug in the file:
include/SubPanel/SubPanelDefinitions.php
At around line 781 there is a function called open_layout_defs. The code of this function is:
function open_layout_defs ( $reload = false , $layout_def_key = '' , $original_only = false )
{
$layout_defs [ $this->_focus->module_dir ] = array ( ) ;
$layout_defs [ $layout_def_key ] = array ( ) ;
if (empty ( $this->layout_defs ) || $reload || (! empty ( $layout_def_key ) && ! isset ( $layout_defs [ $layout_def_key ] )))
{
if (file_exists ( 'modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php' ))
require ('modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php') ;
if (! $original_only && file_exists ( 'custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php' ))
require ('custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php') ;
if (! empty ( $layout_def_key ))
$this->layout_defs = $layout_defs [ $layout_def_key ] ;
else
$this->layout_defs = $layout_defs [ $this->_focus->module_dir ] ;
}
}
As you can see it is not checking for the custom version of subpaneldefs.php, so I modified it into:
function open_layout_defs ( $reload = false , $layout_def_key = '' , $original_only = false )
{
$layout_defs [ $this->_focus->module_dir ] = array ( ) ;
$layout_defs [ $layout_def_key ] = array ( ) ;
if (empty ( $this->layout_defs ) || $reload || (! empty ( $layout_def_key ) && ! isset ( $layout_defs [ $layout_def_key ] )))
{
if (file_exists ( 'modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php' ))
require ('modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php') ;
if (file_exists ( 'custom/modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php' ))
require ('custom/modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php') ;
if (! $original_only && file_exists ( 'custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php' ))
require ('custom/modules/' . $this->_focus->module_dir . '/Ext/Layoutdefs/layoutdefs.ext.php') ;
if (! empty ( $layout_def_key ))
$this->layout_defs = $layout_defs [ $layout_def_key ] ;
else
$this->layout_defs = $layout_defs [ $this->_focus->module_dir ] ;
}
}
And now it works on any module if we place subpaneldefs.php in the custom folder.
For the sake of clarity I added the following lines after it tried to include the original subpaneldefs.php file:
if (file_exists ( 'custom/modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php' ))
require ('custom/modules/' . $this->_focus->module_dir . '/metadata/subpaneldefs.php') ;
This is a bug. When I have time I will add it in gitHub, but unfortunately I am not sure if I can test it sufficiently against potential derived issues (although I believe it should be fine as it doesn’t do anything potentially harmful.
ForAccounts.php
I haven’t had the time to check yet. I will do later. Sorry