Audit module is not working in custom directory

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:

  1. Copy the Audit module from {dir_name}/modules and paste it in {dir_name}/custom/modules
  2. 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.

Any help will be appreciated.

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.

I tried to add few files in which I made the changes. Still, no luck :frowning:

Maybe this can help you understand

https://pgorod.github.io/Audit-File-Accesses/

I tried this one… Now, the English folder is working but the other two files are not working (Popup_picker.html, Popup_picker.php).

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:

https://github.com/salesagility/SuiteCRM/pull/3891/files

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.

What is the exact path of the file you are trying to use from custom folder?

And where is that file (or the original version, not from custom folder) getting loaded in the core code, did you find out?

Custom folder file path is: {root}/custom/modules/Audit/Popup_picker.php

And in the original version file path is: {root}/modules/Audit/Popup_picker.php

Currently, I made changes in {root}/modules/Audit/Popup_picker.php. When I’ll upgrade suitecrm version then I’ll lost all the changes.

Thanks. And where do you go in the app, to get to that screen? Which menus, which buttons do you press?

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.

Ok, try to add the get_custom_file_if_exists in this line

https://github.com/salesagility/SuiteCRM/blob/master/include/MVC/View/views/view.popup.php#L227

and see if it works.

1 Like

Thanks! Its working now…

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.

1 Like

I made a PR so this can be made in an upgrade safe manner in the future

https://github.com/salesagility/SuiteCRM/pull/6072

2 Likes