salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.26k stars 2.03k forks source link

Unable to clear template cache #10459

Open gaspare-joubert opened 1 week ago

gaspare-joubert commented 1 week ago

Issue

Unable to clear template cache using TemplateHandler clearCache method. This is a bug. This happens when the optional $view value does not contain file extension '.tpl'. When DetailView cache template directory was built using $_SESSION['groupLayout'] in TemplateHandler::buildTemplate(). When the CRM instance is not in developer mode.

Possible Fix

In include/TemplateHandler/TemplateHandler::clearCache the IF statements must be updated to add the '.tpl' extension to $view and to check for '$_SESSION['groupLayout']'.

Steps to Reproduce the Issue

1. Make sure the CRM instance is not in Developer Mode in the Admin panel
2. Navigate to a view in the CRM (example Detail or EditView) 
3. Add some functionality for the view to call the clearCache method
4. Confirm in the cache directory during the request that the view's cache template is removed..

Context

I was trying to set a field's property type as 'readonly' in a Service. The change was not showing because the cached template was not being updated.

Version

7.12.8

What browser are you currently using?

Chrome

Browser Version

Version 125.0.6422.141 (Official Build) (64-bit)

Environment Information

MySQL, PHP7.4

Operating System and Version

Ubuntu 22.04.4 LTS