I am adding a different layout for Created By in view change log screen with fields (name, date_entered, created_by_name). Also changing layout for this screen. However, Its not working.
Steps followed:
Copy the Audit module from {dir_name}/modules and paste it in {dir_name}/custom/modules
Made the necessary changes and its not working
Later, I removed other files and keep the necessary files (english folder, Popup_picker.html, Popup_picker.php). Still, its not working.
You shouldn’t try to copy entire modules into custom directory, that surely won’t work.
Copy just one file you need to customize. It will be combined with the others. Note that not all files are customizable, so you need to check if your changed version is getting picked up after a Quick Repair and Rebuild.
Not all files in SuiteCRM are customizable in an upgrade-safe manner. The “custom” directory scheme is not universal.
You can look for the place where those files are being included, or required, and see if it is looking in the custom directory for possible replacements.
You can see a PR I made a while ago trying to make a module more customizable, this will give you an idea of what I mean:
Sry, I am not getting it. When I used get_custom_file_if_exists then its returning same path which I mentioned inside it. If I add custom folder and file not existing in custom folder then its not throwing error even.
Go to any screen… I mean lead, policy, invoice etc and click the detail view or edit view of any Invoice, Lead, Policy etc. Then, there is a button to check the change log “View Change Log”. Click it and it will show a popup window with change log history.
I have one question. Is this file is used for only Audit module popup or its used for other popups also?
I guess I need to put condition module wise…
It’s used in most other modules. But you don’t have to put any condition, it will only use a custom file if there is a custom file in custom/MODULE_NAME/Popup_picker.php, so nothing will happen for the other modules, since there is on custom file there.
Note that this change is not upgrade safe either. It’s just a confirmation of where this could/should be changed in the core code.
Hey @pgr, I know this is an old thread, but it’s almost exactly what I’m trying to do. I’ve created a custom history panel that pulls in actvities from all modules realted to the account. I’ve also managed to get the sort and the filter working on this custom history subpanel. My stumbling block that I’ve been stuck on for like a week is the summary button. I first tried to copy the Popup_picker.php to Activities and then mod it to change the query. I just can’t get it to run in the custom folder.
So I went with trying to make custom sugarwidget, an entry point, and then trying to call it in the popup. I’ve been going around in circles trying to construct the URL properly and I just can’t get it to work.
It would be so simple if I could get a custom Popup_picker.php to run. It appears that’s what this thread is about. I have a couple fo questions:
Does the fix you came up with (already applied a long time ago) apply to all modules, or only the Audit module?
If I want my custom Popup_picker.php to run, should I be putting it in /custom/Activities OR /custom/Accounts? (I want it to run for the history subpanel in the accconts module).
Thanks @pgr, I finally did get my Sugarwidget → entrypoint → popup_picker.php working. I was stuck on the URL construction for the popup but finally got it working. I now have my custom popup_picker.php running. So now the next challenge is to customize the output! Having just a custom/Popup_picker.php working would have been so much more convenient!
Thanks @pgr I think I’m good. I created a copy of Popup_picker.php in custom/Activities/ expecting it to get picked up when the “summary” was clicked in history. I couldn’t get this file to get picked up over the default file and I really wanted to make changes to Popup_picker.php upgrade safe.
So what I ended up doing was created a custom SugarWidget that points to a custom entry point which points to my custom Popup_Picker.php which opens inside the popup.
FINALLY got it working, I was having trouble just getting the final URL constructed properly so the popup worked. Here’s what I ended up with for the SugarWidget:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButton.php');
class SugarWidgetSubPanelTopCustomSummaryButton extends SugarWidgetSubPanelTopButton
{
public function display($defines, $additionalFormFields = null, $nonbutton = false)
{
global $app_strings;
global $currentModule;
$title = $app_strings['LBL_CUSTOM_SUMMARY_BUTTON_TITLE'] ?? 'View Custom Summary';
$value = $app_strings['LBL_CUSTOM_SUMMARY_BUTTON_LABEL'] ?? 'View Summary';
$id = $defines['focus']->id;
$custom_endpoint = "&entryPoint=customPopupPicker&record=$id&module_name=$currentModule";
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(),
);
// Ensure the array is properly converted to a JSON string for JavaScript consumption
$json_encoded_php_array = htmlspecialchars(json_encode($popup_request_data), ENT_QUOTES, 'UTF-8');
// Check ACL to disable button if user doesn't have access
if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'detail', true)) {
return '<input disabled type="button" class="button" title="' . $title . '" value="' . $value . '" />';
}
// Return HTML for the button, properly forming the onclick event with JSON data
return '<input type="button" class="button" title="' . $title . '" value="' . $value . '" onclick="open_popup(\'Activities\', 600, 400, \'' . $custom_endpoint . '\', true, false, ' . $json_encoded_php_array . '); return false;" />';
}
}