Issue with cache file for the Notes's module

Hello,

I’m currently facing an issue with the SearchForm_advanced.tpl file in cache/themes/SuiteP/modules/Notes.
There is a format issue in it that cause the Notes list to be blank on SuiteCRM. It’s because there is in the file {php}{/php} instead of <?php ?>. Obvisouly, I did the change and the list of Notes is appearing correctly.
But this is a cache file and every day, the cache renew itself and obviously my modifications are overwrited and Notes’s list is again blank.
Can someone help on this ? Can I force SuiteCRM to not renew the cache file ? Or can I change definitely the cache file ?

Best regards

Please share your SuiteCRM and PHP versions

There were changes to Smarty templates (those tpl files) recently, required by the newer PHP versions.

Check you’re within the Matrix:

We have SuiteCRM 7.14.4 and PHP 8.2 versions.

Can you paste here the line of code that you are changing. Then, Highlight it and press Ctrl e to make it preformatted text so it doesn’t get interpreted as html.

This is this line in SearchForm_advanced.tpl :
{php}$this->_tpl_vars['user_options'] = get_user_array(false);{/php}
Obviously it doesn’t work because it should be :
<?php $this->_tpl_vars['user_options'] = get_user_array(false);?>
When I replace the first line by the second, the list of notes appears in SuiteCRM.
My issue is that this file is in the cache folder of SuiteCRM and it’s overwritten everyday. So I have to do the changes every day. It’s not convenient.
That’s why I need to know from where the file SearchForm_advanced.tpl is generated to see if I can change definitely the file or where do I stop the cache to renew itself ?

It’s probably this one

I used a simple “find in files” to find it.

grep -irn "get_user_array(false)" public/legacy/ | grep '.tpl'

Thank you. I’m kinda new to Linux also and I’m not familiar with the grep command. I did the change in the file. I will see tomorrow when the cache will be renew if the issue is still up.

This is a bug and should be reported on github so it will get fixed. The reason is because the current version of Smarty template engine does not support the {php} tag anymore, so you have to rewrite it so it will work with the current way of passing the variable to the template.

Thank you, at least it’s working for now. Is it already reported on github ? If not, I can report it on my behalf.

Agreed, this should be reported and a PR provided.

By examining this PR we can see a bunch of examples on how to remove those deprecated {php} tags:

… and it’s not by adding <?php> tags in their place. So I guess it should be done by changing into assignments that Smarty can handle, and if it can’t handle them (that get_user_array perhaps) then a custom smarty function can be added for it, or else the values can be prepared in an assign while setting up the template, in the calling PHP code.