Cannot include custom TemplateHandler.php in upgrade safe way #4536

Open
opened 2026-02-20 16:19:10 -05:00 by deekerman · 0 comments
Owner

Originally created by @wiatrp on GitHub (May 20, 2021).

Issue

I need a way to customize the include/TemplateHandler/TemplateHandler.php file. This file is included/required in many other files with calls like require_once('include/TemplateHandler/TemplateHandler.php'); or require_once 'include/TemplateHandler/TemplateHandler.php';. Because of this, I cannot create a custom file like what would be expected in custom/include/TemplateHandler/TemplateHandler.php

Expected Behavior

The include/TemplateHandler/TemplateHandler.php file require calls should look for a custom file first

Actual Behavior

The include/TemplateHandler/TemplateHandler.php file require calls just grab the non custom file

Possible Fix

Require once should be changed to search for custom files
Instead of: require_once('include/TemplateHandler/TemplateHandler.php');
Should be: require_once(get_custom_file_if_exists('include/TemplateHandler/TemplateHandler.php'));

Steps to Reproduce

  1. Global search TemplateHandler.php to see all locations the file is used

Context

Your Environment

  • SuiteCRM Version used:
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)):
  • Environment name and version (e.g. MySQL, PHP 7):
  • Operating System and version (e.g Ubuntu 16.04):
Originally created by @wiatrp on GitHub (May 20, 2021). <!--- Provide a general summary of the issue in the **Title** above --> <!--- Before you open an issue, please check if a similar issue already exists or has been closed before. ---> <!--- If you have discovered a security risk please report it by emailing security@suitecrm.com. This will be delivered to the product team who handle security issues. Please don't disclose security bugs publicly until they have been handled by the security team. ---> #### Issue <!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug --> <!--- Ensure that all code ``` is surrounded ``` by triple back quotes. This can also be done over multiple lines --> I need a way to customize the `include/TemplateHandler/TemplateHandler.php` file. This file is included/required in many other files with calls like `require_once('include/TemplateHandler/TemplateHandler.php');` or `require_once 'include/TemplateHandler/TemplateHandler.php';`. Because of this, I cannot create a custom file like what would be expected in `custom/include/TemplateHandler/TemplateHandler.php` #### Expected Behavior <!--- Tell us what should happen --> The `include/TemplateHandler/TemplateHandler.php` file require calls should look for a custom file first #### Actual Behavior <!--- Tell us what happens instead --> <!--- Also please check relevant logs (suitecrm.log, php error.log etc.) --> The `include/TemplateHandler/TemplateHandler.php` file require calls just grab the non custom file #### Possible Fix <!--- Not obligatory, but suggest a fix or reason for the bug --> Require once should be changed to search for custom files Instead of: `require_once('include/TemplateHandler/TemplateHandler.php');` Should be: `require_once(get_custom_file_if_exists('include/TemplateHandler/TemplateHandler.php'));` #### Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug include code to reproduce, if relevant --> 1. Global search `TemplateHandler.php` to see all locations the file is used #### Context <!--- How has this bug affected you? What were you trying to accomplish? --> <!--- If you feel this should be a low/medium/high priority then please state so --> #### Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * SuiteCRM Version used: * Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): * Environment name and version (e.g. MySQL, PHP 7): * Operating System and version (e.g Ubuntu 16.04):
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#4536
No description provided.