Hi all,
Had a google and a search of the forums here and the support docs but havenāt found a solution yet. Iām trying to enable auditing on the Documents module so that a Workflow for document approval can be tracked, just having an issue viewing the change log within the Doc module
Iāve added a php file to the /custom/Extension/modules/Documents/Ext/Vardefs/ folder with the following:
<?php
$dictionary['Document']['audited'] = true;
?>
a Quick R&R then creates the Audit table, and checking the table it appears to be logging changes. Issue is that I cant get the āView Change Logā menu item from the record edit/action menu, nor find any information on how to do so
Has anyone got any pointers on what needs to be changed to add this?
Thanks
I donāt think you need to do that from the Vardefs, you should be able to tick a checkbox in Studio.
Anyway, letās try accessing this by URL first.
Try this format:
http://your.company.com/index.php?module=Audit&action=Popup&query=true&record=e1f7e4c9-5348-fa04-69ea-594a93db5687&module_name=Documents
Obviously, change your.company.com to whatever is your domain.
You also need to put your Documentās id in place of my id. To get it, just open the Document in Detail view and grab the id from the end of the URL:
http://your.company.com/index.php?module=Documents&offset=1&stamp=1532085298046048200&return_module=Documents&action=DetailView&record=e1f7e4c9-5348-fa04-69ea-594a93db5687
Itās possible that your = sign will show as a %3D, donāt let that confuse you:
http://your.company.com/index.php?module=Documents&offset=1&stamp=1532085298046048200&return_module=Documents&action=DetailView&record%3De1f7e4c9-5348-fa04-69ea-594a93db5687
If this works we can go about finding a way to get the button to show.
Thanks for the reply,
Did initially try without the additional Vardefs line and just enabling audit on a field within Studio but no luck, line needs to be in there before a R&R will create the audit table. Once created auditing works correctly; I can view the recorded changes in the db, and the link youāve provided appears to work correctly for each document I enter/edit. Iām just not getting the āChange Logā link from within the Detail view of any Document record unfortunately.
I left it out of my original post accidentally, but tested on the following setups:
- SuiteCRM 7.10.7 (Ubuntu & Win10)
- SuiteCRM 7.10.2 (Ubuntu)
Same in each case on both releases
Cheers
I donāt know, but maybe this will take you somewhere
https://github.com/salesagility/SuiteCRM/search?q=%24audit_link&unscoped_q=%24audit_link
I wonder about that isAuditEnabled variable⦠it seems to be at the Bean level, not at the field levelā¦
Ok, I think I made some progressā¦
The Quick Repair and Rebuild does the work of creating new audit tables - so maybe after using Studio you needed to do a QR&R and forgot to.
I also found the bean-level audit setting.
Itās in modules/Documents/vardefs.php, we would need a line with āauditedā => true at the main level, so the upgrade-safe way to put it there is to create
custom/Extension/modules/Documents/Ext/Vardefs/MakeAudited.php
(create any missing directories along the way)
Put this content into that file:
<?php
$dictionary['Document']['audited'] = true;
?>
Do a QR&R and now you can see a āView Change Logā button in the Edit view. Itās not showing in the Detail view, for some reasonā¦
Thatās what I did initially, just to check:
-> Studio -> Documents -> Fields -> [Selected Field] -> Audit Checked -> Save -> QRR
Always get the message āDocuments not Audit Enabledā and no table is created.
Appears the extra manual code is required as weāve been doing. If I create a file auditEnabled.php with the āauditedā => true line then a QRR creates the _audit table and the logging functions fine.
I did a little more digging and some tests though; interestingly if I enable auditing on the Tasks or Calls modules with the above process, I do get the āView Change Logā button in the detail view without any further tweaks, so it looks like this issue is limited to the Documents module in some wayā¦
Created a PR with the changes required to enable the button:
https://github.com/salesagility/SuiteCRM/pull/6191
Hm, a PR, nice!
(youāll have to clean it up a bit, itās including previous changes by other people)
What is your opinion, shouldnāt Documents have āauditedā enabled by default? Any reason not to, if other modules do? People can still edit which fields they want to audit from Studio⦠but it would be nice to not force users to go into PHP files to enable thisā¦
In that case we would simply add a line with āauditedā => true at the main level directly in modules/Documents/vardefs.php
Haha yeah, havenāt submitted changes on github before so the process was a little hit/miss. Iāll try tidy it up tonight - thanks for the earlier pointers down the right track
I canāt see a reason not-to, for our deployment Iāve been through all the other Modules we have available and enabled auditing where it wasnāt by default. Just for added clarity on changes / internal QC